linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] ARM: Change the mandatory barriers implementation
Date: Tue, 23 Feb 2010 12:30:40 +0000	[thread overview]
Message-ID: <20100223123040.GC10501@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1266927403.3123.56.camel@e102109-lin.cambridge.arm.com>

On Tue, Feb 23, 2010 at 12:16:43PM +0000, Catalin Marinas wrote:
> 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.

No.  Please read the code.

The original code defines mandatory barriers in the following cases:
- ARMv7+
- SMP
- Any architecture which sets arch_is_coherent() (for coherent DMA) -
  which at the moment is only Xscale 3 on IXP23xx platforms.

So, we end up with mandatory barriers for: ARMv7+, ARMv6 SMP, XScale 3.
We end up with mb() and friends being compiler barriers on everything
else.

However, because dsb() replaced the 'drain write buffer' instruction in
things like the TLB operations, dsb() et al need to be defined for the
other architectures - and TLB operations execute dsb() according to the
TLB type attributes.

What your patch does is make mb() and friends unconditionally call dsb()
and friends.  As I've pointed out, this is totally wrong.  We only need
mb() and friends to be dsb() et al for ARMv6+ and anything which has
arch_is_coherent() enabled.

So, all you need to do is to leave the #else clause as-is, and change:

#if __LINUX_ARM_ARCH__ >= 7 || defined(CONFIG_SMP)

to be

#if __LINUX_ARM_ARCH__ >= 6

No need for any additional ifdefs.

  reply	other threads:[~2010-02-23 12:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23 11:01 [PATCH 1/4] ARM: Change the mandatory barriers implementation Catalin Marinas
2010-02-23 11:10 ` Russell King - ARM Linux
2010-02-23 12:16   ` Catalin Marinas
2010-02-23 12:30     ` Russell King - ARM Linux [this message]
2010-02-23 15:12       ` Catalin Marinas
2010-02-23 15:24         ` Russell King - ARM Linux
2010-02-23 16:02           ` Catalin Marinas
2010-02-23 18:03             ` Russell King - ARM Linux
2010-02-23 18:07               ` Catalin Marinas
2010-03-01  3:37                 ` Jamie Lokier
2010-02-26 15:43               ` Catalin Marinas
2010-03-01  3:44                 ` Jamie Lokier
2010-02-23 12:21   ` Catalin Marinas
2010-02-23 12:31     ` Russell King - ARM Linux
2010-02-23 11:35 ` Shilimkar, Santosh
2010-02-23 11:41   ` Russell King - ARM Linux
2010-02-23 17:33 ` Russell King - ARM Linux
2010-02-23 17:58   ` Catalin Marinas
2010-02-23 18:04     ` Catalin Marinas

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=20100223123040.GC10501@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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).