Linux PARISC architecture development
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Grant Grundler <grundler@parisc-linux.org>
Cc: parisc-linux@parisc-linux.org
Subject: Re: [parisc-linux] coherent ops and mb() revisited
Date: 04 Sep 2004 22:56:30 -0400	[thread overview]
Message-ID: <1094352991.1924.12.camel@mulgrave> (raw)
In-Reply-To: <20040905013844.GC23842@colo.lackof.org>

On Sat, 2004-09-04 at 21:38, Grant Grundler wrote:
> I haven't tested the following patch and just wanted to get
> feedback if it is "the right thing" or not.

It should work, but I don't think it's the right thing to do.

__ldcw already insists on operating on volatile data, which is the
correct thing to do.  Adding a memory barrier is probably harmless, but
it crimps any optimisations gcc might like to try with that function
(not that there really are any with such a simple loop).  Indeed, we
could even remove the __volatile__ from the asm.

I think the best implementation is probably

barrier();
a = __ldcw_align(x);
while (__ldcw(a) == 0)
	while(*a == 0)
		;
mb();

Which makes it totally clear what barriers we need where in the spinlock
(the first being simply a compiler ordering barrier and the second
actually a processor memory barrier).

James


_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

  reply	other threads:[~2004-09-05  2:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-05  1:38 [parisc-linux] coherent ops and mb() revisited Grant Grundler
2004-09-05  2:56 ` James Bottomley [this message]
2004-09-05  6:27   ` John David Anglin
2004-09-05 14:36     ` James Bottomley
2004-09-06  4:19       ` Grant Grundler
2004-09-06  9:24         ` John David Anglin
2004-09-06 14:15         ` James Bottomley
2004-09-07 15:17           ` Grant Grundler
2004-09-07 15:30             ` James Bottomley
2004-09-08 16:52               ` Grant Grundler
2004-09-08 17:11                 ` James Bottomley
2004-09-10 16:11                   ` Grant Grundler

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=1094352991.1924.12.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=grundler@parisc-linux.org \
    --cc=parisc-linux@parisc-linux.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