Re: [PATCH 2/3] m68k: Switch to asm-generic/barrier.h

Geert Uytterhoeven
2014-02-05T07:47:01Z

Hi Finn,

On Wed, Feb 5, 2014 at 2:03 AM, Finn Thain <fthain@telegraphics.com.au> wrote:
> On Tue, 4 Feb 2014, Geert Uytterhoeven wrote:
>> The generic nop() implementation is fine for m68k.
>
> If the barrier in the old nop() implementation isn't needed anymore,
> perhaps we should also remove the nop() instances in macfb.c? One comment
> from this file says, "the nop's are there to order writes". (I don't know
> whether there is any timing issue here. Seeing the way nop() was sprinkled
> through macfb.c, I doubt that there is.) Is the volatile casting in
> nubus_writeb() aka raw_outb() aka out_8() equivalent to the old barrier?

barrier() does:

#define barrier() __asm__ __volatile__("": : :"memory")

I.e. it prevents gcc from:
1. Reordering instructions due to the volatile,
2. Caching data in registers due to the "memory".

nop() still has the former, while the volatile casting in the I/O macros
should have the same effect as the latter.

So yes, I think they can be removed. Can you test that, please?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds