Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp407331rdf; Fri, 3 Nov 2023 04:35:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWOvZJ0x3/8dwZ2LjbynIBXcKaYeAprjsP69AA8FXtYSiNtF8efsFzrlob9kU/MLm6LoEA X-Received: by 2002:a05:6358:7e47:b0:169:8620:a23c with SMTP id p7-20020a0563587e4700b001698620a23cmr11950581rwm.4.1699011329845; Fri, 03 Nov 2023 04:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699011329; cv=none; d=google.com; s=arc-20160816; b=rOyjuKj1R3bKn8xvM2CAVAadHzpyDGyK3f4TEJDc1s9f+J6ZCxm6/O5HW1vUUtqGSV ab/y0n9l0p07a1q96u5BVsn6d9ZQnpeFfHypnBtwXfAlawH9bROglsmq4t7eWy+x1UW7 l1Bv/mK19fFzV8St28iXzRJNWMZZZuldBzEHn+72H4GoJEqm8kvO8fcKLQkrXyS7O2lC cTV8mkjsOs/6btCCkZrOul75e8oEaIzhYw+Rxf/l2YNwsALV2IkTTL+mfpCu0rPN31Ra fT53LTzMo77vakzv5uxScWU2XULbPvuxcnuLNeaTldghcLZLbCW0xPdxJvZwxskvUHe5 +tXA== 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 :message-id:date:subject:cc:to:from; bh=T5QdMHt1DOzgNZRG8d6UMUjbDnluhyO2HUWIzss4hzg=; fh=LfNcvWFrdfG96mWtoVw9HYMrvma9efS1dExdXeyKyjA=; b=DJwKyX0y/ShT1w0hzD5CwqFVm3SbBPW4gmqyZxhi3mpvgMKUkJe87q+I/CNSN/rZrq oLUxHqHOIMj1qm/9lW6yJp/0ABRbc9eRbuHjw3sOOGTPveQ1F1Wb7MoPE9ljaHTsvE7+ AW87zQUmd1OA4+oa0PkPnRjnXu1uNj848DDo0l3ZYMK3SI4hm3ll0MurgzkY0Rrq5bIX TWN8+fp8UCiyrRbbKUwNORd12O2CSiwPXCW389Dyo3UBLYhV4WlTbOJJWRN7w3wssg8Q AYXjD1+iZGpTpKlw+UeJT7XH8tmxbgS9sVDxaWVqg6crCHM+Jn57QG2NT8cTVA+8JE2+ VzNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k69-20020a638448000000b005b8f298110csi1360472pgd.6.2023.11.03.04.35.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 04:35:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 49C8F8292BC3; Fri, 3 Nov 2023 04:35:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233073AbjKCLfW (ORCPT + 99 others); Fri, 3 Nov 2023 07:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbjKCLfV (ORCPT ); Fri, 3 Nov 2023 07:35:21 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6303E1A8; Fri, 3 Nov 2023 04:35:18 -0700 (PDT) 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 AA1A52F4; Fri, 3 Nov 2023 04:36:00 -0700 (PDT) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A26EA3F67D; Fri, 3 Nov 2023 04:35:12 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Tom Rix , Kan Liang , Yang Jihong , Kajol Jain , Athira Rajeev , Ravi Bangoria , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] perf test: Add option to change objdump binary Date: Fri, 3 Nov 2023 11:34:58 +0000 Message-Id: <20231103113501.490012-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 04:35:27 -0700 (PDT) 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" 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