[POWERPC] Initialize paca->current earlier
authorBenjamin Herrenschmidt <benh@ozlabs.org>
Wed, 9 Apr 2008 07:21:26 +0000 (17:21 +1000)
committerPaul Mackerras <paulus@samba.org>
Wed, 16 Apr 2008 21:46:10 +0000 (07:46 +1000)
Currently, we initialize the "current" pointer in the PACA (which
is used by the "current" macro in the kernel) before calling
setup_system(). That means that early_setup() is called with
current still "NULL" which is -not- a good idea. It happens to
work so far but breaks with lockdep when early code calls printk.

This changes it so that all PACAs are statically initialized with
__current pointing to the init task. For non-0 CPUs, this is fixed
up before use.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/head_64.S
arch/powerpc/kernel/paca.c

index 43a38d89eafc3a3303af811b26224117d807b10d..44229c3749ac52bc1779eea2a9b66c81146e1ffc 100644 (file)
@@ -1521,10 +1521,6 @@ _INIT_GLOBAL(start_here_common)
        li      r0,0
        stdu    r0,-STACK_FRAME_OVERHEAD(r1)
 
-       /* ptr to current */
-       LOAD_REG_IMMEDIATE(r4, init_task)
-       std     r4,PACACURRENT(r13)
-
        /* Load the TOC */
        ld      r2,PACATOC(r13)
        std     r1,PACAKSAVE(r13)
index 867b22d17385485b8d98bf02480659ac63e2b0dd..ac163bd46cfdaf99d7a5da904d9f455cf6a220dc 100644 (file)
@@ -73,6 +73,7 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = {
        .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL,             \
        .hw_cpu_id = 0xffff,                                                \
        .slb_shadow_ptr = &slb_shadow[number],                              \
+       .__current = &init_task,                                            \
 }
 
 struct paca_struct paca[] = {