From: Andrew Jones <ajones@ventanamicro.com>
To: Yury Norov <yury.norov@gmail.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>, linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/cpuinfo: prevent warning when reading /proc/cpuinfo
Date: Fri, 14 Oct 2022 17:36:49 +0200 [thread overview]
Message-ID: <20221014153649.6yu7foo5j24s6pcf@kamzik> (raw)
In-Reply-To: <CAAH8bW8Uvb-GzoZiPVEeNGQL-y1cF90sGs99_PRetmcpisF81Q@mail.gmail.com>
On Fri, Oct 14, 2022 at 08:06:41AM -0700, Yury Norov wrote:
> On Fri, Oct 14, 2022 at 7:26 AM Alexander Gordeev
> <agordeev@linux.ibm.com> wrote:
> >
> > Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has
> > started issuing warnings when reading /proc/cpuinfo and config
> > DEBUG_PER_CPU_MAPS is enabled. Avoid calling cpumask_next() with
> > the cpu index equal to nr_cpu_ids - 1 and ensure no warning is
> > generated.
> >
> > Link: https://lore.kernel.org/r/20221012081905.1800640-1-ajones@ventanamicro.com
> > Reported-by: Andrew Jones <ajones@ventanamicro.com>
> > Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
> > ---
> > arch/s390/kernel/processor.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
> > index a194611ba88c..908a0be900ea 100644
> > --- a/arch/s390/kernel/processor.c
> > +++ b/arch/s390/kernel/processor.c
> > @@ -334,6 +334,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
> >
> > static inline void *c_update(loff_t *pos)
> > {
> > + if (*pos >= nr_cpu_ids)
> > + return NULL;
> > if (*pos)
> > *pos = cpumask_next(*pos - 1, cpu_online_mask);
> > else
>
> This silences the warning entirely. If you don't need it, I'd suggest
> using find_next_bit()
> instead. But from the discussion to similar patch, I think you need to
> allow nr_cpu_ids
> only:
> + if (*pos == nr_cpu_ids)
> + return NULL;
Yes, and I'll post my v3's with this change for x86 and riscv now.
Thanks,
drew
prev parent reply other threads:[~2022-10-14 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 14:26 [PATCH] s390/cpuinfo: prevent warning when reading /proc/cpuinfo Alexander Gordeev
2022-10-14 15:06 ` Yury Norov
2022-10-14 15:36 ` Andrew Jones [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=20221014153649.6yu7foo5j24s6pcf@kamzik \
--to=ajones@ventanamicro.com \
--cc=agordeev@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=yury.norov@gmail.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