From: Petr Tesarik <ptesarik@suse.cz>
To: "Jan Beulich" <JBeulich@suse.com>
Cc: "Borislav Petkov" <bp@alien8.de>, <x86@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>, <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86: Issue a warning if number of present CPUs > maxcpus and CONFIG_HOTPLUG=n
Date: Mon, 17 Feb 2014 11:04:02 +0100 [thread overview]
Message-ID: <20140217110402.7e4fc211@hananiah.suse.cz> (raw)
In-Reply-To: <5301D7AA020000780011CBE9@nat28.tlf.novell.com>
Hi Jan,
On Mon, 17 Feb 2014 08:34:34 +0000
"Jan Beulich" <JBeulich@suse.com> wrote:
> >>> On 15.02.14 at 15:02, Petr Tesarik <ptesarik@suse.cz> wrote:
> > --- a/arch/x86/kernel/smpboot.c
> > +++ b/arch/x86/kernel/smpboot.c
> > @@ -1226,9 +1226,6 @@ __init void prefill_possible_map(void)
> > #ifdef CONFIG_HOTPLUG_CPU
> > if (setup_max_cpus)
> > possible += disabled_cpus;
> > -#else
> > - if (possible > i)
> > - possible = i;
> > #endif
> > } else
> > possible = setup_possible_cpus;
>
> In between here total_cpus is being set, which now will get a
> larger value if !HOTPLUG_CPU. Did you check that this has no
> unintended side effect? And even if you did, it would still feel
> more safe if you moved that line down after the capping point
> below.
This is a non-issue. total_cpus is initialized to
max(possible, num_processors + disabled_cpus).
possible is initialized to num_processors just before the conditional
block, and in !HOTPLUG case, it is not modified afterwards. So:
BEFORE THE CHANGE:
The value of possible was modified only if it was larger than
min(setup_max_cpus, 1). In turn, it could never be bigger than
num_processors + disabled_cpus.
Result: total_cpus = num_processors + disabled_cpus.
AFTER THE CHANGE:
The value of possible is not modified, i.e. it remains equal to
num_processors. disabled_cpus cannot be negative.
Result: total_cpus = num_processors + disabled_cpus
In fact, you can only increase the value of total_cpus by passing
a nr_possible parameter to the kernel which is greater than the
total number of CPUs detected through system tables (MPTABLES, ACPI,
SFI etc.).
> Similarly (but perhaps less important, albeit possibly slightly
> confusing) the NR_CPUS related warning could now get issued
> along with the warning below (when possible > nr_cpu_ids > i).
> Hence that may better be moved down too (or then in effect
> the if() block you modify below would get moved up). I realize
> that two warning instead of just one would also be possible
> without any change, so you're not really introducing some
> entirely new inconsistency here...
Well, if the user passes both nr_cpus and maxcpus parameters to the
kernel, I think it's fair to issue two warnings. But if everyone agrees
that only the maxcpus warning should be printed in that case, I can
send a version 2 of my patch.
Petr Tesarik
> > @@ -1246,7 +1243,7 @@ __init void prefill_possible_map(void)
> > if (!setup_max_cpus)
> > #endif
> > if (possible > i) {
> > - pr_warn("%d Processors exceeds max_cpus limit of %u\n",
> > + pr_warn("%d Processors exceeds maxcpus limit of %u\n",
> > possible, setup_max_cpus);
> > possible = i;
> > }
> > --
> > 1.8.4.5
>
>
>
next prev parent reply other threads:[~2014-02-17 10:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-15 14:02 Petr Tesarik
2014-02-16 17:11 ` Borislav Petkov
2014-02-17 8:34 ` Jan Beulich
2014-02-17 10:04 ` Petr Tesarik [this message]
2014-02-17 13:40 ` Henrique de Moraes Holschuh
2014-02-17 14:16 ` Petr Tesarik
2014-02-17 19:07 ` Henrique de Moraes Holschuh
2014-02-17 19:31 ` Petr Tesarik
2014-02-17 22:51 ` Henrique de Moraes Holschuh
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=20140217110402.7e4fc211@hananiah.suse.cz \
--to=ptesarik@suse.cz \
--cc=JBeulich@suse.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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
all inboxes | Powered by JetHome®