Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qemu/qemu
base: 143b3619bbe8
Choose a base ref
...
head repository: qemu/qemu
compare: d156cbd78536
Choose a head ref
  • 10 commits
  • 12 files changed
  • 9 contributors

Commits on May 15, 2023

  1. async: Suppress GCC13 false positive in aio_bh_poll()

    GCC13 reports an error :
    
    ../util/async.c: In function ‘aio_bh_poll’:
    include/qemu/queue.h:303:22: error: storing the address of local variable ‘slice’ in ‘*ctx.bh_slice_list.sqh_last’ [-Werror=dangling-pointer=]
      303 |     (head)->sqh_last = &(elm)->field.sqe_next;                          \
          |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
    ../util/async.c:169:5: note: in expansion of macro ‘QSIMPLEQ_INSERT_TAIL’
      169 |     QSIMPLEQ_INSERT_TAIL(&ctx->bh_slice_list, &slice, next);
          |     ^~~~~~~~~~~~~~~~~~~~
    ../util/async.c:161:17: note: ‘slice’ declared here
      161 |     BHListSlice slice;
          |                 ^~~~~
    ../util/async.c:161:17: note: ‘ctx’ declared here
    
    But the local variable 'slice' is removed from the global context list
    in following loop of the same routine. Add a pragma to silent GCC.
    
    Cc: Stefan Hajnoczi <stefanha@redhat.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Daniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: Cédric Le Goater <clg@redhat.com>
    Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
    Message-Id: <20230420202939.1982044-1-clg@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit d66ba6d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (Mjt: cherry-picked to stable-7.2 to eliminate CI failures on win*)
    legoater authored and Michael Tokarev committed May 15, 2023
    Copy the full SHA
    acf607c View commit details
    Browse the repository at this point in the history
  2. tcg: ppc64: Fix mask generation for vextractdm

    In function do_extractm() the mask is calculated as
    dup_const(1 << (element_width - 1)). '1' being signed int
    works fine for MO_8,16,32. For MO_64, on PPC64 host
    this ends up becoming 0 on compilation. The vextractdm
    uses MO_64, and it ends up having mask as 0.
    
    Explicitly use 1ULL instead of signed int 1 like its
    used everywhere else.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1536
    Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Reviewed-by: Lucas Mateus Castro <lucas.araujo@eldorado.org.br>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Message-Id: <168319292809.1159309.5817546227121323288.stgit@ltc-boston1.aus.stglabs.ibm.com>
    Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
    (cherry picked from commit 6a5d81b)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    ShivaprasadGBhat authored and Michael Tokarev committed May 15, 2023
    Copy the full SHA
    78ddc7d View commit details
    Browse the repository at this point in the history
  3. hw/virtio/vhost-user: avoid using unitialized errp

    During protocol negotiation, when we the QEMU
    stub does not support a backend with F_CONFIG,
    it throws a warning and supresses the
    VHOST_USER_PROTOCOL_F_CONFIG bit.
    
    However, the warning uses warn_reportf_err macro
    and passes an unitialized errp pointer. However,
    the macro tries to edit the 'msg' member of the
    unitialized Error and segfaults.
    
    Instead, just use warn_report, which prints a
    warning message directly to the output.
    
    Fixes: 5653493 ("hw/virtio/vhost-user: don't suppress F_CONFIG when supported")
    Signed-off-by: Albert Esteve <aesteve@redhat.com>
    Message-Id: <20230302121719.9390-1-aesteve@redhat.com>
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 90e3123)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    aesteve-rh authored and Michael Tokarev committed May 15, 2023
    Copy the full SHA
    89137d1 View commit details
    Browse the repository at this point in the history
  4. virtio: fix reachable assertion due to stale value of cached region size

    In virtqueue_{split,packed}_get_avail_bytes() descriptors are read
    in a loop via MemoryRegionCache regions and calls to
    vring_{split,packed}_desc_read() - these take a region cache and the
    index of the descriptor to be read.
    
    For direct descriptors we use a cache provided by the caller, whose
    size matches that of the virtqueue vring. We limit the number of
    descriptors we can read by the size of that vring:
    
        max = vq->vring.num;
        ...
        MemoryRegionCache *desc_cache = &caches->desc;
    
    For indirect descriptors, we initialize a new cache and limit the
    number of descriptors by the size of the intermediate descriptor:
    
        len = address_space_cache_init(&indirect_desc_cache,
                                       vdev->dma_as,
                                       desc.addr, desc.len, false);
        desc_cache = &indirect_desc_cache;
        ...
        max = desc.len / sizeof(VRingDesc);
    
    However, the first initialization of `max` is done outside the loop
    where we process guest descriptors, while the second one is done
    inside. This means that a sequence of an indirect descriptor followed
    by a direct one will leave a stale value in `max`. If the second
    descriptor's `next` field is smaller than the stale value, but
    greater than the size of the virtqueue ring (and thus the cached
    region), a failed assertion will be triggered in
    address_space_read_cached() down the call chain.
    
    Fix this by initializing `max` inside the loop in both functions.
    
    Fixes: 9796d0a ("virtio: use address_space_map/unmap to access descriptors")
    Signed-off-by: Carlos López <clopez@suse.de>
    Message-Id: <20230302100358.3613-1-clopez@suse.de>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit bbc1c32)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    00xc authored and Michael Tokarev committed May 15, 2023
    Copy the full SHA
    6f80264 View commit details
    Browse the repository at this point in the history
  5. block/monitor: Fix crash when executing HMP commit

    hmp_commit() calls blk_is_available() from a non-coroutine context (and
    in the main loop). blk_is_available() is a co_wrapper_mixed_bdrv_rdlock
    function, and in the non-coroutine context it calls AIO_WAIT_WHILE(),
    which crashes if the aio_context lock is not taken before.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1615
    Signed-off-by: Wang Liang <wangliangzz@inspur.com>
    Message-Id: <20230424103902.45265-1-wangliangzz@126.com>
    Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
    Reviewed-by: Kevin Wolf <kwolf@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 8c1e8fb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Wang Liang authored and Michael Tokarev committed May 15, 2023
    Copy the full SHA
    ecb4635 View commit details
    Browse the repository at this point in the history

Commits on May 16, 2023

  1. target/s390x: Fix EXECUTE of relative branches

    Fix a problem similar to the one fixed by commit 703d03a
    ("target/s390x: Fix EXECUTE of relative long instructions"), but now
    for relative branches.
    
    Reported-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20230426235813.198183-2-iii@linux.ibm.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit e8ecdfe)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    iii-i authored and Michael Tokarev committed May 16, 2023
    Copy the full SHA
    c1d19d5 View commit details
    Browse the repository at this point in the history
  2. 9pfs/xen: Fix segfault on shutdown

    xen_9pfs_free can't use gnttabdev since it is already closed and NULL-ed
    out when free is called.  Do the teardown in _disconnect().  This
    matches the setup done in _connect().
    
    trace-events are also added for the XenDevOps functions.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Message-Id: <20230502143722.15613-1-jandryuk@gmail.com>
    [C.S.: - Remove redundant return in xen_9pfs_free().
           - Add comment to trace-events. ]
    Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
    (cherry picked from commit 92e667f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (Mjt: minor context conflict in hw/9pfs/xen-9p-backend.c)
    jandryuk authored and Michael Tokarev committed May 16, 2023
    Copy the full SHA
    9f41896 View commit details
    Browse the repository at this point in the history

Commits on May 17, 2023

  1. xen/pt: reserve PCI slot 2 for Intel igd-passthru

    Intel specifies that the Intel IGD must occupy slot 2 on the PCI bus,
    as noted in docs/igd-assign.txt in the Qemu source code.
    
    Currently, when the xl toolstack is used to configure a Xen HVM guest with
    Intel IGD passthrough to the guest with the Qemu upstream device model,
    a Qemu emulated PCI device will occupy slot 2 and the Intel IGD will occupy
    a different slot. This problem often prevents the guest from booting.
    
    The only available workarounds are not good: Configure Xen HVM guests to
    use the old and no longer maintained Qemu traditional device model
    available from xenbits.xen.org which does reserve slot 2 for the Intel
    IGD or use the "pc" machine type instead of the "xenfv" machine type and
    add the xen platform device at slot 3 using a command line option
    instead of patching qemu to fix the "xenfv" machine type directly. The
    second workaround causes some degredation in startup performance such as
    a longer boot time and reduced resolution of the grub menu that is
    displayed on the monitor. This patch avoids that reduced startup
    performance when using the Qemu upstream device model for Xen HVM guests
    configured with the igd-passthru=on option.
    
    To implement this feature in the Qemu upstream device model for Xen HVM
    guests, introduce the following new functions, types, and macros:
    
    * XEN_PT_DEVICE_CLASS declaration, based on the existing TYPE_XEN_PT_DEVICE
    * XEN_PT_DEVICE_GET_CLASS macro helper function for XEN_PT_DEVICE_CLASS
    * typedef XenPTQdevRealize function pointer
    * XEN_PCI_IGD_SLOT_MASK, the value of slot_reserved_mask to reserve slot 2
    * xen_igd_reserve_slot and xen_igd_clear_slot functions
    
    Michael Tsirkin:
    * Introduce XEN_PCI_IGD_DOMAIN, XEN_PCI_IGD_BUS, XEN_PCI_IGD_DEV, and
      XEN_PCI_IGD_FN - use them to compute the value of XEN_PCI_IGD_SLOT_MASK
    
    The new xen_igd_reserve_slot function uses the existing slot_reserved_mask
    member of PCIBus to reserve PCI slot 2 for Xen HVM guests configured using
    the xl toolstack with the gfx_passthru option enabled, which sets the
    igd-passthru=on option to Qemu for the Xen HVM machine type.
    
    The new xen_igd_reserve_slot function also needs to be implemented in
    hw/xen/xen_pt_stub.c to prevent FTBFS during the link stage for the case
    when Qemu is configured with --enable-xen and --disable-xen-pci-passthrough,
    in which case it does nothing.
    
    The new xen_igd_clear_slot function overrides qdev->realize of the parent
    PCI device class to enable the Intel IGD to occupy slot 2 on the PCI bus
    since slot 2 was reserved by xen_igd_reserve_slot when the PCI bus was
    created in hw/i386/pc_piix.c for the case when igd-passthru=on.
    
    Move the call to xen_host_pci_device_get, and the associated error
    handling, from xen_pt_realize to the new xen_igd_clear_slot function to
    initialize the device class and vendor values which enables the checks for
    the Intel IGD to succeed. The verification that the host device is an
    Intel IGD to be passed through is done by checking the domain, bus, slot,
    and function values as well as by checking that gfx_passthru is enabled,
    the device class is VGA, and the device vendor in Intel.
    
    Signed-off-by: Chuck Zmudzinski <brchuckz@aol.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Message-Id: <b1b4a21fe9a600b1322742dda55a40e9961daa57.1674346505.git.brchuckz@aol.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    (cherry picked from commit 4f67543)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    zmudc authored and Michael Tokarev committed May 17, 2023
    Copy the full SHA
    6af3a80 View commit details
    Browse the repository at this point in the history
  2. Revert "vhost-user: Monitor slave channel in vhost_user_read()"

    This reverts commit db8a377.
    
    Motivation : this is breaking vhost-user with DPDK as reported in [0].
    
    Received unexpected msg type. Expected 22 received 40
    Fail to update device iotlb
    Received unexpected msg type. Expected 40 received 22
    Received unexpected msg type. Expected 22 received 11
    Fail to update device iotlb
    Received unexpected msg type. Expected 11 received 22
    vhost VQ 1 ring restore failed: -71: Protocol error (71)
    Received unexpected msg type. Expected 22 received 11
    Fail to update device iotlb
    Received unexpected msg type. Expected 11 received 22
    vhost VQ 0 ring restore failed: -71: Protocol error (71)
    unable to start vhost net: 71: falling back on userspace virtio
    
    The failing sequence that leads to the first error is :
    - QEMU sends a VHOST_USER_GET_STATUS (40) request to DPDK on the master
      socket
    - QEMU starts a nested event loop in order to wait for the
      VHOST_USER_GET_STATUS response and to be able to process messages from
      the slave channel
    - DPDK sends a couple of legitimate IOTLB miss messages on the slave
      channel
    - QEMU processes each IOTLB request and sends VHOST_USER_IOTLB_MSG (22)
      updates on the master socket
    - QEMU assumes to receive a response for the latest VHOST_USER_IOTLB_MSG
      but it gets the response for the VHOST_USER_GET_STATUS instead
    
    The subsequent errors have the same root cause : the nested event loop
    breaks the order by design. It lures QEMU to expect responses to the
    latest message sent on the master socket to arrive first.
    
    Since this was only needed for DAX enablement which is still not merged
    upstream, just drop the code for now. A working solution will have to
    be merged later on. Likely protect the master socket with a mutex
    and service the slave channel with a separate thread, as discussed with
    Maxime in the mail thread below.
    
    [0] https://lore.kernel.org/qemu-devel/43145ede-89dc-280e-b953-6a2b436de395@redhat.com/
    
    Reported-by: Yanghang Liu <yanghliu@redhat.com>
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2155173
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Message-Id: <20230119172424.478268-2-groug@kaod.org>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
    Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
    (cherry picked from commit f340a59)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    gkurz authored and Michael Tokarev committed May 17, 2023
    Copy the full SHA
    4ebaba4 View commit details
    Browse the repository at this point in the history
  3. Revert "vhost-user: Introduce nested event loop in vhost_user_read()"

    This reverts commit a7f523c.
    
    The nested event loop is broken by design. It's only user was removed.
    Drop the code as well so that nobody ever tries to use it again.
    
    I had to fix a couple of trivial conflicts around return values because
    of 025faa8 ("vhost-user: stick to -errno error return convention").
    
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Message-Id: <20230119172424.478268-3-groug@kaod.org>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
    (cherry picked from commit 4382138)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    gkurz authored and Michael Tokarev committed May 17, 2023
    Copy the full SHA
    d156cbd View commit details
    Browse the repository at this point in the history