qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 4/4] dma-helpers: Move reschedule_dma BH to b


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 4/4] dma-helpers: Move reschedule_dma BH to blk's AioContext
Date: Fri, 13 Mar 2015 09:13:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 13/03/2015 02:38, Fam Zheng wrote:
> That if the dbs' owner is an iothread, dma should be resumed on the right
> thread. In this case it is the AioContext of the block device.
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  dma-helpers.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/dma-helpers.c b/dma-helpers.c
> index 6918572..84f61a7 100644
> --- a/dma-helpers.c
> +++ b/dma-helpers.c
> @@ -95,8 +95,10 @@ static void reschedule_dma(void *opaque)
>  static void continue_after_map_failure(void *opaque)
>  {
>      DMAAIOCB *dbs = (DMAAIOCB *)opaque;
> +    AioContext *ctx;
>  
> -    dbs->bh = qemu_bh_new(reschedule_dma, dbs);
> +    ctx = blk_get_aio_context(dbs->blk);
> +    dbs->bh = aio_bh_new(ctx, reschedule_dma, dbs);
>      qemu_bh_schedule(dbs->bh);
>  }
>  
> 

This looks good.  However, I wonder if dma_aio_cancel should also call
cpu_unregister_map_client.  In this case, it's much better to just use a
lock for the list (though you can still use atomics for the in-use flag).

Paolo



reply via email to

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