public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] bug in cpuid & msr on nosmp machine
@ 2004-05-19 16:35 matthieu castet
  2004-05-19 17:46 ` matthieu castet
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: matthieu castet @ 2004-05-19 16:35 UTC (permalink / raw)
  To: linux-kernel

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

hi,

on monocpu machine (and maybe even on smp machine), when you try to 
acces to a cpu that don't exist (/dev/cpu/1/cpuid), cpuid (msr) call 
cpu_online, but on nosmp machine if the cpu!=0 this procude a BUG();
So I add a check that verify if the cpu can exist before calling cpu_online.

Matthieu CASTET

[-- Attachment #2: cpuid.patch --]
[-- Type: text/x-patch, Size: 454 bytes --]

--- linux/arch/i386/kernel/cpuid.c	2004-05-18 20:47:05.000000000 +0200
+++ linux-2.6.5/arch/i386/kernel/cpuid.c	2004-04-04 05:36:12.000000000 +0200
@@ -135,7 +135,7 @@
   int cpu = iminor(file->f_dentry->d_inode);
   struct cpuinfo_x86 *c = &(cpu_data)[cpu];
 
-  if (cpu >= num_possible_cpus() || !cpu_online(cpu))
+  if (!cpu_online(cpu))
     return -ENXIO;		/* No such CPU */
   if ( c->cpuid_level < 0 )
     return -EIO;		/* CPUID not supported */

[-- Attachment #3: msr.patch --]
[-- Type: text/x-patch, Size: 460 bytes --]

--- linux/arch/i386/kernel/msr.c	2004-05-19 18:25:09.000000000 +0200
+++ linux-2.6.5/arch/i386/kernel/msr.c	2004-04-04 05:36:57.000000000 +0200
@@ -241,7 +241,7 @@
   int cpu = iminor(file->f_dentry->d_inode);
   struct cpuinfo_x86 *c = &(cpu_data)[cpu];
   
-  if (cpu >= num_possible_cpus() || !cpu_online(cpu))
+  if (!cpu_online(cpu))
     return -ENXIO;		/* No such CPU */
   if ( !cpu_has(c, X86_FEATURE_MSR) )
     return -EIO;		/* MSR not supported */

^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <1XCh4-1jO-67@gated-at.bofh.it>]

end of thread, other threads:[~2004-05-22  8:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-19 16:35 [patch] bug in cpuid & msr on nosmp machine matthieu castet
2004-05-19 17:46 ` matthieu castet
2004-05-20  2:44 ` Jeff Sipek
2004-05-20  9:51   ` Paul Jackson
2004-05-20  7:32 ` Andrew Morton
2004-05-20  8:34   ` Rusty Russell
2004-05-20  8:51     ` Andrew Morton
2004-05-20  9:30       ` Rusty Russell
2004-05-20  9:57       ` Rusty Russell
     [not found] <1XCh4-1jO-67@gated-at.bofh.it>
     [not found] ` <1XRg3-4LW-31@gated-at.bofh.it>
     [not found]   ` <1XRg3-4LW-29@gated-at.bofh.it>
     [not found]     ` <1XSc3-5y3-23@gated-at.bofh.it>
2004-05-22  8:13       ` Andi Kleen

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