All of lore.kernel.org
 help / color / mirror / Atom feed
* FPU context switching fix for SMP
@ 2005-01-26  8:24 Krzysztof Helt
  2005-01-26  8:26 ` William Lee Irwin III
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Krzysztof Helt @ 2005-01-26  8:24 UTC (permalink / raw)
  To: sparclinux

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

Here is a patch for FPU context switching in SMP.

A copy_thread() function clears PF_USEDFPU flag for a new thread,
but it does not clear the PSR_EF bit. Thus, a first FPU exception
called from the child thread is not handled properly. I made the
patch after PPC and MIPS architectures - both clear a similar bit
in copy_thread.
This bug does not exist in the UP kernel, probably because it
does not rely on PF_USEDFPU flag.

The patch below should be applied for both 2.4 and 2.6 branches.

I tested it with a test-fenv program from  glibc testsuite. The
test fails the same test cases in both SMP and UP with  the patch
applied. Without the patch, the test on SMP kernel failes in
almost two times more testcases.

Regards,
Krzysztof

----------------------------------------------------
Reklama Twojej strony WWW już od 20 groszy? - Oczywiście!
To nie jest żadna ściema! - Sprawdź:
http://klik.wp.pl/?adr=http%3A%2F%2Fbiznes.szukaj.wp.pl%2Fboksy.html&sid=299

[-- Attachment #2: copy_thread-fpu.24.patch --]
[-- Type: application/octet-stream, Size: 655 bytes --]

--- linux-2.4.29/arch/sparc/kernel/process.c.orig	2005-01-26 08:38:01.000000000 +0100
+++ linux-2.4.29/arch/sparc/kernel/process.c	2005-01-26 08:38:54.000000000 +0100
@@ -3,6 +3,8 @@
  *
  *  Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  *  Copyright (C) 1996 Eddie C. Dost   (ecd@skynet.be)
+ *
+ *	2005-01-26	Krzysztof Helt	-	cleared PSR_EF in copy_thread
  */
 
 /*
@@ -512,6 +514,10 @@
 		}
 	}
 
+  	/* FPU must be disabled in SMP. */
+  	/* It does not hurt in UP either. */
+  	childregs->psr &= ~PSR_EF;
+  
 	/* Set the return value for the child. */
 	childregs->u_regs[UREG_I0] = current->pid;
 	childregs->u_regs[UREG_I1] = 1;

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-02-15 20:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-26  8:24 FPU context switching fix for SMP Krzysztof Helt
2005-01-26  8:26 ` William Lee Irwin III
2005-01-26  8:57 ` Krzysztof Helt
2005-01-26 22:06 ` Baurjan Ismagulov
2005-01-26 23:09 ` David S. Miller
2005-01-29 18:22 ` Baurjan Ismagulov
2005-02-15 17:40 ` David S. Miller
2005-02-15 20:01 ` William Lee Irwin III

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.