From: Matthew Wilcox <matthew@wil.cx>
To: Kyle McMartin <kyle@mcmartin.ca>
Cc: Carlos O'Donell <carlos@systemhalted.org>,
Helge Deller <deller@gmx.de>,
linux-parisc@vger.kernel.org,
John David Anglin <dave.anglin@nrc.ca>
Subject: Re: ldcw inline assembler patch
Date: Mon, 16 Jun 2008 16:05:50 -0600 [thread overview]
Message-ID: <20080616220550.GB28190@parisc-linux.org> (raw)
In-Reply-To: <20080616215726.GD18358@phobos.i.cabal.ca>
On Mon, Jun 16, 2008 at 05:57:26PM -0400, Kyle McMartin wrote:
> On Mon, Jun 16, 2008 at 05:54:24PM -0400, Carlos O'Donell wrote:
> > On Mon, Jun 16, 2008 at 5:06 PM, Helge Deller <deller@gmx.de> wrote:
> > > So, your proposal is (copy-and-pasted in here) the following ?
> > >
> > > diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
> > > index ee80c92..daeae39 100644
> > > --- a/include/asm-parisc/system.h
> > > +++ b/include/asm-parisc/system.h
> > > @@ -169,7 +169,7 @@ static inline void set_eiem(unsigned long val)
> > > #define __ldcw(a) ({ \
> > > unsigned __ret; \
> > > __asm__ __volatile__(__LDCW " 0(%1),%0" \
> > > - : "=r" (__ret) : "r" (a)); \
> > > + : "=r" (__ret) : "r" (a) : "memory" ); \
> > > __ret; \
> > > })
> >
> > Yes. The asm should clobber memory thus forcing the compiler to avoid
> > memory temporaries.
>
> It shouldn't need to, since we're only ever accessing one word (the one
> specified in the operand.)
>
> Otherwise basically every inline asm everywhere ever is going to need a
> memory clobber, and that's just BROKEN.
Carlos' and Helge's point (I think) is that the __ldcw() doesn't clobber
memory, so gcc can cache other things in registers across a call to
__ldcw(). While this is true, our definition of __raw_spin_lock() has
two calls to mb() in it, which is defined to clobber memory.
The only users of __ldcw() are in spinlock.h which has the mb()s in
place. I don't think there's a problem here.
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
next prev parent reply other threads:[~2008-06-16 22:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-14 15:36 ldcw inline assembler patch Helge Deller
2008-06-16 20:50 ` Carlos O'Donell
2008-06-16 21:06 ` Helge Deller
2008-06-16 21:54 ` Carlos O'Donell
2008-06-16 21:57 ` Kyle McMartin
2008-06-16 22:03 ` Kyle McMartin
2008-06-16 22:05 ` Matthew Wilcox [this message]
2008-06-16 22:14 ` Carlos O'Donell
2008-06-17 1:56 ` Carlos O'Donell
2008-06-17 3:34 ` Carlos O'Donell
2008-06-21 18:34 ` John David Anglin
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=20080616220550.GB28190@parisc-linux.org \
--to=matthew@wil.cx \
--cc=carlos@systemhalted.org \
--cc=dave.anglin@nrc.ca \
--cc=deller@gmx.de \
--cc=kyle@mcmartin.ca \
--cc=linux-parisc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.