All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Denys Vlasenko <dvlasenk@redhat.com>
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, 3 Oct 2015 09:44:28 +0200	[thread overview]
Message-ID: <20151003074428.GA25143@gmail.com> (raw)
In-Reply-To: <1443813145-29102-3-git-send-email-dvlasenk@redhat.com>


* 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.

> +	/* 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?

Thanks,

	Ingo

  reply	other threads:[~2015-10-03  7:44 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 [this message]
2015-10-03 20:26     ` Denys Vlasenko
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=20151003074428.GA25143@gmail.com \
    --to=mingo@kernel.org \
    --cc=daniel@numascale.com \
    --cc=dvlasenk@redhat.com \
    --cc=jiang.liu@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.