From: sashiko-bot@kernel.org
To: "Yury Norov" <ynorov@nvidia.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH 5/6] virt: steal_governor: Warn on unexpected preferred mask states
Date: Sun, 01 Nov 2026 19:36:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-192624@kernel.org> (raw)
In-Reply-To: <20261101192203.6979-6-ynorov@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] virt: steal_governor: unreachable WARN_ON() in decrease_preferred_cpus()
--
commit 735c9f0cd33ee22cf920d749e3d1bde33a6cf851
Author: Yury Norov <ynorov@nvidia.com>
virt: steal_governor: Warn on unexpected preferred mask states
This commit adds WARN_ON() checks in decrease_preferred_cpus() and
steal_governor_loop() to warn if cpu_preferred_mask enters an unexpected
state.
> diff --git a/drivers/virt/steal_governor.c b/drivers/virt/steal_governor.c
> index bc3936e69eed9..5679b7ddc078f 100644
> --- a/drivers/virt/steal_governor.c
> +++ b/drivers/virt/steal_governor.c
> @@ -145,7 +145,9 @@ static void decrease_preferred_cpus(void)
> /* Always leave first housekeeping core as preferred. */
> first_hk_core = topology_sibling_cpumask(cpu);
> cpu = cpumask_last(cpu_preferred_mask);
> - if (cpu >= nr_cpu_ids)
> +
> + /* We can't end up with no preferred CPUs under normal conditions. */
> + if (WARN_ON(cpu >= nr_cpu_ids))
> return;
[Severity: Low]
Can this WARN_ON() in decrease_preferred_cpus() ever be reached?
Just above this check in drivers/virt/steal_governor.c,
decrease_preferred_cpus() already checks whether the intersection of the
housekeeping cpumask and cpu_preferred_mask is empty while holding
cpus_read_lock() and cpu_preferred_mutex:
cpu = cpumask_first_and(housekeeping_cpumask(HK_TYPE_KERNEL_NOISE),
cpu_preferred_mask);
if (cpu >= nr_cpu_ids)
return;
If cpu_preferred_mask is empty on entry, cpumask_first_and() returns
nr_cpu_ids and decrease_preferred_cpus() returns early before reaching
cpumask_last(cpu_preferred_mask). Otherwise, at least one bit in
cpu_preferred_mask is set, so cpumask_last(cpu_preferred_mask) is guaranteed
to be less than nr_cpu_ids.
Should this check be removed, or should the warning be placed on the earlier
check if an empty preferred mask is what this is meant to catch?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261101192203.6979-1-ynorov@nvidia.com?part=5
next prev parent reply other threads:[~2026-11-01 19:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 19:21 [PATCH 0/6] sched: Expose writable interface for preferred CPUs mask Yury Norov
2026-11-01 19:21 ` [PATCH 1/6] sched: decouple PREFERRED_CPU from PARAVIRT in Kconfig.preempt Yury Norov
2026-11-01 19:28 ` sashiko-bot
2026-11-02 10:16 ` Ilya Leoshkevich
2026-11-02 11:00 ` Peter Zijlstra
2026-11-02 11:34 ` Ilya Leoshkevich
2026-11-02 13:00 ` Shrikanth Hegde
2026-11-02 13:41 ` Ilya Leoshkevich
2026-11-02 14:57 ` Shrikanth Hegde
2026-11-01 19:21 ` [PATCH 2/6] cpumask: Add reset_preferred_cpumask() helper Yury Norov
2026-11-01 19:28 ` sashiko-bot
2026-11-01 19:21 ` [PATCH 3/6] sched: Restore preferred CPUs when hotplug removes the last one Yury Norov
2026-11-01 19:32 ` sashiko-bot
2026-11-01 19:22 ` [PATCH 4/6] sched: serialize preferred cpumask update better Yury Norov
2026-11-01 19:32 ` sashiko-bot
2026-11-01 19:22 ` [PATCH 5/6] virt: steal_governor: Warn on unexpected preferred mask states Yury Norov
2026-11-01 19:36 ` sashiko-bot [this message]
2026-11-01 19:22 ` [PATCH 6/6] cpu: Add per-CPU preferred sysfs control Yury Norov
2026-11-01 19:40 ` sashiko-bot
2026-11-02 8:47 ` [PATCH 0/6] sched: Expose writable interface for preferred CPUs mask Peter Zijlstra
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=sashiko-outbox-192624@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=ynorov@nvidia.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