From: Tejun Heo <tj@kernel.org>
To: Tony Vroon <tony@linx.net>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Christoph Lameter <cl@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH] percpu: fix unit_map[] verification in pcpu_setup_first_chunk()
Date: Tue, 29 Sep 2009 01:19:13 +0900 [thread overview]
Message-ID: <4AC0E201.2020006@kernel.org> (raw)
In-Reply-To: <1254055797.2756.1.camel@localhost>
pcpu_setup_first_chunk() incorrectly used NR_CPUS as the impossible
unit number while unit number can equal and go over NR_CPUS with
sparse unit map. This triggers BUG_ON() spuriously on machines which
have non-power-of-two number of cpus. Use UINT_MAX instead.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Tony Vroon <tony@linx.net>
---
Erghh... stupid mistake. This should fix it. Can you please verify?
Thanks.
mm/percpu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: work/mm/percpu.c
===================================================================
--- work.orig/mm/percpu.c
+++ work/mm/percpu.c
@@ -1604,7 +1604,7 @@ int __init pcpu_setup_first_chunk(const
unit_off = alloc_bootmem(nr_cpu_ids * sizeof(unit_off[0]));
for (cpu = 0; cpu < nr_cpu_ids; cpu++)
- unit_map[cpu] = NR_CPUS;
+ unit_map[cpu] = UINT_MAX;
pcpu_first_unit_cpu = NR_CPUS;
for (group = 0, unit = 0; group < ai->nr_groups; group++, unit += i) {
@@ -1619,7 +1619,7 @@ int __init pcpu_setup_first_chunk(const
continue;
BUG_ON(cpu > nr_cpu_ids || !cpu_possible(cpu));
- BUG_ON(unit_map[cpu] != NR_CPUS);
+ BUG_ON(unit_map[cpu] != UINT_MAX);
unit_map[cpu] = unit + i;
unit_off[cpu] = gi->base_offset + i * ai->unit_size;
@@ -1632,7 +1632,7 @@ int __init pcpu_setup_first_chunk(const
pcpu_nr_units = unit;
for_each_possible_cpu(cpu)
- BUG_ON(unit_map[cpu] == NR_CPUS);
+ BUG_ON(unit_map[cpu] == UINT_MAX);
pcpu_nr_groups = ai->nr_groups;
pcpu_group_offsets = group_offsets;
next prev parent reply other threads:[~2009-09-28 16:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-24 0:53 [PATCH] percpu: make pcpu_setup_first_chunk() failures more verbose Tejun Heo
2009-09-24 12:49 ` [PATCH] percpu: make allocation " Tejun Heo
2009-09-27 12:49 ` 2.6.31-09194-g0d9df25 Early boot exception Tony Vroon
2009-09-28 16:19 ` Tejun Heo [this message]
2009-09-28 16:25 ` [PATCH] percpu: fix unit_map[] verification in pcpu_setup_first_chunk() Christoph Lameter
2009-09-28 16:35 ` Tejun Heo
2009-09-28 16:38 ` Tejun Heo
2009-09-28 16:40 ` Christoph Lameter
2009-09-28 16:53 ` Tejun Heo
2009-09-28 22:07 ` Tony Vroon
2009-09-29 0:15 ` Tejun Heo
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=4AC0E201.2020006@kernel.org \
--to=tj@kernel.org \
--cc=cl@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rusty@rustcorp.com.au \
--cc=tony@linx.net \
/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
Powered by JetHome