public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Glauber de Oliveira Costa <gcosta@redhat.com>
Cc: Andreas Herrmann3 <andreas.herrmann3@amd.com>,
	linux-kernel@vger.kernel.org, mingo@elte.hu, tglx@linutronix.de,
	akpm@linux-foundation.org, travis@sgi.com
Subject: Re: [PATCH] x86: show cpuinfo only for online CPUs
Date: Thu, 01 Nov 2007 12:12:35 -0700	[thread overview]
Message-ID: <472A2523.2030201@zytor.com> (raw)
In-Reply-To: <472A1EA1.3070109@redhat.com>

Glauber de Oliveira Costa wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Andreas Herrmann3 escreveu:
>> On Thu, Nov 01, 2007 at 06:35:43PM +0100, Andreas Herrmann3 wrote:
>>> On Thu, Nov 01, 2007 at 03:12:25PM -0200, Glauber de Oliveira Costa wrote:
>>>> So it could even work, but as accident. Unless I'm wrong about it, I'd
>>>> prefer to see an explicit attribution of cpu_index = 0 somewhere for the
>>>> boot cpu.
>>> Hmm, will look at this as well.
>> BTW, isn't it zero initialized anyway?
>> So, no need to explicitely set cpuinfo->cpu_index=0 for the boot cpu.
> 
> Well, it should be, but as far as I know it is not exactly a guarantee
> given by all compilers. So it should be safer to do it explicitly, with
> no prejudice. Unless it's really guaranteed. If it is, yeah, no need.

Any uninitialized field in a static section (.data or .bss) is 
guaranteed to be initialized to zero.  This is guaranteed by the C 
standard.  In the former case, it is the responsibility of the compiler 
and in the latter by the runtime.

The Linux percpu handling creates a .data.percpu section which is then 
replicated into each of the CPU data blocks; thus, percpu data counts as 
static data for this purpose, and initialization is guaranteed.

	-hpa

  reply	other threads:[~2007-11-01 19:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 17:02 [PATCH] x86: show cpuinfo only for online CPUs Andreas Herrmann
2007-11-01 17:12 ` Glauber de Oliveira Costa
2007-11-01 17:35   ` Andreas Herrmann3
2007-11-01 18:35     ` Andreas Herrmann3
2007-11-01 18:44       ` Glauber de Oliveira Costa
2007-11-01 19:12         ` H. Peter Anvin [this message]
2007-11-01 18:32 ` [PATCH v2] " Andreas Herrmann

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=472A2523.2030201@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreas.herrmann3@amd.com \
    --cc=gcosta@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=travis@sgi.com \
    /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