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
..
2008-10-16 16:53:14 +02:00
2008-10-16 16:53:13 +02:00
2008-10-16 09:24:41 -07:00
2008-01-30 13:31:19 +01:00
2008-10-16 16:53:13 +02:00
2008-10-14 10:34:58 +02:00
2008-10-16 16:53:13 +02:00
2008-09-29 10:04:53 +02:00
2008-10-13 10:21:10 +02:00
2008-10-16 16:53:12 +02:00
2008-04-26 17:35:47 +02:00
2008-07-22 14:35:57 +02:00
2008-10-16 16:53:30 +02:00
2008-10-16 16:53:30 +02:00
2008-10-16 16:53:30 +02:00
2008-10-16 16:53:15 +02:00
2008-10-12 12:37:32 +02:00
2008-08-15 08:35:43 -07:00
2008-07-26 12:00:04 -07:00
2008-10-12 12:37:32 +02:00
2008-08-25 12:31:32 +02:00
2008-10-20 08:52:41 -07:00
2008-10-16 16:53:15 +02:00
2008-08-25 10:59:18 +02:00
2008-07-16 12:15:17 -07:00
2008-07-26 16:31:35 +02:00
2008-07-22 14:35:57 +02:00
2008-07-22 21:53:53 +02:00
2008-09-05 17:44:08 +02:00
2008-07-22 14:35:57 +02:00
2008-01-30 13:31:52 +01:00
2008-08-21 10:01:52 +02:00
2008-10-16 16:53:13 +02:00
2008-10-16 16:53:15 +02:00
2008-07-22 14:35:57 +02:00
2008-10-16 16:52:59 +02:00
2008-10-16 16:53:15 +02:00
2008-10-22 07:31:28 +02:00