[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080506072442.82a834c8.akpm@linux-foundation.org>
Date: Tue, 6 May 2008 07:24:42 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Ben Hutchings <bhutchings@...arflare.com>
Cc: netdev@...r.kernel.org, linux-net-drivers@...arflare.com
Subject: Re: New driver "sfc" for Solarstorm SFC4000 controller.
On Tue, 6 May 2008 13:50:09 +0100 Ben Hutchings <bhutchings@...arflare.com> wrote:
> Andrew Morton wrote:
> > On Fri, 2 May 2008 17:05:35 +0100 Ben Hutchings <bhutchings@...arflare.com> wrote:
> >
> > > > Oh dear, it found
> > > >
> > > > #5617: FILE: drivers/net/sfc/falcon.c:1877:
> > > > + if (*(volatile u32 *)dma_done == FALCON_STATS_DONE)
> > > >
> > > > which was naughty of you. Perhaps this was already discussed in review
> > > > with the people who actually know what they're talking about.
> > >
> > > There wasn't any specific discussion of this. Is it wrong? We want to
> > > prevent the compiler from caching *dma_done, which is itself written by DMA.
> >
> > Documentation/volatile-considered-harmful.txt has some dicussion.
>
> Looks like we should be using something like:
>
> while (*dma_done != FALCON_STATS_DONE)
> cpu_relax();
>
> But then how do we time-out?
Dunno, something like
while (*dma_done != FALCON_STATS_DONE) {
if (time_after(jiffies, when_to_timeout))
goto timeout;
cpu_relax();
}
or
while (*dma_done != FALCON_STATS_DONE) {
udelay(1);
if (++timeout > TIMEOUT)
goto timeout;
}
?
--
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