linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] use valid value when unmapping cpus
@ 2003-06-04 21:26 Matthew Dobson
  2003-06-09  5:20 ` Matt Mackall
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Dobson @ 2003-06-04 21:26 UTC (permalink / raw)
  To: Trivial Patch Monkey, Martin J. Bligh, linux-kernel

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

For some unknown reason, we stick a -1 in cpu_2_node when we unmap a cpu 
on i386.  We're better off sticking a 0 in there, because at least 0 is 
a valid value if something references it.  -1 is only going to cause 
problems at some point down the line.  Besides, we initialize the array 
with 0's, so undoing it should return it to that same value.

Cheers!

-Matt

[-- Attachment #2: i386_smpboot_fix.patch --]
[-- Type: text/plain, Size: 398 bytes --]

--- linux-2.5.70-vanilla/arch/i386/kernel/smpboot.c	Mon Mar 24 14:00:35 2003
+++ linux-2.5.70-vanilla/arch/i386/kernel/smpboot.c.fixed	Wed Apr  2 18:23:06 2003
@@ -520,7 +520,7 @@
 	printk("Unmapping cpu %d from all nodes\n", cpu);
 	for (node = 0; node < MAX_NR_NODES; node ++)
 		node_2_cpu_mask[node] &= ~(1 << cpu);
-	cpu_2_node[cpu] = -1;
+	cpu_2_node[cpu] = 0;
 }
 #else /* !CONFIG_NUMA */
 

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

* Re: [patch] use valid value when unmapping cpus
  2003-06-04 21:26 [patch] use valid value when unmapping cpus Matthew Dobson
@ 2003-06-09  5:20 ` Matt Mackall
  2003-06-09 16:59   ` Matthew Dobson
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Mackall @ 2003-06-09  5:20 UTC (permalink / raw)
  To: Matthew Dobson; +Cc: Trivial Patch Monkey, Martin J. Bligh, linux-kernel

On Wed, Jun 04, 2003 at 02:26:22PM -0700, Matthew Dobson wrote:
> For some unknown reason, we stick a -1 in cpu_2_node when we unmap a cpu 
> on i386.  We're better off sticking a 0 in there, because at least 0 is 
> a valid value if something references it.  -1 is only going to cause 
> problems at some point down the line.

Problems down the line help you find the bogus dereference. Even
better to stick a poison value in there.

-- 
Matt Mackall : http://www.selenic.com : of or relating to the moon

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

* Re: [patch] use valid value when unmapping cpus
  2003-06-09  5:20 ` Matt Mackall
@ 2003-06-09 16:59   ` Matthew Dobson
  0 siblings, 0 replies; 3+ messages in thread
From: Matthew Dobson @ 2003-06-09 16:59 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Trivial Patch Monkey, Martin J. Bligh, linux-kernel

Matt Mackall wrote:
> On Wed, Jun 04, 2003 at 02:26:22PM -0700, Matthew Dobson wrote:
> 
>>For some unknown reason, we stick a -1 in cpu_2_node when we unmap a cpu 
>>on i386.  We're better off sticking a 0 in there, because at least 0 is 
>>a valid value if something references it.  -1 is only going to cause 
>>problems at some point down the line.
> 
> 
> Problems down the line help you find the bogus dereference. Even
> better to stick a poison value in there.

Well, it's not really a dereference issue.  The function, cpu_to_node() 
just returns an integer which is the node that particular CPU is on. 
This should always return a valid value.  This is used in many places, 
often as a direct index into an array, and we shouldn't have to check 
its return value everywhere.  The default behavior is to just return 0, 
because 0 is a valid node, even for UP/SMP.  The array of CPU -> node 
mappings is initialized to 0's on i386 already, so unmapping a CPU 
should return this mapping to its uninitialized state.

Cheers!

-Matt


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-04 21:26 [patch] use valid value when unmapping cpus Matthew Dobson
2003-06-09  5:20 ` Matt Mackall
2003-06-09 16:59   ` Matthew Dobson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).