]> git.baikalelectronics.ru Git - kernel.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)
commitf2aa0e7cf69ff15926df2a1b28c1ba35e894ac2c
tree5faa8dbdff73f2bc85befa530f2f165dd3001724
parent1ae59b1235d891dcb67aa092f8ca354b65c98bfd
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