Skip to content
Snippets Groups Projects
  1. Apr 06, 2022
  2. Mar 04, 2022
    • Emanuele Giuseppe Esposito's avatar
      main-loop.h: introduce qemu_in_main_thread() · 6538692e
      Emanuele Giuseppe Esposito authored
      
      When invoked from the main loop, this function is the same
      as qemu_mutex_iothread_locked, and returns true if the BQL is held.
      When invoked from iothreads or tests, it returns true only
      if the current AioContext is the Main Loop.
      
      This essentially just extends qemu_mutex_iothread_locked to work
      also in unit tests or other users like storage-daemon, that run
      in the Main Loop but end up using the implementation in
      stubs/iothread-lock.c.
      
      Using qemu_mutex_iothread_locked in unit tests defaults to false
      because they use the implementation in stubs/iothread-lock,
      making all assertions added in next patches fail despite the
      AioContext is still the main loop.
      
      See the comment in the function header for more information.
      
      Signed-off-by: default avatarEmanuele Giuseppe Esposito <eesposit@redhat.com>
      Message-Id: <20220303151616.325444-2-eesposit@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      6538692e
  3. Jan 18, 2022
  4. Nov 04, 2021
  5. Nov 02, 2021
  6. Oct 14, 2021
  7. Sep 30, 2021
  8. Sep 04, 2021
  9. Aug 31, 2021
  10. Aug 26, 2021
  11. Jul 14, 2021
  12. Jul 09, 2021
  13. Jun 18, 2021
    • Paolo Bonzini's avatar
      async: the main AioContext is only "current" if under the BQL · 5f50be9b
      Paolo Bonzini authored
      
      If we want to wake up a coroutine from a worker thread, aio_co_wake()
      currently does not work.  In that scenario, aio_co_wake() calls
      aio_co_enter(), but there is no current AioContext and therefore
      qemu_get_current_aio_context() returns the main thread.  aio_co_wake()
      then attempts to call aio_context_acquire() instead of going through
      aio_co_schedule().
      
      The default case of qemu_get_current_aio_context() was added to cover
      synchronous I/O started from the vCPU thread, but the main and vCPU
      threads are quite different.  The main thread is an I/O thread itself,
      only running a more complicated event loop; the vCPU thread instead
      is essentially a worker thread that occasionally calls
      qemu_mutex_lock_iothread().  It is only in those critical sections
      that it acts as if it were the home thread of the main AioContext.
      
      Therefore, this patch detaches qemu_get_current_aio_context() from
      iothreads, which is a useless complication.  The AioContext pointer
      is stored directly in the thread-local variable, including for the
      main loop.  Worker threads (including vCPU threads) optionally behave
      as temporary home threads if they have taken the big QEMU lock,
      but if that is not the case they will always schedule coroutines
      on remote threads via aio_co_schedule().
      
      With this change, the stub qemu_mutex_iothread_locked() must be changed
      from true to false.  The previous value of true was needed because the
      main thread did not have an AioContext in the thread-local variable,
      but now it does have one.
      
      Reported-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20210609122234.544153-1-pbonzini@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Tested-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      [eblake: tweak commit message per Vladimir's review]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      5f50be9b
  14. Jun 15, 2021
  15. May 27, 2021
  16. May 26, 2021
  17. May 04, 2021
  18. May 02, 2021
  19. Apr 01, 2021
  20. Mar 19, 2021
  21. Mar 10, 2021
  22. Feb 16, 2021
    • Pavel Dovgalyuk's avatar
      replay: fix icount request when replaying clock access · 366a85e4
      Pavel Dovgalyuk authored
      
      Record/replay provides REPLAY_CLOCK_LOCKED macro to access
      the clock when vm_clock_seqlock is locked. This macro is
      needed because replay internals operate icount. In locked case
      replay use icount_get_raw_locked for icount request, which prevents
      excess locking which leads to deadlock. But previously only
      record code used *_locked function and replay did not.
      Therefore sometimes clock access lead to deadlocks.
      This patch fixes clock access for replay too and uses *_locked
      icount access function.
      
      Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
      Message-Id: <161347990483.1313189.8371838968343494161.stgit@pasha-ThinkPad-X280>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      366a85e4
  23. Feb 08, 2021
  24. Jan 18, 2021
  25. Dec 15, 2020
  26. Nov 16, 2020
    • David Hildenbrand's avatar
      util/vfio-helpers.c: Use ram_block_discard_disable() in qemu_vfio_open_pci() · b430b513
      David Hildenbrand authored
      
      Currently, when using "nvme://" for a block device, like
          -drive file=nvme://0000:01:00.0/1,if=none,id=drive0 \
          -device virtio-blk,drive=drive0 \
      
      VFIO may pin all guest memory, and discarding of RAM no longer works as
      expected. I was able to reproduce this easily with my
          01:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd
                  NVMe SSD Controller SM981/PM981/PM983
      
      Similar to common VFIO, we have to disable it, making sure that:
      a) virtio-balloon won't discard any memory ("silently disabled")
      b) virtio-mem and nvme:// run mutually exclusive
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Wei Yang <richardw.yang@linux.intel.com>
      Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
      Cc: Peter Xu <peterx@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20201116105947.9194-1-david@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b430b513
    • Alex Bennée's avatar
      stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub · d67ef04c
      Alex Bennée authored
      
      We should never build something that calls this without having it.
      
      Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20201110192316.26397-6-alex.bennee@linaro.org>
      d67ef04c
  27. Oct 23, 2020
    • Stefan Hajnoczi's avatar
      block: move block exports to libblockdev · cbc20bfb
      Stefan Hajnoczi authored
      
      Block exports are used by softmmu, qemu-storage-daemon, and qemu-nbd.
      They are not used by other programs and are not otherwise needed in
      libblock.
      
      Undo the recent move of blockdev-nbd.c from blockdev_ss into block_ss.
      Since bdrv_close_all() (libblock) calls blk_exp_close_all()
      (libblockdev) a stub function is required..
      
      Make qemu-nbd.c use signal handling utility functions instead of
      duplicating the code. This helps because os-posix.c is in libblockdev
      and it depends on a qemu_system_killed() symbol that qemu-nbd.c lacks.
      Once we use the signal handling utility functions we also end up
      providing the necessary symbol.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-id: 20200929125516.186715-4-stefanha@redhat.com
      [Fixed s/ndb/nbd/ typo in commit description as suggested by Eric Blake
      --Stefan]
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      cbc20bfb
  28. Oct 22, 2020
    • Claudio Fontana's avatar
      replay: do not build if TCG is not available · 9b1c9116
      Claudio Fontana authored
      
      this fixes non-TCG builds broken recently by replay reverse debugging.
      
      Stub the needed functions in stub/, splitting roughly between functions
      needed only by system emulation, by system emulation and tools,
      and by everyone.  This includes duplicating some code in replay/, and
      puts the logic for non-replay related events in the replay/ module (+
      the stubs), so this should be revisited in the future.
      
      Surprisingly, only _one_ qtest was affected by this, ide-test.c, which
      resulted in a buzz as the bh events were never delivered, and the bh
      never executed.
      
      Many other subsystems _should_ have been affected.
      
      This fixes the immediate issue, however a better way to group replay
      functionality to TCG-only code could be developed in the long term.
      
      Signed-off-by: default avatarClaudio Fontana <cfontana@suse.de>
      Message-Id: <20201013192123.22632-4-cfontana@suse.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      9b1c9116
  29. Oct 09, 2020
Loading