Skip to content

Commit 072c444

Browse files
i3abghanystsquad
authored andcommitted
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 <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Alex Bennée <[email protected]> Message-Id: <[email protected]> Message-Id: <[email protected]>
1 parent de9fc40 commit 072c444

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

contrib/plugins/cache.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,14 @@ static void vcpu_mem_access(unsigned int vcpu_index, qemu_plugin_meminfo_t info,
355355
struct qemu_plugin_hwaddr *hwaddr;
356356
InsnData *insn;
357357

358-
g_mutex_lock(&mtx);
359358
hwaddr = qemu_plugin_get_hwaddr(info, vaddr);
360359
if (hwaddr && qemu_plugin_hwaddr_is_io(hwaddr)) {
361-
g_mutex_unlock(&mtx);
362360
return;
363361
}
364362

365363
effective_addr = hwaddr ? qemu_plugin_hwaddr_phys_addr(hwaddr) : vaddr;
366364

365+
g_mutex_lock(&mtx);
367366
if (!access_cache(dcache, effective_addr)) {
368367
insn = (InsnData *) userdata;
369368
insn->dmisses++;

0 commit comments

Comments
 (0)