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: b300c1344654
Choose a base ref
...
head repository: qemu/qemu
compare: 6ad2c71c2381
Choose a head ref
  • 18 commits
  • 12 files changed
  • 5 contributors

Commits on May 25, 2023

  1. target/i386: EPYC-Rome model without XSAVES

    Based on the kernel commit "b0563468ee x86/CPU/AMD: Disable XSAVES on
    AMD family 0x17", host system with EPYC-Rome can clear XSAVES capability
    bit. In another words, EPYC-Rome host without XSAVES can occur. Thus, we
    need an EPYC-Rome cpu model (without this feature) that matches the
    solution of fixing this erratum
    
    Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru>
    Message-Id: <20230524213748.8918-1-davydov-max@yandex-team.ru>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Maksim Davydov authored and bonzini committed May 25, 2023
    Copy the full SHA
    fb00aa6 View commit details
    Browse the repository at this point in the history
  2. meson.build: Fix glib -Wno-unused-function workaround

    We want to only enable '-Wno-unused-function' if glib's version is
    smaller than '2.57.2' and has a G_DEFINE_AUTOPTR_CLEANUP_FUNC()
    implementation that doesn't take into account unused functions. But the
    compilation test isn't working as intended as '-Wunused-function' isn't
    enabled while running it.
    
    Let's enable it.
    
    Fixes: fc9a809 ("build: move glib detection and workarounds to meson")
    Signed-off-by: Nicolas Saenz Julienne <nsaenz@amazon.com>
    
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230524173123.66483-1-nsaenz@amazon.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Nicolas Saenz Julienne authored and bonzini committed May 25, 2023
    Copy the full SHA
    f49d883 View commit details
    Browse the repository at this point in the history
  3. meson: fix rule for qemu-ga installer

    The bindir variable is not available in the "glib" variable, which is an internal
    dependency (created with "declare_dependency").  Use glib_pc instead, which contains
    the variable as it is instantiated from glib-2.0.pc.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    91a2e68 View commit details
    Browse the repository at this point in the history
  4. meson: move -no-pie from linker to compiler

    The large comment in the patch says it all; the -no-pie flag is broken and
    this is why it was not included in QEMU_LDFLAGS before commit a988b4c
    ("build: move remaining compiler flag tests to meson", 2023-05-18).  And
    some distros made things even worse, so we have to add it to the compiler
    command line.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1664
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    b03fcd6 View commit details
    Browse the repository at this point in the history
  5. usb/ohci: Set pad to 0 after frame update

    When the OHCI controller's framenumber is incremented, HccaPad1 register
    should be set to zero (Ref OHCI Spec 4.4)
    
    ReactOS uses hccaPad1 to determine if the OHCI hardware is running,
    consequently it fails this check in current qemu master.
    
    Signed-off-by: Ryan Wendland <wendland@live.com.au>
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1048
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    6301460 View commit details
    Browse the repository at this point in the history
  6. softmmu/ioport.c: allocate MemoryRegionPortioList ports on the heap

    In order to facilitate a conversion of MemoryRegionPortioList to a QOM object
    move the allocation of MemoryRegionPortioList ports to the heap instead of
    using a variable-length member at the end of the MemoryRegionPortioList
    structure.
    
    Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230419151652.362717-2-mark.cave-ayland@ilande.co.uk>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    mcayland authored and bonzini committed May 25, 2023
    Copy the full SHA
    d2f07b7 View commit details
    Browse the repository at this point in the history
  7. softmmu/ioport.c: QOMify MemoryRegionPortioList

    The aim of QOMification is so that the lifetime of the MemoryRegionPortioList
    structure can be managed using QOM's in-built refcounting instead of having to
    handle this manually.
    
    Due to the use of an opaque pointer it isn't possible to model the new
    TYPE_MEMORY_REGION_PORTIO_LIST directly using QOM properties, however since
    use of the new object is restricted to the portio API we can simply set the
    opaque pointer (and the heap-allocated port list) internally.
    
    Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230419151652.362717-3-mark.cave-ayland@ilande.co.uk>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    mcayland authored and bonzini committed May 25, 2023
    Copy the full SHA
    2877068 View commit details
    Browse the repository at this point in the history
  8. softmmu/ioport.c: make MemoryRegionPortioList owner of portio_list Me…

    …moryRegions
    
    Currently when portio_list MemoryRegions are freed using portio_list_destroy() the RCU
    thread segfaults generating a backtrace similar to that below:
    
        #0 0x5555599a34b6 in phys_section_destroy ../softmmu/physmem.c:996
        #1 0x5555599a37a3 in phys_sections_free ../softmmu/physmem.c:1011
        #2 0x5555599b24aa in address_space_dispatch_free ../softmmu/physmem.c:2430
        #3 0x55555996a283 in flatview_destroy ../softmmu/memory.c:292
        #4 0x55555a2cb9fb in call_rcu_thread ../util/rcu.c:284
        #5 0x55555a29b71d in qemu_thread_start ../util/qemu-thread-posix.c:541
        #6 0x7ffff4a0cea6 in start_thread nptl/pthread_create.c:477
        #7 0x7ffff492ca2e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xfca2e)
    
    The problem here is that portio_list_destroy() unparents the portio_list
    MemoryRegions causing them to be freed immediately, however the flatview
    still has a reference to the MemoryRegion and so causes a use-after-free
    segfault when the RCU thread next updates the flatview.
    
    Solve the lifetime issue by making MemoryRegionPortioList the owner of the
    portio_list MemoryRegions, and then reparenting them to the portio_list
    owner. This ensures that they can be accessed as QOM children via the
    portio_list owner, yet the MemoryRegionPortioList owns the refcount.
    
    Update portio_list_destroy() to unparent the MemoryRegion from the
    portio_list owner (while keeping mrpio->mr live until finalization of the
    MemoryRegionPortioList), so that the portio_list MemoryRegions remain
    allocated until flatview_destroy() removes the final refcount upon the
    next flatview update.
    
    Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230419151652.362717-4-mark.cave-ayland@ilande.co.uk>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    mcayland authored and bonzini committed May 25, 2023
    Copy the full SHA
    690705c View commit details
    Browse the repository at this point in the history
  9. monitor: use QEMU_LOCK_GUARD a bit more

    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    e37548e View commit details
    Browse the repository at this point in the history
  10. monitor: allow calling monitor_resume under mon_lock

    Move monitor_resume()'s call to readline_show_prompt() outside the
    potentially locked section.  Reuse the existing monitor_accept_input()
    bottom half for this purpose.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    c5d0c55 View commit details
    Browse the repository at this point in the history
  11. monitor: add more *_locked() functions

    Allow flushing and printing to the monitor while mon->mon_lock is
    held.  This will help cleaning up the locking of mon->mux_out and
    mon->suspend_cnt.
    
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    4cb96b9 View commit details
    Browse the repository at this point in the history
  12. monitor: do not use mb_read/mb_set for suspend_cnt

    Clean up monitor_event to just use monitor_suspend/monitor_resume,
    using mon->mux_out to protect against incorrect nesting (especially
    on startup).
    
    The only remaining case of reading suspend_cnt is in the can_read
    callback, which is just advisory and can use qatomic_read.
    
    As an extra benefit, mux_out is now simply protected by mon_lock.
    Also, moving the prompt to the beginning of the main loop removes
    it from the output in some error cases where QEMU does not actually
    start successfully.  It is not a full fix and it would be nice to
    also remove the monitor heading, but this is already a small (though
    unintentional) improvement.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    6ee7c82 View commit details
    Browse the repository at this point in the history
  13. monitor: cleanup detection of qmp_dispatcher_co shutting down

    Instead of overloading qmp_dispatcher_co_busy, make the coroutine
    pointer NULL.  This will make things break spectacularly if somebody
    tries to start a request after monitor_cleanup().
    
    AIO_WAIT_WHILE_UNLOCKED() does not need qatomic_mb_read(), because
    the macro contains all the necessary memory barriers.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    3e6bed6 View commit details
    Browse the repository at this point in the history
  14. monitor: cleanup fetching of QMP requests

    Use a continue statement so that "after going to sleep" is treated the same
    way as "after processing a request".  Pull the monitor_lock critical
    section out of monitor_qmp_requests_pop_any_with_lock() and protect
    qmp_dispatcher_co_shutdown with the monitor_lock.
    
    The two changes are complex to separate because monitor_qmp_dispatcher_co()
    previously had a complicated logic to check for shutdown both before
    and after going to sleep.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    0ff2553 View commit details
    Browse the repository at this point in the history
  15. monitor: introduce qmp_dispatcher_co_wake

    This makes it possible to turn qmp_dispatcher_co_busy into a static
    variable.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    9f2d585 View commit details
    Browse the repository at this point in the history
  16. monitor: extract request dequeuing to a new function

    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    60f4f62 View commit details
    Browse the repository at this point in the history
  17. monitor: do not use mb_read/mb_set

    Instead of relying on magic memory barriers, document the pattern that
    is being used.  It is the one based on Dekker's algorithm, and in this
    case it is embodied as follows:
    
        enqueue request;              sleeping = true;
        smp_mb();                     smp_mb();
        if (sleeping) kick();         if (!have a request) yield();
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed May 25, 2023
    Copy the full SHA
    eea7cd3 View commit details
    Browse the repository at this point in the history
  18. Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

    * hot-unplug fixes for ioport
    * purge qatomic_mb_read/set from monitor
    * build system fixes
    * OHCI fix from gitlab
    * provide EPYC-Rome CPU model not susceptible to XSAVES erratum
    
    # -----BEGIN PGP SIGNATURE-----
    #
    # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmRvGpEUHHBib256aW5p
    # QHJlZGhhdC5jb20ACgkQv/vSX3jHroOa/Af/WS5/tmIlEYgH7UOPERQXNqf7+Jwj
    # bA2wgqv3ZoQwcgp5f4EVjfA8ABfpGxLZy6xIdUSbWANb8lDJNuh/nPd/em3rWUAU
    # LnJGGdo1vF31gfsVQnlzb7hJi3ur+e2f8JqkRVskDCk3a7YY44OCN42JdKWLrN9u
    # CFf2zYqxMqXHjrYrY0Kx2oTkfGDZrfwUlx0vM4dHb8IEoxaplfDd8lJXQzjO4htr
    # 3nPBPjQ+h08EeC7mObH4XoJE0omzovR10GkBo8K4q952xGOQ041Y/2YY7JwLfx0D
    # na7IanVo+ZAmvTJZoJFSBwNnXkTMHvDH5+Hc45NSTsDBtz0YJhRxPw/z/A==
    # =A5Lp
    # -----END PGP SIGNATURE-----
    # gpg: Signature made Thu 25 May 2023 01:21:37 AM PDT
    # gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
    # gpg:                issuer "pbonzini@redhat.com"
    # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [undefined]
    # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [undefined]
    # gpg: WARNING: This key is not certified with a trusted signature!
    # gpg:          There is no indication that the signature belongs to the owner.
    # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
    #      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83
    
    * tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
      monitor: do not use mb_read/mb_set
      monitor: extract request dequeuing to a new function
      monitor: introduce qmp_dispatcher_co_wake
      monitor: cleanup fetching of QMP requests
      monitor: cleanup detection of qmp_dispatcher_co shutting down
      monitor: do not use mb_read/mb_set for suspend_cnt
      monitor: add more *_locked() functions
      monitor: allow calling monitor_resume under mon_lock
      monitor: use QEMU_LOCK_GUARD a bit more
      softmmu/ioport.c: make MemoryRegionPortioList owner of portio_list MemoryRegions
      softmmu/ioport.c: QOMify MemoryRegionPortioList
      softmmu/ioport.c: allocate MemoryRegionPortioList ports on the heap
      usb/ohci: Set pad to 0 after frame update
      meson: move -no-pie from linker to compiler
      meson: fix rule for qemu-ga installer
      meson.build: Fix glib -Wno-unused-function workaround
      target/i386: EPYC-Rome model without XSAVES
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed May 25, 2023
    Copy the full SHA
    6ad2c71 View commit details
    Browse the repository at this point in the history