pvpanic: Separate pvpanic from machine type
v2 cover pvpanic: Separate pvpanic from machine type
Creating the pvpanic device as part of the machine type has the potential to trigger guest OS, guest firmware and driver bugs. The potential of such was originally viewed as minimal. However, since releasing 1.5 with pvpanic as part
of the builtin machine type, several issues were observed in the field:
- Some Windows versions triggered 'New Hardware Wizard' and an unidentified device appeared in Device Manager.
- Issue reported off list: on Linux >= 3.10
the pvpanic driver breaks the reset on crash option:
VM stops instead of being reset.
pvpanic device also changes monitor command behaviour in some cases, such silent incompatible changes aren't expected by management tools:
- Monitor command requires 'cont' before 'system_reset' in order to restart the VM after kernel panic/BSOD
Note that libvirt is the main user and libvirt people indicated their preference to creating device with -device pvpanic rather than a built-in one that can't be removed.
These issues were raised at last KVM call. The agreement reached there was that we were a bit too rash to make the device
a builtin, and that for 1.6 we should drop the pvpanic device from the default machine type, instead teach management tools to add it by default using -device pvpanic.
It's not clear whether changing 1.5 behaviour at this point is a sane thing, so this patchset doesn't touch 1.5 machine type.
This patch series reworks the patchset from Hu Tao (don't create pvpanic device by default) addressing comments and modifying behaviour according to what was discussed on the call.
Please review and consider for 1.6.
A related discussion can be followed at
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00036.html.
This is a continuation of patches sent by Hu Tao:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00124.html
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.html
Changes from v1 (by Hu Tao):
- Keep pvpanic device enabled by default for 1.5 for backport compatibility
- Addressed Andreas Färber review (removed bus type)
- Small changes to be posible to enable pvpanic both from command line and from machine_init
- Added pvpanic to MISC category
Marcel Apfelbaum (2):
hw/misc: don't create pvpanic device by default
hw/misc: make pvpanic known to user
hw/i386/pc_piix.c | 9 ++++----- hw/i386/pc_q35.c | 7 ++++--- hw/misc/pvpanic.c | 25 ++++++++++--------------- 3 files changed, 18 insertions(+), 23 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/2 hw/misc: don't create pvpanic device by default
This patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00124.html
No need to hard-code pvpanic as part of the machine.
It can be added with "-device pvpanic" from command line (The next patch). Anyway, for backport compatibility it is still part of 1.5 machine.
---
Changes from v1:
- Keep pvpanic device enabled by default for 1.5
for backport compatibility
hw/i386/pc_piix.c | 9 ++++----- hw/i386/pc_q35.c | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-)
hw/i386/pc_piix.c +4 -5
@@ -56,7 +56,7 @@ static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };static const int ide_iobase2[MAX_IDE_BUS ] = {0x3f6 ,0x376 };static const int ide_irq[MAX_IDE_BUS ] = {14 ,15 }; -static bool has_pvpanic = true; +static bool has_pvpanic;static bool has_pci_info = true;/* PC hardware initialisation */
@@ -252,14 +252,15 @@ static void pc_init_pci(QEMUMachineInitArgs *args)static void pc_init_pci_1_5 (QEMUMachineInitArgs *args) { has_pci_info = false; + has_pvpanic = true;pc_init_pci (args); }static void pc_init_pci_1_4 (QEMUMachineInitArgs *args) { - has_pvpanic = false;x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE ); -pc_init_pci_1_5 (args); + has_pci_info = false; +pc_init_pci (args); }static void pc_init_pci_1_3 (QEMUMachineInitArgs *args)
@@ -290,7 +291,6 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)const char *kernel_cmdline = args->kernel_cmdline;const char *initrd_filename = args->initrd_filename;const char *boot_device = args->boot_device; - has_pvpanic = false; has_pci_info = false;disable_kvm_pv_eoi ();enable_compat_apic_id_mode ();
@@ -309,7 +309,6 @@ static void pc_init_isa(QEMUMachineInitArgs *args)const char *kernel_cmdline = args->kernel_cmdline;const char *initrd_filename = args->initrd_filename;const char *boot_device = args->boot_device; - has_pvpanic = false; has_pci_info = false;if (cpu_model ==NULL ) cpu_model ="486" ;
hw/i386/pc_q35.c +4 -3
@@ -46,7 +46,7 @@/* ICH9 AHCI has 6 ports */ #define MAX_SATA_PORTS 6 -static bool has_pvpanic = true; +static bool has_pvpanic;static bool has_pci_info = true;/* PC hardware initialisation */
@@ -220,14 +220,15 @@ static void pc_q35_init(QEMUMachineInitArgs *args)static void pc_q35_init_1_5 (QEMUMachineInitArgs *args) { has_pci_info = false; + has_pvpanic = true;pc_q35_init (args); }static void pc_q35_init_1_4 (QEMUMachineInitArgs *args) { - has_pvpanic = false;x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE ); -pc_q35_init_1_5 (args); + has_pci_info = false; +pc_q35_init (args); }static QEMUMachine pc_q35_machine_v1_6 = {
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH for-1.6 V2 1/2] hw/misc: don't create pvpanic device by default
Quoted 9 lines · Marcel Apfelbaum
This patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00124.htmlNo need to hard-code pvpanic as part of the machine.
It can be added with "-device pvpanic" from command line (The next patch). Anyway, for backport compatibility it is still part of 1.5 machine.Signed-off-by Marcel Apfelbaum <[email protected]>
Re: [Qemu-devel] [PATCH for-1.6 V2 1/2] hw/misc: don't create pvpanic device by default
In reply to Marcel ApfelbaumAm 11.08.2013 17:10, schrieb Marcel Apfelbaum:
Quoted 9 lines
This patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00124.htmlNo need to hard-code pvpanic as part of the machine.
It can be added with "-device pvpanic" from command line (The next patch). Anyway, for backport compatibility it is still part of 1.5 machine.Signed-off-by Marcel Apfelbaum <[email protected]>
Quoted 8 lines
---
Changes from v1:
- Keep pvpanic device enabled by default for 1.5
for backport compatibilityhw/i386/pc_piix.c | 9 ++++----- hw/i386/pc_q35.c | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-)
Anthony, note that my pending CPU pull adds a line to the two _1_4 functions, so that they trivially conflict.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH for-1.6 V2 1/2] hw/misc: don't create pvpanic device by default
In reply to Marcel Apfelbaum*** Mismerged! ***
Quoted 32 lines · Marcel Apfelbaum
This patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00124.htmlNo need to hard-code pvpanic as part of the machine.
It can be added with "-device pvpanic" from command line (The next patch). Anyway, for backport compatibility it is still part of 1.5 machine.Signed-off-by Marcel Apfelbaum <[email protected]>---
Changes from v1:
- Keep pvpanic device enabled by default for 1.5
for backport compatibilityhw/i386/pc_piix.c | 9 ++++----- hw/i386/pc_q35.c | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-)hw/i386/pc_piix.c +1
-1@@ -56,7 +56,7 @@ static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };static const int ide_iobase2[MAX_IDE_BUS ] = {0x3f6 ,0x376 };static const int ide_irq[MAX_IDE_BUS ] = {14 ,15 }; -static bool has_pvpanic = true; +static bool has_pvpanic;static bool has_pci_info = true;/* PC hardware initialisation */
hw/i386/pc_piix.c static void pc_init_pci(QEMUMachineInitArgs *args) · line 258
Quoted 7 lines
hw/i386/pc_piix.c +1
-0@@ -252,14 +252,15 @@ static void pc_init_pci(QEMUMachineInitArgs *args)static void pc_init_pci_1_5 (QEMUMachineInitArgs *args) { has_pci_info = false; + has_pvpanic = true;pc_init_pci (args); }
This hunk got applied to pc_init_pci_1_6() instead of pc_init_pci_1_5().
Quoted 40 lines
hw/i386/pc_piix.c +2
-4static void pc_init_pci_1_4 (QEMUMachineInitArgs *args) { - has_pvpanic = false;x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE ); -pc_init_pci_1_5 (args); + has_pci_info = false; +pc_init_pci (args); }static void pc_init_pci_1_3 (QEMUMachineInitArgs *args)@@ -290,7 +291,6 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)const char *kernel_cmdline = args->kernel_cmdline;const char *initrd_filename = args->initrd_filename;const char *boot_device = args->boot_device; - has_pvpanic = false; has_pci_info = false;disable_kvm_pv_eoi ();enable_compat_apic_id_mode ();@@ -309,7 +309,6 @@ static void pc_init_isa(QEMUMachineInitArgs *args)const char *kernel_cmdline = args->kernel_cmdline;const char *initrd_filename = args->initrd_filename;const char *boot_device = args->boot_device; - has_pvpanic = false; has_pci_info = false;if (cpu_model ==NULL ) cpu_model ="486" ;hw/i386/pc_q35.c +1
-1@@ -46,7 +46,7 @@/* ICH9 AHCI has 6 ports */ #define MAX_SATA_PORTS 6 -static bool has_pvpanic = true; +static bool has_pvpanic;static bool has_pci_info = true;/* PC hardware initialisation */
hw/i386/pc_q35.c static void pc_q35_init(QEMUMachineInitArgs *args) · line 226
Quoted 7 lines
hw/i386/pc_q35.c +1
-0@@ -220,14 +220,15 @@ static void pc_q35_init(QEMUMachineInitArgs *args)static void pc_q35_init_1_5 (QEMUMachineInitArgs *args) { has_pci_info = false; + has_pvpanic = true;pc_q35_init (args); }
This hunk got applied to pc_q35_init_1_6() instead of pc_q35_init_1_5().
Quoted 10 lines
hw/i386/pc_q35.c +2
-2static void pc_q35_init_1_4 (QEMUMachineInitArgs *args) { - has_pvpanic = false;x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE ); -pc_q35_init_1_5 (args); + has_pci_info = false; +pc_q35_init (args); }static QEMUMachine pc_q35_machine_v1_6 = {
PATCH v2 2/2 hw/misc: make pvpanic known to user
In reply to Marcel ApfelbaumThis patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.html
The pvpanic device may be enabled now with "-device pvpanic" from command line.
---
Changes from V1:
- Addressed Andreas Färber review (removed bus type)
- Small changes to be posible to enable pvpanic both from command line and from machine_init
- Added pvpanic to MISC category
hw/misc/pvpanic.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
hw/misc/pvpanic.c +10 -15
@@ -97,29 +97,24 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) {ISADevice *d =ISA_DEVICE (dev);PVPanicState *s =ISA_PVPANIC_DEVICE (dev); +FWCfgState *fw_cfg =fw_cfg_find (); +uint16_t *pvpanic_port; -isa_register_ioport (d, &s->io, s->ioport); -} +if (!fw_cfg) { +return ; + } -static void pvpanic_fw_cfg (ISADevice *dev,FWCfgState *fw_cfg) -{ -PVPanicState *s =ISA_PVPANIC_DEVICE (dev); -uint16_t *pvpanic_port =g_malloc (sizeof (*pvpanic_port)); + pvpanic_port =g_malloc (sizeof (*pvpanic_port)); *pvpanic_port =cpu_to_le16 (s->ioport); -fw_cfg_add_file (fw_cfg,"etc/pvpanic-port" , pvpanic_port,sizeof (*pvpanic_port)); + +isa_register_ioport (d, &s->io, s->ioport); }void pvpanic_init (ISABus *bus) { -ISADevice *dev; -FWCfgState *fw_cfg =fw_cfg_find (); -if (!fw_cfg) { -return ; - } - dev =isa_create_simple (bus,TYPE_ISA_PVPANIC_DEVICE ); -pvpanic_fw_cfg (dev, fw_cfg); +isa_create_simple (bus,TYPE_ISA_PVPANIC_DEVICE ); }static Property pvpanic_isa_properties[] = {
@@ -132,8 +127,8 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = pvpanic_isa_realizefn; - dc->no_user =1 ; dc->props = pvpanic_isa_properties; +set_bit (DEVICE_CATEGORY_MISC , dc->categories); }static TypeInfo pvpanic_isa_info = {
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH for-1.6 V2 2/2] hw/misc: make pvpanic known to user
Quoted 7 lines · Marcel Apfelbaum
This patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.htmlThe pvpanic device may be enabled now with "-device pvpanic" from command line.
Signed-off-by Marcel Apfelbaum <[email protected]>
Quoted 21 lines · Marcel Apfelbaum
Creating the pvpanic device as part of the machine type has the potential to trigger guest OS, guest firmware and driver bugs. The potential of such was originally viewed as minimal. However, since releasing 1.5 with pvpanic as part
of the builtin machine type, several issues were observed in the field:
- Some Windows versions triggered 'New Hardware Wizard' and an unidentified device appeared in Device Manager.
- Issue reported off list: on Linux >= 3.10
the pvpanic driver breaks the reset on crash option:
VM stops instead of being reset.pvpanic device also changes monitor command behaviour in some cases, such silent incompatible changes aren't expected by management tools:
- Monitor command requires 'cont' before 'system_reset' in order to restart the VM after kernel panic/BSODNote that libvirt is the main user and libvirt people indicated their preference to creating device with -device pvpanic rather than a built-in one that can't be removed.
Quoted 7 lines
These issues were raised at last KVM call. The agreement reached there was that we were a bit too rash to make the device
a builtin, and that for 1.6 we should drop the pvpanic device from the default machine type, instead teach management tools to add it by default using -device pvpanic.
It's not clear whether changing 1.5 behaviour at this point is a sane thing, so this patchset doesn't touch 1.5 machine type.
Thanks for doing this; it makes sense to get this in for 1.6. From the libvirt point of view:
Series: Reviewed-by: Eric Blake <[email protected]>
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 30 lines · Eric Blake
Quoted 21 lines · Marcel Apfelbaum
Creating the pvpanic device as part of the machine type has the potential to trigger guest OS, guest firmware and driver bugs. The potential of such was originally viewed as minimal. However, since releasing 1.5 with pvpanic as part
of the builtin machine type, several issues were observed in the field:
- Some Windows versions triggered 'New Hardware Wizard' and an unidentified device appeared in Device Manager.
- Issue reported off list: on Linux >= 3.10
the pvpanic driver breaks the reset on crash option:
VM stops instead of being reset.pvpanic device also changes monitor command behaviour in some cases, such silent incompatible changes aren't expected by management tools:
- Monitor command requires 'cont' before 'system_reset' in order to restart the VM after kernel panic/BSODNote that libvirt is the main user and libvirt people indicated their preference to creating device with -device pvpanic rather than a built-in one that can't be removed.
Quoted 7 lines
These issues were raised at last KVM call. The agreement reached there was that we were a bit too rash to make the device
a builtin, and that for 1.6 we should drop the pvpanic device from the default machine type, instead teach management tools to add it by default using -device pvpanic.
It's not clear whether changing 1.5 behaviour at this point is a sane thing, so this patchset doesn't touch 1.5 machine type.
Quoted 2 lines
Thanks for doing this; it makes sense to get this in for 1.6. From the libvirt point of view:
Eric, my pleasure!
And I really think that using "-device pvpanic" is the right thing to to do. Marcel
Quoted 3 lines
Series: Reviewed-by: Eric Blake <[email protected]>
How about adding a flag that tells QEMU whether to pause or reboot the guest after the panic?
We cannot assume that we always have a management layer that takes care of this.
One example is Microsoft's WHQL that deliberately generates a BSOD, and then examines the dump files.
Ronen.
Quoted 59 lines · Marcel Apfelbaum
Creating the pvpanic device as part of the machine type has the potential to trigger guest OS, guest firmware and driver bugs. The potential of such was originally viewed as minimal. However, since releasing 1.5 with pvpanic as part
of the builtin machine type, several issues were observed in the field:
- Some Windows versions triggered 'New Hardware Wizard' and an unidentified device appeared in Device Manager.
- Issue reported off list: on Linux >= 3.10
the pvpanic driver breaks the reset on crash option:
VM stops instead of being reset.pvpanic device also changes monitor command behaviour in some cases, such silent incompatible changes aren't expected by management tools:
- Monitor command requires 'cont' before 'system_reset' in order to restart the VM after kernel panic/BSODNote that libvirt is the main user and libvirt people indicated their preference to creating device with -device pvpanic rather than a built-in one that can't be removed.
These issues were raised at last KVM call. The agreement reached there was that we were a bit too rash to make the device
a builtin, and that for 1.6 we should drop the pvpanic device from the default machine type, instead teach management tools to add it by default using -device pvpanic.
It's not clear whether changing 1.5 behaviour at this point is a sane thing, so this patchset doesn't touch 1.5 machine type.This patch series reworks the patchset from Hu Tao (don't create pvpanic device by default) addressing comments and modifying behaviour according to what was discussed on the call.
Please review and consider for 1.6.A related discussion can be followed at
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00036.html.This is a continuation of patches sent by Hu Tao:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00124.html
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.htmlChanges from v1 (by Hu Tao):
- Keep pvpanic device enabled by default for 1.5 for backport compatibility
- Addressed Andreas Färber review (removed bus type)
- Small changes to be posible to enable pvpanic both from command line and frommachine_init
- Added pvpanic to MISC categoryMarcel Apfelbaum (2):
hw/misc: don't create pvpanic device by default hw/misc: make pvpanic known to userhw/i386/pc_piix.c | 9 ++++----- hw/i386/pc_q35.c | 7 ++++--- hw/misc/pvpanic.c | 25 ++++++++++--------------- 3 files changed, 18 insertions(+), 23 deletions(-)
Quoted 6 lines · Ronen Hod
How about adding a flag that tells QEMU whether to pause or reboot the guest after the panic?
We cannot assume that we always have a management layer that takes care of this.
One example is Microsoft's WHQL that deliberately generates a BSOD, and then examines the dump files.
After this patch the pvpanic is not part of the global devices anymore so just don't enable it if you want to reboot on BSOD.
In my opinion "reboot after panic" equals "run without pvpanic device" Marcel
Quoted 64 lines
Ronen.
Quoted 59 lines · Marcel Apfelbaum
Creating the pvpanic device as part of the machine type has the potential to trigger guest OS, guest firmware and driver bugs. The potential of such was originally viewed as minimal. However, since releasing 1.5 with pvpanic as part
of the builtin machine type, several issues were observed in the field:
- Some Windows versions triggered 'New Hardware Wizard' and an unidentified device appeared in Device Manager.
- Issue reported off list: on Linux >= 3.10
the pvpanic driver breaks the reset on crash option:
VM stops instead of being reset.pvpanic device also changes monitor command behaviour in some cases, such silent incompatible changes aren't expected by management tools:
- Monitor command requires 'cont' before 'system_reset' in order to restart the VM after kernel panic/BSODNote that libvirt is the main user and libvirt people indicated their preference to creating device with -device pvpanic rather than a built-in one that can't be removed.
These issues were raised at last KVM call. The agreement reached there was that we were a bit too rash to make the device
a builtin, and that for 1.6 we should drop the pvpanic device from the default machine type, instead teach management tools to add it by default using -device pvpanic.
It's not clear whether changing 1.5 behaviour at this point is a sane thing, so this patchset doesn't touch 1.5 machine type.This patch series reworks the patchset from Hu Tao (don't create pvpanic device by default) addressing comments and modifying behaviour according to what was discussed on the call.
Please review and consider for 1.6.A related discussion can be followed at
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00036.html.This is a continuation of patches sent by Hu Tao:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00124.html
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.htmlChanges from v1 (by Hu Tao):
- Keep pvpanic device enabled by default for 1.5 for backport compatibility
- Addressed Andreas Färber review (removed bus type)
- Small changes to be posible to enable pvpanic both from command line and frommachine_init
- Added pvpanic to MISC categoryMarcel Apfelbaum (2):
hw/misc: don't create pvpanic device by default hw/misc: make pvpanic known to userhw/i386/pc_piix.c | 9 ++++----- hw/i386/pc_q35.c | 7 ++++--- hw/misc/pvpanic.c | 25 ++++++++++--------------- 3 files changed, 18 insertions(+), 23 deletions(-)
Il 21/08/2013 10:03, Marcel Apfelbaum ha scritto:
Quoted 10 lines · Ronen Hod
Quoted 6 lines
How about adding a flag that tells QEMU whether to pause or reboot the guest after the panic?
We cannot assume that we always have a management layer that takes care of this.
One example is Microsoft's WHQL that deliberately generates a BSOD, and then examines the dump files.After this patch the pvpanic is not part of the global devices anymore so just don't enable it if you want to reboot on BSOD.
In my opinion "reboot after panic" equals "run without pvpanic device"
This is not entirely possible, since "reboot after panic" is a guest setting while "run without pvpanic device" is a host setting (that the guest administrator may not even have access to: Ronen's case is a good example of this, because the "administrator" there is the WHQL harness).
However, I think this is a driver problem. The driver should just probe the "reboot after panic" setting and not issue the outb to the pvpanic port.
Paolo
Quoted 17 lines · Paolo Bonzini
Il 21/08/2013 10:03, Marcel Apfelbaum ha scritto:
Quoted 10 lines · Ronen Hod
Quoted 6 lines
How about adding a flag that tells QEMU whether to pause or reboot the guest after the panic?
We cannot assume that we always have a management layer that takes care of this.
One example is Microsoft's WHQL that deliberately generates a BSOD, and then examines the dump files.After this patch the pvpanic is not part of the global devices anymore so just don't enable it if you want to reboot on BSOD.
In my opinion "reboot after panic" equals "run without pvpanic device"This is not entirely possible, since "reboot after panic" is a guest setting while "run without pvpanic device" is a host setting (that the guest administrator may not even have access to: Ronen's case is a good example of this, because the "administrator" there is the WHQL harness).
Quoted 4 lines
However, I think this is a driver problem. The driver should just probe the "reboot after panic" setting and not issue the outb to the pvpanic port.
Paolo
This might or might not be possible on different OS-es. What exactly is gained by doing vmstop on outb of pvpanic? We want a notification about the panic but
adding yet another way to halt seems kind of useless. Why not let VM continue? If it wants to stop it can always call halt.
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Paolo Bonzini
Il 21/08/2013 10:03, Marcel Apfelbaum ha scritto:
Quoted 10 lines · Ronen Hod
Quoted 6 lines
How about adding a flag that tells QEMU whether to pause or reboot the guest after the panic?
We cannot assume that we always have a management layer that takes care of this.
One example is Microsoft's WHQL that deliberately generates a BSOD, and then examines the dump files.After this patch the pvpanic is not part of the global devices anymore so just don't enable it if you want to reboot on BSOD.
In my opinion "reboot after panic" equals "run without pvpanic device"This is not entirely possible, since "reboot after panic" is a guest setting while "run without pvpanic device" is a host setting (that the guest administrator may not even have access to: Ronen's case is a good example of this, because the "administrator" there is the WHQL harness).
Quoted 7 lines
Quoted 4 lines
However, I think this is a driver problem. The driver should just probe the "reboot after panic" setting and not issue the outb to the pvpanic port.
Paolo
This might or might not be possible on different OS-es. What exactly is gained by doing vmstop on outb of pvpanic?
This gives management apps (libvirt) a chance to take care of the situation. It can reboot, poweroff, or dump guest.
Quoted 5 lines
We want a notification about the panic but adding yet another way to halt seems kind of useless. Why not let VM continue? If it wants to stop it can always call halt.
Il 21/08/2013 11:42, Michael S. Tsirkin ha scritto:
Quoted 18 lines · Paolo Bonzini
Quoted 17 lines
Il 21/08/2013 10:03, Marcel Apfelbaum ha scritto:
Quoted 10 lines · Ronen Hod
Quoted 6 lines
How about adding a flag that tells QEMU whether to pause or reboot the guest after the panic?
We cannot assume that we always have a management layer that takes care of this.
One example is Microsoft's WHQL that deliberately generates a BSOD, and then examines the dump files.After this patch the pvpanic is not part of the global devices anymore so just don't enable it if you want to reboot on BSOD.
In my opinion "reboot after panic" equals "run without pvpanic device"This is not entirely possible, since "reboot after panic" is a guest setting while "run without pvpanic device" is a host setting (that the guest administrator may not even have access to: Ronen's case is a good example of this, because the "administrator" there is the WHQL harness).
Quoted 5 lines
Quoted 2 lines
However, I think this is a driver problem. The driver should just probe the "reboot after panic" setting and not issue the outb to the pvpanic port.
This might or might not be possible on different OS-es. What exactly is gained by doing vmstop on outb of pvpanic?
Because events are edge-triggered, and can be lost if management dies at the wrong time, each event that QEMU sends must go together with a way for management to poll the state.
For panic, the way to poll the state is "info status". This matches what we do for watchdogs, for example. Management can issue "info status" to learn of the panic state, even if it happens while management itself is not running:
libvirtd QEMU guest
---------------------------------------------------------------
stops
<- pvpanic outb
emits panic event
(no one receives it)
starts
info status ->
<- PANICKED
Because there is only one running state, this means the VM has to be stopped.
But actually, fixing the driver would only be required if pvpanic were mandatory.
Now that pvpanic is optional, "reboot after panic" can also be fixed in libvirt. Let's remove the "must reset after panic" limitation; then, libvirt can simply do itself a "continue" after receiving the panicked event (or after seeing that the guest is in panicked state). The panicked event will never be sent unless management explicitly requests it (with "-device pvpanic"), so backwards compatibility is preserved.
The pause will still happen if management was stopped, but that's a fair compromise IMHO.
It will mean also that "reboot after panic" will be broken in 1.6.0, unfortunately. Perhaps we can have a quick 1.6.1 release with this patch:
vl.c +1 -2
@@ -685,8 +685,7 @@ int runstate_is_running(void)bool runstate_needs_reset (void ) {return runstate_check (RUN_STATE_INTERNAL_ERROR ) || -runstate_check (RUN_STATE_SHUTDOWN ) || -runstate_check (RUN_STATE_GUEST_PANICKED ); +runstate_check (RUN_STATE_SHUTDOWN ); }StatusInfo *qmp_query_status (Error **errp)
By the way, this means two things:
- I am now sold on the idea that explicitly enabling of pvpanic is the right thing to do;
- on the other hand this is the proof that the change was not fully understood, and rushing it in 1.6 was the wrong thing to do.
Paolo
Quoted 4 lines
We want a notification about the panic but adding yet another way to halt seems kind of useless. Why not let VM continue? If it wants to stop it can always call halt.
Quoted 82 lines · Paolo Bonzini
Il 21/08/2013 11:42, Michael S. Tsirkin ha scritto:
Quoted 18 lines · Paolo Bonzini
Quoted 17 lines
Il 21/08/2013 10:03, Marcel Apfelbaum ha scritto:
Quoted 10 lines · Ronen Hod
Quoted 6 lines
How about adding a flag that tells QEMU whether to pause or reboot the guest after the panic?
We cannot assume that we always have a management layer that takes care of this.
One example is Microsoft's WHQL that deliberately generates a BSOD, and then examines the dump files.After this patch the pvpanic is not part of the global devices anymore so just don't enable it if you want to reboot on BSOD.
In my opinion "reboot after panic" equals "run without pvpanic device"This is not entirely possible, since "reboot after panic" is a guest setting while "run without pvpanic device" is a host setting (that the guest administrator may not even have access to: Ronen's case is a good example of this, because the "administrator" there is the WHQL harness).
Quoted 5 lines
Quoted 2 lines
However, I think this is a driver problem. The driver should just probe the "reboot after panic" setting and not issue the outb to the pvpanic port.
This might or might not be possible on different OS-es. What exactly is gained by doing vmstop on outb of pvpanic?
Because events are edge-triggered, and can be lost if management dies at the wrong time, each event that QEMU sends must go together with a way for management to poll the state.
For panic, the way to poll the state is "info status". This matches what we do for watchdogs, for example. Management can issue "info status" to learn of the panic state, even if it happens while management itself is not running:
libvirtd QEMU guest
---------------------------------------------------------------
stops
<- pvpanic outb
emits panic event
(no one receives it)
starts
info status ->
<- PANICKEDBecause there is only one running state, this means the VM has to be stopped.
But actually, fixing the driver would only be required if pvpanic were mandatory.
Now that pvpanic is optional, "reboot after panic" can also be fixed in libvirt. Let's remove the "must reset after panic" limitation; then, libvirt can simply do itself a "continue" after receiving the panicked event (or after seeing that the guest is in panicked state). The panicked event will never be sent unless management explicitly requests it (with "-device pvpanic"), so backwards compatibility is preserved.
The pause will still happen if management was stopped, but that's a fair compromise IMHO.
It will mean also that "reboot after panic" will be broken in 1.6.0, unfortunately. Perhaps we can have a quick 1.6.1 release with this patch:
vl.c +1
-2@@ -685,8 +685,7 @@ int runstate_is_running(void)bool runstate_needs_reset (void ) {return runstate_check (RUN_STATE_INTERNAL_ERROR ) || -runstate_check (RUN_STATE_SHUTDOWN ) || -runstate_check (RUN_STATE_GUEST_PANICKED ); +runstate_check (RUN_STATE_SHUTDOWN ); }StatusInfo *qmp_query_status (Error **errp)By the way, this means two things:
Quoted 7 lines
- I am now sold on the idea that explicitly enabling of pvpanic is the right thing to do;
- on the other hand this is the proof that the change was not fully understood, and rushing it in 1.6 was the wrong thing to do.
Paolo
You mean 1.5.
pvpanic was a builtin in 1.5 and that was clearly the wrong thing to do. We fixed that in 1.6, thankfully.
Quoted 5 lines
Quoted 4 lines
We want a notification about the panic but adding yet another way to halt seems kind of useless. Why not let VM continue? If it wants to stop it can always call halt.
Il 21/08/2013 12:16, Michael S. Tsirkin ha scritto:
Quoted 6 lines
Quoted 6 lines
By the way, this means two things:
- I am now sold on the idea that explicitly enabling of pvpanic is the right thing to do;
Quoted 6 lines
Quoted 2 lines
- on the other hand this is the proof that the change was not fully understood, and rushing it in 1.6 was the wrong thing to do.
You mean 1.5.
pvpanic was a builtin in 1.5 and that was clearly the wrong thing to do. We fixed that in 1.6, thankfully.
No, even taking it out in 1.6 is a mistake. It happened too close to the release.
Now we have 1.5 which has it, 1.6 which doesn't have it and requires reset after panic, 1.7 which doesn't have it and in all likelihood will not require reset after panic.
Paolo
Anthony Liguori
AppliedApplied. Thanks.
Regards,
Anthony Liguori