diff mbox

[0/2] libxl: fix soft reset for PVHv2 guests

Message ID 20170320180311.5091-1-vkuznets@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vitaly Kuznetsov March 20, 2017, 6:03 p.m. UTC
Hi,

I'm trying to make kexec/kdump work for PVHv2 guests too. PVHv2 guests are
almost HVM guests so no major changes to the soft reset procedures are
required. A few issues, however, arose during testing.

Linux also requires some changes to boot after kexec. As PVH guests boot
like normal HVM guests after kexec we need to detect their 'PVH-ness'
somehow here's a hack which utilizes XEN_IOPORT_MAGIC:


With the hack I was able to do kdump on a PVHv2 guest. I'll start a separate
mail thread to discuss how we should do it right.

Vitaly Kuznetsov (2):
  libxl: don't try to rename dm save file for PVH
  libxl: preserve console tty across soft reset

 tools/libxl/libxl_console.c  |  5 ++++-
 tools/libxl/libxl_create.c   | 24 +++++++++++++++++-------
 tools/libxl/libxl_internal.h |  1 +
 3 files changed, 22 insertions(+), 8 deletions(-)

Comments

Wei Liu March 22, 2017, 11:30 a.m. UTC | #1
On Mon, Mar 20, 2017 at 07:03:09PM +0100, Vitaly Kuznetsov wrote:
> Vitaly Kuznetsov (2):
>   libxl: don't try to rename dm save file for PVH

I've pushed this patch.

>   libxl: preserve console tty across soft reset
> 

I will wait for v2 for this one.

>  tools/libxl/libxl_console.c  |  5 ++++-
>  tools/libxl/libxl_create.c   | 24 +++++++++++++++++-------
>  tools/libxl/libxl_internal.h |  1 +
>  3 files changed, 22 insertions(+), 8 deletions(-)
> 
> -- 
> 2.9.3
>
Vitaly Kuznetsov March 22, 2017, 12:06 p.m. UTC | #2
Wei Liu <wei.liu2@citrix.com> writes:

> On Mon, Mar 20, 2017 at 07:03:09PM +0100, Vitaly Kuznetsov wrote:
>> Vitaly Kuznetsov (2):
>>   libxl: don't try to rename dm save file for PVH
>
> I've pushed this patch.
>
>>   libxl: preserve console tty across soft reset
>> 
>
> I will wait for v2 for this one.
>

Sure, thanks! I also plan to replace other occurances of raw xs_read()
in do_domain_soft_reset() with libxl__xs_read_* to be consistent. I'll
test and send these patches soon.
diff mbox

Patch

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index ec1d5c4..b9f3fdf 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -51,6 +51,7 @@ 
 #include <xen/hvm.h>
 #include <xen/hvc-console.h>
 #include <xen/acpi.h>
+#include <xen/platform_pci.h>
 
 #include <asm/paravirt.h>
 #include <asm/apic.h>
@@ -1765,6 +1766,19 @@  void __init xen_prepare_pvh(void)
 
        x86_init.oem.arch_setup = xen_pvh_arch_setup;
 }
+
+static void xen_detect_pvh(void) {
+       short magic;
+
+       if (xen_pvh)
+               return;
+
+       magic = inw(XEN_IOPORT_MAGIC);
+       if (magic != XEN_IOPORT_MAGIC_VAL) {
+               xen_pvh = 1;
+               xen_pvh_arch_setup();
+       }
+}
 #endif
 
 void __ref xen_hvm_init_shared_info(void)
@@ -1912,6 +1926,9 @@  static void __init xen_hvm_guest_init(void)
 
        init_hvm_pv_info();
 
+       /* Detect PVH booting after kexec */
+       xen_detect_pvh();
+
        xen_hvm_init_shared_info();
 
        xen_panic_handler_init();