From: Paolo Bonzini <pbonzini@redhat.com>
Cc: liu ping fan <qemulist@gmail.com>,
Anthony Liguori <anthony@codemonkey.ws>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] QEMUBH: make AioContext's bh re-entrant
Date: Sat, 15 Jun 2013 11:44:02 -0400 [thread overview]
Message-ID: <51BC8BC2.5050400@redhat.com> (raw)
In-Reply-To: <51BC4D14.8010502@redhat.com>
Il 15/06/2013 07:16, Paolo Bonzini ha scritto:
> ... I'm not sure that this works yet. I see two problems:
> ctx->walking_bh needs to be accessed atomic, and while you are doing the
> deletions somebody could come up and start a read. Havoc.
Hmm, are you just trying to protect aio_bh_poll from aio_bh_new, while
still having only one thread that can do aio_bh_poll (multiple producer,
single consumer)?
In this case what you have should work and this patch is almost ready
for commit. In fact it's actually important to have it for the
dataplane stuff that Stefan is doing, I think.
But _please document what you are doing_! It's not the first time that
I tell you this: locking policy must be _thoroughly_ documented, and
_not_ figured out by the reviewers. Without this, I'm not going to give
my Reviewed-by.
Regarding barriers, there is another write barrier you need to add
before anything that sets bh->scheduled. This makes sure any writes
that are needed by the callback are done before the locations are read
in the aio_bh_poll thread. Similarly, you want a matching read barrier
before calling the callback.
Please pick up the atomics patch from my branch so that you have the
smp_read_barrier_depends() primitive; and resubmit with documentation
about the locking policy in the commit message _and_ the header files.
Also please add a comment before each barrier saying what is ordered
against what.
Thanks,
Paolo
> It's not an easy problem, because even with RCU the bottom half callback
> should run _outside_ the RCU critical section. I suggest that you hunt
> the kernel for something that is trying to do the same.
next prev parent reply other threads:[~2013-06-15 15:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-14 2:55 [Qemu-devel] [PATCH] QEMUBH: make AioContext's bh re-entrant Liu Ping Fan
2013-06-15 5:35 ` Paolo Bonzini
2013-06-15 8:43 ` liu ping fan
2013-06-15 11:16 ` Paolo Bonzini
2013-06-15 15:44 ` Paolo Bonzini [this message]
2013-06-16 10:00 ` liu ping fan
2013-06-16 10:03 ` 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=51BC8BC2.5050400@redhat.com \
--to=pbonzini@redhat.com \
--cc=anthony@codemonkey.ws \
--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).