lkml.org 
[lkml]   [2004]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
SubjectRe: [patch] bug in cpuid & msr on nosmp machine
matthieu castet wrote:
> 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
oups i send the wrong patch


--- linux-2.6.5/arch/i386/kernel/cpuid.c 2004-04-04 05:36:12.000000000 +0200
+++ linux/arch/i386/kernel/cpuid.c 2004-05-18 20:47:05.000000000 +0200
@@ -135,7 +135,7 @@
int cpu = iminor(file->f_dentry->d_inode);
struct cpuinfo_x86 *c = &(cpu_data)[cpu];

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

- if (!cpu_online(cpu))
+ if (cpu >= num_possible_cpus() || !cpu_online(cpu))
return -ENXIO; /* No such CPU */
if ( !cpu_has(c, X86_FEATURE_MSR) )
return -EIO; /* MSR not supported */
\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.101 / U:0.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site