From: Ben Hutchings <bhutchings@solarflare.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: Re: New driver "sfc" for Solarstorm SFC4000 controller.
Date: Tue, 6 May 2008 16:40:43 +0100 [thread overview]
Message-ID: <20080506154042.GD2217@solarflare.com> (raw)
In-Reply-To: <20080506081225.637df034.akpm@linux-foundation.org>
Andrew Morton wrote:
> On Tue, 6 May 2008 16:04:53 +0100 Ben Hutchings <bhutchings@solarflare.com> wrote:
>
> > > or
> > >
> > > while (*dma_done != FALCON_STATS_DONE) {
> > > udelay(1);
> > > if (++timeout > TIMEOUT)
> > > goto timeout;
> > > }
> >
> > On some architectures udelay() is defined using inline assembly that is not
> > specified as clobbering memory. So the compiler need not reload *dma_done
> > after calling it, and this doesn't work.
>
> So pop a cpu_relax() in there as the document describes?
That changes the timing, though it may not matter that much.
Seems to me that this is actually in the last set of "situations where
volatile makes sense":
- Pointers to data structures in coherent memory which might be modified
by I/O devices can, sometimes, legitimately be volatile. A ring buffer
used by a network adapter, where that adapter changes pointers to
indicate which descriptors have been processed, is an example of this
type of situation.
So we could add declare dma_done as volatile u32 * and not do anything
clever in the loop.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
next prev parent reply other threads:[~2008-05-06 15:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200804301925.m3UJPc72001651@hera.kernel.org>
2008-05-01 19:08 ` New driver "sfc" for Solarstorm SFC4000 controller Andrew Morton
2008-05-02 16:05 ` Ben Hutchings
2008-05-02 18:09 ` Andrew Morton
2008-05-06 12:50 ` Ben Hutchings
2008-05-06 14:24 ` Andrew Morton
2008-05-06 15:04 ` Ben Hutchings
2008-05-06 15:12 ` Andrew Morton
2008-05-06 15:40 ` Ben Hutchings [this message]
2008-05-07 17:55 ` Ben Hutchings
2008-05-02 19:10 ` Michael Brown
2008-05-03 20:01 ` Ben Hutchings
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=20080506154042.GD2217@solarflare.com \
--to=bhutchings@solarflare.com \
--cc=akpm@linux-foundation.org \
--cc=linux-net-drivers@solarflare.com \
--cc=netdev@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 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 NNTP newsgroup(s).