|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] xen/events: Mark rebound IPI ports pending on resume
After a live migration or save/restore of a Linux HVM guest on Xen, the
guest might hang and the do_suspend() never completes. Then, one of two
patterns shows up: either one vCPU spins in csd_lock_wait() called from
xen_arch_resume() -> on_each_cpu(), or all vCPUs are idle with tasks
stuck in TASK_WAKING.
When a VM resumes (after HYPERVISOR_suspend() returns in the new
domain), IPI event channels are not yet rebound to the new domain. IPIs
sent in that window go to a port of the old domain and are lost. But in
this window, e.g., gnttab_resume() calls printk which might cause a
console flush, which in turn wakes up a worker on another CPU. If that
CPU does not share the LLC with the sender, ttwu_queue_wakelist() queues
the wakeup on its call_single_queue and sends an IPI, which is then also
lost.
An IPI is only sent when the call_single_queue of the target goes from
empty to non-empty. So, once the IPI for the first entry is lost, all
later entries, including wakeups and the cross-calls from
xen_arch_resume(), are queued without an IPI. On a native suspend this
does not happen, because the other CPUs are offline and their queues are
flushed when they go down. On Xen all CPUs stay online.
Fix this issue by marking each rebound IPI port pending in
restore_cpu_ipis(). Once the port is unmasked, every CPU takes one IPI
and runs whatever was queued for it.
Reported-by: Olivier Lambert <olivier.lambert@xxxxxxxxxx>
Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
drivers/xen/events/events_base.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index fd16d652c81f..f0431164b28e 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -2027,6 +2027,14 @@ static void restore_cpu_ipis(unsigned int cpu)
xen_irq_info_ipi_setup(info, cpu, evtchn, ipi);
/* The affinity mask is still valid */
bind_evtchn_to_cpu(info, cpu, false);
+
+ /*
+ * Mark the new port pending, so IPIs that arrived in the window
+ * between HYPERVISOR_suspend() and xen_irq_info_ipi_setup() are
+ * delivered to the new port.
+ */
+ if (!irqd_irq_disabled(irq_get_irq_data(irq)))
+ set_evtchn(evtchn);
}
}
--
2.53.0
--
Julian Vetter | Vates Hypervisor & Kernel Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |