From: Yury Norov <yury.norov@gmail.com>
To: kernel test robot <lkp@intel.com>, linux-kernel@vger.kernel.org
Cc: kbuild-all@lists.01.org, Vivek Goyal <vgoyal@redhat.com>,
Yinghai Lu <yinghai@kernel.org>,
"H. Peter Anvin" <hpa@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Andrew Morton <akpm@linux-foundation.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E . McKenney" <paulmck@kernel.org>,
Vlastimil Babka <vbabka@suse.cz>,
Dmitry Vyukov <dvyukov@google.com>,
Valentin Schneider <vschneid@redhat.com>,
Sander Vanheule <sander@svanheule.net>,
Alexey Klimov <klimov.linux@gmail.com>,
Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH 4/4] lib/cpumask: add FORCE_NR_CPUS config option
Date: Fri, 2 Sep 2022 10:31:20 -0700 [thread overview]
Message-ID: <YxI96NfjexPr2XqN@yury-laptop> (raw)
In-Reply-To: <Yw57ABzUuW7Fic9w@yury-laptop>
On Tue, Aug 30, 2022 at 02:05:09PM -0700, Yury Norov wrote:
> + Vivek Goyal <vgoyal@redhat.com>
> + Yinghai Lu <yinghai@kernel.org>
> + H. Peter Anvin <hpa@linux.intel.com>
>
> On Wed, Aug 31, 2022 at 02:33:41AM +0800, kernel test robot wrote:
> > Hi Yury,
> >
> > I love your patch! Perhaps something to improve:
> >
> > [auto build test WARNING on tip/x86/core]
> > [also build test WARNING on linus/master v6.0-rc3 next-20220830]
> > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > And when submitting patch, we suggest to use '--base' as documented in
> > https://git-scm.com/docs/git-format-patch#_base_tree_information]
> >
> > url: https://github.com/intel-lab-lkp/linux/commits/Yury-Norov/cpumask-cleanup-nr_cpu_ids-vs-nr_cpumask_bits-mess/20220830-010755
> > base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git bc12b70f7d216b36bd87701349374a13e486f8eb
> > config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220831/202208310215.C2IzssKr-lkp@intel.com/config)
> > compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> >
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > smatch warnings:
> > arch/x86/kernel/apic/apic.c:2437 generic_processor_info() warn: always true condition '(num_processors >= (1) - 1) => (0-u32max >= 0)'
>
> This is the code that woke up the smatch:
> /*
> * If boot cpu has not been detected yet, then only allow upto
> * nr_cpu_ids - 1 processors and keep one slot free for boot cpu
> */
> if (!boot_cpu_detected && num_processors >= nr_cpu_ids - 1 &&
> apicid != boot_cpu_physical_apicid) {
> int thiscpu = max + disabled_cpus - 1;
>
> pr_warn("APIC: NR_CPUS/possible_cpus limit of %i almost"
> " reached. Keeping one slot for boot cpu."
> " Processor %d/0x%x ignored.\n", max, thiscpu, apicid);
>
> disabled_cpus++;
> return -ENODEV;
> }
>
> It has been added in a patch 14cb6dcf0a023f597 ("x86, boot: Wait for
> boot cpu to show up if nr_cpus limit is about to hit")
>
> My patch adds an option FORCE_NR_CPUS that makes nr_cpu_ids a compile-time
> defined.
>
> Hence, the num_processors >= nr_cpus - 1,
> may become: num_processors >= 0, if NR_CPUS == 1.
>
> So the plain straightforward fix would be:
>
> if (!boot_cpu_detected &&
> #if (NR_CPUS > 1)
> num_processors >= nr_cpu_ids - 1 &&
> #endif
> apicid != boot_cpu_physical_apicid) { ... }
>
> However, I have a feeling that all the logic above is not needed at
> all on UP machines. If that's true, the '#if NR_CPUS > 1' should
> protect the whole condition, or even bigger piece of the
> generic_processor_info().
As Dave Hansen said:
I think it's a reasonable warning, but it's also not something we need
to hack around. We can surely only land in here with
boot_cpu_detected==true if NR_CPUS==1, so the rest of the expression is
moot.
I don't think it's worth adding the #ifdef.
So, leaving things as they are.
If no other comments, moving the series into bitmap-for-next.
Thanks,
Yury
prev parent reply other threads:[~2022-09-02 17:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-29 16:57 [PATCH 0/4] cpumask: cleanup nr_cpu_ids vs nr_cpumask_bits mess Yury Norov
2022-08-29 16:57 ` [PATCH 1/4] smp: add set_nr_cpu_ids() Yury Norov
2022-08-29 16:57 ` [PATCH 2/4] lib/cpumask: delete misleading comment Yury Norov
2022-08-29 16:57 ` [PATCH 3/4] lib/cpumask: deprecate nr_cpumask_bits Yury Norov
2022-08-29 16:57 ` [PATCH 4/4] lib/cpumask: add FORCE_NR_CPUS config option Yury Norov
2022-08-29 17:02 ` Andy Shevchenko
[not found] ` <202208310215.C2IzssKr-lkp@intel.com>
2022-08-30 21:02 ` Yury Norov
2022-09-02 17:31 ` Yury Norov [this message]
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=YxI96NfjexPr2XqN@yury-laptop \
--to=yury.norov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dvyukov@google.com \
--cc=ebiggers@google.com \
--cc=hpa@linux.intel.com \
--cc=kbuild-all@lists.01.org \
--cc=klimov.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=lkp@intel.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=sander@svanheule.net \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
--cc=vgoyal@redhat.com \
--cc=vschneid@redhat.com \
--cc=yinghai@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®