kernel-ark/arch
Paul Mackerras 3b5750644b [POWERPC] Bolt in SLB entry for kernel stack on secondary cpus
This fixes a regression reported by Kamalesh Bulabel where a POWER4
machine would crash because of an SLB miss at a point where the SLB
miss exception was unrecoverable.  This regression is tracked at:

http://bugzilla.kernel.org/show_bug.cgi?id=10082

SLB misses at such points shouldn't happen because the kernel stack is
the only memory accessed other than things in the first segment of the
linear mapping (which is mapped at all times by entry 0 of the SLB).
The context switch code ensures that SLB entry 2 covers the kernel
stack, if it is not already covered by entry 0.  None of entries 0
to 2 are ever replaced by the SLB miss handler.

Where this went wrong is that the context switch code assumes it
doesn't have to write to SLB entry 2 if the new kernel stack is in the
same segment as the old kernel stack, since entry 2 should already be
correct.  However, when we start up a secondary cpu, it calls
slb_initialize, which doesn't set up entry 2.  This is correct for
the boot cpu, where we will be using a stack in the kernel BSS at this
point (i.e. init_thread_union), but not necessarily for secondary
cpus, whose initial stack can be allocated anywhere.  This doesn't
cause any immediate problem since the SLB miss handler will just
create an SLB entry somewhere else to cover the initial stack.

In fact it's possible for the cpu to go quite a long time without SLB
entry 2 being valid.  Eventually, though, the entry created by the SLB
miss handler will get overwritten by some other entry, and if the next
access to the stack is at an unrecoverable point, we get the crash.

This fixes the problem by making slb_initialize create a suitable
entry for the kernel stack, if we are on a secondary cpu and the stack
isn't covered by SLB entry 0.  This requires initializing the
get_paca()->kstack field earlier, so I do that in smp_create_idle
where the current field is initialized.  This also abstracts a bit of
the computation that mk_esid_data in slb.c does so that it can be used
in slb_initialize.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-05-02 15:00:45 +10:00
..
alpha arch/alpha/kernel/traps.c: use time_* macros 2008-04-28 08:58:27 -07:00
arm ARM: always select HAVE_IDE 2008-04-28 23:44:43 +02:00
avr32 atmel_lcdfb: don't initialize a pre-allocated framebuffer 2008-04-28 08:58:38 -07:00
blackfin [Blackfin] arch: add include/boot .gitignore files 2008-04-25 08:29:11 +08:00
cris cris: remove redundant display of free swap space in show_mem() 2008-04-28 08:58:28 -07:00
frv frv si_addr annotations 2008-04-28 10:03:30 -07:00
h8300 Generic semaphore implementation 2008-04-17 10:42:34 -04:00
ia64 ia64 kvm fixes for O=... builds 2008-04-28 10:03:30 -07:00
m32r Generic semaphore implementation 2008-04-17 10:42:34 -04:00
m68k m68k: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:27 -07:00
m68knommu Generic semaphore implementation 2008-04-17 10:42:34 -04:00
mips Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus 2008-04-28 10:51:43 -07:00
mn10300 PCI: remove initial bios sort of PCI devices on x86 2008-04-20 21:46:58 -07:00
parisc mm: have zonelist contains structs with both a zone pointer and zone_idx 2008-04-28 08:58:18 -07:00
powerpc [POWERPC] Bolt in SLB entry for kernel stack on secondary cpus 2008-05-02 15:00:45 +10:00
ppc [POWERPC] Add strncmp to arch/ppc 2008-04-24 20:57:34 +10:00
s390 KVM: add ioctls to save/store mpstate 2008-04-27 18:21:16 +03:00
sh hotplug-memory: make online_page() common 2008-04-28 08:58:17 -07:00
sparc sparc: Remove old style signal frame support. 2008-04-27 02:26:36 -07:00
sparc64 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 2008-04-28 09:45:57 -07:00
um uml: clean up arch/um/drivers/ubd_kern.c 2008-04-28 08:58:29 -07:00
v850 arch: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:14:49 -04:00
x86 x86_64 vDSO: use initdata 2008-04-28 13:49:35 -07:00
xtensa Generic semaphore implementation 2008-04-17 10:42:34 -04:00
.gitignore
Kconfig Kprobes: indicate kretprobe support in Kconfig 2008-03-04 16:35:11 -08:00