Skip to contentSkip to conversation

PCI Device Subtree Change from Traditional to Upstream

DISCUSSION Kevin Stange 5 participants 18 messages Dec 20, 2017 – Apr 8, 2019

lore
Share & tools
lore
#0 lore raw

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Signature · 11 lines
Kevin Stange
Chief Technology Officer
Steadfast | Managed Infrastructure, Datacenter and Cloud Services
800 S Wells, Suite 190 | Chicago, IL 60607
312.602.2689 X203 | Fax: 312.602.2688
[email protected] | www.steadfast.net

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 16 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 8 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Paul,

Any idea on this?

Thanks,
-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
In reply to Kevin Stange
Quoted 16 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 8 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Hi Kevin,

I've got a patch to QEMU that seems to do the trick:

From: Anthony PERARD <[email protected]>
Subject: [PATCH] xen-platform: Hardcode PCI slot to 3

---
 hw/i386/pc_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
index 5e47528993..93e3a9a916 100644
@@ -405,7 +405,7 @@ static void pc_xen_hvm_init(MachineState *machine)
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
-        pci_create_simple(bus, -1, "xen-platform");
+        pci_create_simple(bus, PCI_DEVFN(3, 0), "xen-platform");
     }
 }
 #endif

The same thing could be done by libxl, by providing specific command line options to qemu. (I think that could even be done via a different config file for the guest.)

Regards,

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw
Quoted 53 lines · Anthony PERARD
Quoted 16 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 8 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Hi Kevin,

I've got a patch to QEMU that seems to do the trick:

From: Anthony PERARD <[email protected]>
Subject: [PATCH] xen-platform: Hardcode PCI slot to 3

---
 hw/i386/pc_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
index 5e47528993..93e3a9a916 100644
@@ -405,7 +405,7 @@ static void pc_xen_hvm_init(MachineState *machine)
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
-        pci_create_simple(bus, -1, "xen-platform");
+        pci_create_simple(bus, PCI_DEVFN(3, 0), "xen-platform");
     }
 }
 #endif
Quoted 3 lines

The same thing could be done by libxl, by providing specific command line options to qemu. (I think that could even be done via a different config file for the guest.)

This patch doesn't seem to work for me. It seems like the device model process is exiting immediately, but I haven't been able to find any information as to what is going wrong. I tested with Xen 4.6.6 and the QEMU packaged with that release. Should I try it on a different version of Xen and QEMU?

Signature · 11 lines
Kevin Stange
Chief Technology Officer
Steadfast | Managed Infrastructure, Datacenter and Cloud Services
800 S Wells, Suite 190 | Chicago, IL 60607
312.602.2689 X203 | Fax: 312.602.2688
[email protected] | www.steadfast.net

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw
Quoted 54 lines · Kevin Stange
Quoted 53 lines · Anthony PERARD
Quoted 16 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 8 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Hi Kevin,

I've got a patch to QEMU that seems to do the trick:

From: Anthony PERARD <[email protected]>
Subject: [PATCH] xen-platform: Hardcode PCI slot to 3

---
 hw/i386/pc_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
index 5e47528993..93e3a9a916 100644
@@ -405,7 +405,7 @@ static void pc_xen_hvm_init(MachineState *machine)
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
-        pci_create_simple(bus, -1, "xen-platform");
+        pci_create_simple(bus, PCI_DEVFN(3, 0), "xen-platform");
     }
 }
 #endif
Quoted 9 lines
Quoted 3 lines

The same thing could be done by libxl, by providing specific command line options to qemu. (I think that could even be done via a different config file for the guest.)

This patch doesn't seem to work for me. It seems like the device model process is exiting immediately, but I haven't been able to find any information as to what is going wrong. I tested with Xen 4.6.6 and the QEMU packaged with that release. Should I try it on a different version of Xen and QEMU?

What this patch does is asking QEMU to insert the PCI card "xen-platform" into the 3rd PCI slot. My guess is that failed because there is already a PCI device there.

You could check qemu's logs, it's in
/var/log/xen/qemu-dm-${guest_name}.log

Let's try something else, instead of patching QEMU, we can patch libxl, that might work better. Can you try this patch? (I've only test compiled.) I've write the patch for Xen 4.6, since that the version you are using.

From: Anthony PERARD <[email protected]>
Subject: [PATCH] libxl_dm: Explicitly put xen-platform device on PCI slot 3

In order to do that, we don't use xenfv machine anymore and explicity add the platform device on the command line.

---
 tools/libxl/libxl_dm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
tools/libxl/libxl_dm.c +6 -5
index 0db5f13553..59c0102a3e 100644
@@ -899,6 +899,11 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
             }
         }
 
+        if (libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
+            flexarray_vappend(dm_args, "-device",
+                              "xen-platform,addr=3", NULL);
+        }
+
         if (libxl_defbool_val(b_info->u.hvm.nographic) && (!sdl && !vnc)) {
             flexarray_append(dm_args, "-nographic");
         }
@@ -1075,14 +1080,10 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
             flexarray_append(dm_args, b_info->extra_pv[i]);
         break;
     case LIBXL_DOMAIN_TYPE_HVM:
-        if (!libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
             /* Switching here to the machine "pc" which does not add
              * the xen-platform device instead of the default "xenfv" machine.
              */
-            machinearg = libxl__sprintf(gc, "pc,accel=xen");
-        } else {
-            machinearg = libxl__sprintf(gc, "xenfv");
-        }
+        machinearg = libxl__sprintf(gc, "pc,accel=xen");
         if (b_info->u.hvm.mmio_hole_memkb) {
             uint64_t max_ram_below_4g = (1ULL << 32) -
                 (b_info->u.hvm.mmio_hole_memkb << 10);
Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw
Quoted 33 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Anthony PERARD
Sent: 04 January 2018 12:52
To: Kevin Stange <[email protected]>
Cc: George Dunlap <[email protected]>; xen- [email protected]
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 5 lines · Kevin Stange
Quoted 4 lines · Anthony PERARD
Quoted 3 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under

HVM

Quoted 1 line
Quoted 1 line
Quoted 1 line

from using QEMU traditional to QEMU upstream as is recommended in

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each

device.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 9 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Kevin,

I missed the original email as it went past...

Are Xen Project PV drivers installed in the guest? And are you talking about a PV NIC device or an emulated device?

Paul
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
Quoted 43 lines · Paul Durrant
Quoted 33 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Anthony PERARD
Sent: 04 January 2018 12:52
To: Kevin Stange <[email protected]>
Cc: George Dunlap <[email protected]>; xen- [email protected]
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 5 lines · Kevin Stange
Quoted 4 lines · Anthony PERARD
Quoted 3 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under

HVM

Quoted 1 line
Quoted 1 line
Quoted 1 line

from using QEMU traditional to QEMU upstream as is recommended in

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each

device.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 9 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Quoted 5 lines

Kevin,

I missed the original email as it went past...

Are Xen Project PV drivers installed in the guest? And are you talking about a PV NIC device or an emulated device?

These guests use some of the older Xen PV drivers with a PV NIC, not an emulated device.

Signature · 11 lines
Kevin Stange
Chief Technology Officer
Steadfast | Managed Infrastructure, Datacenter and Cloud Services
800 S Wells, Suite 190 | Chicago, IL 60607
312.602.2689 X203 | Fax: 312.602.2688
[email protected] | www.steadfast.net

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw
Quoted 61 lines

-----Original Message-----
From: Kevin Stange [mailto:[email protected]]
Sent: 04 January 2018 21:17
To: Paul Durrant <[email protected]>
Cc: George Dunlap <[email protected]>; xen- [email protected]; Anthony Perard <[email protected]>
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 2 lines · Paul Durrant
Quoted 2 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On

Behalf

Quoted 8 lines
Quoted 8 lines

Of Anthony PERARD
Sent: 04 January 2018 12:52
To: Kevin Stange <[email protected]>
Cc: George Dunlap <[email protected]>; xen- [email protected]
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 6 lines
Quoted 6 lines · Kevin Stange
Quoted 5 lines · Anthony PERARD
Quoted 4 lines · Kevin Stange
Quoted 3 lines

Hi,

I've been working on transitioning a number of Windows guests

under

Quoted 2 lines
Quoted 2 lines

HVM

Quoted 1 line
Quoted 1 line
Quoted 1 line

from using QEMU traditional to QEMU upstream as is recommended

in

Quoted 10 lines
Quoted 10 lines

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each

device.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same?

A

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Kevin,

Quoted 8 lines
Quoted 3 lines

I missed the original email as it went past...

Are Xen Project PV drivers installed in the guest? And are you talking about

a PV NIC device or an emulated device?

These guests use some of the older Xen PV drivers with a PV NIC, not an emulated device.

Ok. I was curious because the latest PV drivers contain a hack (that was actually suggested by someone at Microsoft) to make sure that (as far as the Windows PnP subsystem is concerned) the Xen platform device never moves once the XENBUS driver has been installed. This is done by installing a filter driver onto Windows' PCI bus driver that spots the platform device and re-writes the trailing 'uniquifier' to be exactly what it was at the time of driver installation. So, if you update your VMs to use newer PV drivers first, then you should be immune to the platform device moving on the bus.

Cheers,

Paul

Quoted 7 lines

--
Kevin Stange
Chief Technology Officer
Steadfast | Managed Infrastructure, Datacenter and Cloud Services 800 S Wells, Suite 190 | Chicago, IL 60607
312.602.2689 X203 | Fax: 312.602.2688 [email protected] | www.steadfast.net

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw
Quoted 64 lines · Paul Durrant
Quoted 64 lines

-----Original Message-----
From: Kevin Stange [mailto:[email protected]]
Sent: 04 January 2018 21:17
To: Paul Durrant <[email protected]>
Cc: George Dunlap <[email protected]>; xen- [email protected]; Anthony Perard <[email protected]>
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 2 lines · Paul Durrant
Quoted 2 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On

Behalf

Quoted 8 lines
Quoted 8 lines

Of Anthony PERARD
Sent: 04 January 2018 12:52
To: Kevin Stange <[email protected]>
Cc: George Dunlap <[email protected]>; xen- [email protected]
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 6 lines
Quoted 6 lines · Kevin Stange
Quoted 5 lines · Anthony PERARD
Quoted 4 lines · Kevin Stange
Quoted 3 lines

Hi,

I've been working on transitioning a number of Windows guests

under

Quoted 2 lines
Quoted 2 lines

HVM

Quoted 1 line
Quoted 1 line
Quoted 1 line

from using QEMU traditional to QEMU upstream as is recommended

in

Quoted 10 lines
Quoted 10 lines

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each

device.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same?

A

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Kevin,

I missed the original email as it went past...

Are Xen Project PV drivers installed in the guest? And are you talking about

Quoted 8 lines
Quoted 5 lines

a PV NIC device or an emulated device?

These guests use some of the older Xen PV drivers with a PV NIC, not an emulated device.

Ok. I was curious because the latest PV drivers contain a hack (that was actually suggested by someone at Microsoft) to make sure that (as far as the Windows PnP subsystem is concerned) the Xen platform device never moves once the XENBUS driver has been installed. This is done by installing a filter driver onto Windows' PCI bus driver that spots the platform device and re-writes the trailing 'uniquifier' to be exactly what it was at the time of driver installation. So, if you update your VMs to use newer PV drivers first, then you should be immune to the platform device moving on the bus.

This is interesting and good to learn, but I had a lot of trouble in the past trying to convert existing guests to use the modern PV drivers, due to difficulties completely removing the old ones and getting Windows to adopt the new ones. The resulting mess is more work than dealing with the current problem, which is why it would be nice to be able to just massage the Windows guests to the desired configuration from outside.

Signature · 11 lines
Kevin Stange
Chief Technology Officer
Steadfast | Managed Infrastructure, Datacenter and Cloud Services
800 S Wells, Suite 190 | Chicago, IL 60607
312.602.2689 X203 | Fax: 312.602.2688
[email protected] | www.steadfast.net

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#9 lore raw
In reply to Anthony PERARD
Quoted 65 lines · Anthony PERARD
Quoted 54 lines · Kevin Stange
Quoted 53 lines · Anthony PERARD
Quoted 16 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 8 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Hi Kevin,

I've got a patch to QEMU that seems to do the trick:

From: Anthony PERARD <[email protected]>
Subject: [PATCH] xen-platform: Hardcode PCI slot to 3

---
 hw/i386/pc_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
index 5e47528993..93e3a9a916 100644
@@ -405,7 +405,7 @@ static void pc_xen_hvm_init(MachineState *machine)
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
-        pci_create_simple(bus, -1, "xen-platform");
+        pci_create_simple(bus, PCI_DEVFN(3, 0), "xen-platform");
     }
 }
 #endif
Quoted 9 lines
Quoted 3 lines

The same thing could be done by libxl, by providing specific command line options to qemu. (I think that could even be done via a different config file for the guest.)

This patch doesn't seem to work for me. It seems like the device model process is exiting immediately, but I haven't been able to find any information as to what is going wrong. I tested with Xen 4.6.6 and the QEMU packaged with that release. Should I try it on a different version of Xen and QEMU?

Quoted 6 lines

What this patch does is asking QEMU to insert the PCI card "xen-platform" into the 3rd PCI slot. My guess is that failed because there is already a PCI device there.

You could check qemu's logs, it's in
/var/log/xen/qemu-dm-${guest_name}.log

The log file in question only says:

qemu: terminating on signal 1 from pid 8865

Quoted 4 lines

Let's try something else, instead of patching QEMU, we can patch libxl, that might work better. Can you try this patch? (I've only test compiled.) I've write the patch for Xen 4.6, since that the version you are using.

This isn't doing the trick either, with the same misbehavior. The log file is the same in both cases.

Signature · 11 lines
Kevin Stange
Chief Technology Officer
Steadfast | Managed Infrastructure, Datacenter and Cloud Services
800 S Wells, Suite 190 | Chicago, IL 60607
312.602.2689 X203 | Fax: 312.602.2688
[email protected] | www.steadfast.net

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#10 lore raw
Quoted 77 lines · Kevin Stange
Quoted 65 lines · Anthony PERARD
Quoted 54 lines · Kevin Stange
Quoted 53 lines · Anthony PERARD
Quoted 16 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 8 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Hi Kevin,

I've got a patch to QEMU that seems to do the trick:

From: Anthony PERARD <[email protected]>
Subject: [PATCH] xen-platform: Hardcode PCI slot to 3

---
 hw/i386/pc_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
index 5e47528993..93e3a9a916 100644
@@ -405,7 +405,7 @@ static void pc_xen_hvm_init(MachineState *machine)
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
-        pci_create_simple(bus, -1, "xen-platform");
+        pci_create_simple(bus, PCI_DEVFN(3, 0), "xen-platform");
     }
 }
 #endif
Quoted 9 lines
Quoted 3 lines

The same thing could be done by libxl, by providing specific command line options to qemu. (I think that could even be done via a different config file for the guest.)

This patch doesn't seem to work for me. It seems like the device model process is exiting immediately, but I haven't been able to find any information as to what is going wrong. I tested with Xen 4.6.6 and the QEMU packaged with that release. Should I try it on a different version of Xen and QEMU?

Quoted 6 lines

What this patch does is asking QEMU to insert the PCI card "xen-platform" into the 3rd PCI slot. My guess is that failed because there is already a PCI device there.

You could check qemu's logs, it's in
/var/log/xen/qemu-dm-${guest_name}.log

The log file in question only says:

qemu: terminating on signal 1 from pid 8865

Quoted 7 lines
Quoted 4 lines

Let's try something else, instead of patching QEMU, we can patch libxl, that might work better. Can you try this patch? (I've only test compiled.) I've write the patch for Xen 4.6, since that the version you are using.

This isn't doing the trick either, with the same misbehavior. The log file is the same in both cases.

I'm getting confusing behavior here. I tried to boot a guest using a build with the second patch and behaves the way the first one did, with the qemu-system-i386 process exiting and preventing the guest from ever booting. However, I tried to downgrade the packages to completely unpatched version in preparation to reboot again and once the older copy of the runtime is installed, the qemu-system-i386 starts properly using the command line arguments that libxl had specified and the system comes up with the correct PCI subtree.

This leads me to believe something about my build is screwed up somehow such that my qemu-system-i386 is broken. I'm quite sure I'm not applying any extra patches to it that weren't otherwise in the CentOS virt packages.

Signature · 11 lines
Kevin Stange
Chief Technology Officer
Steadfast | Managed Infrastructure, Datacenter and Cloud Services
800 S Wells, Suite 190 | Chicago, IL 60607
312.602.2689 X203 | Fax: 312.602.2688
[email protected] | www.steadfast.net

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#11 lore raw
Quoted 95 lines · Kevin Stange
Quoted 77 lines · Kevin Stange
Quoted 65 lines · Anthony PERARD
Quoted 54 lines · Kevin Stange
Quoted 53 lines · Anthony PERARD
Quoted 16 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 8 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Hi Kevin,

I've got a patch to QEMU that seems to do the trick:

From: Anthony PERARD <[email protected]>
Subject: [PATCH] xen-platform: Hardcode PCI slot to 3

---
 hw/i386/pc_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
index 5e47528993..93e3a9a916 100644
@@ -405,7 +405,7 @@ static void pc_xen_hvm_init(MachineState *machine)
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
-        pci_create_simple(bus, -1, "xen-platform");
+        pci_create_simple(bus, PCI_DEVFN(3, 0), "xen-platform");
     }
 }
 #endif
Quoted 9 lines
Quoted 3 lines

The same thing could be done by libxl, by providing specific command line options to qemu. (I think that could even be done via a different config file for the guest.)

This patch doesn't seem to work for me. It seems like the device model process is exiting immediately, but I haven't been able to find any information as to what is going wrong. I tested with Xen 4.6.6 and the QEMU packaged with that release. Should I try it on a different version of Xen and QEMU?

Quoted 6 lines

What this patch does is asking QEMU to insert the PCI card "xen-platform" into the 3rd PCI slot. My guess is that failed because there is already a PCI device there.

You could check qemu's logs, it's in
/var/log/xen/qemu-dm-${guest_name}.log

The log file in question only says:

qemu: terminating on signal 1 from pid 8865

Quoted 7 lines
Quoted 4 lines

Let's try something else, instead of patching QEMU, we can patch libxl, that might work better. Can you try this patch? (I've only test compiled.) I've write the patch for Xen 4.6, since that the version you are using.

This isn't doing the trick either, with the same misbehavior. The log file is the same in both cases.

I'm getting confusing behavior here. I tried to boot a guest using a build with the second patch and behaves the way the first one did, with the qemu-system-i386 process exiting and preventing the guest from ever booting. However, I tried to downgrade the packages to completely unpatched version in preparation to reboot again and once the older copy of the runtime is installed, the qemu-system-i386 starts properly using the command line arguments that libxl had specified and the system comes up with the correct PCI subtree.

Quoted 4 lines

This leads me to believe something about my build is screwed up somehow such that my qemu-system-i386 is broken. I'm quite sure I'm not applying any extra patches to it that weren't otherwise in the CentOS virt packages.

George pointed me at the fact I had failed to pull in the seabios package from CentOS virt. The version from RHEL is broken and that was my issue. Sorry for generating extra noise as a result.

I can confirm that patch 2 (and probably patch 1, really) work around the issue for me. Thank you for the help!

It would be nice if there was a way to set default or override options to domains from a configuration file that is read by libxl, qemu, or libvirt but I see no code or documentation to support that right now.

Signature · 11 lines
Kevin Stange
Chief Technology Officer
Steadfast | Managed Infrastructure, Datacenter and Cloud Services
800 S Wells, Suite 190 | Chicago, IL 60607
312.602.2689 X203 | Fax: 312.602.2688
[email protected] | www.steadfast.net

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw
In reply to Anthony PERARD
Quoted 79 lines · Anthony PERARD
Quoted 54 lines · Kevin Stange
Quoted 53 lines · Anthony PERARD
Quoted 16 lines · Kevin Stange

Hi,

I've been working on transitioning a number of Windows guests under HVM from using QEMU traditional to QEMU upstream as is recommended in the documentation. When I move these guests, the PCI subtree for Xen devices changes and Windows creates a totally new copy of each device. Windows tracks down the storage without issue, but it treats the new instance of the NIC driver as a new device and clears the network configuration even though the MAC address is unchanged. Manually booting the guest back on the traditional device model reactivates the original PCI subtree and the old network configuration with it.

The only thing that I have been able to find that's substantially different comparing the device trees is that the device instance ID values differ on the parent Xen PCI device:

Quoted 8 lines

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&18

PCI\VEN_5853&DEV_0001&SUBSYS_00015853&REV_01\3&267A616A&3&10

Besides actually setting the guest to boot using QEMU traditional, is there a way to convince Windows to treat these devices as the same? A patch-based solution would be acceptable to me if there is one, but I don't understand the code well enough to create my own solution.

Hi Kevin,

I've got a patch to QEMU that seems to do the trick:

From: Anthony PERARD <[email protected]>
Subject: [PATCH] xen-platform: Hardcode PCI slot to 3

---
 hw/i386/pc_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
index 5e47528993..93e3a9a916 100644
@@ -405,7 +405,7 @@ static void pc_xen_hvm_init(MachineState *machine)
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
-        pci_create_simple(bus, -1, "xen-platform");
+        pci_create_simple(bus, PCI_DEVFN(3, 0), "xen-platform");
     }
 }
 #endif
Quoted 9 lines
Quoted 3 lines

The same thing could be done by libxl, by providing specific command line options to qemu. (I think that could even be done via a different config file for the guest.)

This patch doesn't seem to work for me. It seems like the device model process is exiting immediately, but I haven't been able to find any information as to what is going wrong. I tested with Xen 4.6.6 and the QEMU packaged with that release. Should I try it on a different version of Xen and QEMU?

What this patch does is asking QEMU to insert the PCI card "xen-platform" into the 3rd PCI slot. My guess is that failed because there is already a PCI device there.

You could check qemu's logs, it's in
/var/log/xen/qemu-dm-${guest_name}.log

Let's try something else, instead of patching QEMU, we can patch libxl, that might work better. Can you try this patch? (I've only test compiled.) I've write the patch for Xen 4.6, since that the version you are using.

Quoted 7 lines

From: Anthony PERARD <[email protected]>
Subject: [PATCH] libxl_dm: Explicitly put xen-platform device on PCI slot 3

In order to do that, we don't use xenfv machine anymore and explicity add the platform device on the command line.

Anthony,

It seems like we might want to add the ability to specify which slot we want the xen-platform device to occupy. Is it worth thinking of the best way to add a patch like this upstream?

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw
Quoted 7 lines · George Dunlap
Quoted 6 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>
Subject: [PATCH] libxl_dm: Explicitly put xen-platform device on PCI slot 3

In order to do that, we don't use xenfv machine anymore and explicity add the platform device on the command line.

Quoted 7 lines
Quoted 1 line

Anthony,

It seems like we might want to add the ability to specify which slot we want the xen-platform device to occupy. Is it worth thinking of the best way to add a patch like this upstream?

I think that would be nice for people who switch from qemu-trad to QEMU. The only question that remain is, how to name the xl config option? The rest is to simply take my libxl patch and make it use the new config option.

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#14 lore raw
Quoted 12 lines · Anthony PERARD
Quoted 11 lines · George Dunlap
Quoted 7 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>
Subject: [PATCH] libxl_dm: Explicitly put xen-platform device on PCI slot 3

In order to do that, we don't use xenfv machine anymore and explicity add the platform device on the command line.

Anthony,

Quoted 8 lines
Quoted 3 lines

It seems like we might want to add the ability to specify which slot we want the xen-platform device to occupy. Is it worth thinking of the best way to add a patch like this upstream?

I think that would be nice for people who switch from qemu-trad to QEMU. The only question that remain is, how to name the xl config option? The rest is to simply take my libxl patch and make it use the new config option.

Well the other half would be to make sure something like this doesn't happen by accident in the future -- i.e., that no future changes in QEMU will accidentally move it away from whatever the current slot is now.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#15 lore raw
Quoted 28 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 January 2018 18:15
To: Anthony Perard <[email protected]>
Cc: Kevin Stange <[email protected]>; [email protected]; George Dunlap <[email protected]>
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 4 lines · Anthony PERARD
Quoted 3 lines · George Dunlap
Quoted 2 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>
Subject: [PATCH] libxl_dm: Explicitly put xen-platform device on PCI slot

3

Quoted 12 lines
Quoted 11 lines
Quoted 5 lines

In order to do that, we don't use xenfv machine anymore and explicity add the platform device on the command line.

Anthony,

It seems like we might want to add the ability to specify which slot we want the xen-platform device to occupy. Is it worth thinking of the best way to add a patch like this upstream?

Quoted 9 lines
Quoted 4 lines

I think that would be nice for people who switch from qemu-trad to QEMU. The only question that remain is, how to name the xl config option? The rest is to simply take my libxl patch and make it use the new config option.

Well the other half would be to make sure something like this doesn't happen by accident in the future -- i.e., that no future changes in QEMU will accidentally move it away from whatever the current slot is now.

IMO, it would be best if libxl specified the bus topology exactly (i.e. specified devfn for everything that appears on the bus). If we, as I hope, make a move to having Xen rather than QEMU own the topology then this should hopefully ensure at least some degree of forward compatibility.

Paul

Quoted 6 lines

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw
Quoted 33 lines · Paul Durrant
Quoted 33 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 January 2018 18:15
To: Anthony Perard <[email protected]>
Cc: Kevin Stange <[email protected]>; [email protected]; George Dunlap <[email protected]>
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 4 lines · Anthony PERARD
Quoted 3 lines · George Dunlap
Quoted 2 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>
Subject: [PATCH] libxl_dm: Explicitly put xen-platform device on PCI slot

3

Quoted 16 lines
Quoted 11 lines
Quoted 5 lines

In order to do that, we don't use xenfv machine anymore and explicity add the platform device on the command line.

Anthony,

It seems like we might want to add the ability to specify which slot we want the xen-platform device to occupy. Is it worth thinking of the best way to add a patch like this upstream?

I think that would be nice for people who switch from qemu-trad to QEMU. The only question that remain is, how to name the xl config option? The rest is to simply take my libxl patch and make it use the new config option.

Quoted 6 lines
Quoted 4 lines

Well the other half would be to make sure something like this doesn't happen by accident in the future -- i.e., that no future changes in QEMU will accidentally move it away from whatever the current slot is now.

IMO, it would be best if libxl specified the bus topology exactly (i.e. specified devfn for everything that appears on the bus). If we, as I hope, make a move to having Xen rather than QEMU own the topology then this should hopefully ensure at least some degree of forward compatibility.

Is this on anybody's radar? It seems like this wouldn't be a huge amount of work, and it would prevent this sort of compatibility issue in the future.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#17 lore raw
Quoted 46 lines

-----Original Message-----
From: George Dunlap [mailto:[email protected]]
Sent: 08 April 2019 10:47
To: Paul Durrant <[email protected]>; Anthony Perard <[email protected]>
Cc: Kevin Stange <[email protected]>; [email protected]
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 38 lines · Paul Durrant
Quoted 37 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 January 2018 18:15
To: Anthony Perard <[email protected]>
Cc: Kevin Stange <[email protected]>; [email protected]; George Dunlap <[email protected]>
Subject: Re: [Xen-devel] PCI Device Subtree Change from Traditional to Upstream

Quoted 4 lines · Anthony PERARD
Quoted 3 lines · George Dunlap
Quoted 2 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>
Subject: [PATCH] libxl_dm: Explicitly put xen-platform device on PCI slot

3

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

In order to do that, we don't use xenfv machine anymore and explicity add the platform device on the command line.

Anthony,

Quoted 8 lines
Quoted 3 lines

It seems like we might want to add the ability to specify which slot we want the xen-platform device to occupy. Is it worth thinking of the best way to add a patch like this upstream?

I think that would be nice for people who switch from qemu-trad to QEMU. The only question that remain is, how to name the xl config option? The rest is to simply take my libxl patch and make it use the new config option.

Well the other half would be to make sure something like this doesn't happen by accident in the future -- i.e., that no future changes in QEMU will accidentally move it away from whatever the current slot is now.

Quoted 7 lines
Quoted 1 line

IMO, it would be best if libxl specified the bus topology exactly (i.e. specified devfn for

everything that appears on the bus). If we, as I hope, make a move to having Xen rather than QEMU own the topology then this should hopefully ensure at least some degree of forward compatibility.

Is this on anybody's radar? It seems like this wouldn't be a huge amount of work, and it would prevent this sort of compatibility issue in the future.

This very topic came up in relation to the XAPI toolstack last week. It would definitely be good to have commonality with libxl on this but I'm not aware of anyone working on this.

Paul

Quoted 2 lines

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel