mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Galtieri <pgaltieri@mvista.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: floating point register corruption
Date: Tue, 29 Nov 2005 12:24:01 -0700	[thread overview]
Message-ID: <1133292241.26244.11.camel@playin.mvista.com> (raw)

Folks,
  I recently discovered a bug on PPC which causes the floating
point registers to get corrupted when CONFIG_PREEMPT=y.

The problem occurred while running a multi threaded Java application
that does floating point.  The problem could be reproduced in
anywhere from 2 to 6 hours.  With the patch I have included below
it ran for over a week without failure.

Paolo

Signed-off-by: pgaltieri@mvista.com

--- linux-2.6.15-rc3/arch/ppc/kernel/process.c	2005-11-29
07:01:55.000000000 -0700
+++ new-linux-2.6.15-rc3/arch/ppc/kernel/process.c	2005-11-29
07:20:37.000000000 -0700
@@ -417,6 +417,7 @@
 
 void exit_thread(void)
 {
+	preempt_disable();
 	if (last_task_used_math == current)
 		last_task_used_math = NULL;
 	if (last_task_used_altivec == current)
@@ -425,10 +426,12 @@
 	if (last_task_used_spe == current)
 		last_task_used_spe = NULL;
 #endif
+	preempt_enable();
 }
 
 void flush_thread(void)
 {
+	preempt_disable();
 	if (last_task_used_math == current)
 		last_task_used_math = NULL;
 	if (last_task_used_altivec == current)
@@ -437,6 +440,7 @@
 	if (last_task_used_spe == current)
 		last_task_used_spe = NULL;
 #endif
+	preempt_enable();
 }
 
 void
@@ -535,6 +539,7 @@
 	regs->nip = nip;
 	regs->gpr[1] = sp;
 	regs->msr = MSR_USER;
+	preempt_disable();
 	if (last_task_used_math == current)
 		last_task_used_math = NULL;
 	if (last_task_used_altivec == current)
@@ -543,6 +548,7 @@
 	if (last_task_used_spe == current)
 		last_task_used_spe = NULL;
 #endif
+	preempt_enable();
 	memset(current->thread.fpr, 0, sizeof(current->thread.fpr));
 	current->thread.fpscr.val = 0;
 #ifdef CONFIG_ALTIVEC



                 reply	other threads:[~2005-11-29 19:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1133292241.26244.11.camel@playin.mvista.com \
    --to=pgaltieri@mvista.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®