summary refs log tree commit diff stats
path: root/contrib/plugins/cache.c
diff options
context:
space:
mode:
authorMahmoud Mandour <ma.mandourr@gmail.com>2021-07-21 00:26:56 +0100
committerAlex Bennée <alex.bennee@linaro.org>2021-07-23 17:22:16 +0100
commit072c444b0d948451771b0245b74d5310a00e3dd2 (patch)
tree146b9a21bbc8edf89a5d77bc98ff7eb97e4b38a8 /contrib/plugins/cache.c
parentde9fc40f36ab8e696d1c69727e80a80c46f20978 (diff)
downloadfocaccia-qemu-072c444b0d948451771b0245b74d5310a00e3dd2.tar.gz
focaccia-qemu-072c444b0d948451771b0245b74d5310a00e3dd2.zip
plugins/cache: limited the scope of a mutex lock
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>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210714172151.8494-3-ma.mandourr@gmail.com>
Message-Id: <20210720232703.10650-23-alex.bennee@linaro.org>
Diffstat (limited to 'contrib/plugins/cache.c')
-rw-r--r--contrib/plugins/cache.c3
1 files changed, 1 insertions, 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++;