qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, alex bennee <alex.bennee@linaro.org>
Subject: Re: [Qemu-devel] [PATCH 0/5] More thread sanitizer fixes and atomic.h improvements
Date: Thu, 13 Oct 2016 15:29:11 -0400	[thread overview]
Message-ID: <20161013192911.GA23593@flamenco> (raw)
In-Reply-To: <457275072.2788355.1476344395576.JavaMail.zimbra@redhat.com>

On Thu, Oct 13, 2016 at 03:39:55 -0400, Paolo Bonzini wrote:
> > On Mon, Oct 10, 2016 at 15:59:02 +0200, Paolo Bonzini wrote:
> > > See each patch.  My attempt at fixing whatever I did when I obviously
> > > didn't know enough^W about the C11 memory model, and at setting a
> > > better example for future generations...
> > 
> > Just for context. Building on this patchset, is it now time to
> > phase out smp_(rw)mb in favour or C11's acq/rel, as you laid
> > out in your KVM Forum talk [*]?
> 
> Yes, this would be the start of it.  However I'm a bit undecided
> because ARMv8 doesn't have acq/rel memory barriers, and its STLR
> opcode is stronger than a store release.
> 
> > What is the plan with smp_mb_(sg)et? It's not clear to me from
> > the slides, but given patch 5 I don't see a reason to keep them.
> 
> No plan for now.  It makes sense to phase out at least atomic_mb_read.
> atomic_mb_set is more efficient on x86 than store+mfence, so there's
> that too.

I see, thanks.

On a related note: can we squeeze the appended in this patch set? If
we keep the atomic_mb's, at least there should be a good reason for their
use--this is not the case below.

		Emilio

commit cffdc51df4a6346f2b38425f1f1251aa12866fa8
Author: Emilio G. Cota <cota@braap.org>
Date:   Thu Oct 13 15:06:07 2016 -0400

    qht-bench: relax test_start/stop atomic accesses
    
    test_start/stop are used only as flags to loop on. Barriers are unnecessary,
    since no dependent data is transferred among threads apart from the flags
    themselves.
    
    This commit relaxes the three accesses to test_start/stop that were
    not yet relaxed.
    
    Signed-off-by: Emilio G. Cota <cota@braap.org>

diff --git a/tests/qht-bench.c b/tests/qht-bench.c
index 76360a0..2afa09d 100644
--- a/tests/qht-bench.c
+++ b/tests/qht-bench.c
@@ -193,7 +193,7 @@ static void *thread_func(void *p)
     rcu_register_thread();
 
     atomic_inc(&n_ready_threads);
-    while (!atomic_mb_read(&test_start)) {
+    while (!atomic_read(&test_start)) {
         cpu_relax();
     }
 
@@ -393,11 +393,11 @@ static void run_test(void)
     while (atomic_read(&n_ready_threads) != n_rw_threads + n_rz_threads) {
         cpu_relax();
     }
-    atomic_mb_set(&test_start, true);
+    atomic_set(&test_start, true);
     do {
         remaining = sleep(duration);
     } while (remaining);
-    atomic_mb_set(&test_stop, true);
+    atomic_set(&test_stop, true);
 
     for (i = 0; i < n_rw_threads; i++) {
         qemu_thread_join(&rw_threads[i]);

  reply	other threads:[~2016-10-13 19:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10 13:59 [Qemu-devel] [PATCH 0/5] More thread sanitizer fixes and atomic.h improvements Paolo Bonzini
2016-10-10 13:59 ` [Qemu-devel] [PATCH 1/5] atomic: introduce smp_mb_acquire and smp_mb_release Paolo Bonzini
2016-10-10 15:29   ` Eric Blake
2016-10-10 16:38     ` Paolo Bonzini
2016-10-10 13:59 ` [Qemu-devel] [PATCH 2/5] cpus: use atomic_read to read seqlock-protected variables Paolo Bonzini
2016-10-12  8:44   ` Alex Bennée
2016-10-13 19:20   ` Emilio G. Cota
2016-10-13 20:45     ` Paolo Bonzini
2016-10-10 13:59 ` [Qemu-devel] [PATCH 3/5] qemu-thread: use acquire/release to clarify semantics of QemuEvent Paolo Bonzini
2016-10-12  9:21   ` Alex Bennée
2016-10-12  9:31     ` Paolo Bonzini
2016-10-10 13:59 ` [Qemu-devel] [PATCH 4/5] rcu: simplify memory barriers Paolo Bonzini
2016-10-10 13:59 ` [Qemu-devel] [PATCH 5/5] atomic: base mb_read/mb_set on load-acquire and store-release Paolo Bonzini
2016-10-12  9:28   ` Alex Bennée
2016-10-12  9:30     ` Paolo Bonzini
2016-10-20 18:36   ` Pranith Kumar
2016-10-10 16:53 ` [Qemu-devel] [PATCH 0/5] More thread sanitizer fixes and atomic.h improvements no-reply
2016-10-11 19:21 ` no-reply
2016-10-12 11:32 ` Alex Bennée
2016-10-12 11:34   ` Paolo Bonzini
2016-10-12 22:45 ` Emilio G. Cota
2016-10-13  7:39   ` Paolo Bonzini
2016-10-13 19:29     ` Emilio G. Cota [this message]
2016-10-14  9:55       ` Paolo Bonzini
2016-10-21 17:38 ` Alex Bennée
2016-10-22  9:10   ` Paolo Bonzini

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=20161013192911.GA23593@flamenco \
    --to=cota@braap.org \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 NNTP newsgroup(s).