Commit db1231dc authored by Anton Blanchard's avatar Anton Blanchard Committed by Michael Ellerman

powerpc: Fix DSCR inheritance over fork()

Two DSCR tests have a hack in them:

	/*
	 * XXX: Force a context switch out so that DSCR
	 * current value is copied into the thread struct
	 * which is required for the child to inherit the
	 * changed value.
	 */
	sleep(1);

We should not be working around this in the testcase, it is a kernel bug.
Fix it by copying the current DSCR to the child, instead of what we
had in the thread struct at last context switch.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 20dbe670
...@@ -1287,7 +1287,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ...@@ -1287,7 +1287,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
if (cpu_has_feature(CPU_FTR_DSCR)) { if (cpu_has_feature(CPU_FTR_DSCR)) {
p->thread.dscr_inherit = current->thread.dscr_inherit; p->thread.dscr_inherit = current->thread.dscr_inherit;
p->thread.dscr = current->thread.dscr; p->thread.dscr = mfspr(SPRN_DSCR);
} }
if (cpu_has_feature(CPU_FTR_HAS_PPR)) if (cpu_has_feature(CPU_FTR_HAS_PPR))
p->thread.ppr = INIT_PPR; p->thread.ppr = INIT_PPR;
......
...@@ -60,14 +60,6 @@ int dscr_inherit_exec(void) ...@@ -60,14 +60,6 @@ int dscr_inherit_exec(void)
else else
set_dscr(dscr); set_dscr(dscr);
/*
* XXX: Force a context switch out so that DSCR
* current value is copied into the thread struct
* which is required for the child to inherit the
* changed value.
*/
sleep(1);
pid = fork(); pid = fork();
if (pid == -1) { if (pid == -1) {
perror("fork() failed"); perror("fork() failed");
......
...@@ -40,14 +40,6 @@ int dscr_inherit(void) ...@@ -40,14 +40,6 @@ int dscr_inherit(void)
else else
set_dscr(dscr); set_dscr(dscr);
/*
* XXX: Force a context switch out so that DSCR
* current value is copied into the thread struct
* which is required for the child to inherit the
* changed value.
*/
sleep(1);
pid = fork(); pid = fork();
if (pid == -1) { if (pid == -1) {
perror("fork() failed"); perror("fork() failed");
......
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