From patchwork Wed May 17 14:52:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 99991 Delivered-To: patch@linaro.org Received: by 10.182.142.97 with SMTP id rv1csp253455obb; Wed, 17 May 2017 07:52:40 -0700 (PDT) X-Received: by 10.200.40.193 with SMTP id j1mr3652010qtj.186.1495032760055; Wed, 17 May 2017 07:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495032760; cv=none; d=google.com; s=arc-20160816; b=ckU1iVodJoEmrALACxB3ROw5qQNdHrtxbk41v9TecxDFX38qKsbg4flpSU7oNZdRUz d8mvR5OKcZWQ+ATWoDObV0ZsGRJoPYfN7AbAdAdjs5rlqAmZHazX0KxNKrEXAuux3+e6 QAn4GfNcXR31riruR0VgbK4cCRcZqO7jZAfBnLf5vPznjQYPDUOCtTBJ3/lWv5h3hkdk 11livi3iY+I2cEq79i8NS/1wcbwvkyJUdxxiAxqbdC+Ow/lrppewTvPkcf6ch+oBroCS nj1p2sFPw6ntg0HzrIf4zcwf5zrb2qo4tCuH0KyElFhetsuci9YzMRAdINH6fJITPB/2 87WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=vTYtpBDRzxzM+fZ0Ec4/8/8UNwCxlePzzhuR8PHRSx8=; b=hUZQNw+ZTvPcBGVBJk02Ouf/D8yTU+qGYyiEBZht7/Hx/2mC+AtsIz0wWjSDG/j6x4 yT3X/iM3ilUP73Y3XSs0miI/N4NwEgOb8y5l3aqPCWeB1zJCBDcBZ5ULTT1ThNhNSuU/ D263D0GkSjhYHWrzqJbo/DsgRh7oIV5wHaaBBOzMWFedFzCYFPviReakLJDBscrf7tm6 v40iNmwXpjjN90d3lnYbOTFehWTeuAPZ7X7jSJX3QS2ffyXCHfIoFr9cPyacNuf6Al5H /cWW+krt+xVgFeGsNj0y5xYERF3pLHoMqktDIZ2MMIJ01XF1Oj0nXVFgKbwDop9YrvhY X1UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k61si2478841qtd.172.2017.05.17.07.52.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 17 May 2017 07:52:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB0Jb-0001oO-Hs for patch@linaro.org; Wed, 17 May 2017 10:52:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB0J8-0001jL-Ma for qemu-devel@nongnu.org; Wed, 17 May 2017 10:52:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB0J7-0004fA-Hv for qemu-devel@nongnu.org; Wed, 17 May 2017 10:52:10 -0400 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:36111) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dB0J7-0004f2-Bb for qemu-devel@nongnu.org; Wed, 17 May 2017 10:52:09 -0400 Received: by mail-wm0-x22f.google.com with SMTP id 70so13261416wmq.1 for ; Wed, 17 May 2017 07:52:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vTYtpBDRzxzM+fZ0Ec4/8/8UNwCxlePzzhuR8PHRSx8=; b=WAbWTAWHxa+uOVbHGMS2soTKy/wPkgKcm1g5x44lk4PjsUPM7yzSXXyIRAG9HfDbtG bsouFGs1gMoByi3nXo9sb8mstsswHfGVOo3zwLiyViA67pycsca0gbdYxnNEH+hDDavT VkZTjxOFkGiqaCAs61nXkyv1hZ8iRxj0EEZqc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vTYtpBDRzxzM+fZ0Ec4/8/8UNwCxlePzzhuR8PHRSx8=; b=EC9+u9mIKCI8dwMBObrX2cVgSdSIKCbVa7fsHwJKix9Kh1FExtXEloLGPcDDSvBg23 hYidFhBpH1Zunvb+3qdfazhBXbXITJUgY09y+4Nvy/N3CK9bPPA44kPdlIej3MRewH8S ztrJrmJVU+NaTugDlmb83/7/tlhNAvBQX8wkH2Qjm0Puh1hb2IMT7Y3qUfR/iTE2XiwX uVY0UHXBCPFvxVorxmISnnUGNUFxfR5v9VAgmJbOEU5z/9ooNDs218DDjdPgYQy3H1P5 1EDK854rDsXXP4r/APzHOjxpxgk/L5gyTPGi1mE+oL8D0PICXND0F6Cuzm7MyGO6lFBo wdzQ== X-Gm-Message-State: AODbwcDRZDW1HuNhNrRD1lJi/TLCJjJXrdCNfKmiuln2sjbKKf4sdE8P RYHQEeLQyxolrjQR X-Received: by 10.28.87.72 with SMTP id l69mr10597009wmb.111.1495032728010; Wed, 17 May 2017 07:52:08 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b201sm18156845wme.2.2017.05.17.07.52.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 May 2017 07:52:04 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B37663E0873; Wed, 17 May 2017 15:52:59 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: pbonzini@redhat.com, stefanha@redhat.com Date: Wed, 17 May 2017 15:52:56 +0100 Message-Id: <20170517145259.28979-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170517145259.28979-1-alex.bennee@linaro.org> References: <20170517145259.28979-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22f Subject: [Qemu-devel] [PATCH v2 3/6] scripts/qemu-gdb/tcg: new helper to dump tcg state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This adds a simple helper to dump lock state within TCG. Signed-off-by: Alex Bennée --- scripts/qemu-gdb.py | 3 ++- scripts/qemugdb/tcg.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 scripts/qemugdb/tcg.py -- 2.11.0 Reviewed-by: Philippe Mathieu-Daudé 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 +# +# 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))