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
Date: Wed, 28 Aug 2013 18:37:11 +0200 [thread overview]
Message-ID: <521E2737.1030108@redhat.com> (raw)
In-Reply-To: <1377705768-21996-1-git-send-email-ncmike@ncultra.org>
Il 28/08/2013 18:02, Mike Day ha scritto:
> @@ -1102,15 +1110,15 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
> pstrcat(new_block->idstr, sizeof(new_block->idstr), name);
>
> /* This assumes the iothread lock is taken here too. */
> - qemu_mutex_lock_ramlist();
> - QTAILQ_FOREACH(block, &ram_list.blocks, next) {
> + rcu_read_lock();
> + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
> if (block != new_block && !strcmp(block->idstr, new_block->idstr)) {
> fprintf(stderr, "RAMBlock \"%s\" already registered, abort!\n",
> new_block->idstr);
> abort();
> }
> }
> - qemu_mutex_unlock_ramlist();
> + rcu_read_unlock();
Forgot about this. Every time you see "This assumes the iothread lock
is taken here too", you're in the write side so you do not need
lock/unlock and you do not need...
> /* This assumes the iothread lock is taken here too. */
> qemu_mutex_lock_ramlist();
> - QTAILQ_FOREACH(block, &ram_list.blocks, next) {
> + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
> if (addr == block->offset) {
> - QTAILQ_REMOVE(&ram_list.blocks, block, next);
> + QLIST_REMOVE_RCU(block, next);
> ram_list.mru_block = NULL;
> ram_list.version++;
> g_free(block);
qemu_mutex_lock_ramlist/qemu_mutex_unlock_ramlist either.
Otherwise, the patch is pretty solid! Thanks,
Paolo
prev parent reply other threads:[~2013-08-28 16:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-28 16:02 [Qemu-devel] [RFC PATCH] convert ram_list to RCU DQ Mike Day
2013-08-28 16:35 ` Paolo Bonzini
2013-08-29 19:18 ` Mike Day
2013-08-30 8:19 ` Paolo Bonzini
2013-08-30 14:08 ` Mike Day
2013-08-28 16:37 ` 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=521E2737.1030108@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 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.