public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Andi Kleen <ak@suse.de>
Cc: pravin shelar <pravins@calsoftinc.com>,
	Ravikiran G Thirumalai <kiran@scalex86.org>,
	Shai Fultheim <shai@scalex86.org>,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] garbage values in file /proc/net/sockstat
Date: Mon, 23 Jan 2006 14:28:53 +0100	[thread overview]
Message-ID: <43D4DA15.4010009@cosmosbay.com> (raw)
In-Reply-To: <200601231224.16196.ak@suse.de>

Andi Kleen a écrit :
> On Monday 23 January 2006 12:21, pravin shelar wrote:
>> 	In 2.6.16-rc1-mm1, (for x86_64 arch) cpu_possible_map is not same 
>> as NR_CPUS (prefill_possible_map()). Therefore per cpu areas are allocated 
>> for cpu_possible cpus only (setup_per_cpu_areas()). This causes sockstat 
>> to return garbage value on x84_64 arch.
>>
>> So these per_cpu accesses are geting relocated (RELOC_HIDE) using
>> boot_cpu_pda[]->data_offset which is not initialized.
>>
>> There are other instances of same bug where per_cpu() macro is used
>> without cpu_possible() check. e.g. net/core/utils.c :: 
>> net_random_reseed(), net/core/dev.c :: net_dev_init(), etc.
>>
>> This patch fixes these bugs.
> 
> Thanks. Patches Look good.  Dave, can you push them for 2.6.16 still please?
> 

Shouldnt we force a page fault for not possible cpus in cpu_data
to catch all access to per_cpu(some_object, some_not_possible_cpu) ?

We can use a red zone big enough to hold the whole per_cpu data.

Something like :

file include/asm-x86_64/pgtable.h

#define CPUDATA_RED_ZONE 0xffff808000000000UL  /* start of percpu catcher */

file arch/x86_64/kernel/setup64.c

setup_per_cpu_areas(void)
{
...
     for (i = 0 ; i < NR_CPUS ; i++) {
         if (!cpu_possible(cpu))
             cpu_pda(i)->data_offset = CPUDATA_RED_ZONE - __per_cpu_start ;
     }
}

Eric


  reply	other threads:[~2006-01-23 13:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-23 11:21 [PATCH] garbage values in file /proc/net/sockstat pravin shelar
2006-01-23 11:24 ` Andi Kleen
2006-01-23 13:28   ` Eric Dumazet [this message]
2006-01-23 15:11     ` Andi Kleen
2006-01-23 16:28       ` Eric Dumazet
2006-01-23 16:46         ` Eric Dumazet
2006-01-25 13:31           ` Andi Kleen
2006-01-25 19:59             ` Ravikiran G Thirumalai
2006-01-25 20:47               ` Ravikiran G Thirumalai
2006-01-26  0:32               ` Andi Kleen
2006-01-25 21:45     ` Red zones (was: [PATCH] garbage values in file /proc/net/sockstat) Bernd Eckenfels
2006-01-26  5:28       ` Red zones Eric Dumazet
2006-01-26 10:07         ` Bernd Eckenfels

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43D4DA15.4010009@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=ak@suse.de \
    --cc=davem@davemloft.net \
    --cc=kiran@scalex86.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pravins@calsoftinc.com \
    --cc=shai@scalex86.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox