From 072c444b0d948451771b0245b74d5310a00e3dd2 Mon Sep 17 00:00:00 2001 From: Mahmoud Mandour Date: Wed, 21 Jul 2021 00:26:56 +0100 Subject: plugins/cache: limited the scope of a mutex lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not necessary to lock the address translation portion of the vcpu_mem_access callback. Signed-off-by: Mahmoud Mandour Signed-off-by: Alex Bennée Reviewed-by: Alex Bennée Message-Id: <20210714172151.8494-3-ma.mandourr@gmail.com> Message-Id: <20210720232703.10650-23-alex.bennee@linaro.org> --- contrib/plugins/cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'contrib/plugins') diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index 4a71602..695fb96 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++; -- cgit v1.1