Skip to contentSkip to conversation

libxl: Actually append the "-vga none" parameter to qemu when using qemu-xen

PATCH In review Sander Eikelenboom 4 participants 8 messages Jan 22, 2015 – Jan 27, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: Actually append the "-vga none" parameter to qemu when using qemu-xen

Commit 2e5738ff "libxl: Add none to vga parameter" introduced the "none" option for the Xen "vga=" config option but only appends the needed parameter for the qemu-traditional case. This patch fixes the qemu-xen case by appending the same "-vga none" qemu paramter.

---
 tools/libxl/libxl_dm.c |    1 +
 1 file changed, 1 insertion(+)
tools/libxl/libxl_dm.c +1 -0
index c2b0487..fc3f5a7 100644
@@ -589,6 +589,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                 libxl__sizekb_to_mb(b_info->video_memkb)));
             break;
         case LIBXL_VGA_INTERFACE_TYPE_NONE:
+            flexarray_append_pair(dm_args, "-vga", "none");
             break;
         }
 
Signature · 1 line
1.7.10.4
#1 lore raw

RFC PATCH 1/1 libxl: Prevent qemu closing QMP socket on shutdown before libxl is done with it.

While this fixes the race and error on shutdown of a HVM guest with pci-passthrough, i don't know if this could give problems in other areas (migration ?), hence posted as RFC.

--
Sander

8< -----------
At present on shutdown when using pci-passthrough with qemu-xen, qemu closes the QMP socket before libxl is done with it causing these errors to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 11568]
Domain 1 has shut down, reason code 0 0x0
Action for shutdown reason code 0 is destroy
Domain 1 needs to be cleaned up: destroying the domain
libxl: error: libxl_qmp.c:443:qmp_next: Socket read error: Connection reset by peer
libxl: error: libxl_qmp.c:701:libxl__qmp_initialize: Failed to connect to QMP
libxl: error: libxl_qmp.c:686:libxl__qmp_initialize: Connection error: Connection refused
libxl: error: libxl_dm.c:1588:kill_device_model: Device Model already exited Done. Exiting now

Prevent this by using the qemu '-no-shutdown' parameter which is described as doing:
"Don’t exit QEMU on guest shutdown, but instead only stop the emulation.
This allows for instance switching to monitor to commit changes to the disk image."

So Qemu will stop emulating, but keeps the QMP socket open and waits for libxl to kill the qemu process when it is done, preventing the race and resulting in this to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 10859] Domain 1 has shut down, reason code 0 0x0 Action for shutdown reason code 0 is destroy Domain 1 needs to be cleaned up: destroying the domain Done. Exiting now

---
 tools/libxl/libxl_dm.c |    1 +
 1 file changed, 1 insertion(+)
tools/libxl/libxl_dm.c +1 -0
index fc3f5a7..3152c87 100644
@@ -435,6 +435,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                     "path=%s/qmp-libxl-%d,server,nowait",
                                     libxl__run_dir_path(), guest_domid));
 
+    flexarray_append(dm_args, "-no-shutdown");
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
 
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#6 lore raw
In reply to Sander Eikelenboom

Il 22/01/2015 18:21, Sander Eikelenboom ha scritto:

Quoted 4 lines

Commit 2e5738ff "libxl: Add none to vga parameter" introduced the "none" option for the Xen "vga=" config option but only appends the needed parameter for the qemu-traditional case. This patch fixes the qemu-xen case by appending the same "-vga none" qemu paramter.

In upstream qemu -nodefaults is used, -vga none is old and deprecated way and not needed with -nodefaults used:
http://git.qemu.org/?p=qemu.git;a=blob;f=docs/qdev-device-use.txt;hb=HEAD
http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxl/libxl_dm.c;hb=HEAD (search -nodefaults) What exactly is your problem?
Could you better detail?

Thanks for any reply.

Quoted 18 lines
---
  tools/libxl/libxl_dm.c |    1 +
  1 file changed, 1 insertion(+)
tools/libxl/libxl_dm.c +1 -0
index c2b0487..fc3f5a7 100644
@@ -589,6 +589,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                  libxl__sizekb_to_mb(b_info->video_memkb)));
              break;
          case LIBXL_VGA_INTERFACE_TYPE_NONE:
+            flexarray_append_pair(dm_args, "-vga", "none");
              break;
          }
 
#7 lore raw
Quoted 14 lines · you

Il 22/01/2015 18:21, Sander Eikelenboom ha scritto:

Quoted 4 lines

Commit 2e5738ff "libxl: Add none to vga parameter" introduced the "none" option for the Xen "vga=" config option but only appends the needed parameter for the qemu-traditional case. This patch fixes the qemu-xen case by appending the same "-vga none" qemu paramter.

In upstream qemu -nodefaults is used, -vga none is old and deprecated way and not needed with -nodefaults used:
http://git.qemu.org/?p=qemu.git;a=blob;f=docs/qdev-device-use.txt;hb=HEAD
http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxl/libxl_dm.c;hb=HEAD
(search -nodefaults)
What exactly is your problem?
Could you better detail?

Quoted 1 line

Thanks for any reply.

Ah you are right .. hmm it seems even this patch isn't helping ..

with vnc=0 && sdl=0 && vga=none i still end up with:
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01) 00:03.0 VGA compatible controller: Cirrus Logic GD 5446

A Cirrus logic controller ..

My assumption that sdl=0 disables sdl seems to be wrong .. i also needed the "nographic" option.

It seems you just have to be very persuasive to get rid of it :-)

So without this patch and with sdl=0 && vnc=0 && vga=none && nographic=1 .. i finely did get rid of the cirrus logic controller.

I'm not entirely sure the "-nodefaults" actually works .. since xen uses it's own machine type "xenfv" by default .. and the referenced doc says:

292 The new way is -device. The mapping from -vga argument to -device 293 depends on the machine type. For machine "pc", it's:
<snip>
315 Bug: the new way doesn't work for machine types "pc" and "isapc", 316 because it violates obscure device initialization ordering 317 constraints.

And further on the document says:

395 === Default Devices ===
396
397 QEMU creates a number of devices by default, depending on the machine 398 type.
399
400 -device DEVNAME... and global DEVNAME... suppress default devices for 401 some DEVNAMEs:
402

   403     default device      suppressing DEVNAMEs
   404     CD-ROM              ide-cd, ide-drive, scsi-cd
   405     isa-fdc's driveA    isa-fdc
   406     parallel            isa-parallel
   407     serial              isa-serial
   408     VGA                 VGA, cirrus-vga, vmware-svga
   409     virtioconsole       virtio-serial-pci, virtio-serial-s390, virtio-serial

410
411 The default NIC is connected to a default part created along with it. 412 It is *not* suppressed by configuring a NIC with -device (you may call 413 that a bug). -net and -netdev suppress the default NIC. 414
415 -nodefaults suppresses all the default devices mentioned above, plus a 416 few other things such as default SD-Card drive and default monitor.

It doesn't say any thing explicitly about sdl though, so it's either:

- the no-defaults also works for machine="xenfv", but qemu still defaults to sdl .. and therefore still enables the cirrus logic controller (or the referenced document is wrong)
or
- the no-defaults doesn't seem to work for machine="xenfv"

Will see if i can figure out which of the two it is ..

--
Sander

Quoted 18 lines
Quoted 18 lines
---
  tools/libxl/libxl_dm.c |    1 +
  1 file changed, 1 insertion(+)
tools/libxl/libxl_dm.c +1 -0
index c2b0487..fc3f5a7 100644
@@ -589,6 +589,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                  libxl__sizekb_to_mb(b_info->video_memkb)));
              break;
          case LIBXL_VGA_INTERFACE_TYPE_NONE:
+            flexarray_append_pair(dm_args, "-vga", "none");
              break;
          }
 
#2 lore raw

Re: [RFC / PATCH] libxl: Prevent qemu closing QMP socket on shutdown before libxl is done with it.

In reply to Sander Eikelenboom
Quoted 3 lines · Sander Eikelenboom

While this fixes the race and error on shutdown of a HVM guest with pci-passthrough, i don't know if this could give problems in other areas (migration ?), hence posted as RFC.

I think the patch should be OK. Maybe you could test it with local migration (migrating a guest to localhost) and tell us if everything is OK?

If so, I think it should be committed.

Quoted 51 lines

--
Sander

8< -----------
At present on shutdown when using pci-passthrough with qemu-xen, qemu closes the QMP socket before libxl is done with it causing these errors to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 11568]
Domain 1 has shut down, reason code 0 0x0
Action for shutdown reason code 0 is destroy
Domain 1 needs to be cleaned up: destroying the domain
libxl: error: libxl_qmp.c:443:qmp_next: Socket read error: Connection reset by peer
libxl: error: libxl_qmp.c:701:libxl__qmp_initialize: Failed to connect to QMP
libxl: error: libxl_qmp.c:686:libxl__qmp_initialize: Connection error: Connection refused
libxl: error: libxl_dm.c:1588:kill_device_model: Device Model already exited Done. Exiting now

Prevent this by using the qemu '-no-shutdown' parameter which is described as doing:
"Don’t exit QEMU on guest shutdown, but instead only stop the emulation.
This allows for instance switching to monitor to commit changes to the disk image."

So Qemu will stop emulating, but keeps the QMP socket open and waits for libxl to kill the qemu process when it is done, preventing the race and resulting in this to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 10859] Domain 1 has shut down, reason code 0 0x0 Action for shutdown reason code 0 is destroy Domain 1 needs to be cleaned up: destroying the domain Done. Exiting now

---
 tools/libxl/libxl_dm.c |    1 +
 1 file changed, 1 insertion(+)
tools/libxl/libxl_dm.c +1 -0
index fc3f5a7..3152c87 100644
@@ -435,6 +435,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                     "path=%s/qmp-libxl-%d,server,nowait",
                                     libxl__run_dir_path(), guest_domid));
 
+    flexarray_append(dm_args, "-no-shutdown");
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
 
Signature · 1 line
1.7.10.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

Re: [RFC / PATCH] libxl: Prevent qemu closing QMP socket on shutdown before libxl is done with it.

Quoted 8 lines · you
Quoted 3 lines · Sander Eikelenboom

While this fixes the race and error on shutdown of a HVM guest with pci-passthrough, i don't know if this could give problems in other areas (migration ?), hence posted as RFC.

I think the patch should be OK. Maybe you could test it with local migration (migrating a guest to localhost) and tell us if everything is OK?

Hi stefano,

I'm not too experienced with migration, but a simple:
"xl -v migrate domid localhost" still seems to work with this patch.

--
Sander

Quoted 47 lines

If so, I think it should be committed.

Quoted 44 lines

--
Sander

8< -----------
At present on shutdown when using pci-passthrough with qemu-xen, qemu closes the QMP socket before libxl is done with it causing these errors to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 11568]
Domain 1 has shut down, reason code 0 0x0
Action for shutdown reason code 0 is destroy
Domain 1 needs to be cleaned up: destroying the domain
libxl: error: libxl_qmp.c:443:qmp_next: Socket read error: Connection reset by peer
libxl: error: libxl_qmp.c:701:libxl__qmp_initialize: Failed to connect to QMP
libxl: error: libxl_qmp.c:686:libxl__qmp_initialize: Connection error: Connection refused
libxl: error: libxl_dm.c:1588:kill_device_model: Device Model already exited Done. Exiting now

Prevent this by using the qemu '-no-shutdown' parameter which is described as doing:
"Don’t exit QEMU on guest shutdown, but instead only stop the emulation.
This allows for instance switching to monitor to commit changes to the disk image."

So Qemu will stop emulating, but keeps the QMP socket open and waits for libxl to kill the qemu process when it is done, preventing the race and resulting in this to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 10859] Domain 1 has shut down, reason code 0 0x0 Action for shutdown reason code 0 is destroy Domain 1 needs to be cleaned up: destroying the domain Done. Exiting now

---
 tools/libxl/libxl_dm.c |    1 +
 1 file changed, 1 insertion(+)
tools/libxl/libxl_dm.c +0 -0
index fc3f5a7..3152c87 100644
@@ -435,6 +435,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                     "path=%s/qmp-libxl-%d,server,nowait",
                                     libxl__run_dir_path(), guest_domid));
 
Quoted 7 lines
Quoted 7 lines
tools/libxl/libxl_dm.c +1 -0
+    flexarray_append(dm_args, "-no-shutdown");
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
 
Signature · 1 line
1.7.10.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw

Re: [RFC / PATCH] libxl: Prevent qemu closing QMP socket on shutdown before libxl is done with it.

Quoted 7 lines · Sander Eikelenboom
Quoted 4 lines · you
Quoted 3 lines · Sander Eikelenboom

While this fixes the race and error on shutdown of a HVM guest with pci-passthrough, i don't know if this could give problems in other areas (migration ?), hence posted as RFC.

Quoted 8 lines
Quoted 3 lines

I think the patch should be OK. Maybe you could test it with local migration (migrating a guest to localhost) and tell us if everything is OK?

Hi stefano,

I'm not too experienced with migration, but a simple:
"xl -v migrate domid localhost" still seems to work with this patch.

Yep, that's the one.

In that case:

Quoted 50 lines

--
Sander

Quoted 47 lines

If so, I think it should be committed.

Quoted 44 lines

--
Sander

8< -----------
At present on shutdown when using pci-passthrough with qemu-xen, qemu closes the QMP socket before libxl is done with it causing these errors to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 11568]
Domain 1 has shut down, reason code 0 0x0
Action for shutdown reason code 0 is destroy
Domain 1 needs to be cleaned up: destroying the domain
libxl: error: libxl_qmp.c:443:qmp_next: Socket read error: Connection reset by peer
libxl: error: libxl_qmp.c:701:libxl__qmp_initialize: Failed to connect to QMP
libxl: error: libxl_qmp.c:686:libxl__qmp_initialize: Connection error: Connection refused
libxl: error: libxl_dm.c:1588:kill_device_model: Device Model already exited Done. Exiting now

Prevent this by using the qemu '-no-shutdown' parameter which is described as doing:
"Don’t exit QEMU on guest shutdown, but instead only stop the emulation.
This allows for instance switching to monitor to commit changes to the disk image."

So Qemu will stop emulating, but keeps the QMP socket open and waits for libxl to kill the qemu process when it is done, preventing the race and resulting in this to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 10859] Domain 1 has shut down, reason code 0 0x0 Action for shutdown reason code 0 is destroy Domain 1 needs to be cleaned up: destroying the domain Done. Exiting now

---
 tools/libxl/libxl_dm.c |    1 +
 1 file changed, 1 insertion(+)
tools/libxl/libxl_dm.c +0 -0
index fc3f5a7..3152c87 100644
@@ -435,6 +435,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                     "path=%s/qmp-libxl-%d,server,nowait",
                                     libxl__run_dir_path(), guest_domid));
 
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
tools/libxl/libxl_dm.c +1 -0
+    flexarray_append(dm_args, "-no-shutdown");
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
 
Signature · 1 line
1.7.10.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Applied
#5 lore raw

Re: [RFC / PATCH] libxl: Prevent qemu closing QMP socket on shutdown before libxl is done with it.

Quoted 14 lines · Stefano Stabellini
Quoted 13 lines · Sander Eikelenboom
Quoted 8 lines · you
Quoted 3 lines · Sander Eikelenboom

While this fixes the race and error on shutdown of a HVM guest with pci-passthrough, i don't know if this could give problems in other areas (migration ?), hence posted as RFC.

I think the patch should be OK. Maybe you could test it with local migration (migrating a guest to localhost) and tell us if everything is OK?

Hi stefano,

Quoted 8 lines
Quoted 2 lines

I'm not too experienced with migration, but a simple:
"xl -v migrate domid localhost" still seems to work with this patch.

Yep, that's the one.

In that case:

Applied.

Sander please wrap your commit logs (the bits which aren't log quotations at least) to <80 (ideally <75) in the future.

Quoted 51 lines
Quoted 51 lines

--
Sander

Quoted 47 lines

If so, I think it should be committed.

Quoted 44 lines

--
Sander

8< -----------
At present on shutdown when using pci-passthrough with qemu-xen, qemu closes the QMP socket before libxl is done with it causing these errors to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 11568]
Domain 1 has shut down, reason code 0 0x0
Action for shutdown reason code 0 is destroy
Domain 1 needs to be cleaned up: destroying the domain
libxl: error: libxl_qmp.c:443:qmp_next: Socket read error: Connection reset by peer
libxl: error: libxl_qmp.c:701:libxl__qmp_initialize: Failed to connect to QMP
libxl: error: libxl_qmp.c:686:libxl__qmp_initialize: Connection error: Connection refused
libxl: error: libxl_dm.c:1588:kill_device_model: Device Model already exited Done. Exiting now

Prevent this by using the qemu '-no-shutdown' parameter which is described as doing:
"Don’t exit QEMU on guest shutdown, but instead only stop the emulation.
This allows for instance switching to monitor to commit changes to the disk image."

So Qemu will stop emulating, but keeps the QMP socket open and waits for libxl to kill the qemu process when it is done, preventing the race and resulting in this to be logged by libxl:

Waiting for domain test (domid 1) to die [pid 10859] Domain 1 has shut down, reason code 0 0x0 Action for shutdown reason code 0 is destroy Domain 1 needs to be cleaned up: destroying the domain Done. Exiting now

---
 tools/libxl/libxl_dm.c |    1 +
 1 file changed, 1 insertion(+)
tools/libxl/libxl_dm.c +0 -0
index fc3f5a7..3152c87 100644
@@ -435,6 +435,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                     "path=%s/qmp-libxl-%d,server,nowait",
                                     libxl__run_dir_path(), guest_domid));
 
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
tools/libxl/libxl_dm.c +1 -0
+    flexarray_append(dm_args, "-no-shutdown");
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
 
Signature · 1 line
1.7.10.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel