mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] NR_CPUS=8 on a 32 cpu box
@ 2003-09-05  1:27 john stultz
  2003-09-05  1:47 ` Dave Hansen
  2003-09-05  7:51 ` Tim Schmielau
  0 siblings, 2 replies; 4+ messages in thread
From: john stultz @ 2003-09-05  1:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lkml, Martin J. Bligh, Dave H

Andrew, All, 

	So, I found the cause of that memory corruption I mentioned last night.
I was booting on the 16x w/ HT and I hadn't taken note that NR_CPUS now
defaults to 8. Whoops. Ends up there isn't any bounds checking when
bringing up the cpus, thus we overflow bios_cpu_apicid[]. 

Here's a quick patch that checks if num_processors has hit NR_CPUS. 
Seems to fix it for me.

Let me know if you have any comments or suggestions. 

thanks
-john

===== arch/i386/kernel/mpparse.c 1.49 vs edited =====
--- 1.49/arch/i386/kernel/mpparse.c	Sun Aug 31 16:14:25 2003
+++ edited/arch/i386/kernel/mpparse.c	Thu Sep  4 18:07:15 2003
@@ -167,6 +167,10 @@
 		boot_cpu_logical_apicid = apicid;
 	}
 
+	if (num_processors > NR_CPUS){
+		printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot boot CPU(apicid 0x%d).\n", NR_CPUS, m->mpc_apicid);
+		return;
+	}
 	num_processors++;
 
 	if (MAX_APICS - m->mpc_apicid <= 0) {




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

* Re: [RFC] NR_CPUS=8 on a 32 cpu box
  2003-09-05  1:27 [RFC] NR_CPUS=8 on a 32 cpu box john stultz
@ 2003-09-05  1:47 ` Dave Hansen
  2003-09-05  2:29   ` Martin J. Bligh
  2003-09-05  7:51 ` Tim Schmielau
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Hansen @ 2003-09-05  1:47 UTC (permalink / raw)
  To: John Stultz; +Cc: Andrew Morton, lkml, Martin J. Bligh

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

On Thu, 2003-09-04 at 18:27, john stultz wrote:
> Let me know if you have any comments or suggestions. 

While you're at it, can we do this as well?  10 bucks says we'll keep
hitting this otherwise.  I think Bill can manage to remember to change
it if he tries for a 64x NUMA-Q.  The rest of us are too stupid most of
the time.

-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: nr_cpus_kconfig-2.6.0-test4+bk-0.patch --]
[-- Type: text/plain, Size: 371 bytes --]

--- linux-2.5/arch/i386/Kconfig.orig	Thu Sep  4 18:41:05 2003
+++ linux-2.5/arch/i386/Kconfig	Thu Sep  4 18:46:44 2003
@@ -451,6 +451,7 @@
 config NR_CPUS
 	int "Maximum number of CPUs (2-255)"
 	depends on SMP
+	default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
 	default "8"
 	help
 	  This allows you to specify the maximum number of CPUs which this

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

* Re: [RFC] NR_CPUS=8 on a 32 cpu box
  2003-09-05  1:47 ` Dave Hansen
@ 2003-09-05  2:29   ` Martin J. Bligh
  0 siblings, 0 replies; 4+ messages in thread
From: Martin J. Bligh @ 2003-09-05  2:29 UTC (permalink / raw)
  To: Dave Hansen, John Stultz; +Cc: Andrew Morton, lkml

> On Thu, 2003-09-04 at 18:27, john stultz wrote:
>> Let me know if you have any comments or suggestions. 
> 
> While you're at it, can we do this as well?  10 bucks says we'll keep
> hitting this otherwise.  I think Bill can manage to remember to change
> it if he tries for a 64x NUMA-Q.  The rest of us are too stupid most of
> the time.

Yeah, good plan.

Thanks for that,

M.


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

* Re: [RFC] NR_CPUS=8 on a 32 cpu box
  2003-09-05  1:27 [RFC] NR_CPUS=8 on a 32 cpu box john stultz
  2003-09-05  1:47 ` Dave Hansen
@ 2003-09-05  7:51 ` Tim Schmielau
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Schmielau @ 2003-09-05  7:51 UTC (permalink / raw)
  To: john stultz; +Cc: Andrew Morton, lkml, Martin J. Bligh, Dave H

> +	if (num_processors > NR_CPUS){
> +		printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot boot CPU(apicid 0x%d).\n", NR_CPUS, m->mpc_apicid);

I'm no expert in this field at all, but doesnt this need to check for '>=' ?

Also, the code following the check could get some reordering for
readability. How about the following:

--- linux-2.6.0-test4/arch/i386/kernel/mpparse.c.orig	Fri Sep  5 09:40:07 2003
+++ linux-2.6.0-test4/arch/i386/kernel/mpparse.c	Fri Sep  5 09:50:11 2003
@@ -167,15 +167,18 @@
 		boot_cpu_logical_apicid = apicid;
 	}

-	num_processors++;
-
 	if (MAX_APICS - m->mpc_apicid <= 0) {
 		printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n",
 			m->mpc_apicid, MAX_APICS);
-		--num_processors;
 		return;
 	}
 	ver = m->mpc_apicver;
+
+	if (num_processors >= NR_CPUS){
+		printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot boot CPU(apicid 0x%d).\n", NR_CPUS, m->mpc_apicid);
+		return;
+	}
+	num_processors++;

 	tmp = apicid_to_cpu_present(apicid);
 	physids_or(phys_cpu_present_map, phys_cpu_present_map, tmp);

Tim


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

end of thread, other threads:[~2003-09-05  7:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-05  1:27 [RFC] NR_CPUS=8 on a 32 cpu box john stultz
2003-09-05  1:47 ` Dave Hansen
2003-09-05  2:29   ` Martin J. Bligh
2003-09-05  7:51 ` Tim Schmielau

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

all inboxes | Powered by JetHome®