From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932397AbbIYOAA (ORCPT ); Fri, 25 Sep 2015 10:00:00 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:31393 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932181AbbIYN77 (ORCPT ); Fri, 25 Sep 2015 09:59:59 -0400 Date: Fri, 25 Sep 2015 09:59:37 -0400 From: Konrad Rzeszutek Wilk To: Vitaly Kuznetsov Cc: xen-devel@lists.xenproject.org, x86@kernel.org, Boris Ostrovsky , David Vrabel , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] xen/pvhvm: add soft reset on kexec/kdump support Message-ID: <20150925135937.GJ20966@l.oracle.com> References: <1443175192-4828-1-git-send-email-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443175192-4828-1-git-send-email-vkuznets@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2015 at 11:59:52AM +0200, Vitaly Kuznetsov wrote: > 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 Reviewed-by: Konrad Rzeszutek Wilk with s/pvhvm/hvm/ to match with the rest of the file. Thanks. > --- > arch/x86/xen/enlighten.c | 23 +++++++++++++++++++++++ > include/xen/interface/sched.h | 8 ++++++++ > 2 files changed, 31 insertions(+) > > diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c > index 30d12af..e4be074 100644 > --- a/arch/x86/xen/enlighten.c > +++ b/arch/x86/xen/enlighten.c > @@ -33,6 +33,10 @@ > #include > #include > > +#ifdef CONFIG_KEXEC_CORE > +#include > +#endif > + > #include > #include > #include > @@ -1807,6 +1811,21 @@ static struct notifier_block xen_hvm_cpu_notifier = { > .notifier_call = xen_hvm_cpu_notify, > }; > > +#ifdef CONFIG_KEXEC_CORE > +static void xen_pvhvm_kexec_shutdown(void) > +{ > + native_machine_shutdown(); > + if (kexec_in_progress) > + xen_reboot(SHUTDOWN_soft_reset); > +} > + > +static void xen_pvhvm_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) > { > if (xen_pv_domain()) > @@ -1826,6 +1845,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_pvhvm_kexec_shutdown; > + machine_ops.crash_shutdown = xen_pvhvm_crash_shutdown; > +#endif > } > #endif > > diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h > index 9ce0839..f184909 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.4.3 >