public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mike Stump <mikestump@comcast.net>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	Bernd Edlinger <bernd.edlinger@hotmail.de>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix sporadic failure in g++.dg/tsan/aligned_vs_unaligned_race.C
Date: Mon, 19 Jan 2015 15:16:00 -0000	[thread overview]
Message-ID: <3A94EBAB-74E7-4281-811C-3ADA0C4CE413@comcast.net> (raw)
In-Reply-To: <CACT4Y+agmy9D98nmPC1ohzAJ0=tf61KQy91HC4SRueMb9J3rjA@mail.gmail.com>

On Jan 19, 2015, at 12:47 AM, Dmitry Vyukov <dvyukov@google.com> wrote:
> Long story short. Tsan has a logical data race the core of data race
> detection algorithm. The race is not a bug, but a deliberate design
> decision that makes tsan considerably faster.

Could you please quantify that for us?  Also, what lockless update method did you use?  Did you try atomic increment?  On my machine, they are as cheap as stores; can’t imagine they could be slow at all.  If the latency and bandwidth of atomic increment is identical to store, would the costs be any higher than using a store to update the tsan data?  A proper port of tsan to my machine would make use of atomic increment.  I consider it a simple matter to sequence the thread termination and the output routine to ensure that all the updates in the threads happen before the output routine runs.  The output routine strikes me as slow, and thread termination strikes me as slow, so taking a little extra time there seems reasonable.  Was the excessive cost you saw due to the termination costs?

> So ironically, if the race memory accesses happen almost simultaneously, tsan can miss the
> race.
> Thus we have sleeps.

I’ve not seen a reason why the test suite should randomly fail.  The gcc test suite does not.  Could you explain why the llvm test suite does?  Surely you know that sleep is not a synchronization primitive?

> Sleeps vs barrier is being discussed in the "Fix parameters of
> __tsan_vptr_update" thread.

When finished, let us know the outcome.  To date, I’ve not seen any compelling reason to have the core of tsan be other than deterministic and the test suite other than deterministic.  I’d love to see the backing for such a decision.

> I would really like to keep llvm and gcc tests in sync as much as possible.

Excellent, from my perspective, that would mean that you make the llvm test suite deterministic.

  reply	other threads:[~2015-01-19 15:13 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-03  9:01 Bernd Edlinger
2015-01-03  9:51 ` Mike Stump
2015-01-03 11:20   ` Bernd Edlinger
2015-01-04 17:00     ` Bernd Edlinger
2015-01-04 19:07       ` Mike Stump
2015-01-04 19:17         ` Jakub Jelinek
2015-01-04 19:44           ` Bernd Edlinger
2015-01-04 22:19             ` Mike Stump
2015-01-05  8:49               ` Bernd Edlinger
2015-01-05 20:58                 ` Mike Stump
2015-01-05 22:02                   ` Mike Stump
2015-01-06  1:07                     ` Bernd Edlinger
2015-01-06  9:08                       ` Bernd Edlinger
2015-01-06  9:16                         ` Jakub Jelinek
2015-01-06  9:38                           ` Bernd Edlinger
2015-01-06 17:45                           ` Bernd Edlinger
2015-01-06 19:48                             ` Mike Stump
2015-01-06 23:22                               ` Bernd Edlinger
2015-01-07  0:33                                 ` Mike Stump
2015-01-07  7:17                                   ` Bernd Edlinger
2015-01-07  8:23                                     ` Jakub Jelinek
2015-01-07 14:55                                       ` Bernd Edlinger
2015-01-07 15:04                                         ` Jakub Jelinek
2015-01-07 16:58                                       ` Mike Stump
2015-01-07 17:00                                         ` Jakub Jelinek
2015-01-07 18:21                                           ` Bernd Edlinger
2015-01-07 18:32                                             ` Jakub Jelinek
2015-01-07 22:44                                               ` Bernd Edlinger
2015-01-08 19:24                                                 ` Mike Stump
2015-01-08 19:29                                                   ` Jakub Jelinek
2015-01-08 21:07                                                     ` Mike Stump
2015-01-08 21:27                                                       ` Jakub Jelinek
2015-01-08 22:06                                                         ` Mike Stump
2015-01-08 22:23                                                           ` Bernd Edlinger
2015-01-09 15:36                                                         ` Bernd Edlinger
2015-01-09 15:37                                                           ` Jakub Jelinek
2015-01-19  8:53                                                             ` Dmitry Vyukov
2015-01-19 15:16                                                               ` Mike Stump [this message]
2015-01-21  8:52                                                                 ` Dmitry Vyukov
2015-01-21  9:02                                                                   ` Jakub Jelinek
2015-01-21  9:07                                                                     ` Dmitry Vyukov
2015-01-08 19:10                                       ` Mike Stump
2015-01-07 16:36                                     ` Mike Stump
2015-01-06 21:29                       ` Mike Stump
2015-01-04 19:05     ` Mike Stump
2015-01-04 19:15       ` Jakub Jelinek
2015-01-04 21:48       ` Bernd Edlinger
2015-01-04 21:58         ` Mike Stump
2015-01-04 22:20           ` Bernd Edlinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A94EBAB-74E7-4281-811C-3ADA0C4CE413@comcast.net \
    --to=mikestump@comcast.net \
    --cc=bernd.edlinger@hotmail.de \
    --cc=dvyukov@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).