From de94da8a9855fb5010b479ad5c16e6b041dc00f1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 17 Oct 2025 16:17:55 +0200 Subject: [PATCH] 6.1-stable patches added patches: xen-events-update-virq_to_irq-on-migration.patch --- queue-6.1/series | 1 + ...ents-update-virq_to_irq-on-migration.patch | 64 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 queue-6.1/xen-events-update-virq_to_irq-on-migration.patch diff --git a/queue-6.1/series b/queue-6.1/series index fe1b0e1050..9b206e7076 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -165,3 +165,4 @@ fs-add-initramfs_options-to-set-initramfs-mount-opti.patch cramfs-verify-inode-mode-when-loading-from-disk.patch writeback-avoid-softlockup-when-switching-many-inode.patch writeback-avoid-excessively-long-inode-switching-tim.patch +xen-events-update-virq_to_irq-on-migration.patch diff --git a/queue-6.1/xen-events-update-virq_to_irq-on-migration.patch b/queue-6.1/xen-events-update-virq_to_irq-on-migration.patch new file mode 100644 index 0000000000..37176fa9b4 --- /dev/null +++ b/queue-6.1/xen-events-update-virq_to_irq-on-migration.patch @@ -0,0 +1,64 @@ +From stable+bounces-186326-greg=kroah.com@vger.kernel.org Fri Oct 17 15:41:25 2025 +From: Sasha Levin +Date: Fri, 17 Oct 2025 09:41:17 -0400 +Subject: xen/events: Update virq_to_irq on migration +To: stable@vger.kernel.org +Cc: Jason Andryuk , Juergen Gross , Sasha Levin +Message-ID: <20251017134117.3957210-1-sashal@kernel.org> + +From: Jason Andryuk + +[ Upstream commit 3fcc8e146935415d69ffabb5df40ecf50e106131 ] + +VIRQs come in 3 flavors, per-VPU, per-domain, and global, and the VIRQs +are tracked in per-cpu virq_to_irq arrays. + +Per-domain and global VIRQs must be bound on CPU 0, and +bind_virq_to_irq() sets the per_cpu virq_to_irq at registration time +Later, the interrupt can migrate, and info->cpu is updated. When +calling __unbind_from_irq(), the per-cpu virq_to_irq is cleared for a +different cpu. If bind_virq_to_irq() is called again with CPU 0, the +stale irq is returned. There won't be any irq_info for the irq, so +things break. + +Make xen_rebind_evtchn_to_cpu() update the per_cpu virq_to_irq mappings +to keep them update to date with the current cpu. This ensures the +correct virq_to_irq is cleared in __unbind_from_irq(). + +Fixes: e46cdb66c8fc ("xen: event channels") +Cc: stable@vger.kernel.org +Signed-off-by: Jason Andryuk +Reviewed-by: Juergen Gross +Signed-off-by: Juergen Gross +Message-ID: <20250828003604.8949-4-jason.andryuk@amd.com> +[ Adjust context ] +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/xen/events/events_base.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +--- a/drivers/xen/events/events_base.c ++++ b/drivers/xen/events/events_base.c +@@ -1807,9 +1807,20 @@ static int xen_rebind_evtchn_to_cpu(stru + * virq or IPI channel, which don't actually need to be rebound. Ignore + * it, but don't do the xenlinux-level rebind in that case. + */ +- if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0) ++ if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0) { ++ int old_cpu = info->cpu; ++ + bind_evtchn_to_cpu(evtchn, tcpu, false); + ++ if (info->type == IRQT_VIRQ) { ++ int virq = info->u.virq; ++ int irq = per_cpu(virq_to_irq, old_cpu)[virq]; ++ ++ per_cpu(virq_to_irq, old_cpu)[virq] = -1; ++ per_cpu(virq_to_irq, tcpu)[virq] = irq; ++ } ++ } ++ + do_unmask(info, EVT_MASK_REASON_TEMPORARY); + + return 0; -- 2.47.3