All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/1] target-arm queue
@ 2022-08-09 12:13 Peter Maydell
  2022-08-09 12:13 ` [PULL 1/1] icount: Take iothread lock when running QEMU timers Peter Maydell
  2022-08-09 19:17 ` [PULL 0/1] target-arm queue Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2022-08-09 12:13 UTC (permalink / raw)
  To: qemu-devel

Just one bugfix patch for this rc:

The following changes since commit ca5f3d4df1b47d7f66a109cdb504e83dfd7ec433:

  Merge tag 'pull-la-20220808' of https://gitlab.com/rth7680/qemu into staging (2022-08-08 19:51:12 -0700)

are available in the Git repository at:

  https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220809

for you to fetch changes up to c7f26ded6d5065e4116f630f6a490b55f6c5f58e:

  icount: Take iothread lock when running QEMU timers (2022-08-09 10:55:14 +0100)

----------------------------------------------------------------
target-arm queue:
 * icount: Take iothread lock when running QEMU timers

----------------------------------------------------------------
Peter Maydell (1):
      icount: Take iothread lock when running QEMU timers

 accel/tcg/tcg-accel-ops-icount.c | 6 ++++++
 1 file changed, 6 insertions(+)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PULL 1/1] icount: Take iothread lock when running QEMU timers
  2022-08-09 12:13 [PULL 0/1] target-arm queue Peter Maydell
@ 2022-08-09 12:13 ` Peter Maydell
  2022-08-09 19:17 ` [PULL 0/1] target-arm queue Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2022-08-09 12:13 UTC (permalink / raw)
  To: qemu-devel

The function icount_prepare_for_run() is called with the iothread
unlocked, but it can call icount_notify_aio_contexts() which will
run qemu timer handlers. Those are supposed to be run only with
the iothread lock held, so take the lock while we do that.

Since icount mode runs everything on a single thread anyway,
not holding the lock is likely mostly not going to introduce
races, but it can cause us to trip over assertions that we
do hold the lock, such as the one reported in issue 1130.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1130
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Message-id: 20220801164527.3134765-1-peter.maydell@linaro.org
---
 accel/tcg/tcg-accel-ops-icount.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/accel/tcg/tcg-accel-ops-icount.c b/accel/tcg/tcg-accel-ops-icount.c
index 8f1dda4344c..84cc7421be8 100644
--- a/accel/tcg/tcg-accel-ops-icount.c
+++ b/accel/tcg/tcg-accel-ops-icount.c
@@ -109,7 +109,13 @@ void icount_prepare_for_run(CPUState *cpu)
     replay_mutex_lock();
 
     if (cpu->icount_budget == 0) {
+        /*
+         * We're called without the iothread lock, so must take it while
+         * we're calling timer handlers.
+         */
+        qemu_mutex_lock_iothread();
         icount_notify_aio_contexts();
+        qemu_mutex_unlock_iothread();
     }
 }
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PULL 0/1] target-arm queue
  2022-08-09 12:13 [PULL 0/1] target-arm queue Peter Maydell
  2022-08-09 12:13 ` [PULL 1/1] icount: Take iothread lock when running QEMU timers Peter Maydell
@ 2022-08-09 19:17 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2022-08-09 19:17 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel

On 8/9/22 05:13, Peter Maydell wrote:
> Just one bugfix patch for this rc:
> 
> The following changes since commit ca5f3d4df1b47d7f66a109cdb504e83dfd7ec433:
> 
>    Merge tag 'pull-la-20220808' of https://gitlab.com/rth7680/qemu into staging (2022-08-08 19:51:12 -0700)
> 
> are available in the Git repository at:
> 
>    https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220809
> 
> for you to fetch changes up to c7f26ded6d5065e4116f630f6a490b55f6c5f58e:
> 
>    icount: Take iothread lock when running QEMU timers (2022-08-09 10:55:14 +0100)
> 
> ----------------------------------------------------------------
> target-arm queue:
>   * icount: Take iothread lock when running QEMU timers

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.


r~


> 
> ----------------------------------------------------------------
> Peter Maydell (1):
>        icount: Take iothread lock when running QEMU timers
> 
>   accel/tcg/tcg-accel-ops-icount.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-09 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-09 12:13 [PULL 0/1] target-arm queue Peter Maydell
2022-08-09 12:13 ` [PULL 1/1] icount: Take iothread lock when running QEMU timers Peter Maydell
2022-08-09 19:17 ` [PULL 0/1] target-arm queue Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.