qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] d79df2: blockjob: avoid recursive AioContext


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] d79df2: blockjob: avoid recursive AioContext locking
Date: Thu, 23 Mar 2017 05:45:11 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: d79df2a2ceb3cb0771146587e9a4bfb312577f46
      
https://github.com/qemu/qemu/commit/d79df2a2ceb3cb0771146587e9a4bfb312577f46
  Author: Paolo Bonzini <address@hidden>
  Date:   2017-03-22 (Wed, 22 Mar 2017)

  Changed paths:
    M blockjob.c

  Log Message:
  -----------
  blockjob: avoid recursive AioContext locking

Streaming or any other block job hangs when performed on a block device
that has a non-default iothread.  This happens because the AioContext
is acquired twice by block_job_defer_to_main_loop_bh and then released
only once by BDRV_POLL_WHILE.  (Insert rants on recursive mutexes, which
unfortunately are a temporary but necessary evil for iothreads at the
moment).

Luckily, the reason for the double acquisition is simple; the function
acquires the AioContext for both the job iothread and the BDS iothread,
in case the BDS iothread was changed while the job was running.  It
is therefore enough to skip the second acquisition when the two
AioContexts are one and the same.

Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Message-id: address@hidden
Signed-off-by: Jeff Cody <address@hidden>


  Commit: e3796a245ad0efa65ca8d2dc6424562a8fbaeb6a
      
https://github.com/qemu/qemu/commit/e3796a245ad0efa65ca8d2dc6424562a8fbaeb6a
  Author: John Snow <address@hidden>
  Date:   2017-03-22 (Wed, 22 Mar 2017)

  Changed paths:
    M blockjob.c

  Log Message:
  -----------
  blockjob: add block_job_start_shim

The purpose of this shim is to allow us to pause pre-started jobs.
The purpose of *that* is to allow us to buffer a pause request that
will be able to take effect before the job ever does any work, allowing
us to create jobs during a quiescent state (under which they will be
automatically paused), then resuming the jobs after the critical section
in any order, either:

(1) -block_job_start
    -block_job_resume (via e.g. drained_end)

(2) -block_job_resume (via e.g. drained_end)
    -block_job_start

The problem that requires a startup wrapper is the idea that a job must
start in the busy=true state only its first time-- all subsequent entries
require busy to be false, and the toggling of this state is otherwise
handled during existing pause and yield points.

The wrapper simply allows us to mandate that a job can "start," set busy
to true, then immediately pause only if necessary. We could avoid
requiring a wrapper, but all jobs would need to do it, so it's been
factored out here.

Signed-off-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Message-id: address@hidden
Signed-off-by: Jeff Cody <address@hidden>


  Commit: f4d9cc88ee69a5b04a843424e50f466e36fcad4e
      
https://github.com/qemu/qemu/commit/f4d9cc88ee69a5b04a843424e50f466e36fcad4e
  Author: John Snow <address@hidden>
  Date:   2017-03-22 (Wed, 22 Mar 2017)

  Changed paths:
    M block/block-backend.c
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: add drained_begin / drained_end ops

Allow block backends to forward drain requests to their devices/users.
The initial intended purpose for this patch is to allow BBs to forward
requests along to BlockJobs, which will want to pause if their associated
BB has entered a drained region.

Signed-off-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Message-id: address@hidden
Signed-off-by: Jeff Cody <address@hidden>


  Commit: 600ac6a0ef5c06418446ef2f37407bddcc51b21c
      
https://github.com/qemu/qemu/commit/600ac6a0ef5c06418446ef2f37407bddcc51b21c
  Author: John Snow <address@hidden>
  Date:   2017-03-22 (Wed, 22 Mar 2017)

  Changed paths:
    M blockjob.c

  Log Message:
  -----------
  blockjob: add devops to blockjob backends

This lets us hook into drained_begin and drained_end requests from the
backend level, which is particularly useful for making sure that all
jobs associated with a particular node (whether the source or the target)
receive a drain request.

Suggested-by: Kevin Wolf <address@hidden>
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Message-id: address@hidden
Signed-off-by: Jeff Cody <address@hidden>


  Commit: e6ebebc204bfb467fba008d6ead5a228508b65ac
      
https://github.com/qemu/qemu/commit/e6ebebc204bfb467fba008d6ead5a228508b65ac
  Author: Peter Maydell <address@hidden>
  Date:   2017-03-23 (Thu, 23 Mar 2017)

  Changed paths:
    M block/block-backend.c
    M blockjob.c
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into 
staging

# gpg: Signature made Wed 22 Mar 2017 17:28:56 GMT
# gpg:                using RSA key 0xBDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <address@hidden>"
# gpg:                 aka "Jeffrey Cody <address@hidden>"
# gpg:                 aka "Jeffrey Cody <address@hidden>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* remotes/cody/tags/block-pull-request:
  blockjob: add devops to blockjob backends
  block-backend: add drained_begin / drained_end ops
  blockjob: add block_job_start_shim
  blockjob: avoid recursive AioContext locking

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/2077cabcac3e...e6ebebc204bf

reply via email to

[Prev in Thread] Current Thread [Next in Thread]