From: "Badole, Vishal" <vishal.badole@amd.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "tglx@kernel.org" <tglx@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"bp@alien8.de" <bp@alien8.de>,
"wangyang.guo@intel.com" <wangyang.guo@intel.com>,
"tianyou.li@intel.com" <tianyou.li@intel.com>,
"tim.c.chen@linux.intel.com" <tim.c.chen@linux.intel.com>,
"dan.liang@intel.com" <dan.liang@intel.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] lib/group_cpus: Snapshot cluster masks to keep grouping hotplug invariant
Date: Sun, 9 Aug 2026 22:41:42 +0530 [thread overview]
Message-ID: <fdec1131-7de8-426d-b2f3-9e6266e6d49c@amd.com> (raw)
In-Reply-To: <20260807133840.31a194a9cd04d4a2b6d817c1@linux-foundation.org>
On 8/8/2026 2:08 AM, Andrew Morton wrote:
> On Fri, 7 Aug 2026 13:06:12 +0530 Vishal Badole <Vishal.Badole@amd.com> wrote:
>
>> group_cpus_evenly() builds the managed-IRQ affinity spread used by
>> multi-queue devices such as NVMe. That spread is meant to be a property
>> of the static CPU topology: it walks cpu_present_mask and then
>> cpu_possible_mask so every hardware queue owns a fixed set of CPUs,
>> including CPUs that are offline at the time. A driver depends on that
>> partition staying stable across re-computation - the CPUs a queue is
>> given at probe must still describe the same queue after the device is
>> later reset and its affinity recomputed.
>>
>> On an AMD system that stability breaks across an s2idle cycle. With CPUs
>> 3-11 offlined and only CPUs 0-2 left online, the machine is suspended to
>> s2idle and resumed. The NVMe controller uses the simple-suspend quirk, so
>> resume fully re-initialises it and recomputes the affinity spread. The
>> system then hangs for roughly two minutes and stays sluggish afterwards,
>> the controller only making progress through its command-timeout poll:
>>
>> nvme nvme0: I/O tag 898 (3382) QID 9 timeout, completion polled
>> nvme nvme0: I/O tag 398 (618e) QID 11 timeout, completion polled
>>
>> QID 9 and QID 11 are the queues whose CPUs were offline when the spread
>> was recomputed. "completion polled" means the commands did finish in
>> hardware, but their interrupts were never delivered to a CPU that was
>> watching the queue, so nothing reaped them until the timeout fired.
>>
>> It happens because commit 89802ca36c96 ("lib/group_cpus: make group CPU
>> cluster aware") derives the cluster groups from topology_cluster_cpumask(),
>> which lists only the cluster siblings that are online when it is called.
>> The resulting partition therefore depends on the transient online mask
>> rather than on the topology alone. Recomputed on resume while the non-boot
>> CPUs are still offline, it no longer matches the boot-time partition, and a
>> queue is left with an affinity that does not cover the CPU it is meant to
>> serve once that CPU comes back online. The dependence is on the online
>> mask, not on any AMD-specific behaviour, so the same stall is reproducible
>> on Intel platforms as well.
>
> Thanks for the careful description of what is wrong. It helps.
>
> And things do sounds very wrong. Could people@intel please prioritize
> their review and testing of this fix?
>
>> Make the cluster grouping depend on the complete cluster topology rather
>> than on whichever CPUs happen to be online. Snapshot the cluster masks
>> once while every CPU is online and reuse that view for every later spread.
>> A fully-online view is the complete cluster membership, so the partition
>> derived from it is identical no matter which CPUs are online when the
>> controller is reset, which is exactly the invariance the callers already
>> assume.
>>
>> ...
>>
>> + /*
>> + * Only a fully-online view is the complete cluster membership; if any
>
> minor: the above sentence is hard to understand.
>
Thanks for the feedback, I’ll simplify that sentence to make it clearer
in the next patch revision.
>> + if (!data_race(cpumask_equal(cpu_possible_mask, cpu_online_mask)))
>
> AI review suggests using cpu_present_mask here:
>
> https://sashiko.dev/#/patchset/20260807073612.3711269-1-Vishal.Badole@amd.com
>
Good catch, I'll switch to cpu_present_mask in the next patch revision.
next prev parent reply other threads:[~2026-08-09 17:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 7:36 Vishal Badole
2026-08-07 20:38 ` Andrew Morton
2026-08-09 17:11 ` Badole, Vishal [this message]
2026-08-20 5:36 ` Guo, Wangyang
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=fdec1131-7de8-426d-b2f3-9e6266e6d49c@amd.com \
--to=vishal.badole@amd.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=tianyou.li@intel.com \
--cc=tim.c.chen@linux.intel.com \
--cc=wangyang.guo@intel.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
all inboxes | Powered by JetHome®