From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Alexey Dobriyan <adobriyan@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/proc: fix /proc/cpuinfo cpu offline bug
Date: Wed, 22 Oct 2008 12:39:07 +0800 [thread overview]
Message-ID: <48FEAE6B.70809@cn.fujitsu.com> (raw)
In-Reply-To: <e7baa9c80810170544q1eaec469vc3a1ad2cba8e4ee0@mail.gmail.com>
Hi, Ingo and Alexey,
I have changed my changelog. please review again.
Thanks, Lai.
Lai Jiangshan wrote:
> On Fri, Oct 17, 2008 at 7:41 PM, Alexey Dobriyan <adobriyan@gmail.com> wrote:
>> On Fri, Oct 17, 2008 at 04:55:25PM +0800, Lai Jiangshan wrote:
>>> In my test, I found that if a cpu has been offline,
>>> the next cpus may not be shown in the /proc/cpuinfo.
>>>
>>> trivially reproduce this bug:
>>>
>>> 1) add these lines in the end of show_cpuinfo()
>>> if (m->size - m->count - 20 > 0)
>>> seq_printf(m, "%*s", (int)(m->size - m->count - 20), "show bug\n");
>> What is it?
>>
>> Can you just show wrong /proc/cpuinfo ?
>>
>> Can someone with at least 4-way box please do so?
>
> this is not wrong /proc/cpuinfo, this is an enlarged /proc/cpuinfo
> this trivial example just use "show bug\n" as the enlarged content.
>
> if you boot your machine with enough cpu, your /proc/cpuinfo
> have been enlarged too, please use this:
>
> #!/bin/sh
> nr_cpus=16 # i386
> for ((i=1; i<nr_cpus; i++))
> do
> echo 0 > /sys/devices/system/cpu/cpu$i/online
> cpus=$(grep processor /proc/cpuinfo | wc -l)
> (( cpus == nr_cpus -1 )) || break; # bug eccur
> echo 1 > /sys/devices/system/cpu/cpu$i/online
> done
> cat /proc/cpuinfo # it shows this bug.
>
> Lai
>
>>> 3) offline cpu#1
>>> 4) cat /proc/cpuinfo
>>> cpu#2 and cpu#3 .... cannot be shown in /proc/cpuinfo
>>> --- a/arch/x86/kernel/cpu/proc.c
>>> +++ b/arch/x86/kernel/cpu/proc.c
>>> @@ -160,14 +160,16 @@ static void *c_start(struct seq_file *m, loff_t *pos)
>>> {
>>> if (*pos == 0) /* just in case, cpu 0 is not the first */
>>> *pos = first_cpu(cpu_online_map);
>>> - if ((*pos) < nr_cpu_ids && cpu_online(*pos))
>>> + else
>>> + *pos = next_cpu_nr(*pos - 1, cpu_online_map);
>>> + if ((*pos) < nr_cpu_ids)
>>> return &cpu_data(*pos);
>>> return NULL;
>>> }
>>>
>>> static void *c_next(struct seq_file *m, void *v, loff_t *pos)
>>> {
>>> - *pos = next_cpu(*pos, cpu_online_map);
>>> + (*pos)++;
>>> return c_start(m, pos);
>>> }
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>>
>
>
>
next prev parent reply other threads:[~2008-10-22 4:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-17 8:55 [PATCH] x86/proc: fix /proc/cpuinfo cpu offline bug Lai Jiangshan
2008-10-17 11:41 ` Alexey Dobriyan
2008-10-17 12:44 ` Lai Jiangshan
2008-10-22 4:39 ` Lai Jiangshan [this message]
2008-10-22 4:42 ` Lai Jiangshan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48FEAE6B.70809@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.