qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] xen-pvdevice: Introduce a simplistic xen-pvdevice save state
@ 2018-03-13 23:14 Igor Druzhinin
  2018-03-27  9:42 ` Anthony PERARD
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Druzhinin @ 2018-03-13 23:14 UTC (permalink / raw)
  To: qemu-devel, xen-devel
  Cc: sstabellini, anthony.perard, paul.durrant, pbonzini, mst,
	Igor Druzhinin

This should help to avoid problems with accessing the device after
migration/resume without PV drivers by migrating its PCI configuration
space state. Without an explicitly defined state record it resets
every time a VM migrates which confuses the OS and makes every
access to xen-pvdevice MMIO region to fail. PV tools enable some
logic to save and restore PCI configuration state from within the VM
every time it migrates which basically hides the issue.

Older systems will acquire the new record when migrated which should
not change their state for worse.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
---
v2: add more concrete info
---
 hw/i386/xen/xen_pvdevice.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index f748823..a146f18 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -71,6 +71,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
+static const VMStateDescription vmstate_xen_pvdevice = {
+    .name = "xen-pvdevice",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_PCI_DEVICE(parent_obj, XenPVDevice),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
 {
     XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
@@ -120,6 +130,7 @@ static void xen_pv_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_SYSTEM_OTHER;
     dc->desc = "Xen PV Device";
     dc->props = xen_pv_props;
+    dc->vmsd = &vmstate_xen_pvdevice;
 }
 
 static const TypeInfo xen_pv_type_info = {
-- 
2.7.4

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

* Re: [Qemu-devel] [PATCH v2] xen-pvdevice: Introduce a simplistic xen-pvdevice save state
  2018-03-13 23:14 [Qemu-devel] [PATCH v2] xen-pvdevice: Introduce a simplistic xen-pvdevice save state Igor Druzhinin
@ 2018-03-27  9:42 ` Anthony PERARD
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony PERARD @ 2018-03-27  9:42 UTC (permalink / raw)
  To: Igor Druzhinin
  Cc: qemu-devel, xen-devel, sstabellini, paul.durrant, pbonzini, mst

On Tue, Mar 13, 2018 at 11:14:54PM +0000, Igor Druzhinin wrote:
> This should help to avoid problems with accessing the device after
> migration/resume without PV drivers by migrating its PCI configuration
> space state. Without an explicitly defined state record it resets
> every time a VM migrates which confuses the OS and makes every
> access to xen-pvdevice MMIO region to fail. PV tools enable some
> logic to save and restore PCI configuration state from within the VM
> every time it migrates which basically hides the issue.
> 
> Older systems will acquire the new record when migrated which should
> not change their state for worse.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> v2: add more concrete info
> ---
>  hw/i386/xen/xen_pvdevice.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,

-- 
Anthony PERARD

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

end of thread, other threads:[~2018-03-27  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-13 23:14 [Qemu-devel] [PATCH v2] xen-pvdevice: Introduce a simplistic xen-pvdevice save state Igor Druzhinin
2018-03-27  9:42 ` Anthony PERARD

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).