linux-kernel-test/arch
Lai Jiangshan bc8bcc79ea x86/proc: fix /proc/cpuinfo cpu offline bug
Impact: fix missing CPUs in /proc/cpuinfo after CPU hotunplug/hotreplug

In my test, I found that if a cpu has been offline,
the next cpus may not be shown in the /proc/cpuinfo.

if one read() cannot consume the whole /proc/cpuinfo,
c_start() will be called again in the next read() calls.
And *pos has been increased by 1 by the caller(seq_read()).
if this time the cpu#*pos is offline, c_start() will return
NULL, and the next cpus can not be shown.

this fix use next_cpu_nr(*pos - 1, cpu_online_map) to
search the next unshown cpu.

the most easy way to reproduce this bug:
1) offline cpu#1             (cpu#0 is online)
2) dd ibs=2 if=/proc/cpuinfo
   the result is that only cpu#0 is shown.
   cpu#2 and cpu#3 .... cannot be shown in /proc/cpuinfo
   it's bug.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-10-22 14:29:37 +02:00
..
alpha Merge branch 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-10-20 13:23:01 -07:00
arm misc: replace remaining __FUNCTION__ with __func__ 2008-10-20 16:17:42 -07:00
avr32 Merge branch 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-10-20 13:23:01 -07:00
blackfin container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
cris cris: use bcd2bin/bin2bcd 2008-10-20 08:52:41 -07:00
frv container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
h8300 container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
ia64 PCI: Add ability to mmap legacy_io on some platforms 2008-10-20 11:01:46 -07:00
m32r Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-10-20 13:21:24 -07:00
m68k arch/m68k/bvme6000/rtc.c: remove duplicated include 2008-10-20 08:52:34 -07:00
m68knommu container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
mips mips: use bcd2bin/bin2bcd 2008-10-20 08:52:41 -07:00
mn10300 mn10300: use bcd2bin/bin2bcd 2008-10-20 08:52:41 -07:00
parisc Merge git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6 2008-10-20 14:40:31 -07:00
powerpc misc: replace remaining __FUNCTION__ with __func__ 2008-10-20 16:17:42 -07:00
s390 container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
sh Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 2008-10-20 09:13:34 -07:00
sparc container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
sparc64 container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
um uml: fix a compile error 2008-10-20 08:52:34 -07:00
x86 x86/proc: fix /proc/cpuinfo cpu offline bug 2008-10-22 14:29:37 +02:00
xtensa container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
.gitignore
Kconfig Kconfig: eliminate "def_bool n" constructs 2008-10-16 11:21:31 -07:00