Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2188392rdf; Mon, 6 Nov 2023 07:11:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IElafF+JoQirGepZoSA8JyxcyJrLJaieL3XtzhMXH2xqCYDk9NcETB6jMVzyEisN+A+ePzz X-Received: by 2002:a05:6a20:2447:b0:14d:e075:fc5d with SMTP id t7-20020a056a20244700b0014de075fc5dmr25123734pzc.40.1699283509894; Mon, 06 Nov 2023 07:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699283509; cv=none; d=google.com; s=arc-20160816; b=LWJiJBvIT+p25GYur0Ig2jkDymwnb2RL/rUvietI9cg08bh/mmsDdTKaHPoFhz77Lq BaJ2X3a9IKzEFn335K36JpV9ewqPKr3G8z/4zylpr8/rv/qmJnMEqkPvzQkK9ixGiA4s t0jyycdKVCqRN8II3plB7vyiV74Xw9o+W0kdUmtDHiSqLPppyJuIKsJYpRUmmO04sUwY UVXxbTGOWj0e8PcREMSgN2HJMhtZghaOcE4OEU56wgXl9hNm6vxmsihMjnhn9oyclBGt Or451rPRHffr9RMV6dGDFndqTCPzBKBFlFCkH7AmhUpwJznSzBEnYQesMRnFNsjxageH c5hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7PzUsKStPSYNfs9O7DUycuym6jFFD8tt3fexEc3cG6k=; fh=WrkBSc9J4RSrV1QvAQeMf1qpvV0f69oXxEMq7ttlegY=; b=EG8ZTnId2i0AlCOey16AfhaCLvCOW8YpzKQaOBT2OCU438LPLDra67idskT7HF1aBx XMxcBaK43v8VkHj6RT4PlFOSZUs/jn3rHrUaHFUePUxBxEHeO4ic5XsmPUj3+JHMVofX 9iRGWAuW/znWSeXKoX0D//hxjVsg0OmhENRaTDV02HGHvup/KSubJlWKrCASxr4XiZbn 2pw9phZfDOaOFviD12ZfuejaBK3AFUa5FOoyCAJr7imqqcTy2lae9hm8WZAA8Za9lEP0 1xFZVv+CBqZU/okQkxmuAvSzSDAKtcYSJmsB3QVNDzvWu1kTyqj8vWxWgf0gm00GMP8h bBqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n3-20020a056a0007c300b006bf1f9bb921si7850452pfu.120.2023.11.06.07.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:11:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1B1E380267E3; Mon, 6 Nov 2023 07:11:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232049AbjKFPL0 (ORCPT + 99 others); Mon, 6 Nov 2023 10:11:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbjKFPLZ (ORCPT ); Mon, 6 Nov 2023 10:11:25 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 883ECD8; Mon, 6 Nov 2023 07:11:22 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 81D2DC15; Mon, 6 Nov 2023 07:12:06 -0800 (PST) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7F23C3F6C4; Mon, 6 Nov 2023 07:11:19 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org, irogers@google.com Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Tom Rix , Fangrui Song , Kan Liang , Ravi Bangoria , Yang Jihong , Kajol Jain , Athira Rajeev , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v2 1/2] perf test: Add option to change objdump binary Date: Mon, 6 Nov 2023 15:10:48 +0000 Message-Id: <20231106151051.129440-2-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106151051.129440-1-james.clark@arm.com> References: <20231106151051.129440-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 07:11:37 -0800 (PST) All of the other Perf subcommands that use objdump have an option to specify the binary, so add the same option to perf test. This is useful if you have built the kernel with a different toolchain to the system one, where the system objdump may fail to disassemble vmlinux. Now this can be fixed with something like this: $ perf test --objdump llvm-objdump "object code reading" Reviewed-by: Ian Rogers Signed-off-by: James Clark --- tools/perf/tests/builtin-test.c | 3 +++ tools/perf/tests/code-reading.c | 2 +- tools/perf/tests/tests.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index cb6f1dd00dc4..a8d17dd50588 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -32,6 +32,7 @@ static bool dont_fork; const char *dso_to_test; +const char *test_objdump_path = "objdump"; /* * List of architecture specific tests. Not a weak symbol as the array length is @@ -529,6 +530,8 @@ int cmd_test(int argc, const char **argv) "Do not fork for testcase"), OPT_STRING('w', "workload", &workload, "work", "workload to run for testing"), OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"), + OPT_STRING(0, "objdump", &test_objdump_path, "path", + "objdump binary to use for disassembly and annotations"), OPT_END() }; const char * const test_subcommands[] = { "list", NULL }; diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 3af81012014e..b353358acc3a 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -185,7 +185,7 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf, int ret; fmt = "%s -z -d --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s"; - ret = snprintf(cmd, sizeof(cmd), fmt, "objdump", addr, addr + len, + ret = snprintf(cmd, sizeof(cmd), fmt, test_objdump_path, addr, addr + len, filename); if (ret <= 0 || (size_t)ret >= sizeof(cmd)) return -1; diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index b394f3ac2d66..dad3d7414142 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h @@ -207,5 +207,6 @@ DECLARE_WORKLOAD(brstack); DECLARE_WORKLOAD(datasym); extern const char *dso_to_test; +extern const char *test_objdump_path; #endif /* TESTS_H */ -- 2.34.1