aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2017-10-28 02:16:41 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2018-08-23 18:46:25 +0200
commitcb764d06650da5fad7c833975b255d08e91a0a52 (patch)
tree7f403b625d17ba77ad11639d976b2c847f0c830c /cpus.c
parentd557de4a0e290c9946f37ff1fba7204844cccc64 (diff)
downloadqemu-cb764d06650da5fad7c833975b255d08e91a0a52.zip
qemu-cb764d06650da5fad7c833975b255d08e91a0a52.tar.gz
qemu-cb764d06650da5fad7c833975b255d08e91a0a52.tar.bz2
qsp: track BQL callers explicitly
The BQL is acquired via qemu_mutex_lock_iothread(), which makes the profiler assign the associated wait time (i.e. most of BQL wait time) entirely to that function. This loses the original call site information, which does not help diagnose BQL contention. Fix it by tracking the callers explicitly. Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cpus.c b/cpus.c
index b5844b7..a5ea3ee 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1762,10 +1762,16 @@ bool qemu_mutex_iothread_locked(void)
return iothread_locked;
}
-void qemu_mutex_lock_iothread(void)
+/*
+ * The BQL is taken from so many places that it is worth profiling the
+ * callers directly, instead of funneling them all through a single function.
+ */
+void qemu_mutex_lock_iothread_impl(const char *file, int line)
{
+ QemuMutexLockFunc bql_lock = atomic_read(&qemu_bql_mutex_lock_func);
+
g_assert(!qemu_mutex_iothread_locked());
- qemu_mutex_lock(&qemu_global_mutex);
+ bql_lock(&qemu_global_mutex, file, line);
iothread_locked = true;
}