Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: pbonzini@redhat.com (Paolo Bonzini)
Subject: [ltt-dev] [URCU PATCH] caa: do not generate code for rmb/wmb on x86_64, rmb on i686
Date: Mon,  5 Sep 2011 13:27:33 +0200	[thread overview]
Message-ID: <1315222053-18159-1-git-send-email-pbonzini@redhat.com> (raw)

In userspace we can assume no accesses to write-combining memory occur,
and also that there are no non-temporal load/stores (people would presumably
write those with assembly or intrinsics and put appropriate lfence/sfence
manually).  So rmb and wmb are no-ops on x86.

But IDT chips are an exception, so keep wmb on 32-bit and document better
the rationale.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 urcu/arch/x86.h |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/urcu/arch/x86.h b/urcu/arch/x86.h
index 9e5411f..d25f13d 100644
--- a/urcu/arch/x86.h
+++ b/urcu/arch/x86.h
@@ -33,15 +33,19 @@ extern "C" {
 
 #ifdef CONFIG_RCU_HAVE_FENCE
 #define cmm_mb()    asm volatile("mfence":::"memory")
-#define cmm_rmb()   asm volatile("lfence":::"memory")
-#define cmm_wmb()   asm volatile("sfence"::: "memory")
+#define cmm_rmb()   asm volatile("":::"memory")
+#define cmm_wmb()   asm volatile(""::: "memory")
 #else
 /*
- * Some non-Intel clones support out of order store. cmm_wmb() ceases to be a
- * nop for these.
+ * IDT WinChip supports weak store ordering, and the kernel may enable it
+ * under our feet; cmm_wmb() ceases to be a nop for these processors.
+ *
+ * The same would hold for cmm_rmb() on some old PentiumPro multiprocessor
+ * systems that have an errata, but the Linux kernel says that "Even distro
+ * kernels should think twice before enabling this".
  */
 #define cmm_mb()    asm volatile("lock; addl $0,0(%%esp)":::"memory")
-#define cmm_rmb()   asm volatile("lock; addl $0,0(%%esp)":::"memory")
+#define cmm_rmb()   asm volatile("":::"memory")
 #define cmm_wmb()   asm volatile("lock; addl $0,0(%%esp)"::: "memory")
 #endif
 
-- 
1.7.6





             reply	other threads:[~2011-09-05 11:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-05 11:27 Paolo Bonzini [this message]
2011-09-05 15:12 ` Mathieu Desnoyers
     [not found] ` <BLU0-SMTP648D3439671501BF3EC1AE961D0@phx.gbl>
2011-09-05 15:15   ` Paolo Bonzini
2011-09-05 15:32     ` Mathieu Desnoyers

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=1315222053-18159-1-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@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