All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 4/4] dma-helpers: Move reschedule_dma BH to blk's AioContext
Date: Fri, 13 Mar 2015 16:58:47 +0800	[thread overview]
Message-ID: <20150313085847.GC3527@ad.nay.redhat.com> (raw)
In-Reply-To: <55029C22.1070901@redhat.com>

On Fri, 03/13 09:13, Paolo Bonzini wrote:
> 
> 
> 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 <famz@redhat.com>
> > ---
> >  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).

The other possibility is grab a reference for the cpu_register_map_client call,
and release it in reschedule_dma. This way the atomics can keep, but we'll need
a "finished" flag in DMAAIOCB to avoid double completion.

Fam

  reply	other threads:[~2015-03-13  8:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-03-13 10:48       ` Paolo Bonzini
2015-03-13 12:33         ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150313085847.GC3527@ad.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.