[PATCH 1/1 V2] Add Thread Support for the Context ID Register of ARM v6 & v7 Architectures

Will Deacon will.deacon at arm.com
Mon Jul 25 17:27:40 EDT 2011


On Mon, Jul 25, 2011 at 11:33:23AM +0100, Russell King - ARM Linux wrote:
> On Mon, Jul 25, 2011 at 12:12:29PM +0200, Wolfgang BETZ wrote:
> > C is a typed language for a reason.  Don't destroy it with casts.
> > 
> > So, the _minimum_ that needs to change in this patch is for those casts
> > to go, and cpu_switch_mm() needs to be fixed to take the context ID
> > value, rather a context ID value casted to a mm_struct.
> > 
> > Well, this is exactly what the patch is doing right now.
> > I have intentionally avoided to centralize this cast into cpu_switch_mm() in order to be sure to not miss any call to it, accidentally. As said above, the compiler will warn about something like this.
> > Maybe you could take a closer look at v3 of the patch, which I will send out within today.
> 
> You've completely missed my point.  What's the really scary thing here
> is that you can't see that you're doing something very very wrong.

I'd still like to know why we can't avoid piggybacking on the switch_mm code
by doing similar to the hack I posted here:

http://lists.infradead.org/pipermail/linux-arm-kernel/2011-July/058436.html

Given that future cores (>= A15) put the ASID in a different register and
there's apparently a need for a thread switch notifier anyway, tying the
contextidr up so tightly with switch_mm doesn't feel right to me.

So, ugly casts aside, I'm not convinced by the approach taken here.

Will



More information about the linux-arm-kernel mailing list