qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/4] exec: Make bounce buffer thread safe
@ 2015-03-13  1:38 Fam Zheng
  2015-03-13  1:38 ` [Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer Fam Zheng
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Fam Zheng @ 2015-03-13  1:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

The global bounce buffer used for non-direct memory access is not thread-safe:

 1) Access to "bounce" is not atomic.

 2) Access to "map_client_list" is not atomic.

 3) In dma_blk_cb, there is a race condition between:

        mem = dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir);
        /* ... */
        cpu_register_map_client(dbs, continue_after_map_failure);

    Bounce may become available after dma_memory_map failed but before
    cpu_register_map_client is called.

 4) The callback registered by cpu_register_map_client is not called in the
    right AioContext.

This series fixes these issues respectively.


Fam Zheng (4):
  exec: Atomic access to bounce buffer
  exec: Atomic access to map_client_list
  exec: Notify cpu_register_map_client caller if the bounce buffer is
    available
  dma-helpers: Move reschedule_dma BH to blk's AioContext

 dma-helpers.c |  4 +++-
 exec.c        | 35 +++++++++++++++++++----------------
 2 files changed, 22 insertions(+), 17 deletions(-)

-- 
1.9.3

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

end of thread, other threads:[~2015-03-13 12:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-13  1:38 [Qemu-devel] [PATCH v2 0/4] exec: Make bounce buffer thread safe Fam Zheng
2015-03-13  1:38 ` [Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer Fam Zheng
2015-03-13  8:09   ` Paolo Bonzini
2015-03-13  8:16     ` Fam Zheng
2015-03-13  8:32       ` Paolo Bonzini
2015-03-13  8:38         ` Fam Zheng
2015-03-13  8:41         ` Paolo Bonzini
2015-03-13  1:38 ` [Qemu-devel] [PATCH v2 2/4] exec: Atomic access to map_client_list Fam Zheng
2015-03-13  8:11   ` Paolo Bonzini
2015-03-13  1:38 ` [Qemu-devel] [PATCH v2 3/4] exec: Notify cpu_register_map_client caller if the bounce buffer is available Fam Zheng
2015-03-13  8:12   ` Paolo Bonzini
2015-03-13  1:38 ` [Qemu-devel] [PATCH v2 4/4] dma-helpers: Move reschedule_dma BH to blk's AioContext Fam Zheng
2015-03-13  8:13   ` Paolo Bonzini
2015-03-13  8:58     ` Fam Zheng
2015-03-13 10:48       ` Paolo Bonzini
2015-03-13 12:33         ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).