[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 3/4] exec: Notify cpu_register_map_client caller
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v2 3/4] exec: Notify cpu_register_map_client caller if the bounce buffer is available |
Date: |
Fri, 13 Mar 2015 09:38:42 +0800 |
The caller's workflow is like
if (!address_space_map()) {
...
cpu_register_map_client();
}
If bounce buffer became available after address_space_map() but before
cpu_register_map_client(), the caller could miss it and has to wait for the
next bounce buffer uesr to release, which may never happen in the worse case.
Just notify the caller with the passed callback in cpu_register_map_client().
Signed-off-by: Fam Zheng <address@hidden>
---
exec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/exec.c b/exec.c
index 93ccd5a..82781e4 100644
--- a/exec.c
+++ b/exec.c
@@ -2502,6 +2502,9 @@ void *cpu_register_map_client(void *opaque, void
(*callback)(void *opaque))
client->opaque = opaque;
client->callback = callback;
QSLIST_INSERT_HEAD_ATOMIC(&map_client_list, client, link);
+ if (!atomic_read(&bounce.in_use)) {
+ callback(opaque);
+ }
return client;
}
--
1.9.3
- Re: [Qemu-devel] [PATCH v2 4/4] dma-helpers: Move reschedule_dma BH to blk's AioContext, (continued)
[Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer, Fam Zheng, 2015/03/12
[Qemu-devel] [PATCH v2 2/4] exec: Atomic access to map_client_list, Fam Zheng, 2015/03/12
[Qemu-devel] [PATCH v2 3/4] exec: Notify cpu_register_map_client caller if the bounce buffer is available,
Fam Zheng <=