public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][OPROFILE] x86: Use for_each_possible_cpu to allocate msrs (was [PATCH] x86: fix oprofile double free (was Re: Multiple free during oprofile unload))
@ 2007-05-31  2:24 Arnaldo Carvalho de Melo
  2007-05-31  6:09 ` Chris Wright
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-05-31  2:24 UTC (permalink / raw)
  To: John Levon; +Cc: linux-kernel, chrisw, alan, davej, ak

The fix for the fix needed a fix: allocate_msrs() was using
for_each_online_cpu(), but nmi_setup uses for_each_possible_cpu(), and
in my test machine, a Dell Poweredge 1950 I have 2 dual core Xeons,
which makes for 4 possible cores, but wait, they are HT capable, so...

[acme@mica linux-2.6.21.3.orig]$ dmesg | grep Allowing
SMP: Allowing 8 CPUs, 4 hotplug CPUs
[acme@mica linux-2.6.21.3.orig]$

We have 8 possible CPUs, but only 4 online, b00m. Fix it by making
allocate_msrs agree with nmi_setup, i.e. make both use
for_each_possible_cpu().

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---


diff -uNrp linux-2.6.21.3.orig/arch/i386/oprofile/nmi_int.c linux-2.6.21.3.new/arch/i386/oprofile/nmi_int.c
--- linux-2.6.21.3.orig/arch/i386/oprofile/nmi_int.c	2007-05-30 23:08:33.000000000 -0300
+++ linux-2.6.21.3.new/arch/i386/oprofile/nmi_int.c	2007-05-30 23:09:17.000000000 -0300
@@ -154,7 +154,7 @@ static int allocate_msrs(void)
 	size_t counters_size = sizeof(struct op_msr) * model->num_counters;
 
 	int i;
-	for_each_online_cpu(i) {
+	for_each_possible_cpu(i) {
 		cpu_msrs[i].counters = kmalloc(counters_size, GFP_KERNEL);
 		if (!cpu_msrs[i].counters) {
 			success = 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-31  6:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-31  2:24 [PATCH][OPROFILE] x86: Use for_each_possible_cpu to allocate msrs (was [PATCH] x86: fix oprofile double free (was Re: Multiple free during oprofile unload)) Arnaldo Carvalho de Melo
2007-05-31  6:09 ` Chris Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox