From: Zou Nan hai <nanhai.zou@intel.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>
Subject: [Patch2/2] fix wrong proc cpuinfo on x64
Date: 06 Nov 2007 16:28:20 +0800 [thread overview]
Message-ID: <1194333940.3046.38.camel@linux-znh> (raw)
in 2.6.24-rc1 kernel,
The /proc/cpuinfo display is wrong.
Another issue is that it will display bogus cpus with wrong information
if the kernel is compiled with a big CONFIG_NR_CPU.
That is because before a cpu in cpu_present_map is up, c->cpu_index of
that cpu is 0.
thus the cpu_online(c->cpu_index) check in show_cpuinfo is invalid.
This patch will let cpuinfo_op use cpu_online_map instead of
cpu_present_map to iterate cpus.
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
--- linux-2.6.24-rc1/arch/x86/kernel/setup_64.c 2007-10-29 22:03:05.000000000 -0400
+++ b/arch/x86/kernel/setup_64.c 2007-11-05 23:09:06.000000000 -0500
@@ -1078,8 +1078,6 @@ static int show_cpuinfo(struct seq_file
#ifdef CONFIG_SMP
- if (!cpu_online(c->cpu_index))
- return 0;
cpu = c->cpu_index;
#endif
@@ -1171,15 +1169,15 @@ static int show_cpuinfo(struct seq_file
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_possible_map);
- if ((*pos) < NR_CPUS && cpu_possible(*pos))
+ *pos = first_cpu(cpu_online_map);
+ if ((*pos) < NR_CPUS && cpu_online(*pos))
return &cpu_data(*pos);
return NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
- *pos = next_cpu(*pos, cpu_possible_map);
+ *pos = next_cpu(*pos, cpu_online_map);
return c_start(m, pos);
}
next reply other threads:[~2007-11-06 8:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-06 8:28 Zou Nan hai [this message]
2007-11-06 18:37 ` [Patch2/2] fix wrong proc cpuinfo on x64 Andreas Herrmann
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=1194333940.3046.38.camel@linux-znh \
--to=nanhai.zou@intel.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox