diff options
| author | Jia Jia <physicalmtea@gmail.com> | 2026-09-19 16:39:33 +0800 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2026-11-02 09:07:01 -0500 |
| commit | cf0a5805d43236e308f14188f9737ddcf83fb53a (patch) | |
| tree | 0c677441b7e8d3c70ec16ae43f97b6f7571855ff /include | |
| parent | 434d2bc41bd0c0ac576d4d259bd9f2ab49071174 (diff) | |
vduse: avoid infinite loop when no affinity CPU is online
If all CPUs in vq->irq_affinity are offline, cpumask_next() walks to the
end of the mask, and the loop then resets the cursor to IRQ_UNBOUND and
restarts the scan. When VDUSE_VQ_INJECT_IRQ is issued, the intersection of
vq->irq_affinity and cpu_online_mask is empty, so the caller busy-loops in
kernel context on its current CPU (e.g. CPU2).
Replace the while loop in vduse_vq_update_effective_cpu() with
cpumask_next_and_wrap() to find the intersection of vq->irq_affinity and
cpu_online_mask in a single wrapped scan. If the intersection is empty, set
curr_cpu to IRQ_UNBOUND and let the existing unbound workqueue handle
injection, avoiding repeated rescans when all CPUs in the affinity are
offline. Use cpus_read_lock()/cpus_read_unlock() to keep the selected CPU
online.
Fixes: 28f6288eb63d ("vduse: Support set_vq_affinity callback")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260919083933.104437-1-physicalmtea@gmail.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
