From patchwork Fri Jan 12 11:30:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 124306 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1986785qgn; Fri, 12 Jan 2018 04:15:12 -0800 (PST) X-Google-Smtp-Source: ACJfBovF0kQXVycAFMNqqY+mMfRTPOqC7v2afBHC9CpCousU8z59mRBVZwJXRbvVRj97/7ygT70e X-Received: by 10.37.81.138 with SMTP id f132mr23060644ybb.58.1515759312245; Fri, 12 Jan 2018 04:15:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515759312; cv=none; d=google.com; s=arc-20160816; b=Pv1xaIblg6BlvU1CSasoaoeP64H00FpaO+QCg7lHi6e9Nkz3We7A+84KsPIv+oejjp WVYYXGFTqS3i4LBLwopOzE1A9/5H+41JjizbP5KFfMfCFHbYNK9dahvD5S8oTjVxAfZK 9p+XhPnLmFIQMgZj7mtPXXFDwpcANv72gCkXg01AOMceHc1d4VU1PQ1jIn5yBYbqaAYX VJx41dJuQQFhwCjuPDBQRznf41+cJYab7CXLG5amojO+QoqJu9iZMgw+At67QrAkrjK6 giRbWE7Opxy2LBkQ79cea9+h5tMZDn9nMV+OZM8qe5xptYqmBmqcLU5ULFs7geWznOcs oZKQ== 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=8uK7m+aJMARg3nM8RYFYCYedyXZ6erON3h2snC7pldM=; b=Hv2i0Dfph0dsTP+Rs9OI+wkrRh433fsxLAlWEwJexUtxwdh14aSK/Wx7sJl8J2ueA3 CEIFSvgYqxLTVDBFzzt647DTfHP4AwxC/PvWdESbZvhh6nILlp28SrDamyR+ZA9D+wGb 5gJZ5RRDOF1sDDDG+D67mvhOPhYA20uRakUJPQnJHQZAv7M9VTirj4tWEU+QTS8TfXog W1xiO3jts2L3OjDEYIX3vMFAk2xqUAB+wttDIIc6W2zSLZeJmvy+vh7fh54S96dyuHMx fCmwSIATNWJ8bf7eFEjGwaxRO3U0gAm5NSRgSz4cM/kIzYmVWq7Xx6LDD875UajiCC7L WtOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Gu6WeHjI; 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 i67si1196096ybi.643.2018.01.12.04.15.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:15:12 -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=Gu6WeHjI; 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]:36462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZyEp-0004yR-OX for patch@linaro.org; Fri, 12 Jan 2018 07:15:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZxZ4-0007ja-KV for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:32:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZxZ3-0005m8-Ka for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:32:02 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:37003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eZxZ3-0005lV-DS for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:32:01 -0500 Received: by mail-wr0-x241.google.com with SMTP id f8so5037331wre.4 for ; Fri, 12 Jan 2018 03:32:01 -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=8uK7m+aJMARg3nM8RYFYCYedyXZ6erON3h2snC7pldM=; b=Gu6WeHjIKfSmDdb6oRzZdNG0zr6iEeEwyXbmc8jEfSzcFo0D+zNEUdzLezD3OSbVsk P6zONynhs3/y5mYRlUgb/2U8Uyvdgx0rQqSAz4RNdvHe3xmOwtUllEb54WULPyBMW1ps zJUkMoEA4KgASR0OeJrjPNrRumpLSaTKrw9E25UyBwbwAqkfimzF1u/Gy1U7fMQ10URH HC2qnTuQH/A7j+6jnPiGATtn+zRJVRi5Fgc27Tqu9tp3ZCfybvu7SoDrobPUCOm1X0fb eGB1SSdtrrwxN4o6G2/r9xo0OTmhHnZGAHp7PYDVLrp0nUsgvQ6FMWlyh816qWq3HBLN aJ8g== 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=8uK7m+aJMARg3nM8RYFYCYedyXZ6erON3h2snC7pldM=; b=OGS1klkty4Qdu/V1rt+NgWg3qzKgf1pi330eJu+bihD/GJ9c5ppSmQ51ofzVQdWZDG 8M2df9xq/zVuUXnexk5gGfI0B9BQnLZGNyHB4FwSRH4+wZ7Utd1v9U97XuzBgsh6X0hP /fAyUrwhyyC4PvGhQ0gSkwJl2yRtzyv/ulpFNhO+N9/eEI98iL64GqGY0wY6n3GbLvM8 ycW6FxnUVTFGt7z3yBkMjVU3x3e86Hgvga0SEjiZsnS24GAapT1oJ0mYNxEqGvTJ6Id2 C5dLlWdZt6X/WTWd0weTtfUJdmfuQauyVnq3jnPbJyM9KqkQMjFSRmL6BRksgF6YyEte ulvg== X-Gm-Message-State: AKGB3mIC9esHTZSsjB2a/hIzgXD+nf02TJRsXg6pQqahbNE0fJaZiKCu Vt33ZdPhXf3dar42EZ7WrIxwVr6v X-Received: by 10.223.183.23 with SMTP id l23mr14776005wre.33.1515756720039; Fri, 12 Jan 2018 03:32:00 -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 l8sm2732271wmg.46.2018.01.12.03.31.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 03:31:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 12 Jan 2018 12:30:59 +0100 Message-Id: <1515756676-3860-36-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515756676-3860-1-git-send-email-pbonzini@redhat.com> References: <1515756676-3860-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 35/52] 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..88d042e --- /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))