All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Krzysztof Helt" <krzysztof.h1@wp.pl>
To: sparclinux@vger.kernel.org
Subject: FPU context switching fix for SMP
Date: Wed, 26 Jan 2005 08:24:42 +0000	[thread overview]
Message-ID: <41f753cabb795@wp.pl> (raw)

[-- 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;

             reply	other threads:[~2005-01-26  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-26  8:24 Krzysztof Helt [this message]
2005-01-26  8:26 ` FPU context switching fix for SMP 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41f753cabb795@wp.pl \
    --to=krzysztof.h1@wp.pl \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.