qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zihan Yang <whois.zihan.yang@gmail.com>
To: qemu-devel@nongnu.org
Cc: Zihan Yang <whois.zihan.yang@gmail.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH] RAMList: replace QemuMutex with CompatGMutex
Date: Wed, 14 Feb 2018 16:49:47 +0800	[thread overview]
Message-ID: <1518598187-27169-1-git-send-email-whois.zihan.yang@gmail.com> (raw)

change the mutex member in RAMList structure from QemuMutex to CompatGMutex.
qemu_mutex_init() is just deleted instead of being replaced with g_mutex_init()
because there is no need to do initialize a mutex that is statically allocated.

Signed-off-by: Zihan Yang <whois.zihan.yang@gmail.com>
---
 exec.c                 | 5 ++---
 include/exec/ramlist.h | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/exec.c b/exec.c
index e8d7b33..90cdd05 100644
--- a/exec.c
+++ b/exec.c
@@ -1423,12 +1423,12 @@ void qemu_flush_coalesced_mmio_buffer(void)
 
 void qemu_mutex_lock_ramlist(void)
 {
-    qemu_mutex_lock(&ram_list.mutex);
+    g_mutex_lock(&ram_list.mutex);
 }
 
 void qemu_mutex_unlock_ramlist(void)
 {
-    qemu_mutex_unlock(&ram_list.mutex);
+    g_mutex_unlock(&ram_list.mutex);
 }
 
 void ram_block_dump(Monitor *mon)
@@ -3331,7 +3331,6 @@ void cpu_register_map_client(QEMUBH *bh)
 
 void cpu_exec_init_all(void)
 {
-    qemu_mutex_init(&ram_list.mutex);
     /* The data structures we set up here depend on knowing the page size,
      * so no more changes can be made after this point.
      * In an ideal world, nothing we did before we had finished the
diff --git a/include/exec/ramlist.h b/include/exec/ramlist.h
index 2e2ac6c..24be5e4 100644
--- a/include/exec/ramlist.h
+++ b/include/exec/ramlist.h
@@ -45,7 +45,7 @@ typedef struct {
 } DirtyMemoryBlocks;
 
 typedef struct RAMList {
-    QemuMutex mutex;
+    CompatGMutex mutex;
     RAMBlock *mru_block;
     /* RCU-enabled, writes protected by the ramlist lock. */
     QLIST_HEAD(, RAMBlock) blocks;
-- 
2.7.4

             reply	other threads:[~2018-02-14  8:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14  8:49 Zihan Yang [this message]
2018-02-14 10:13 ` [Qemu-devel] [PATCH] RAMList: replace QemuMutex with CompatGMutex Paolo Bonzini
2018-02-14 11:43   ` Zihan Yang
2018-02-14 12:11     ` Paolo Bonzini
2018-02-16  9:13       ` Peter Maydell
2018-02-20 12:14         ` 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=1518598187-27169-1-git-send-email-whois.zihan.yang@gmail.com \
    --to=whois.zihan.yang@gmail.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).