[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080506154042.GD2217@solarflare.com>
Date: Tue, 6 May 2008 16:40:43 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: netdev@...r.kernel.org, linux-net-drivers@...arflare.com
Subject: Re: New driver "sfc" for Solarstorm SFC4000 controller.
Andrew Morton wrote:
> On Tue, 6 May 2008 16:04:53 +0100 Ben Hutchings <bhutchings@...arflare.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists