public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Mark Brown <bmark@us.ibm.com>,
	Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] MEMORY_BARRIER default
Date: Fri, 22 Mar 2002 00:28:00 -0000	[thread overview]
Message-ID: <20020322092754.A32482@sunsite.ms.mff.cuni.cz> (raw)
In-Reply-To: <1016742904.5188.166.camel@myware.mynet>; from drepper@redhat.com on Thu, Mar 21, 2002 at 12:35:04PM -0800

On Thu, Mar 21, 2002 at 12:35:04PM -0800, Ulrich Drepper wrote:
> On Thu, 2002-03-21 at 11:46, Jakub Jelinek wrote:
> 
> > Shouldn't sysdeps/ia64/pt-machine.h instead define a
> > MEMORY_BARRIER (to something like:
> > __asm__ __volatile__("" : : : "memory");
> > )?
> 
> This looks more correct.  Though this should probably be the default for
> all platforms which don't define specific BARRIER macros.

Like this?

2002-03-22  Jakub Jelinek  <jakub@redhat.com>

	* internals.h (MEMORY_BARRIER): Clobber memory if architecture doesn't
	define its own barrier.
	* sysdeps/mips/pt-machine.h (MEMORY_BARRIER): Remove.

--- libc/linuxthreads/sysdeps/mips/pt-machine.h.jj	Fri Mar 22 09:28:10 2002
+++ libc/linuxthreads/sysdeps/mips/pt-machine.h	Fri Mar 22 09:28:29 2002
@@ -30,10 +30,6 @@
 extern long int testandset (int *spinlock);
 extern int __compare_and_swap (long int *p, long int oldval, long int newval);
 
-/* Memory barrier.  */
-#define MEMORY_BARRIER() __asm__ ("" : : : "memory")
-
-
 /* Spinlock implementation; required.  */
 
 PT_EI long int
--- libc/linuxthreads/internals.h.jj	Fri Mar 22 09:19:41 2002
+++ libc/linuxthreads/internals.h	Fri Mar 22 09:25:28 2002
@@ -194,11 +194,12 @@ static inline int nonexisting_handle(pth
 #endif
 
 /* If MEMORY_BARRIER isn't defined in pt-machine.h, assume the architecture
-   doesn't need a memory barrier instruction (e.g. Intel x86).  Some
+   doesn't need a memory barrier instruction (e.g. Intel x86) and just prevent
+   the compiler from caching memory structures in registers accross it.  Some
    architectures distinguish between full, read and write barriers.  */
 
 #ifndef MEMORY_BARRIER
-#define MEMORY_BARRIER()
+#define MEMORY_BARRIER() __asm__ __volatile__ ("" : : : "memory")
 #endif
 #ifndef READ_MEMORY_BARRIER
 #define READ_MEMORY_BARRIER() MEMORY_BARRIER()


	Jakub

       reply	other threads:[~2002-03-22  8:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AE06E1AA-3C4A-11D6-98E8-0030657603C6@us.ibm.com>
     [not found] ` <20020321204602.X32482@sunsite.ms.mff.cuni.cz>
     [not found]   ` <1016742904.5188.166.camel@myware.mynet>
2002-03-22  0:28     ` Jakub Jelinek [this message]
2002-03-22  0:37       ` Ulrich Drepper
2002-03-25  9:41       ` David Mosberger
2002-04-02 14:30         ` Ulrich Drepper
2002-04-02 14:40           ` David Mosberger

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=20020322092754.A32482@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=bmark@us.ibm.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.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).