Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932446AbWAWQrf (ORCPT ); Mon, 23 Jan 2006 11:47:35 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932453AbWAWQre (ORCPT ); Mon, 23 Jan 2006 11:47:34 -0500 Received: from gw1.cosmosbay.com ([62.23.185.226]:45962 "EHLO gw1.cosmosbay.com") by vger.kernel.org with ESMTP id S932446AbWAWQre (ORCPT ); Mon, 23 Jan 2006 11:47:34 -0500 Message-ID: <43D50880.605@cosmosbay.com> Date: Mon, 23 Jan 2006 17:46:56 +0100 From: Eric Dumazet User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Eric Dumazet CC: Andi Kleen , pravin shelar , Ravikiran G Thirumalai , Shai Fultheim , linux-kernel@vger.kernel.org, "David S. Miller" Subject: Re: [PATCH] garbage values in file /proc/net/sockstat References: <200601231224.16196.ak@suse.de> <43D4DA15.4010009@cosmosbay.com> <200601231611.51326.ak@suse.de> <43D50445.1080208@cosmosbay.com> In-Reply-To: <43D50445.1080208@cosmosbay.com> Content-Type: multipart/mixed; boundary="------------090109060508080803030802" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.6 (gw1.cosmosbay.com [172.16.8.80]); Mon, 23 Jan 2006 17:46:57 +0100 (CET) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2959 Lines: 75 This is a multi-part message in MIME format. --------------090109060508080803030802 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sorry for the first version of he patch. I did one change, in order to do the initialization only for !possible cpu [PATCH] x86_64 : Use a special CPUDATA_RED_ZONE to catch accesses to per_cpu(some_object, some_not_possible_cpu) Because cpu_data(cpu)->data_offset may contain garbage, some buggy code may do random things without notice. If we initialize data_offset so that the per_cpu() data sits in an unmapped memory area, we should get page faults and stack traces should help us find the bugs. Signed-off-by: Eric Dumazet --------------090109060508080803030802 Content-Type: text/plain; name="cpudata_red_zone.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cpudata_red_zone.patch" --- linux-2.6.16-rc1/Documentation/x86_64/mm.txt 2006-01-17 08:44:47.000000000 +0100 +++ linux-2.6.16-rc1-mm2-ed/Documentation/x86_64/mm.txt 2006-01-23 16:54:46.000000000 +0100 @@ -5,7 +5,8 @@ 0000000000000000 - 00007fffffffffff (=47bits) user space, different per mm hole caused by [48:63] sign extension -ffff800000000000 - ffff80ffffffffff (=40bits) guard hole +ffff800000000000 - ffff807fffffffff (=39bits) guard hole +ffff808000000000 - ffff80ffffffffff (=39bits) not possible cpus percpudata hole ffff810000000000 - ffffc0ffffffffff (=46bits) direct mapping of all phys. memory ffffc10000000000 - ffffc1ffffffffff (=40bits) hole ffffc20000000000 - ffffe1ffffffffff (=45bits) vmalloc/ioremap space --- linux-2.6.16-rc1/include/asm-x86_64/pgtable.h 2006-01-17 08:44:47.000000000 +0100 +++ linux-2.6.16-rc1-mm2-ed/include/asm-x86_64/pgtable.h 2006-01-23 16:54:46.000000000 +0100 @@ -136,6 +136,7 @@ #ifndef __ASSEMBLY__ #define MAXMEM 0x3fffffffffffUL +#define CPUDATA_RED_ZONE 0xffff808000000000UL #define VMALLOC_START 0xffffc20000000000UL #define VMALLOC_END 0xffffe1ffffffffffUL #define MODULES_VADDR 0xffffffff88000000UL --- linux-2.6.16-rc1/arch/x86_64/kernel/setup64.c 2006-01-23 16:36:38.000000000 +0100 +++ linux-2.6.16-rc1-mm2-ed/arch/x86_64/kernel/setup64.c 2006-01-23 17:40:54.000000000 +0100 @@ -99,9 +99,14 @@ size = PERCPU_ENOUGH_ROOM; #endif - for_each_cpu_mask (i, cpu_possible_map) { + for (i = 0 ; i < NR_CPUS ; i++) { char *ptr; + if (!cpu_possible(i)) { + cpu_pda(i)->data_offset = (char *)CPUDATA_RED_ZONE - __per_cpu_start; + continue; + } + if (!NODE_DATA(cpu_to_node(i))) { printk("cpu with no node %d, num_online_nodes %d\n", i, num_online_nodes()); --------------090109060508080803030802-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/