public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: nofpu and nodsp only affect CPU0
@ 2010-05-02 21:43 Kevin Cernekee
  2010-05-10 20:19 ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Cernekee @ 2010-05-02 21:43 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, linux-kernel

The "nofpu" and "nodsp" kernel command line options currently do not
affect CPUs that are brought online later in the boot process or
hotplugged at runtime.  It is desirable to apply the nofpu/nodsp options
to all CPUs in the system, so that surprising results are not seen when
a process migrates from one CPU to another.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
 arch/mips/include/asm/cpu-info.h |    2 ++
 arch/mips/kernel/cpu-probe.c     |    6 ++++++
 arch/mips/kernel/setup.c         |   11 +++++++----
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h
index b39def3..55b156b 100644
--- a/arch/mips/include/asm/cpu-info.h
+++ b/arch/mips/include/asm/cpu-info.h
@@ -84,6 +84,8 @@ extern struct cpuinfo_mips cpu_data[];
 #define current_cpu_data cpu_data[smp_processor_id()]
 #define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
 
+extern int mips_fpu_disabled, mips_dsp_disabled;
+
 extern void cpu_probe(void);
 extern void cpu_report(void);
 
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index be5bb16..baba603 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -982,6 +982,12 @@ __cpuinit void cpu_probe(void)
 	 */
 	BUG_ON(current_cpu_type() != c->cputype);
 
+	if (mips_fpu_disabled)
+		c->options &= ~MIPS_CPU_FPU;
+
+	if (mips_dsp_disabled)
+		c->ases &= ~MIPS_ASE_DSP;
+
 	if (c->options & MIPS_CPU_FPU) {
 		c->fpu_id = cpu_get_fpu_id();
 
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index f9513f9..1664dc2 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -569,21 +569,24 @@ void __init setup_arch(char **cmdline_p)
 	plat_smp_setup();
 }
 
+int __cpuinitdata mips_fpu_disabled;
+
 static int __init fpu_disable(char *s)
 {
-	int i;
-
-	for (i = 0; i < NR_CPUS; i++)
-		cpu_data[i].options &= ~MIPS_CPU_FPU;
+	cpu_data[0].options &= ~MIPS_CPU_FPU;
+	mips_fpu_disabled = 1;
 
 	return 1;
 }
 
 __setup("nofpu", fpu_disable);
 
+int __cpuinitdata mips_dsp_disabled;
+
 static int __init dsp_disable(char *s)
 {
 	cpu_data[0].ases &= ~MIPS_ASE_DSP;
+	mips_dsp_disabled = 1;
 
 	return 1;
 }
-- 
1.6.3.1


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

* Re: [PATCH] MIPS: nofpu and nodsp only affect CPU0
  2010-05-02 21:43 [PATCH] MIPS: nofpu and nodsp only affect CPU0 Kevin Cernekee
@ 2010-05-10 20:19 ` Ralf Baechle
  2010-05-10 20:41   ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2010-05-10 20:19 UTC (permalink / raw)
  To: Kevin Cernekee; +Cc: linux-mips, linux-kernel

On Sun, May 02, 2010 at 02:43:52PM -0700, Kevin Cernekee wrote:

> The "nofpu" and "nodsp" kernel command line options currently do not
> affect CPUs that are brought online later in the boot process or
> hotplugged at runtime.  It is desirable to apply the nofpu/nodsp options
> to all CPUs in the system, so that surprising results are not seen when
> a process migrates from one CPU to another.

I like this patch; this solution is also cleaner than iterating over the
cpu data array.  However as it constitutes a change in established kernel
behaviour I prefer to queue this patch for 2.6.35 rather than applying it
immediately.

Thanks!

  Ralf

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

* Re: [PATCH] MIPS: nofpu and nodsp only affect CPU0
  2010-05-10 20:19 ` Ralf Baechle
@ 2010-05-10 20:41   ` Ralf Baechle
  0 siblings, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2010-05-10 20:41 UTC (permalink / raw)
  To: Kevin Cernekee; +Cc: linux-mips, linux-kernel

On Mon, May 10, 2010 at 09:19:59PM +0100, Ralf Baechle wrote:

> > The "nofpu" and "nodsp" kernel command line options currently do not
> > affect CPUs that are brought online later in the boot process or
> > hotplugged at runtime.  It is desirable to apply the nofpu/nodsp options
> > to all CPUs in the system, so that surprising results are not seen when
> > a process migrates from one CPU to another.
> 
> I like this patch; this solution is also cleaner than iterating over the
> cpu data array.  However as it constitutes a change in established kernel
> behaviour I prefer to queue this patch for 2.6.35 rather than applying it
> immediately.

I've moved definitions of mips_fpu_disabled, fpu_disable, mips_dsp_disabled
and dsp_disable from setup.c to cpu-probe.c to allow mips_fpu_disabled and
mips_dsp_disabled to become static.

  Ralf

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

end of thread, other threads:[~2010-05-10 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-02 21:43 [PATCH] MIPS: nofpu and nodsp only affect CPU0 Kevin Cernekee
2010-05-10 20:19 ` Ralf Baechle
2010-05-10 20:41   ` Ralf Baechle

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