Commit ea186239 authored by Anton Blanchard's avatar Anton Blanchard Committed by Ben Hutchings

powerpc: Fix DSCR inheritance in copy_thread()

commit 1021cb26 upstream.

If the default DSCR is non zero we set thread.dscr_inherit in
copy_thread() meaning the new thread and all its children will ignore
future updates to the default DSCR. This is not intended and is
a change in behaviour that a number of our users have hit.

We just need to inherit thread.dscr and thread.dscr_inherit from
the parent which ends up being much simpler.

This was found with the following test case:

http://ozlabs.org/~anton/junkcode/dscr_default_test.cSigned-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 5f31a641
...@@ -778,16 +778,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ...@@ -778,16 +778,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
#endif /* CONFIG_PPC_STD_MMU_64 */ #endif /* CONFIG_PPC_STD_MMU_64 */
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
if (cpu_has_feature(CPU_FTR_DSCR)) { if (cpu_has_feature(CPU_FTR_DSCR)) {
if (current->thread.dscr_inherit) { p->thread.dscr_inherit = current->thread.dscr_inherit;
p->thread.dscr_inherit = 1;
p->thread.dscr = current->thread.dscr; p->thread.dscr = current->thread.dscr;
} else if (0 != dscr_default) {
p->thread.dscr_inherit = 1;
p->thread.dscr = dscr_default;
} else {
p->thread.dscr_inherit = 0;
p->thread.dscr = 0;
}
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment