From: "Alex Bennée" <alex.bennee@linaro.org>
To: pbonzini@redhat.com, stefanha@redhat.com
Cc: cota@braap.org, qemu-devel@nongnu.org,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: [Qemu-devel] [PATCH v2 3/6] scripts/qemu-gdb/tcg: new helper to dump tcg state
Date: Wed, 17 May 2017 15:52:56 +0100 [thread overview]
Message-ID: <20170517145259.28979-4-alex.bennee@linaro.org> (raw)
In-Reply-To: <20170517145259.28979-1-alex.bennee@linaro.org>
This adds a simple helper to dump lock state within TCG.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
scripts/qemu-gdb.py | 3 ++-
scripts/qemugdb/tcg.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 scripts/qemugdb/tcg.py
diff --git a/scripts/qemu-gdb.py b/scripts/qemu-gdb.py
index 3e7adb87dc..91e928f6af 100644
--- a/scripts/qemu-gdb.py
+++ b/scripts/qemu-gdb.py
@@ -26,7 +26,7 @@ import os, sys
sys.path.append(os.path.dirname(__file__))
-from qemugdb import aio, mtree, coroutine, timers
+from qemugdb import aio, mtree, coroutine, timers, tcg
class QemuCommand(gdb.Command):
'''Prefix for QEMU debug support commands'''
@@ -39,6 +39,7 @@ coroutine.CoroutineCommand()
mtree.MtreeCommand()
aio.HandlersCommand()
timers.TimersCommand()
+tcg.TCGLockStatusCommand()
coroutine.CoroutineSPFunction()
coroutine.CoroutinePCFunction()
diff --git a/scripts/qemugdb/tcg.py b/scripts/qemugdb/tcg.py
new file mode 100644
index 0000000000..8c7f1d7454
--- /dev/null
+++ b/scripts/qemugdb/tcg.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# GDB debugging support, TCG status
+#
+# Copyright 2016 Linaro Ltd
+#
+# Authors:
+# Alex Bennée <alex.bennee@linaro.org>
+#
+# This work is licensed under the terms of the GNU GPL, version 2. See
+# the COPYING file in the top-level directory.
+#
+# Contributions after 2012-01-13 are licensed under the terms of the
+# GNU GPL, version 2 or (at your option) any later version.
+
+# 'qemu tcg-lock-status' -- display the TCG lock status across threads
+
+import gdb
+
+class TCGLockStatusCommand(gdb.Command):
+ '''Display TCG Execution Status'''
+ def __init__(self):
+ gdb.Command.__init__(self, 'qemu tcg-lock-status', gdb.COMMAND_DATA,
+ gdb.COMPLETE_NONE)
+
+ def invoke(self, arg, from_tty):
+ gdb.write("Thread, BQL (iothread_mutex), Replay, Blocked?\n")
+ for thread in gdb.inferiors()[0].threads():
+ thread.switch()
+
+ iothread = gdb.parse_and_eval("iothread_locked")
+ replay = gdb.parse_and_eval("replay_locked")
+
+ frame = gdb.selected_frame()
+ if frame.name() == "__lll_lock_wait":
+ frame.older().select()
+ mutex = gdb.parse_and_eval("mutex")
+ owner = gdb.parse_and_eval("mutex->__data.__owner")
+ blocked = ("__lll_lock_wait waiting on %s from %d" %
+ (mutex, owner))
+ else:
+ blocked = "not blocked"
+
+ gdb.write("%d/%d, %s, %s, %s\n" % (thread.num, thread.ptid[1],
+ iothread, replay, blocked))
--
2.11.0
next prev parent reply other threads:[~2017-05-17 14:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 14:52 [Qemu-devel] [PATCH v2 0/6] gdb updates and cputlb traces Alex Bennée
2017-05-17 14:52 ` [Qemu-devel] [PATCH v2 1/6] scripts/replay-dump.py: replay log dumper Alex Bennée
2017-05-31 5:03 ` Philippe Mathieu-Daudé
2017-05-17 14:52 ` [Qemu-devel] [PATCH v2 2/6] scripts/qemu-gdb/timers.py: new helper to dump timer state Alex Bennée
2017-05-17 14:52 ` Alex Bennée [this message]
2017-05-31 1:41 ` [Qemu-devel] [PATCH v2 3/6] scripts/qemu-gdb/tcg: new helper to dump tcg state Philippe Mathieu-Daudé
2017-05-17 14:52 ` [Qemu-devel] [PATCH v2 4/6] cputlb: remove tlb_flush_count Alex Bennée
2017-05-17 14:52 ` [Qemu-devel] [PATCH v2 5/6] cputlb: add trace events Alex Bennée
2017-05-31 5:20 ` Philippe Mathieu-Daudé
2017-05-17 14:52 ` [Qemu-devel] [PATCH v2 6/6] new script/analyse-tlb-flushes-simpletrace.py Alex Bennée
2017-05-30 23:33 ` Pranith Kumar
2017-05-31 7:53 ` Alex Bennée
2017-05-18 9:42 ` [Qemu-devel] [PATCH v2 0/6] gdb updates and cputlb traces Stefan Hajnoczi
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=20170517145259.28979-4-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=cota@braap.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).