stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "x86/xen: Support kexec/kdump in HVM guests by doing a soft reset" has been added to the 4.2-stable tree
@ 2015-10-13 22:59 gregkh
  2015-10-14 15:20 ` David Vrabel
  0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2015-10-13 22:59 UTC (permalink / raw)
  To: vkuznets, david.vrabel, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    x86/xen: Support kexec/kdump in HVM guests by doing a soft reset

to the 4.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 0b34a166f291d255755be46e43ed5497cdd194f2 Mon Sep 17 00:00:00 2001
From: Vitaly Kuznetsov <vkuznets@redhat.com>
Date: Fri, 25 Sep 2015 11:59:52 +0200
Subject: x86/xen: Support kexec/kdump in HVM guests by doing a soft reset

From: Vitaly Kuznetsov <vkuznets@redhat.com>

commit 0b34a166f291d255755be46e43ed5497cdd194f2 upstream.

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>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/xen/enlighten.c      |   23 +++++++++++++++++++++++
 include/xen/interface/sched.h |    8 ++++++++
 2 files changed, 31 insertions(+)

--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -33,6 +33,10 @@
 #include <linux/memblock.h>
 #include <linux/edd.h>
 
+#ifdef CONFIG_KEXEC_CORE
+#include <linux/kexec.h>
+#endif
+
 #include <xen/xen.h>
 #include <xen/events.h>
 #include <xen/interface/xen.h>
@@ -1800,6 +1804,21 @@ static struct notifier_block xen_hvm_cpu
 	.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)
 {
 	if (xen_pv_domain())
@@ -1819,6 +1838,10 @@ static void __init xen_hvm_guest_init(vo
 	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
 }
 #endif
 
--- 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__ */


Patches currently in stable-queue which might be from vkuznets@redhat.com are

queue-4.2/x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "x86/xen: Support kexec/kdump in HVM guests by doing a soft reset" has been added to the 4.2-stable tree
  2015-10-13 22:59 Patch "x86/xen: Support kexec/kdump in HVM guests by doing a soft reset" has been added to the 4.2-stable tree gregkh
@ 2015-10-14 15:20 ` David Vrabel
  2015-10-14 15:24   ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: David Vrabel @ 2015-10-14 15:20 UTC (permalink / raw)
  To: gregkh, vkuznets; +Cc: stable, stable-commits

On 13/10/15 23:59, gregkh@linuxfoundation.org wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
> 
> to the 4.2-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>      x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch
> and it can be found in the queue-4.2 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.
> 
> 
> From 0b34a166f291d255755be46e43ed5497cdd194f2 Mon Sep 17 00:00:00 2001
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
> Date: Fri, 25 Sep 2015 11:59:52 +0200
> Subject: x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
> 
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
> 
> commit 0b34a166f291d255755be46e43ed5497cdd194f2 upstream.
> 
> 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.
[...]
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -33,6 +33,10 @@
>  #include <linux/memblock.h>
>  #include <linux/edd.h>
>  
> +#ifdef CONFIG_KEXEC_CORE
> +#include <linux/kexec.h>
> +#endif
> +
>  #include <xen/xen.h>
>  #include <xen/events.h>
>  #include <xen/interface/xen.h>
> @@ -1800,6 +1804,21 @@ static struct notifier_block xen_hvm_cpu
>  	.notifier_call	= xen_hvm_cpu_notify,
>  };
>  
> +#ifdef CONFIG_KEXEC_CORE

This should be CONFIG_KEXEC in 4.2 and earlier, CONFIG_EXEC_CORE was
introduced in 4.3.

Do you want an updated patch?

David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "x86/xen: Support kexec/kdump in HVM guests by doing a soft reset" has been added to the 4.2-stable tree
  2015-10-14 15:20 ` David Vrabel
@ 2015-10-14 15:24   ` Greg KH
  2015-10-26 18:08     ` Luis Henriques
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2015-10-14 15:24 UTC (permalink / raw)
  To: David Vrabel; +Cc: vkuznets, stable, stable-commits

On Wed, Oct 14, 2015 at 04:20:16PM +0100, David Vrabel wrote:
> On 13/10/15 23:59, gregkh@linuxfoundation.org wrote:
> > 
> > This is a note to let you know that I've just added the patch titled
> > 
> >     x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
> > 
> > to the 4.2-stable tree which can be found at:
> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > 
> > The filename of the patch is:
> >      x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch
> > and it can be found in the queue-4.2 subdirectory.
> > 
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <stable@vger.kernel.org> know about it.
> > 
> > 
> > From 0b34a166f291d255755be46e43ed5497cdd194f2 Mon Sep 17 00:00:00 2001
> > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > Date: Fri, 25 Sep 2015 11:59:52 +0200
> > Subject: x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
> > 
> > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > 
> > commit 0b34a166f291d255755be46e43ed5497cdd194f2 upstream.
> > 
> > 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.
> [...]
> > --- a/arch/x86/xen/enlighten.c
> > +++ b/arch/x86/xen/enlighten.c
> > @@ -33,6 +33,10 @@
> >  #include <linux/memblock.h>
> >  #include <linux/edd.h>
> >  
> > +#ifdef CONFIG_KEXEC_CORE
> > +#include <linux/kexec.h>
> > +#endif
> > +
> >  #include <xen/xen.h>
> >  #include <xen/events.h>
> >  #include <xen/interface/xen.h>
> > @@ -1800,6 +1804,21 @@ static struct notifier_block xen_hvm_cpu
> >  	.notifier_call	= xen_hvm_cpu_notify,
> >  };
> >  
> > +#ifdef CONFIG_KEXEC_CORE
> 
> This should be CONFIG_KEXEC in 4.2 and earlier, CONFIG_EXEC_CORE was
> introduced in 4.3.
> 
> Do you want an updated patch?

An updated patch would be great, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "x86/xen: Support kexec/kdump in HVM guests by doing a soft reset" has been added to the 4.2-stable tree
  2015-10-14 15:24   ` Greg KH
@ 2015-10-26 18:08     ` Luis Henriques
  2015-11-06 19:09       ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Henriques @ 2015-10-26 18:08 UTC (permalink / raw)
  To: Greg KH; +Cc: David Vrabel, vkuznets, stable, stable-commits

On Wed, Oct 14, 2015 at 08:24:50AM -0700, Greg Kroah-Hartman wrote:
> On Wed, Oct 14, 2015 at 04:20:16PM +0100, David Vrabel wrote:
> > On 13/10/15 23:59, gregkh@linuxfoundation.org wrote:
> > > 
> > > This is a note to let you know that I've just added the patch titled
> > > 
> > >     x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
> > > 
> > > to the 4.2-stable tree which can be found at:
> > >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > > 
> > > The filename of the patch is:
> > >      x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch
> > > and it can be found in the queue-4.2 subdirectory.
> > > 
> > > If you, or anyone else, feels it should not be added to the stable tree,
> > > please let <stable@vger.kernel.org> know about it.
> > > 
> > > 
> > > From 0b34a166f291d255755be46e43ed5497cdd194f2 Mon Sep 17 00:00:00 2001
> > > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > > Date: Fri, 25 Sep 2015 11:59:52 +0200
> > > Subject: x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
> > > 
> > > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > > 
> > > commit 0b34a166f291d255755be46e43ed5497cdd194f2 upstream.
> > > 
> > > 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.
> > [...]
> > > --- a/arch/x86/xen/enlighten.c
> > > +++ b/arch/x86/xen/enlighten.c
> > > @@ -33,6 +33,10 @@
> > >  #include <linux/memblock.h>
> > >  #include <linux/edd.h>
> > >  
> > > +#ifdef CONFIG_KEXEC_CORE
> > > +#include <linux/kexec.h>
> > > +#endif
> > > +
> > >  #include <xen/xen.h>
> > >  #include <xen/events.h>
> > >  #include <xen/interface/xen.h>
> > > @@ -1800,6 +1804,21 @@ static struct notifier_block xen_hvm_cpu
> > >  	.notifier_call	= xen_hvm_cpu_notify,
> > >  };
> > >  
> > > +#ifdef CONFIG_KEXEC_CORE
> > 
> > This should be CONFIG_KEXEC in 4.2 and earlier, CONFIG_EXEC_CORE was
> > introduced in 4.3.
> > 
> > Do you want an updated patch?
> 
> An updated patch would be great, thanks.

I'm queuing this patch changing CONFIG_KEXEC_CORE by CONFIG_KEXEC, as
suggested.  Thanks!

Greg, looks like several stable kernels have been released with this
bogus patch.

Cheers,
--
Lu�s

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch "x86/xen: Support kexec/kdump in HVM guests by doing a soft reset" has been added to the 4.2-stable tree
  2015-10-26 18:08     ` Luis Henriques
@ 2015-11-06 19:09       ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2015-11-06 19:09 UTC (permalink / raw)
  To: Luis Henriques; +Cc: David Vrabel, vkuznets, stable, stable-commits

On Mon, Oct 26, 2015 at 06:08:34PM +0000, Luis Henriques wrote:
> On Wed, Oct 14, 2015 at 08:24:50AM -0700, Greg Kroah-Hartman wrote:
> > On Wed, Oct 14, 2015 at 04:20:16PM +0100, David Vrabel wrote:
> > > On 13/10/15 23:59, gregkh@linuxfoundation.org wrote:
> > > > 
> > > > This is a note to let you know that I've just added the patch titled
> > > > 
> > > >     x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
> > > > 
> > > > to the 4.2-stable tree which can be found at:
> > > >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > > > 
> > > > The filename of the patch is:
> > > >      x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch
> > > > and it can be found in the queue-4.2 subdirectory.
> > > > 
> > > > If you, or anyone else, feels it should not be added to the stable tree,
> > > > please let <stable@vger.kernel.org> know about it.
> > > > 
> > > > 
> > > > From 0b34a166f291d255755be46e43ed5497cdd194f2 Mon Sep 17 00:00:00 2001
> > > > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > > > Date: Fri, 25 Sep 2015 11:59:52 +0200
> > > > Subject: x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
> > > > 
> > > > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > > > 
> > > > commit 0b34a166f291d255755be46e43ed5497cdd194f2 upstream.
> > > > 
> > > > 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.
> > > [...]
> > > > --- a/arch/x86/xen/enlighten.c
> > > > +++ b/arch/x86/xen/enlighten.c
> > > > @@ -33,6 +33,10 @@
> > > >  #include <linux/memblock.h>
> > > >  #include <linux/edd.h>
> > > >  
> > > > +#ifdef CONFIG_KEXEC_CORE
> > > > +#include <linux/kexec.h>
> > > > +#endif
> > > > +
> > > >  #include <xen/xen.h>
> > > >  #include <xen/events.h>
> > > >  #include <xen/interface/xen.h>
> > > > @@ -1800,6 +1804,21 @@ static struct notifier_block xen_hvm_cpu
> > > >  	.notifier_call	= xen_hvm_cpu_notify,
> > > >  };
> > > >  
> > > > +#ifdef CONFIG_KEXEC_CORE
> > > 
> > > This should be CONFIG_KEXEC in 4.2 and earlier, CONFIG_EXEC_CORE was
> > > introduced in 4.3.
> > > 
> > > Do you want an updated patch?
> > 
> > An updated patch would be great, thanks.
> 
> I'm queuing this patch changing CONFIG_KEXEC_CORE by CONFIG_KEXEC, as
> suggested.  Thanks!
> 
> Greg, looks like several stable kernels have been released with this
> bogus patch.

Thanks, now fixed up.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-06 19:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 22:59 Patch "x86/xen: Support kexec/kdump in HVM guests by doing a soft reset" has been added to the 4.2-stable tree gregkh
2015-10-14 15:20 ` David Vrabel
2015-10-14 15:24   ` Greg KH
2015-10-26 18:08     ` Luis Henriques
2015-11-06 19:09       ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).