From: Jack Steiner <steiner@sgi.com>
To: Daniel Walker <dwalker@fifo99.com>
Cc: mingo@elte.hu, tglx@linutronix.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: SGU UV Add volatile to macros that access chipset registers
Date: Wed, 9 Sep 2009 14:20:30 -0500 [thread overview]
Message-ID: <20090909192030.GA10530@sgi.com> (raw)
In-Reply-To: <1252519885.14793.135.camel@desktop>
On Wed, Sep 09, 2009 at 11:11:25AM -0700, Daniel Walker wrote:
> On Wed, 2009-09-09 at 13:01 -0500, Jack Steiner wrote:
> > On Wed, Sep 09, 2009 at 09:10:00AM -0700, Daniel Walker wrote:
> > > On Wed, 2009-09-09 at 10:42 -0500, Jack Steiner wrote:
> > > > Add "volatile" to the SGI UV read/write macros that are used to access chipset
> > > > memory mapped registers.
> > >
> > > There is a considerable document regarding the usage of volatile in the
> > > kernel (Documentation/volatile-considered-harmful.txt). Considering that
> > > document, can you give a more descriptive reason why your using
> > > "volatile" here ?
> > >
> >
> > I knew that "volatile" would catch someone's attention :-)
> >
> >
> > Volatile is being added to the accessor functions that are used to
> > read/write memory-mapped I/O registers located within the UV chipset.
> > The use of volatile is hidden within the functions and is not exposed
> > to the users of the functions.
> >
> > Note that the use is limited to the accessor functions in the header
> > file. No .c files are changed or need to know about volatile.
> >
> >
> > This seems to be consistent with other uses of volatile within the kernel.
>
> The document that I cited specifically addresses memory accessors as not
> needing the volatile keyword .. So your still not addressing exactly why
> your code needs it .. Are your accessors special in some way? Is there
> some defect your seeing without the volatile keyword?
The code is not yet in the kernel but the function that exposed the bug
was one that had multiple access to the chipset RTC clock. This
is a free running clock that counts at nsec rate. The compiler optimized
the function so that a single read of the clock was done. This broken
the timing that was trying to measure elapsed time.
I scanned the standard header files and see numerous instances where inline
functions use volatile. The usage of volatile in the UV macros (at least to
me) seems consistent:
mmio_config_xxx()
native_apic_mem_xxx()
readb(), etc.
bit_ops functions
etc...
What am I missing?
prev parent reply other threads:[~2009-09-09 19:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 15:42 [PATCH] x86: SGU UV Add volatile to macros that access chipset registers Jack Steiner
2009-09-09 16:10 ` Daniel Walker
2009-09-09 18:01 ` Jack Steiner
2009-09-09 18:11 ` Daniel Walker
2009-09-09 18:54 ` Chris Friesen
2009-09-09 19:38 ` Jack Steiner
2009-09-10 0:44 ` H. Peter Anvin
2009-09-10 2:21 ` Jack Steiner
2009-09-10 2:22 ` [PATCH V2] x86: SGU UV Add volatile semantics " Jack Steiner
2009-09-10 3:05 ` H. Peter Anvin
2009-09-10 3:23 ` Jack Steiner
2009-09-10 14:31 ` [PATCH V3] " Jack Steiner
2009-09-10 14:31 ` Jack Steiner
2009-09-18 12:06 ` [tip:x86/urgent] x86: SGI UV: " tip-bot for Jack Steiner
2009-09-09 19:20 ` Jack Steiner [this message]
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=20090909192030.GA10530@sgi.com \
--to=steiner@sgi.com \
--cc=dwalker@fifo99.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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.