qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
	fred.konrad@greensocs.com
Subject: Re: [Qemu-devel] [PATCH 5/9] exec: protect mru_block with RCU
Date: Thu, 5 Feb 2015 17:30:55 +0800	[thread overview]
Message-ID: <20150205093055.GD5048@ad.nay.redhat.com> (raw)
In-Reply-To: <54D32BBC.3030302@redhat.com>

On Thu, 02/05 09:37, Paolo Bonzini wrote:
> 
> 
> On 05/02/2015 07:23, Fam Zheng wrote:
> >> > @@ -1381,14 +1397,16 @@ static ram_addr_t ram_block_add(RAMBlock *new_block, Error **errp)
> >> >          QTAILQ_INSERT_TAIL(&ram_list.blocks, new_block, next);
> >> >      }
> >> >      ram_list.mru_block = NULL;
> >> > +    atomic_rcu_set(&ram_list.version, ram_list.version + 1);
> >> >  
> >> > -    ram_list.version++;
> > Why is this not atomic_inc
> 
> Because writes are protected by the ramlist lock.  atomic_inc is more
> expensive.

OK!

> 
> > (or why is atomic_rcu_set necessary here)?
> 
> I probably should move it to patch 9; it is needed to update the list
> before ram_list.version.
> 
> If you prefer I can change it to
> 
> 	smp_wmb();
> 	atomic_set(&ram_list.version, ram_list.version + 1);
> 
> ?
> 

Yes, this looks more obvious :)

Fam

  reply	other threads:[~2015-02-05  9:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 12:52 [Qemu-devel] [PATCH v2 0/9] RCUification of the memory API, part 2 Paolo Bonzini
2015-02-03 12:52 ` [Qemu-devel] [PATCH 1/9] exec: introduce cpu_reload_memory_map Paolo Bonzini
2015-02-04  1:46   ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 2/9] exec: make iotlb RCU-friendly Paolo Bonzini
2015-02-04  2:31   ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 3/9] exec: RCUify AddressSpaceDispatch Paolo Bonzini
2015-02-04  2:56   ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 4/9] rcu: introduce RCU-enabled QLIST Paolo Bonzini
2015-02-04  3:42   ` Fam Zheng
2015-02-04 12:46     ` Paolo Bonzini
2015-02-05  2:03       ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 5/9] exec: protect mru_block with RCU Paolo Bonzini
2015-02-05  6:23   ` Fam Zheng
2015-02-05  8:37     ` Paolo Bonzini
2015-02-05  9:30       ` Fam Zheng [this message]
2015-02-03 12:52 ` [Qemu-devel] [PATCH 6/9] cosmetic changes preparing for the following patches Paolo Bonzini
2015-02-04  3:10   ` Fam Zheng
2015-02-04 12:51     ` Paolo Bonzini
2015-02-03 12:52 ` [Qemu-devel] [PATCH 7/9] rcu: prod call_rcu thread when calling synchronize_rcu Paolo Bonzini
2015-02-04  3:13   ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 8/9] exec: convert ram_list to QLIST Paolo Bonzini
2015-02-03 12:52 ` [Qemu-devel] [PATCH 9/9] Convert ram_list to RCU 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=20150205093055.GD5048@ad.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=fred.konrad@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).