Re: percpu data for non-existant cpus

From: Takayoshi Kochi <kochi_at_hpc.bs1.fc.nec.co.jp>
Date: 2003-11-04 12:43:49
Hi,

From: Jack Steiner <steiner@sgi.com>
Subject: percpu data for non-existant cpus
Date: Mon, 3 Nov 2003 18:55:24 -0600

> It was neccessary in 2.4 to allocate cpu_data areas for
> non-existent cpus. I forget where, but some generic
> initialization code expected to be able to reference cpu_data 
> for all cpus up to NR_CPUS.
> 
> Does 2.6 have the same requirement or can I allocate cpu_data
> areas only for cpus that exist or might exist (cpu_possible()).

The current discontig (for both 2.4 & 2.6) only allocate
cpu_data on existing nodes (which means existing cpus
eventually), doesn't it?

We've found wrap_mmu_context() refers to all percpu data
and if the any of the cpu_data is not valid,
it may cause panic.

Attached patches are for 2.4 & 2.6, which are harmless
even when percpu data are allocated for non-existing
cpus.

---
Takayoshi Kochi

--- linux-2.4.22/arch/ia64/mm/tlb.c.orig	Fri Sep 12 09:45:18 2003
+++ linux-2.4.22/arch/ia64/mm/tlb.c	Wed Oct  8 17:56:03 2003
@@ -75,7 +75,7 @@
 	 * and because interrupts are disabled during context switch.
 	 */
 	for (i = 0; i < NR_CPUS; ++i)
-		if (i != smp_processor_id())
+		if (cpu_online(i) && (i != smp_processor_id()))
 			cpu_data(i)->need_tlb_flush = 1;
 	local_flush_tlb_all();
 }

--- linux-2.6.0-test6.orig/arch/ia64/mm/tlb.c	Sun Sep 28 09:50:38 2003
+++ linux-2.6.0-test6/arch/ia64/mm/tlb.c	Wed Oct  8 17:58:42 2003
@@ -77,7 +77,7 @@
 	{
 		int cpu = get_cpu(); /* prevent preemption/migration */
 		for (i = 0; i < NR_CPUS; ++i)
-			if (i != cpu)
+			if (cpu_online(i) && (i != cpu))
 				per_cpu(ia64_need_tlb_flush, i) = 1;
 		put_cpu();
 	}

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Nov 3 20:46:03 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:20 EST