[PATCH 1/4] ARM: Change the mandatory barriers implementation

Catalin Marinas catalin.marinas at arm.com
Tue Feb 23 07:16:43 EST 2010


On Tue, 2010-02-23 at 11:10 +0000, Russell King - ARM Linux wrote:
> On Tue, Feb 23, 2010 at 11:01:05AM +0000, Catalin Marinas wrote:
> > -#define mb()	do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
> > -#define rmb()	do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
> > -#define wmb()	do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
> > +#define mb()		dsb()
> > +#define rmb()		dmb()
> > +#define wmb()		dsb()
> 
> What is the reason for getting rid of the arch_is_coherent() bit here
> and imposing non-compiler barriers on everything?  

The original code defines the mandatory barriers only if
__LINUX_ARCH_ARM__ >= 7 || CONFIG_SMP. However we still need them for
earlier architectures (v6). We can change the #if here to test for
earlier architectures as well and only do the arch_is_coherent() check
for some early implementations that don't have barriers.

> This also breaks ARMv3 since you now issue a mcr for the write buffer
> on architectures which have no write buffer.

Is this the case for another #ifdef? I can add it.

-- 
Catalin




More information about the linux-arm-kernel mailing list