powerpc: Set paca->data_offset = 0 for boot cpu
authorMichael Ellerman <michael@ellerman.id.au>
Thu, 20 Sep 2012 22:07:58 +0000 (22:07 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 27 Sep 2012 02:51:06 +0000 (12:51 +1000)
In commit 407821a we assigned a poison value to the paca->data_offset.

Unfortunately with CONFIG_LOCK_STAT=y lockdep will read & write to percpu
data very early in boot, prior to us initialising the percpu areas,
leading to a crash.

We have been getting away with this because the data_offset was previously
set to zero. This causes lockdep to read & write to the initial copy of
the percpu variables, which are discarded later in boot.

Although that is "fishy", it does work, and for lock statistics it is no
big deal to discard the counts from early boot.

So set the paca->data_offset = 0 for the boot cpu paca only.

Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/setup_64.c

index 389bd4f0cdb10496f1d478fc44181612123f30d1..efb6a41b3131bc1f115ba0b15ec82dba8392b31a 100644 (file)
@@ -208,6 +208,8 @@ void __init early_setup(unsigned long dt_ptr)
 
        /* Fix up paca fields required for the boot cpu */
        get_paca()->cpu_start = 1;
+       /* Allow percpu accesses to "work" until we setup percpu data */
+       get_paca()->data_offset = 0;
 
        /* Probe the machine type */
        probe_machine();