Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] protect CU1 bit manipulation from preempt
@ 2005-10-06 15:43 Atsushi Nemoto
  2005-10-06 16:40 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Atsushi Nemoto @ 2005-10-06 15:43 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

The ptrace temporarily enable CP1 without fpu-ownership.  These
regions should be protected from preempt.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -126,10 +126,12 @@ int ptrace_getfpregs (struct task_struct
 
 		__put_user (child->thread.fpu.hard.fcr31, data + 64);
 
+		preempt_disable();
 		flags = read_c0_status();
 		__enable_fpu();
 		__asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp));
 		write_c0_status(flags);
+		preempt_enable();
 		__put_user (tmp, data + 65);
 	} else {
 		__put_user (child->thread.fpu.soft.fcr31, data + 64);
@@ -284,10 +286,12 @@ asmlinkage int sys_ptrace(long request, 
 			if (!cpu_has_fpu)
 				break;
 
+			preempt_disable();
 			flags = read_c0_status();
 			__enable_fpu();
 			__asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
 			write_c0_status(flags);
+			preempt_enable();
 			break;
 		}
 		case DSP_BASE ... DSP_BASE + 5: {
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -191,10 +191,12 @@ asmlinkage int sys32_ptrace(int request,
 			if (!cpu_has_fpu)
 				break;
 
+			preempt_disable();
 			flags = read_c0_status();
 			__enable_fpu();
 			__asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
 			write_c0_status(flags);
+			preempt_enable();
 			break;
 		}
 		case DSP_BASE ... DSP_BASE + 5:

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

* Re: [PATCH] protect CU1 bit manipulation from preempt
  2005-10-06 15:43 [PATCH] protect CU1 bit manipulation from preempt Atsushi Nemoto
@ 2005-10-06 16:40 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2005-10-06 16:40 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Fri, Oct 07, 2005 at 12:43:59AM +0900, Atsushi Nemoto wrote:

> The ptrace temporarily enable CP1 without fpu-ownership.  These
> regions should be protected from preempt.

Applied with quite some additions to take care of the MT ASE as well.

  Ralf

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

end of thread, other threads:[~2005-10-06 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-06 15:43 [PATCH] protect CU1 bit manipulation from preempt Atsushi Nemoto
2005-10-06 16:40 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox