From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754296AbYJTRE6 (ORCPT ); Mon, 20 Oct 2008 13:04:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751415AbYJTRDc (ORCPT ); Mon, 20 Oct 2008 13:03:32 -0400 Received: from relay1.sgi.com ([192.48.171.29]:55242 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753395AbYJTRDX (ORCPT ); Mon, 20 Oct 2008 13:03:23 -0400 Message-Id: <20081020170321.816821000@polaris-admin.engr.sgi.com> References: <20081020170319.539427000@polaris-admin.engr.sgi.com> User-Agent: quilt/0.46-1 Date: Mon, 20 Oct 2008 10:03:35 -0700 From: Mike Travis To: Ingo Molnar , Rusty Russell Cc: Andi Kleen , Andrew Morton , davej@codemonkey.org.uk, David Miller , Eric Dumazet , Jack Steiner , Jeremy Fitzhardinge , Jes Sorensen , "H. Peter Anvin" , peterz@infradead.org, Thomas Gleixner , Yinghai Lu , IA64 , PowerPC , S390 , SPARC , linux-kernel@vger.kernel.org Subject: [PATCH 16/35] percpu: fix percpu accessors to potentially !cpu_possible() cpus Content-Disposition: inline; filename=cpumask:fix-impossible-percpu-accesses.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Percpu areas are only allocated for possible cpus. In general, you shouldn't access random cpu's percpu areas: you're corrupting memory. From: Rusty Russell Signed-off-by: Rusty Russell Signed-off-by: Mike Travis --- arch/m32r/kernel/smpboot.c | 2 +- arch/x86/mach-voyager/voyager_smp.c | 2 +- drivers/pnp/pnpbios/bioscalls.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) --- test-compile.orig/arch/m32r/kernel/smpboot.c +++ test-compile/arch/m32r/kernel/smpboot.c @@ -598,7 +598,7 @@ int setup_profiling_timer(unsigned int m * accounting. At that time they also adjust their APIC timers * accordingly. */ - for (i = 0; i < NR_CPUS; ++i) + for_each_possible_cpu(i) per_cpu(prof_multiplier, i) = multiplier; return 0; --- test-compile.orig/arch/x86/mach-voyager/voyager_smp.c +++ test-compile/arch/x86/mach-voyager/voyager_smp.c @@ -1223,7 +1223,7 @@ int setup_profiling_timer(unsigned int m * new values until the next timer interrupt in which they do process * accounting. */ - for (i = 0; i < NR_CPUS; ++i) + for_each_possible_cpu(i) per_cpu(prof_multiplier, i) = multiplier; return 0; --- test-compile.orig/drivers/pnp/pnpbios/bioscalls.c +++ test-compile/drivers/pnp/pnpbios/bioscalls.c @@ -481,7 +481,7 @@ void pnpbios_calls_init(union pnp_bios_i set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); - for (i = 0; i < NR_CPUS; i++) { + for_each_possible_cpu(i) { struct desc_struct *gdt = get_cpu_gdt_table(i); if (!gdt) continue; --