Thread (6 messages) 6 messages, 3 authors, 29d ago

Re: [PATCH v3] Drivers: hv: Avoid infinite retry loop in init_vp_index()

From: sashiko-bot@kernel.org
Date: 2026-08-27 19:56:29

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch attempts to fix an infinite retry loop while relying on a flawed assumption, leaving a kernel hang scenario intact under CPU hotplug.
--

commit 357edd9f97074f4d93f3160be466a7aa7d20c7bb
Author: Waiman Long [off-list ref]

Drivers: hv: Avoid infinite retry loop in init_vp_index()

This commit attempts to fix an infinite retry loop in init_vp_index() by
skipping NUMA nodes that do not contain any housekeeping CPUs. It aims to
ensure that a NUMA node with housekeeping CPUs is eventually found.

Link: https://sashiko.dev/#/message/20260422030903.E1BFCC2BCB0%40smtp.kernel.org [1]
quoted hunk ↗ jump to hunk
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index a044fd3b3c4e7..2e611d2de6d10 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -780,14 +781,16 @@ static void init_vp_index(struct vmbus_channel *channel)
 				next_numa_node_id = 0;
 				continue;
 			}
-			if (cpumask_empty(cpumask_of_node(numa_node)))
+			node_mask = cpumask_of_node(numa_node);
+			if (cpumask_empty(node_mask) ||
+			    !cpumask_intersects(node_mask, hk_mask))
 				continue;
 			break;
 		}
[Severity: High]
This is a pre-existing issue, but the patch attempts to fix an infinite retry
loop while relying on an assumption that leaves a kernel hang scenario intact
under CPU hotplug.

Could this while (true) loop in init_vp_index() iterate endlessly without
sleeping if an administrator dynamically hot-offlines all managed IRQ
housekeeping CPUs?

Since housekeeping_cpumask(HK_TYPE_MANAGED_IRQ) tracks all possible
housekeeping CPUs, the early abort check at the start of the function will see
hk_mask as non-empty even if those CPUs are currently offline.

However, cpumask_of_node() only returns online CPUs. If the remaining managed
IRQ housekeeping CPUs are offlined, cpumask_intersects(node_mask, hk_mask)
will evaluate to false for every NUMA node, causing this loop to spin
indefinitely while holding channel_mutex and cpus_read_lock().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827193750.662623-1-longman@redhat.com?part=1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help