]> git.karo-electronics.de Git - karo-tx-linux.git/commit
powerpc: Restore correct DSCR in context switch
authorAnton Blanchard <anton@samba.org>
Mon, 3 Sep 2012 16:51:10 +0000 (16:51 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 5 Sep 2012 06:05:22 +0000 (16:05 +1000)
commit714332858bfd40dcf8f741498336d93875c23aa7
tree5faa8dbdff73f2bc85befa530f2f165dd3001724
parent1021cb268b3025573c4811f1dee4a11260c4507b
powerpc: Restore correct DSCR in context switch

During a context switch we always restore the per thread DSCR value.
If we aren't doing explicit DSCR management
(ie thread.dscr_inherit == 0) and the default DSCR changed while
the process has been sleeping we end up with the wrong value.

Check thread.dscr_inherit and select the default DSCR or per thread
DSCR as required.

This was found with the following test case, when running with
more threads than CPUs (ie forcing context switching):

http://ozlabs.org/~anton/junkcode/dscr_default_test.c

With the four patches applied I can run a combination of all
test cases successfully at the same time:

http://ozlabs.org/~anton/junkcode/dscr_default_test.c
http://ozlabs.org/~anton/junkcode/dscr_explicit_test.c
http://ozlabs.org/~anton/junkcode/dscr_inherit_test.c

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: <stable@kernel.org> # 3.0+
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/entry_64.S