From patchwork Thu Jan 11 08:27:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 124160 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp374664qgn; Thu, 11 Jan 2018 00:40:28 -0800 (PST) X-Google-Smtp-Source: ACJfBosmLgc59Ts5g8IoQd47tKVLCqym2HhhneLW/dxkaTHHwTc/QSgaPiYsxAxbBTqCWxK/L97K X-Received: by 10.129.87.65 with SMTP id l62mr16576ywb.380.1515660028692; Thu, 11 Jan 2018 00:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515660028; cv=none; d=google.com; s=arc-20160816; b=qaadcTmSO4ZuLOXCyVAQ/BCOgT06Od+eb2jfu2tUng6KBk1TUc2QLeqOHxxconJw57 S+9fsCWNbqdSnIbivUSnh1pzZ8DVMl2Y5lulxxIyFlSpnEijnXlYdwHJ4acBcLxY0SU+ YnF6a1Zdxzh1vlxSxI0WQexfgPlmLUem7PqBcyZqhh1DAuNX7oZqqaFXm/vISwYbhmxC iRYpnDi2Xo40huwimC39It0Cq+qHOSdb1AklOoUpSI/Yyj91smEEF3/Cjs+4cBfEqeXE awn+MAEJGpNXOuqUtHGKFhFFadximqyXknp09mBeET3qXxiWemufYceUmIcwo7PkyiFN XYXQ== 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:user-agent:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=4UZpeXhyff5ylYPlggZbo3RlxXmiNKu8NizLbWA8s0Y=; b=JT9LMXob1zRc9EKMJpQJCMTJy8Ly/6IMnVQl07U5cPlhvNMS85zZ419BXEwR6CDBIi lXje3oaTHuIhhpK3s3n2rJrE52U1ZjyuaDppsLSyatv/DaEO2a4X4O7p1+sgdZCxAJop CCUkghvz2X5WmoomqnCxfuGAb7gRPrT7iFDAKlMPhCAB7vuYx6R9HIt3QJwhoTFqOcH1 Itp82vnvNJkVajmng3hOJZobKC/OsCWu6vA7C3rYQjx4zO4nyIYq6BI4SSQzcUTaFNQR M7JDnyyXZQ4JHB9+rxY4Gmfx4o6R1uXttG4PV15zMjPTm62vYdan0in0n67xmKKQ3Mfh QzFA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u63si3826334ywf.154.2018.01.11.00.40.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 11 Jan 2018 00:40:28 -0800 (PST) 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; 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 Received: from localhost ([::1]:53112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZYPU-00040y-4Y for patch@linaro.org; Thu, 11 Jan 2018 03:40:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZYCd-0001H1-Hl for qemu-devel@nongnu.org; Thu, 11 Jan 2018 03:27:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZYCc-0002Hf-DX for qemu-devel@nongnu.org; Thu, 11 Jan 2018 03:27:11 -0500 Received: from mail.ispras.ru ([83.149.199.45]:41960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZYCc-0002GZ-5R for qemu-devel@nongnu.org; Thu, 11 Jan 2018 03:27:10 -0500 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 5212F54006B; Thu, 11 Jan 2018 11:27:09 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Thu, 11 Jan 2018 11:27:11 +0300 Message-ID: <20180111082711.27295.21310.stgit@pasha-VirtualBox> In-Reply-To: <20180111082452.27295.85707.stgit@pasha-VirtualBox> References: <20180111082452.27295.85707.stgit@pasha-VirtualBox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [RFC PATCH v3 24/30] scripts/qemu-gdb: add simple tcg lock status helper 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: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, mst@redhat.com, jasowang@redhat.com, quintela@redhat.com, zuban32s@gmail.com, maria.klimushenkova@ispras.ru, dovgaluk@ispras.ru, kraxel@redhat.com, boost.lists@gmail.com, pbonzini@redhat.com, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée Add a simple helper to dump lock state. 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 diff --git a/scripts/qemu-gdb.py b/scripts/qemu-gdb.py index b3f8e04..d58213e 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 +from qemugdb import aio, mtree, coroutine, tcg class QemuCommand(gdb.Command): '''Prefix for QEMU debug support commands''' @@ -38,6 +38,7 @@ QemuCommand() coroutine.CoroutineCommand() mtree.MtreeCommand() aio.HandlersCommand() +tcg.TCGLockStatusCommand() coroutine.CoroutineSPFunction() coroutine.CoroutinePCFunction() diff --git a/scripts/qemugdb/tcg.py b/scripts/qemugdb/tcg.py new file mode 100644 index 0000000..8c7f1d7 --- /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))