From: Paolo Bonzini <pbonzini@redhat.com>
To: Mike Day <ncmike@ncultra.org>
Cc: Paul Mckenney <paulmck@linux.vnet.ibm.com>,
Mathew Desnoyers <mathieu.desnoyers@efficios.com>,
qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [RFC PATCH] Convert ram_list to RCU DQ V4
Date: Thu, 05 Sep 2013 00:46:09 +0200 [thread overview]
Message-ID: <5227B831.7000208@redhat.com> (raw)
In-Reply-To: <CAGaKXu3R3C4Lw2wg356mxd5Y_bMy9y07_CbWJH-aZzexiBabgQ@mail.gmail.com>
Il 04/09/2013 22:48, Mike Day ha scritto:
>
> On Wed, Sep 4, 2013 at 3:58 PM, Paolo Bonzini <pbonzini@redhat.com
> <mailto:pbonzini@redhat.com>> wrote:
>>
>> > @@ -1323,23 +1325,21 @@ static RAMBlock
> *qemu_get_ram_block(ram_addr_t addr)
>> > {
>> > RAMBlock *block;
>> >
>> > - /* The list is protected by the iothread lock here. */
>> > + /* This assumes the iothread lock is taken here too. */
>> > +
>> > block = ram_list.mru_block;
>> > if (block && addr - block->offset < block->length) {
>> > - goto found;
>> > + return block;
>> > }
>> > - QTAILQ_FOREACH(block, &ram_list.blocks, next) {
>> > + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
>> > if (addr - block->offset < block->length) {
>> > - goto found;
>> > + atomic_rcu_set(&ram_list.mru_block, block);
>>
>> I think this is not needed, block was already published into the block
>> list. What is important is to order mru_block == NULL so that it
>> happens before the node is removed. Which we don't do, but we can fix
>> later.
>
> I am thinking of writing some macros and possibly reorganizing the ram
> globals into a struct so that we can update it by exchanging pointers
> atomically. It seems to disjoint right and error-prone now that we are
> making it rcu-enabled.
Note that mru_block is set in hottish paths, so changes to mru_block
need not result in copying the RAM globals. Only changes to the list
would. But I'm not sure yet that copying the RAM globals struct is
useful. All we need the version flag for, is to know whether a pointer
from a previous RCU read-side critical section is still valid after a
new rcu_read_lock().
Paolo
prev parent reply other threads:[~2013-09-04 22:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-04 19:41 [Qemu-devel] [RFC PATCH] Convert ram_list to RCU DQ V4 Mike Day
2013-09-04 19:58 ` Paolo Bonzini
2013-09-04 20:48 ` Mike Day
2013-09-04 22:46 ` Paolo Bonzini [this message]
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=5227B831.7000208@redhat.com \
--to=pbonzini@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=mathieu.desnoyers@efficios.com \
--cc=ncmike@ncultra.org \
--cc=paulmck@linux.vnet.ibm.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 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).