Skip to content
Snippets Groups Projects
  1. Apr 21, 2022
  2. Oct 02, 2021
  3. Aug 05, 2021
  4. May 02, 2021
  5. Mar 18, 2021
  6. Mar 15, 2021
  7. Feb 15, 2021
    • Kevin Wolf's avatar
      monitor: Fix assertion failure on shutdown · c81219a7
      Kevin Wolf authored
      
      Commit 357bda95 already tried to fix the order in monitor_cleanup() by
      moving shutdown of the dispatcher coroutine further to the start.
      However, it didn't go far enough:
      
      iothread_stop() makes sure that all pending work (bottom halves) in the
      AioContext of the monitor iothread is completed. iothread_destroy()
      depends on this and fails an assertion if there is still a pending BH.
      
      While the dispatcher coroutine is running, it will try to resume the
      monitor after taking a request out of the queue, which involves a BH.
      The dispatcher is run until it terminates in the AIO_WAIT_WHILE() loop.
      However, adding new BHs between iothread_stop() and iothread_destroy()
      is forbidden.
      
      Fix this by stopping the dispatcher first before shutting down the other
      parts of the monitor. This means we can now receive requests that aren't
      handled any more when QEMU is shutting down, but this is unlikely to be
      a problem for QMP clients.
      
      Fixes: 357bda95
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20210212172028.288825-2-kwolf@redhat.com>
      Tested-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      c81219a7
  8. Dec 19, 2020
  9. Oct 15, 2020
    • Kevin Wolf's avatar
      monitor: Fix order in monitor_cleanup() · 357bda95
      Kevin Wolf authored
      
      We can only destroy Monitor objects after we're sure that they are not
      in use by the dispatcher coroutine any more. This fixes crashes like the
      following where we tried to destroy a monitor mutex while the dispatcher
      coroutine still holds it:
      
       (gdb) bt
       #0  0x00007fe541cf4bc5 in raise () at /lib64/libc.so.6
       #1  0x00007fe541cdd8a4 in abort () at /lib64/libc.so.6
       #2  0x000055c24e965327 in error_exit (err=16, msg=0x55c24eead3a0 <__func__.33> "qemu_mutex_destroy") at ../util/qemu-thread-posix.c:37
       #3  0x000055c24e9654c3 in qemu_mutex_destroy (mutex=0x55c25133e0f0) at ../util/qemu-thread-posix.c:70
       #4  0x000055c24e7cfaf1 in monitor_data_destroy_qmp (mon=0x55c25133dfd0) at ../monitor/qmp.c:439
       #5  0x000055c24e7d23bc in monitor_data_destroy (mon=0x55c25133dfd0) at ../monitor/monitor.c:615
       #6  0x000055c24e7d253a in monitor_cleanup () at ../monitor/monitor.c:644
       #7  0x000055c24e6cb002 in qemu_cleanup () at ../softmmu/vl.c:4549
       #8  0x000055c24e0d259b in main (argc=24, argv=0x7ffff66b0d58, envp=0x7ffff66b0e20) at ../softmmu/main.c:51
      
      Reported-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20201013125027.41003-1-kwolf@redhat.com>
      Tested-by: default avatarBen Widawsky <ben.widawsky@intel.com>
      Tested-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      357bda95
  10. Oct 09, 2020
  11. Sep 23, 2020
    • Stefan Hajnoczi's avatar
      qemu/atomic.h: rename atomic_ to qatomic_ · d73415a3
      Stefan Hajnoczi authored
      
      clang's C11 atomic_fetch_*() functions only take a C11 atomic type
      pointer argument. QEMU uses direct types (int, etc) and this causes a
      compiler error when a QEMU code calls these functions in a source file
      that also included <stdatomic.h> via a system header file:
      
        $ CC=clang CXX=clang++ ./configure ... && make
        ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      
      Avoid using atomic_*() names in QEMU's atomic.h since that namespace is
      used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h
      and <stdatomic.h> can co-exist. I checked /usr/include on my machine and
      searched GitHub for existing "qatomic_" users but there seem to be none.
      
      This patch was generated using:
      
        $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \
          sort -u >/tmp/changed_identifiers
        $ for identifier in $(</tmp/changed_identifiers); do
              sed -i "s%\<$identifier\>%q$identifier%g" \
                  $(git grep -I -l "\<$identifier\>")
          done
      
      I manually fixed line-wrap issues and misaligned rST tables.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
      d73415a3
  12. Jul 10, 2020
  13. Jul 03, 2020
    • David Hildenbrand's avatar
      virtio-pci: Send qapi events when the virtio-mem size changes · 722a3c78
      David Hildenbrand authored
      
      Let's register the notifier and trigger the qapi event with the right
      device id.
      
      MEMORY_DEVICE_SIZE_CHANGE is similar to BALLOON_CHANGE, however on a
      memory device level.
      
      Don't unregister the notifier (we neither have finalize() nor unrealize()
      for VirtIOPCIProxy, so it's not that simple to do it) - both devices are
      expected to vanish at the same time.
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-18-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      722a3c78
  14. Mar 06, 2020
  15. Feb 17, 2020
  16. Aug 16, 2019
    • Markus Armbruster's avatar
      Clean up inclusion of sysemu/sysemu.h · d5938f29
      Markus Armbruster authored
      
      In my "build everything" tree, changing sysemu/sysemu.h triggers a
      recompile of some 5400 out of 6600 objects (not counting tests and
      objects that don't depend on qemu/osdep.h).
      
      Almost a third of its inclusions are actually superfluous.  Delete
      them.  Downgrade two more to qapi/qapi-types-run-state.h, and move one
      from char/serial.h to char/serial.c.
      
      hw/semihosting/config.c, monitor/monitor.c, qdev-monitor.c, and
      stubs/semihost.c define variables declared in sysemu/sysemu.h without
      including it.  The compiler is cool with that, but include it anyway.
      
      This doesn't reduce actual use much, as it's still included into
      widely included headers.  The next commit will tackle that.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Message-Id: <20190812052359.30071-27-armbru@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      d5938f29
  17. Jun 18, 2019
Loading