From patchwork Tue Jan 16 14:17:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 124730 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1043294lje; Tue, 16 Jan 2018 07:04:19 -0800 (PST) X-Google-Smtp-Source: ACJfBot61834BtZ7U1YkzOyFfAJizQmI/lOaPVXPUjL9P+b9UxLmxlCPty/dQru1AAtQXE5zpwlk X-Received: by 10.37.130.77 with SMTP id d13mr4658141ybn.377.1516115059497; Tue, 16 Jan 2018 07:04:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516115059; cv=none; d=google.com; s=arc-20160816; b=qMB0tAQT/MGc2EBPeSHYdG5iCXe/0dOTf0BGha2A+b6JLRa5xqpEfmw8BuUXFsU0R0 06zSNaiZ8N3IcVj99ZMdjxlmyb1KtTwEptg+rGNo5Hh72xzrV+os+6v7a09y1E0BuwTT qXb8JO1mei4SMxBDmFv6nwhAW7YLH50fyCUl2yvag17G+GLVJl9Ymg7B9+qdvGpM61UX QA95ac4Vdn0lqxOb7aFffYrTgbkEZzN+9f1u9PnW5VnxuMHt5YFPooawCkxht5bHNNpu umvTrIoxnQq/ucWZxNLO8VTctnV32sEEPtZr2Ep8UCw1AuieDCARk3+UYkxbnFujUtdZ qmbA== 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=jQ0zev7HbBd4Se78/C004unL1JvTQkF6pSVZna7txHs=; b=A77CmhTDnsduwoqhqrIrt09jYQsSooOScZGV6JkWwU5Hx6GA6dqG6cT1H+fkHF4bq9 Ze0vbjzYMHbz5hnk85tGYP+j22SRWkHdr1xSLd97h4Q0AQ9yfQZ2YSt8ZzlOUGtJsFp1 eXn2l4bOdrAOFmHUAEC5CrbDHSvtD/ekE1H2iAjIfgcq5uKBSlh3UOiLDDy8URv5tioR C+Ay+3BVdkB0oCMw1WSe+NspmDuo1Ir2ctM0Iyz3Wwd/VPfRDdEqqDrwxbKB9EBwCtx/ BEReCSP5TrVjX/7dcE6BdE0ENETII7BvGyOL9s+/v33A1f+ovHxdV1NS15iGZfcDuVA/ UV0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=LZj1UfJ3; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i186si562840ybc.620.2018.01.16.07.04.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 16 Jan 2018 07:04:18 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=LZj1UfJ3; 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=redhat.com Received: from localhost ([::1]:39565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebSmf-0007x1-Pu for patch@linaro.org; Tue, 16 Jan 2018 10:04:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebS4J-0003IM-LM for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebS4G-00051y-Ao for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:27 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:45406) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebS4G-000501-3o for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:24 -0500 Received: by mail-wr0-x241.google.com with SMTP id 16so15333055wry.12 for ; Tue, 16 Jan 2018 06:18:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jQ0zev7HbBd4Se78/C004unL1JvTQkF6pSVZna7txHs=; b=LZj1UfJ3Exnuh21rfgf0SmGxg0c1lMZmF/4LT3PHiGHQrRy4KXleIQdpWM+Nf3exqJ N+ElMqF3OVz5h3higYHCcBCmT6i49GJr3QyPUZjCITrYZYJf8uTEpwnaNz765IeEb5my 4Uf7A8ST9lz0BDyhAbLZ5GM1hR24aZ9I5pRTpXo4Vp9148YTAhQCx09jMVG680126yRC gX01GOhkE1EfybvM/QnwpmR/6h9dzAk7AtYBIg1QcYjvk/STDdcUUEpRsCyKBDJtNpPy Dd9xgCy5w86xPI+MFeB8XviO49GRt273K8G+iP5NPBzOXcFXwATAhR8kUUpl2YWVLdrX TI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=jQ0zev7HbBd4Se78/C004unL1JvTQkF6pSVZna7txHs=; b=aL1lInle1H77a1+V9k5xDb69pwgQztRpwcpfRkiHoo1O9dJ+yT/ALwtQnLaLnR44iF O1zGyFUSKX8Hqpnh32Szv9jpVa6i/2z6J0fBm6l3y4NwpaviQ+0ZYwhlGWdr0R/NL5Vt akuisCi9nIUpZPwqjJwYZ608wYesL/NKS1NBWwaDBC9BUvKlGYAN0tHI9dqHX1Z7fB7n x6BKcQ63Tf5ixEZ71SEi82/yxxEUoXmxFJRMI+WnaMlW3PX3Wc6quB3aKmvr/gns1485 lK5RxdNH+V9t/SZ8BeIR7AzDFWEf1nS6pHEQRDkZdxmmsunUYbnPoDbHMmTLO6l5eQV1 xUhw== X-Gm-Message-State: AKwxytcrNUD8QHeZgJ55CJmDehne4haq7Slxh8mypu0lHkVrbgzN9oQy KQQq8bhLRX8T8l540Et5lc5/73R3 X-Received: by 10.223.134.58 with SMTP id 55mr15229967wrv.262.1516112302793; Tue, 16 Jan 2018 06:18:22 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-229-84.clienti.tiscali.it. [78.12.229.84]) by smtp.gmail.com with ESMTPSA id u10sm1537758wrg.6.2018.01.16.06.18.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 06:18:21 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 15:17:15 +0100 Message-Id: <1516112253-14480-34-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> References: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 33/51] 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: =?utf-8?q?Alex_Benn=C3=A9e?= 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 Signed-off-by: Paolo Bonzini --- scripts/qemu-gdb.py | 3 ++- scripts/qemugdb/tcg.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 scripts/qemugdb/tcg.py -- 1.8.3.1 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))