aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2015-09-25 05:59:52 -0400
committerDavid Vrabel <david.vrabel@citrix.com>2015-09-28 09:48:52 -0400
commit0b34a166f291d255755be46e43ed5497cdd194f2 (patch)
tree5b7a2348190f566b74b3de41af90240887773529
parent2ecf91b6d8b0ee8ef38aa7ea2a0fe0cd57b6ca50 (diff)
x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
Currently there is a number of issues preventing PVHVM Xen guests from doing successful kexec/kdump: - Bound event channels. - Registered vcpu_info. - PIRQ/emuirq mappings. - shared_info frame after XENMAPSPACE_shared_info operation. - Active grant mappings. Basically, newly booted kernel stumbles upon already set up Xen interfaces and there is no way to reestablish them. In Xen-4.7 a new feature called 'soft reset' is coming. A guest performing kexec/kdump operation is supposed to call SCHEDOP_shutdown hypercall with SHUTDOWN_soft_reset reason before jumping to new kernel. Hypervisor (with some help from toolstack) will do full domain cleanup (but keeping its memory and vCPU contexts intact) returning the guest to the state it had when it was first booted and thus allowing it to start over. Doing SHUTDOWN_soft_reset on Xen hypervisors which don't support it is probably OK as by default all unknown shutdown reasons cause domain destroy with a message in toolstack log: 'Unknown shutdown reason code 5. Destroying domain.' which gives a clue to what the problem is and eliminates false expectations. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Cc: <stable@vger.kernel.org> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
-rw-r--r--arch/x86/xen/enlighten.c23
-rw-r--r--include/xen/interface/sched.h8
2 files changed, 31 insertions, 0 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 1f1dbd2949a4..993b7a71386d 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -33,6 +33,10 @@
33#include <linux/memblock.h> 33#include <linux/memblock.h>
34#include <linux/edd.h> 34#include <linux/edd.h>
35 35
36#ifdef CONFIG_KEXEC_CORE
37#include <linux/kexec.h>
38#endif
39
36#include <xen/xen.h> 40#include <xen/xen.h>
37#include <xen/events.h> 41#include <xen/events.h>
38#include <xen/interface/xen.h> 42#include <xen/interface/xen.h>
@@ -1808,6 +1812,21 @@ static struct notifier_block xen_hvm_cpu_notifier = {
1808 .notifier_call = xen_hvm_cpu_notify, 1812 .notifier_call = xen_hvm_cpu_notify,
1809}; 1813};
1810 1814
1815#ifdef CONFIG_KEXEC_CORE
1816static void xen_hvm_shutdown(void)
1817{
1818 native_machine_shutdown();
1819 if (kexec_in_progress)
1820 xen_reboot(SHUTDOWN_soft_reset);
1821}
1822
1823static void xen_hvm_crash_shutdown(struct pt_regs *regs)
1824{
1825 native_machine_crash_shutdown(regs);
1826 xen_reboot(SHUTDOWN_soft_reset);
1827}
1828#endif
1829
1811static void __init xen_hvm_guest_init(void) 1830static void __init xen_hvm_guest_init(void)
1812{ 1831{
1813 if (xen_pv_domain()) 1832 if (xen_pv_domain())
@@ -1827,6 +1846,10 @@ static void __init xen_hvm_guest_init(void)
1827 x86_init.irqs.intr_init = xen_init_IRQ; 1846 x86_init.irqs.intr_init = xen_init_IRQ;
1828 xen_hvm_init_time_ops(); 1847 xen_hvm_init_time_ops();
1829 xen_hvm_init_mmu_ops(); 1848 xen_hvm_init_mmu_ops();
1849#ifdef CONFIG_KEXEC_CORE
1850 machine_ops.shutdown = xen_hvm_shutdown;
1851 machine_ops.crash_shutdown = xen_hvm_crash_shutdown;
1852#endif
1830} 1853}
1831#endif 1854#endif
1832 1855
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index 9ce083960a25..f18490985fc8 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -107,5 +107,13 @@ struct sched_watchdog {
107#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ 107#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
108#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ 108#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
109#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */ 109#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */
110/*
111 * Domain asked to perform 'soft reset' for it. The expected behavior is to
112 * reset internal Xen state for the domain returning it to the point where it
113 * was created but leaving the domain's memory contents and vCPU contexts
114 * intact. This will allow the domain to start over and set up all Xen specific
115 * interfaces again.
116 */
117#define SHUTDOWN_soft_reset 5
110 118
111#endif /* __XEN_PUBLIC_SCHED_H__ */ 119#endif /* __XEN_PUBLIC_SCHED_H__ */