Messages in this thread Patches in this message | | | Date | Wed, 19 May 2004 19:46:17 +0200 | From | matthieu castet <> | Subject | Re: [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 */ | |