qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mahmoud Mandour <ma.mandourr@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Mahmoud Mandour" <ma.mandourr@gmail.com>,
	cota@braap.org, "Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH v2 2/5] plugins/cache: limited the scope of a mutex lock
Date: Wed, 21 Jul 2021 12:36:08 +0200	[thread overview]
Message-ID: <20210721103612.48844-3-ma.mandourr@gmail.com> (raw)
In-Reply-To: <20210721103612.48844-1-ma.mandourr@gmail.com>

It's not necessary to lock the address translation portion of the
vcpu_mem_access callback.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
 contrib/plugins/cache.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
index 4a71602639..695fb969dc 100644
--- a/contrib/plugins/cache.c
+++ b/contrib/plugins/cache.c
@@ -355,15 +355,14 @@ static void vcpu_mem_access(unsigned int vcpu_index, qemu_plugin_meminfo_t info,
     struct qemu_plugin_hwaddr *hwaddr;
     InsnData *insn;
 
-    g_mutex_lock(&mtx);
     hwaddr = qemu_plugin_get_hwaddr(info, vaddr);
     if (hwaddr && qemu_plugin_hwaddr_is_io(hwaddr)) {
-        g_mutex_unlock(&mtx);
         return;
     }
 
     effective_addr = hwaddr ? qemu_plugin_hwaddr_phys_addr(hwaddr) : vaddr;
 
+    g_mutex_lock(&mtx);
     if (!access_cache(dcache, effective_addr)) {
         insn = (InsnData *) userdata;
         insn->dmisses++;
-- 
2.25.1



  parent reply	other threads:[~2021-07-21 10:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 10:36 plugins/cache: multicore cache modelling and minor tweaks Mahmoud Mandour
2021-07-21 10:36 ` [PATCH v2 1/5] plugins/cache: Fixed a bug with destroying FIFO metadata Mahmoud Mandour
2021-07-21 10:36 ` Mahmoud Mandour [this message]
2021-07-21 10:36 ` [PATCH v2 3/5] plugins/cache: Supported multicore cache modelling Mahmoud Mandour
2021-07-21 10:36 ` [PATCH v2 4/5] docs/devel/tcg-plugins: added cores arg to cache plugin Mahmoud Mandour
2021-07-21 10:36 ` [PATCH v2 5/5] plugins/cache: Fixed "function decl. is not a prototype" warnings Mahmoud Mandour

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=20210721103612.48844-3-ma.mandourr@gmail.com \
    --to=ma.mandourr@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=cota@braap.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).