Skip to contentSkip to conversation

Fixes for QEMU 4.1.0-rc3

GIT PULL Applied Paolo Bonzini 3 participants 7 messages Jul 24, 2019 – Jul 25, 2019

lore
Share & tools
lore
#0 lore raw

The following changes since commit 23da9e297b4120ca9702cabec91599a44255fe96:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190722' into staging (2019-07-22 15:16:48 +0100)

are available in the Git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 6baabe5cf8d42ce6bc542fb3ec0bfc10c0ee6c5e:

docs: correct kconfig option (2019-07-24 11:21:59 +0200)

----------------------------------------------------------------
Two more bugfix patches + 1 doc fix.

----------------------------------------------------------------
Jan Kiszka (1):
i386/kvm: Do not sync nested state during runtime

Marc-André Lureau (1):
docs: correct kconfig option

Zhengui li (1):
virtio-scsi: fixed virtio_scsi_ctx_check failed when detaching scsi disk

 docs/devel/kconfig.rst |  2 +-
 hw/scsi/virtio-scsi.c  |  7 +++++--
 target/i386/kvm.c      | 10 +++++-----
 3 files changed, 11 insertions(+), 8 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

[Qemu-devel] [PULL 1/3] virtio-scsi: fixed virtio_scsi_ctx_check failed when detaching scsi disk

From: Zhengui li <[email protected]>

commit a6f230c move blockbackend back to main AioContext on unplug. It set the AioContext of SCSIDevice to the main AioContex, but s->ctx is still the iothread AioContex(if the scsi controller is configure with iothread). So if there are having in-flight requests during unplug, a failing assertion happend. The bt is below:
(gdb) bt

#0  0x0000ffff86aacbd0 in raise () from /lib64/libc.so.6
#1  0x0000ffff86aadf7c in abort () from /lib64/libc.so.6
#2  0x0000ffff86aa6124 in __assert_fail_base () from /lib64/libc.so.6
#3  0x0000ffff86aa61a4 in __assert_fail () from /lib64/libc.so.6
#4  0x0000000000529118 in virtio_scsi_ctx_check (d=<optimized out>, s=<optimized out>, s=<optimized out>) at /home/qemu-4.0.0/hw/scsi/virtio-scsi.c:246
#5  0x0000000000529ec4 in virtio_scsi_handle_cmd_req_prepare (s=0x2779ec00, req=0xffff740397d0) at /home/qemu-4.0.0/hw/scsi/virtio-scsi.c:559
#6  0x000000000052a228 in virtio_scsi_handle_cmd_vq (s=0x2779ec00, vq=0xffff7c6d7110) at /home/qemu-4.0.0/hw/scsi/virtio-scsi.c:603
#7  0x000000000052afa8 in virtio_scsi_data_plane_handle_cmd (vdev=<optimized out>, vq=0xffff7c6d7110) at /home/qemu-4.0.0/hw/scsi/virtio-scsi-dataplane.c:59
#8  0x000000000054d94c in virtio_queue_host_notifier_aio_poll (opaque=<optimized out>) at /home/qemu-4.0.0/hw/virtio/virtio.c:2452

assert(blk_get_aio_context(d->conf.blk) == s->ctx) failed.

To avoid assertion failed, moving the "if" after qdev_simple_device_unplug_cb.

In addition, to avoid another qemu crash below, add aio_disable_external before qdev_simple_device_unplug_cb, which disable the further processing of external clients when doing qdev_simple_device_unplug_cb.
(gdb) bt
#0 scsi_req_unref (req=0xffff6802c6f0) at hw/scsi/scsi-bus.c:1283
#1 0x00000000005294a4 in virtio_scsi_handle_cmd_req_submit (req=<optimized out>,

    s=<optimized out>) at /home/qemu-4.0.0/hw/scsi/virtio-scsi.c:589
#2  0x000000000052a2a8 in virtio_scsi_handle_cmd_vq (s=s@entry=0x9c90e90,
    vq=vq@entry=0xffff7c05f110) at /home/qemu-4.0.0/hw/scsi/virtio-scsi.c:625
#3  0x000000000052afd8 in virtio_scsi_data_plane_handle_cmd (vdev=<optimized out>,
    vq=0xffff7c05f110) at /home/qemu-4.0.0/hw/scsi/virtio-scsi-dataplane.c:60
#4  0x000000000054d97c in virtio_queue_host_notifier_aio_poll (opaque=<optimized out>)
    at /home/qemu-4.0.0/hw/virtio/virtio.c:2447
#5  0x00000000009b204c in run_poll_handlers_once (ctx=ctx@entry=0x6efea40,
    timeout=timeout@entry=0xffff7d7f7308) at util/aio-posix.c:521
#6  0x00000000009b2b64 in run_poll_handlers (ctx=ctx@entry=0x6efea40,
    max_ns=max_ns@entry=4000, timeout=timeout@entry=0xffff7d7f7308) at util/aio-posix.c:559
#7  0x00000000009b2ca0 in try_poll_mode (ctx=ctx@entry=0x6efea40, timeout=0xffff7d7f7308,
    timeout@entry=0xffff7d7f7348) at util/aio-posix.c:594
#8  0x00000000009b31b8 in aio_poll (ctx=0x6efea40, blocking=blocking@entry=true)
    at util/aio-posix.c:636

#9 0x00000000006973cc in iothread_run (opaque=0x6ebd800) at iothread.c:75 #10 0x00000000009b592c in qemu_thread_start (args=0x6efef60) at util/qemu-thread-posix.c:502 #11 0x0000ffff8057f8bc in start_thread () from /lib64/libpthread.so.0
#12 0x0000ffff804e5f8c in thread_start () from /lib64/libc.so.6
(gdb) p bus
$1 = (SCSIBus *) 0x0

Message-Id: <[email protected]>

Message-Id: <[email protected]>

---
 hw/scsi/virtio-scsi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
hw/scsi/virtio-scsi.c +5 -2
index d0bdbff090..8b9e5e2b49 100644
@@ -832,6 +832,7 @@ static void virtio_scsi_hotunplug(HotplugHandler *hotplug_dev, DeviceState *dev,
     VirtIODevice *vdev = VIRTIO_DEVICE(hotplug_dev);
     VirtIOSCSI *s = VIRTIO_SCSI(vdev);
     SCSIDevice *sd = SCSI_DEVICE(dev);
+    AioContext *ctx = s->ctx ?: qemu_get_aio_context();
 
     if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) {
         virtio_scsi_acquire(s);
@@ -841,14 +842,16 @@ static void virtio_scsi_hotunplug(HotplugHandler *hotplug_dev, DeviceState *dev,
         virtio_scsi_release(s);
     }
 
+    aio_disable_external(ctx);
+    qdev_simple_device_unplug_cb(hotplug_dev, dev, errp);
+    aio_enable_external(ctx);
+
     if (s->ctx) {
         virtio_scsi_acquire(s);
         /* If other users keep the BlockBackend in the iothread, that's ok */
         blk_set_aio_context(sd->conf.blk, qemu_get_aio_context(), NULL);
         virtio_scsi_release(s);
     }
-
-    qdev_simple_device_unplug_cb(hotplug_dev, dev, errp);
 }
 
 static struct SCSIBusInfo virtio_scsi_scsi_info = {
Signature · 1 line
2.21.0
#2 lore raw

[Qemu-devel] [PULL 3/3] docs: correct kconfig option

In reply to Paolo Bonzini

From: Marc-André Lureau <[email protected]>

Message-Id: <[email protected]>

---
 docs/devel/kconfig.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docs/devel/kconfig.rst +1 -1
index d6f8eb0977..b7bca44704 100644
@@ -267,7 +267,7 @@ the default configuration by uncommenting lines in the first group,
 or commenting out lines in the second group.
 
 It is also possible to run QEMU's configure script with the
-``--with-default-devices`` option.  When this is done, everything defaults
+``--without-default-devices`` option.  When this is done, everything defaults
 to ``n`` unless it is ``select``ed or explicitly switched on in the
 ``.mak`` files.  In other words, ``default`` and ``imply`` directives
 are disabled.  When QEMU is built with this option, the user will probably
Signature · 1 line
2.21.0
#3 lore raw

Re: [Qemu-devel] [PULL 3/3] docs: correct kconfig option

Quoted 5 lines · Paolo Bonzini

From: Marc-André Lureau <[email protected]>

Message-Id: <[email protected]>

Not a big deal bug I reviewed this one:
https://lists.gnu.org/archive/html/qemu-devel/2019-07/msg05128.html
(wondering if patchwork/patchew is loosing mails/tags).

Quoted 18 lines
---
 docs/devel/kconfig.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docs/devel/kconfig.rst +1 -1
index d6f8eb0977..b7bca44704 100644
@@ -267,7 +267,7 @@ the default configuration by uncommenting lines in the first group,
 or commenting out lines in the second group.
 
 It is also possible to run QEMU's configure script with the
-``--with-default-devices`` option.  When this is done, everything defaults
+``--without-default-devices`` option.  When this is done, everything defaults
 to ``n`` unless it is ``select``ed or explicitly switched on in the
 ``.mak`` files.  In other words, ``default`` and ``imply`` directives
 are disabled.  When QEMU is built with this option, the user will probably
#4 lore raw

Re: [Qemu-devel] [PULL 3/3] docs: correct kconfig option

Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Paolo Bonzini

From: Marc-André Lureau <[email protected]>

Message-Id: <[email protected]>

Not a big deal bug I reviewed this one:
https://lists.gnu.org/archive/html/qemu-devel/2019-07/msg05128.html
(wondering if patchwork/patchew is loosing mails/tags).

No, I just applied it before your review.

Paolo

Quoted 18 lines
Quoted 18 lines
---
 docs/devel/kconfig.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docs/devel/kconfig.rst +1 -1
index d6f8eb0977..b7bca44704 100644
@@ -267,7 +267,7 @@ the default configuration by uncommenting lines in the first group,
 or commenting out lines in the second group.
 
 It is also possible to run QEMU's configure script with the
-``--with-default-devices`` option.  When this is done, everything defaults
+``--without-default-devices`` option.  When this is done, everything defaults
 to ``n`` unless it is ``select``ed or explicitly switched on in the
 ``.mak`` files.  In other words, ``default`` and ``imply`` directives
 are disabled.  When QEMU is built with this option, the user will probably
#5 lore raw

[Qemu-devel] [PULL 2/3] i386/kvm: Do not sync nested state during runtime

In reply to Paolo Bonzini

From: Jan Kiszka <[email protected]>

Writing the nested state e.g. after a vmport access can invalidate important parts of the kernel-internal state, and it is not needed as well. So leave this out from KVM_PUT_RUNTIME_STATE.

Message-Id: <[email protected]>

---
 target/i386/kvm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
target/i386/kvm.c +5 -5
index ada89d27cc..dbbb13772a 100644
@@ -3563,12 +3563,12 @@ int kvm_arch_put_registers(CPUState *cpu, int level)
 
     assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu));
 
-    ret = kvm_put_nested_state(x86_cpu);
-    if (ret < 0) {
-        return ret;
-    }
-
     if (level >= KVM_PUT_RESET_STATE) {
+        ret = kvm_put_nested_state(x86_cpu);
+        if (ret < 0) {
+            return ret;
+        }
+
         ret = kvm_put_msr_feature_control(x86_cpu);
         if (ret < 0) {
             return ret;
Signature · 1 line
2.21.0
#6 lore raw
In reply to Paolo Bonzini
Quoted 20 lines · Paolo Bonzini

The following changes since commit 23da9e297b4120ca9702cabec91599a44255fe96:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190722' into staging (2019-07-22 15:16:48 +0100)

are available in the Git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 6baabe5cf8d42ce6bc542fb3ec0bfc10c0ee6c5e:

docs: correct kconfig option (2019-07-24 11:21:59 +0200)

----------------------------------------------------------------
Two more bugfix patches + 1 doc fix.

----------------------------------------------------------------
Jan Kiszka (1):
i386/kvm: Do not sync nested state during runtime

Quoted 5 lines

Marc-André Lureau (1):
docs: correct kconfig option

Zhengui li (1):
virtio-scsi: fixed virtio_scsi_ctx_check failed when detaching scsi disk

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.

-- PMM