Re: [PATCH 3.12 032/123] x86/xen: Support kexec/kdump in HVM guests by doing a soft reset

From: Luis Henriques
Date: Wed Oct 28 2015 - 11:26:54 EST


On Wed, Oct 28, 2015 at 02:50:49PM +0100, Jiri Slaby wrote:
...
> #include <linux/memblock.h>
> #include <linux/edd.h>
>
> +#ifdef CONFIG_KEXEC_CORE

As already suggested by David Vrabel, this should be CONFIG_KEXEC for
kernels <= 4.2, and not CONFIG_KEXEC_CORE.

Cheers,
--
Luís


> +#include <linux/kexec.h>
> +#endif
> +
> #include <xen/xen.h>
> #include <xen/events.h>
> #include <xen/interface/xen.h>
> @@ -1746,6 +1750,21 @@ static struct notifier_block xen_hvm_cpu_notifier = {
> .notifier_call = xen_hvm_cpu_notify,
> };
>
> +#ifdef CONFIG_KEXEC_CORE
> +static void xen_hvm_shutdown(void)
> +{
> + native_machine_shutdown();
> + if (kexec_in_progress)
> + xen_reboot(SHUTDOWN_soft_reset);
> +}
> +
> +static void xen_hvm_crash_shutdown(struct pt_regs *regs)
> +{
> + native_machine_crash_shutdown(regs);
> + xen_reboot(SHUTDOWN_soft_reset);
> +}
> +#endif
> +
> static void __init xen_hvm_guest_init(void)
> {
> init_hvm_pv_info();
> @@ -1762,6 +1781,10 @@ static void __init xen_hvm_guest_init(void)
> x86_init.irqs.intr_init = xen_init_IRQ;
> xen_hvm_init_time_ops();
> xen_hvm_init_mmu_ops();
> +#ifdef CONFIG_KEXEC_CORE
> + machine_ops.shutdown = xen_hvm_shutdown;
> + machine_ops.crash_shutdown = xen_hvm_crash_shutdown;
> +#endif
> }
>
> static uint32_t __init xen_hvm_platform(void)
> 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 {
> #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
> #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
> #define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */
> +/*
> + * Domain asked to perform 'soft reset' for it. The expected behavior is to
> + * reset internal Xen state for the domain returning it to the point where it
> + * was created but leaving the domain's memory contents and vCPU contexts
> + * intact. This will allow the domain to start over and set up all Xen specific
> + * interfaces again.
> + */
> +#define SHUTDOWN_soft_reset 5
>
> #endif /* __XEN_PUBLIC_SCHED_H__ */
> --
> 2.6.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/