Skip to content
Snippets Groups Projects
  1. 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
  2. Jun 15, 2021
  3. May 27, 2021
  4. May 26, 2021
  5. May 04, 2021
  6. May 02, 2021
  7. Apr 01, 2021
  8. Mar 19, 2021
  9. Mar 10, 2021
  10. 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
  11. Feb 08, 2021
  12. Jan 18, 2021
  13. Dec 15, 2020
  14. 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
  15. 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
  16. 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
  17. Oct 09, 2020
  18. Oct 06, 2020
    • Pavel Dovgaluk's avatar
      gdbstub: add reverse continue support in replay mode · cda38259
      Pavel Dovgaluk authored
      
      This patch adds support of the reverse continue operation for gdbstub.
      Reverse continue finds the last breakpoint that would happen in normal
      execution from the beginning to the current moment.
      Implementation of the reverse continue replays the execution twice:
      to find the breakpoints that were hit and to seek to the last breakpoint.
      Reverse continue loads the previous snapshot and tries to find the breakpoint
      since that moment. If there are no such breakpoints, it proceeds to
      the earlier snapshot, and so on. When no breakpoints or watchpoints were
      hit at all, execution stops at the beginning of the replay log.
      
      Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
      Message-Id: <160174522930.12451.6994758004725016836.stgit@pasha-ThinkPad-X280>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      cda38259
    • Pavel Dovgaluk's avatar
      gdbstub: add reverse step support in replay mode · fda8458b
      Pavel Dovgaluk authored
      
      GDB remote protocol supports two reverse debugging commands:
      reverse step and reverse continue.
      This patch adds support of the first one to the gdbstub.
      Reverse step is intended to step one instruction in the backwards
      direction. This is not possible in regular execution.
      But replayed execution is deterministic, therefore we can load one of
      the prior snapshots and proceed to the desired step. It is equivalent
      to stepping one instruction back.
      There should be at least one snapshot preceding the debugged part of
      the replay log.
      
      Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      
      --
      
      v4 changes:
       - inverted condition in cpu_handle_guest_debug (suggested by Alex Bennée)
      Message-Id: <160174522341.12451.1498758422543765253.stgit@pasha-ThinkPad-X280>
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      fda8458b
    • Pavel Dovgalyuk's avatar
      migration: introduce icount field for snapshots · b39847a5
      Pavel Dovgalyuk authored
      
      Saving icount as a parameters of the snapshot allows navigation between
      them in the execution replay scenario.
      This information can be used for finding a specific snapshot for proceeding
      the recorded execution to the specific moment of the time.
      E.g., 'reverse step' action (introduced in one of the following patches)
      needs to load the nearest snapshot which is prior to the current moment
      of time.
      This patch also updates snapshot test which verifies qemu monitor output.
      
      Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
      Acked-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Acked-by: default avatarKevin Wolf <kwolf@redhat.com>
      
      --
      
      v4 changes:
       - squashed format update with test output update
      v7 changes:
       - introduced the spaces between the fields in snapshot info output
       - updated the test to match new field widths
      Message-Id: <160174518865.12451.14327573383978752463.stgit@pasha-ThinkPad-X280>
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b39847a5
  19. Oct 05, 2020
  20. Sep 30, 2020
  21. Sep 29, 2020
  22. Sep 16, 2020
  23. Sep 07, 2020
    • Thomas Huth's avatar
      stubs: Move qemu_fd_register stub to util/main-loop.c · 8c278762
      Thomas Huth authored
      
      The linker of MinGW sometimes runs into the following problem:
      
      libqemuutil.a(util_main-loop.c.obj): In function `qemu_fd_register':
      /builds/huth/qemu/build/../util/main-loop.c:331: multiple definition of
       `qemu_fd_register'
      libqemuutil.a(stubs_fd-register.c.obj):/builds/huth/qemu/stubs/fd-register.c:5:
       first defined here
      collect2: error: ld returned 1 exit status
      /builds/huth/qemu/rules.mak:88: recipe for target 'tests/test-timed-average.exe'
       failed
      
      qemu_fd_register() is defined in util/main-loop.c for WIN32, so let's simply
      move the stub also there in the #else part of the corresponding #ifndef
      to fix this problem.
      
      Message-Id: <20200903054503.425435-1-thuth@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      8c278762
    • Thomas Huth's avatar
      stubs: Move qemu_timer_notify_cb() and remove qemu_notify_event() stub · b0476d66
      Thomas Huth authored
      
      When cross-compiling with MinGW, there are sometimes some weird linker
      errors like:
      
      ibqemuutil.a(util_main-loop.c.obj): In function `qemu_notify_event':
      /builds/huth/qemu/build/../util/main-loop.c:139: multiple definition of
       `qemu_notify_event'
      libqemuutil.a(stubs_notify-event.c.obj):/builds/huth/qemu/stubs/notify-event.c:5:
       first defined here
      collect2: error: ld returned 1 exit status
      /builds/huth/qemu/rules.mak:88: recipe for target 'tests/test-timed-average.exe'
       failed
      
      It seems like it works better when the qemu_timer_notify_cb() stub (which
      calls qemu_notify_event()) is in a separate file - then we can also even
      remove the qemu_notify_event() stub now.
      
      This patch is based on ideas from the patch "stubs: Remove qemu_notify_event()"
      by Philippe Mathieu-Daudé and the patch "cpu-timers, icount: new modules" from
      Claudio Fontana.
      
      Message-Id: <20200902102433.304737-1-thuth@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      b0476d66
  24. Sep 01, 2020
Loading