qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Liu Ping Fan <qemulist@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Liu Ping Fan <pingfank@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [PATCH v3 2/2] QEMUBH: make AioContext's bh re-entrant
Date: Thu, 20 Jun 2013 09:39:24 +0200	[thread overview]
Message-ID: <20130620073924.GA14255@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1371675569-6516-3-git-send-email-pingfank@linux.vnet.ibm.com>

On Thu, Jun 20, 2013 at 04:59:29AM +0800, Liu Ping Fan wrote:
> BH will be used outside big lock, so introduce lock to protect
> between the writers, ie, bh's adders and deleter. The lock only
> affects the writers and bh's callback does not take this extra lock.
> Note that for the same AioContext, aio_bh_poll() can not run in
> parallel yet.
> 
> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> ---
>  async.c             | 22 ++++++++++++++++++++++
>  include/block/aio.h |  5 +++++
>  2 files changed, 27 insertions(+)

qemu_bh_cancel() and qemu_bh_delete() are not modified by this patch.

It seems that calling them from a thread is a little risky because there
is no guarantee that the BH is no longer invoked after a thread calls
these functions.

I think that's worth a comment or do you want them to take the lock so
they become safe?

The other thing I'm unclear on is the ->idle assignment followed
immediately by a ->scheduled assignment.  Without memory barriers
aio_bh_poll() isn't guaranteed to get an ordered view of these updates:
it may see an idle BH as a regular scheduled BH because ->idle is still
0.

Stefan

  reply	other threads:[~2013-06-20  7:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19 20:59 [Qemu-devel] [PATCH v3 0/2] QEMUBH: make AioContext's bh re-entrant Liu Ping Fan
2013-06-19 20:59 ` [Qemu-devel] [PATCH v3 1/2] add a header file for atomic operations Liu Ping Fan
2013-06-19 16:37   ` Richard Henderson
2013-06-19 16:42     ` Paolo Bonzini
2013-06-19 20:39   ` Torvald Riegel
2013-06-19 20:44     ` Richard Henderson
2013-06-20  8:03       ` Paolo Bonzini
2013-06-19 20:59 ` [Qemu-devel] [PATCH v3 2/2] QEMUBH: make AioContext's bh re-entrant Liu Ping Fan
2013-06-20  7:39   ` Stefan Hajnoczi [this message]
2013-06-20  8:16     ` Paolo Bonzini
2013-06-20  9:12       ` liu ping fan
2013-06-20  9:19         ` Paolo Bonzini
2013-06-20  9:41       ` liu ping fan
2013-06-20  9:45         ` Paolo Bonzini
2013-06-21  4:35           ` liu ping fan

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=20130620073924.GA14255@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pingfank@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemulist@gmail.com \
    /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 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).