[Qemu-devel] [PATCH] block: Don't acquire AioContext in hmp_qemu_io()

Kevin Wolf posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20171212134800.21836-1-kwolf@redhat.com
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
hmp.c | 6 ------
1 file changed, 6 deletions(-)
[Qemu-devel] [PATCH] block: Don't acquire AioContext in hmp_qemu_io()
Posted by Kevin Wolf 6 years, 4 months ago
Commit 15afd94a047 added code to acquire and release the AioContext in
qemuio_command(). This means that the lock is taken twice now in the
call path from hmp_qemu_io(). This causes BDRV_POLL_WHILE() to hang for
any requests issued to nodes in a non-mainloop AioContext.

Dropping the first locking from hmp_qemu_io() fixes the problem.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hmp.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/hmp.c b/hmp.c
index 35a7041824..2d72f94193 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2318,7 +2318,6 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
 {
     BlockBackend *blk;
     BlockBackend *local_blk = NULL;
-    AioContext *aio_context;
     const char* device = qdict_get_str(qdict, "device");
     const char* command = qdict_get_str(qdict, "command");
     Error *err = NULL;
@@ -2338,9 +2337,6 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
         }
     }
 
-    aio_context = blk_get_aio_context(blk);
-    aio_context_acquire(aio_context);
-
     /*
      * Notably absent: Proper permission management. This is sad, but it seems
      * almost impossible to achieve without changing the semantics and thereby
@@ -2368,8 +2364,6 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
      */
     qemuio_command(blk, command);
 
-    aio_context_release(aio_context);
-
 fail:
     blk_unref(local_blk);
     hmp_handle_error(mon, &err);
-- 
2.13.6


Re: [Qemu-devel] [Qemu-block] [PATCH] block: Don't acquire AioContext in hmp_qemu_io()
Posted by Stefan Hajnoczi 6 years, 4 months ago
On Tue, Dec 12, 2017 at 02:48:00PM +0100, Kevin Wolf wrote:
> Commit 15afd94a047 added code to acquire and release the AioContext in
> qemuio_command(). This means that the lock is taken twice now in the
> call path from hmp_qemu_io(). This causes BDRV_POLL_WHILE() to hang for
> any requests issued to nodes in a non-mainloop AioContext.
> 
> Dropping the first locking from hmp_qemu_io() fixes the problem.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  hmp.c | 6 ------
>  1 file changed, 6 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Re: [Qemu-devel] [PATCH] block: Don't acquire AioContext in hmp_qemu_io()
Posted by Kevin Wolf 6 years, 4 months ago
Am 12.12.2017 um 14:48 hat Kevin Wolf geschrieben:
> Commit 15afd94a047 added code to acquire and release the AioContext in
> qemuio_command(). This means that the lock is taken twice now in the
> call path from hmp_qemu_io(). This causes BDRV_POLL_WHILE() to hang for
> any requests issued to nodes in a non-mainloop AioContext.
> 
> Dropping the first locking from hmp_qemu_io() fixes the problem.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Applied to block-next.

Kevin