linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Daniel J Blueman <daniel@numascale.com>,
	Jiang Liu <jiang.liu@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Len Brown <len.brown@intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[] mapping
Date: Sat, 03 Oct 2015 22:26:32 +0200	[thread overview]
Message-ID: <561039F8.9000207@redhat.com> (raw)
In-Reply-To: <20151003074428.GA25143@gmail.com>

On 10/03/2015 09:44 AM, Ingo Molnar wrote:
> 
> * Denys Vlasenko <dvlasenk@redhat.com> wrote:
> 
>> @@ -56,16 +56,34 @@ early_param("numa", numa_setup);
>>  /*
>>   * apicid, cpu, node mappings
>>   */
>> -s16 __apicid_to_node[MAX_LOCAL_APICID] = {
>> -	[0 ... MAX_LOCAL_APICID-1] = NUMA_NO_NODE
>> +
>> +struct apicid_to_node __apicid_to_node[NR_CPUS] = {
>> +	[0 ... NR_CPUS-1] = {-1, NUMA_NO_NODE}
>>  };
>>  
>> +void set_apicid_to_node(int apicid, s16 node)
>> +{
>> +	static int ent;
> 
> having such statics inside functions is really obscure and makes review harder.
> I had to look twice to see it. Please move it outside and also name it 
> appropriately.

Just to confirm: you want it to be a static data, but not inside a function?


>> +	/* Protect against small kernel on large system */
>> +	if (ent >= NR_CPUS)
>> +		return;
>> +
>> +	__apicid_to_node[ent].apicid = apicid;
>> +	__apicid_to_node[ent].node = node;
>> +	ent++;
>> +}
> 
> So what happens if we run a small kernel and run out of entries? We just silently 
> seem to return, no warning, no nothing - the system will likely fail to boot in 
> myserious ways, right?

Good question.

I tested this.

I built a NR_CPUS=8 kernel and booted it on 144 cpu and 240 cpu machines.
Both booted fine:

[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: NR_CPUS/possible_cpus limit of 8 reached.  Processor 8/0x16 ignored.
...
[    0.000000] ACPI: NR_CPUS/possible_cpus limit of 8 reached.  Processor 143/0xf7 ignored.



  reply	other threads:[~2015-10-03 20:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 19:12 [PATCH 1/3] x86/apic: Rename MAX_LOCAL_APIC to MAX_LOCAL_APICID Denys Vlasenko
2015-10-02 19:12 ` [PATCH 2/3] x86/apic: Make apic_version[] smaller Denys Vlasenko
2015-10-02 19:12 ` [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[] mapping Denys Vlasenko
2015-10-03  7:44   ` Ingo Molnar
2015-10-03 20:26     ` Denys Vlasenko [this message]
2015-10-05  4:32     ` [PATCH v2] " Daniel J Blueman
2015-10-09 14:15       ` Thomas Gleixner
2015-10-09 15:16         ` Jiang Liu
2015-10-09 20:40           ` Thomas Gleixner
2015-10-09 15:35   ` [PATCH 3/3] " Jiang Liu
2015-10-12 10:21     ` Daniel J Blueman
2015-10-12 10:25       ` Thomas Gleixner
2015-10-13  9:32         ` Jiang Liu
2015-10-13 12:55           ` Thomas Gleixner

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=561039F8.9000207@redhat.com \
    --to=dvlasenk@redhat.com \
    --cc=daniel@numascale.com \
    --cc=jiang.liu@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).