From patchwork Thu Sep 12 15:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13802293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12EDEEED613 for ; Thu, 12 Sep 2024 15:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=0vEtamCOnYuoncchNofQc9nqoQ7AlgNKS0ZFixTi9Yk=; b=yxPZttkIMxRvRpB1bNpU+va0Nz /ibPyt99rB+5wQJ5p2ltS1hcR94GbsOrfeFYWjn/KWlEEkAUljDMfMYh1HWSPJfNnq/7BzQQBNDLu Sw2iLXf5MJZpbQb7x8fmPJMsULL+hqoK7FCUcFfHCFclHDFy7NTm9inYRMjmd2nqoZ8qeY7TB6wy4 Jq/pUN/1gyKQ5bZaBmM8gAIjzq5UQexgVT/aQH/yV5qV1k7bhrDvt7C+nlxtUKnPs65zI8taB6E68 ChXNhrqlXvi7s9B2Enq0Np5G3o9HoePFoWAkD24IpA+oLhfawJer0cWdPBrTSpdbaL8Z9K12OTYNU DCzNzyBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1solVs-0000000DVdp-3wYK; Thu, 12 Sep 2024 15:13:40 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1solUf-0000000DV2k-3JeQ for linux-arm-kernel@lists.infradead.org; Thu, 12 Sep 2024 15:12:27 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42cb8dac900so10082005e9.3 for ; Thu, 12 Sep 2024 08:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726153943; x=1726758743; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0vEtamCOnYuoncchNofQc9nqoQ7AlgNKS0ZFixTi9Yk=; b=nlTz/lT0+a2sA7n5PTM942TU7+lgNSBoDpaQT6HDQ3dGIjuoCYWxuONoSmUsn8k3Jn Rr6B8hy5ofpIbk4byNstnHq5iw/U7d3PpJuOO2kDzoDeLYjXDdXQkoa0Z17FBxWtDn3o 56vn7x6vDf83jI5A7aLAYuy/XFY8RnehxbWfUrd2OXIbO+j2IHoEw8ayFDDsjYlKMtUz xxtZ2RELfnzEFmcLiKuPYYjAGw9BQfUBp5hGKr6GCu4Jj3Lt/93AwIc20QRcwOviQsqs NGiSE1CTlIZ4Ivf/Gj+VGYK67QH750BbxbUctzwdYzzi4xoSRuuwAqwgff2oNwv+24mT pWHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726153943; x=1726758743; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0vEtamCOnYuoncchNofQc9nqoQ7AlgNKS0ZFixTi9Yk=; b=TWWdeNsK4/nHNAMQfnwcwSi3jlvM1KYENUa38QPQzHnbKniWCyDllwUCKxWUjvafIO 7MqFjTU9wwntpJdGUXt7dqmOYQsAiCmR1iIpJScjPoDHETt84t7wSTu7Nd7pOS3lJK4V 9tUC+mBZfuf1WEbQrIMpHG6w9rvnlX7xWY0e1weXanqavIxB+G1aNI7JusjIC+JA2JRr IobFapeWrNa12JdFChYhzKwReP0wWN6B3iI2uTLpcHvJwTiQdOzz1n80kviU9Oscf0en 76QOaP6HlihFTpsUKMhF4H6fm28sNAEgOO+ZaPRtJPc3/z0QO2I+e5LWLBABrb+4y/F4 YPPg== X-Forwarded-Encrypted: i=1; AJvYcCXFS6Fz6MZyO1G2VEY+pFo+Sa8lkCVcavwvf0xmm+9+DMcwiABi23zvwcqPRNKIZvSkf/3laU6y+ASJOzjjTcOI@lists.infradead.org X-Gm-Message-State: AOJu0Yy88jd7XXBieU/ZUiQhL3Wy7wepLJwh8J9OvtGN6XxzOAbXymqu Bzl399+zy1xWaTRTpeYwtBKlMXVba3zvK4npD8JPz7ZQD7ypFK+KAXcF99JtExc= X-Google-Smtp-Source: AGHT+IHpusjf0xjPxFiA1GZfxsDd5yBxUzacHglUD/J7pm0cxmuicT08JsLhs59QcAxNXs2hkgj50w== X-Received: by 2002:a05:600c:3581:b0:42c:c8be:4217 with SMTP id 5b1f17b1804b1-42cdb53192dmr25176075e9.11.1726153942753; Thu, 12 Sep 2024 08:12:22 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb0dbcb6bsm171928845e9.30.2024.09.12.08.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 08:12:22 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, gankulkarni@os.amperecomputing.com, coresight@lists.linaro.org, leo.yan@arm.com, scclevenger@os.amperecomputing.com Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Leo Yan , Ben Gainey , Ruidong Tian , Benjamin Gray , Mathieu Poirier , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 0/7] perf: cs-etm: Coresight decode and disassembly improvements Date: Thu, 12 Sep 2024 16:11:31 +0100 Message-Id: <20240912151143.1264483-1-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240912_081225_849136_CC718A46 X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A set of changes that came out of the issues reported here [1]. * First 2 patches fix a decode bug in Perf and add support for new consistency checks in OpenCSD * The remaining ones make the disassembly script easier to test and use. This also involves adding a new Python binding to Perf to get a config value (perf_config_get()) [1]: https://lore.kernel.org/linux-arm-kernel/20240719092619.274730-1-gankulkarni@os.amperecomputing.com/ Changes since V1: * Keep the flush function for discontinuities * Still remove the flush when the buffer fills, but now add cs_etm__end_block() for the end trace. That way we won't drop the last branch stack if the instruction sample period wasn't hit at the very end. James Clark (7): perf cs-etm: Don't flush when packet_queue fills up perf cs-etm: Use new OpenCSD consistency checks perf scripting python: Add function to get a config value perf scripts python cs-etm: Update to use argparse perf scripts python cs-etm: Improve arguments perf scripts python cs-etm: Add start and stop arguments perf test: cs-etm: Test Coresight disassembly script .../perf/Documentation/perf-script-python.txt | 2 +- .../scripts/python/Perf-Trace-Util/Context.c | 11 ++ .../scripts/python/arm-cs-trace-disasm.py | 109 +++++++++++++----- .../tests/shell/test_arm_coresight_disasm.sh | 63 ++++++++++ tools/perf/util/config.c | 22 ++++ tools/perf/util/config.h | 1 + .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 7 +- tools/perf/util/cs-etm.c | 25 ++-- 8 files changed, 205 insertions(+), 35 deletions(-) create mode 100755 tools/perf/tests/shell/test_arm_coresight_disasm.sh Tested-by: from the reporters and probably from someone with access to