Message ID | 20221028121913.745307-1-james.clark@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp798225wru; Fri, 28 Oct 2022 05:25:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nInzhD+XV45r6wjTxk6xyQ06WkbASkz1fjP+2pMzxYfOzSMRiAPhTdLhDYh7ieUnwfvK/ X-Received: by 2002:a05:6402:2994:b0:453:4c5c:d31c with SMTP id eq20-20020a056402299400b004534c5cd31cmr51388552edb.412.1666959946771; Fri, 28 Oct 2022 05:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666959946; cv=none; d=google.com; s=arc-20160816; b=Chia2v2S3+sJHFHDyHFhKR7NXhiOfHeG8mcvD2p7SeAk9WEEoe05gRuGI9GIaGkMnM CPRhfsOuqawH9e0Ef53ETczWFxaDD5cP5zvgXMf+Mb1l40r6WP1IFOujNcNU71l3wF0Z CRbJa9KiIwlwB4rzlHgYFTIWL77DYvzTN/UU/rpxhVOEpKR2bOdKmXVc+dNNQENj0GB5 d44lZT1kOsgnwiq9/GtwC7zPphgiIxrER0lJc0Xy+XwvD1V/KrdtXqnX8jmYctMLZzjv NswdnuBypMY5QS+V0kQY3I7lbPc+bRDPd84TgGdLbq5CsXsGDhtJvOFiwInhU1cYweYj 86gA== 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=pcRjkX8Mb5JJKez4seuU6Fd05ohTOnpc5vQFVDo48y8=; b=K3Nh3fZvZSo6SMjyeAukYlJbOpQ9TRgIjLU3mrnD/GLha5bvFTnfanV5AMI2je3Dy3 zOzNwT5N0zrIBVDAkhC/ekQAhWg0o63T5FEaNcuwciMPW3jojr+hqkexJkk7NEmW7/lW C9g83Ekfx/vxe36g7JJmqFg2jgDGI4zdYylj+kSpwwAcoPvjg4Dgs3nlbvReHy79xtIp VviL6L226KrkO1QyX0uXdMYn4N5MrkcTGNaizDs2F1mG6M0BDig2zUCIbkHPEgzxJS3V wagkmfOEBSsKjVKQ7xM+6qyWBCExxx4ReQhoPBGMdIWK2KJfjqLf4aBjXATNMDG8NEaG 3l4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt4-20020a170907728400b007ac60b83407si4693996ejc.725.2022.10.28.05.25.21; Fri, 28 Oct 2022 05:25:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbiJ1MT0 (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Fri, 28 Oct 2022 08:19:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiJ1MTZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Oct 2022 08:19:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0DFDE6B177; Fri, 28 Oct 2022 05:19:23 -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 C9D5C1FB; Fri, 28 Oct 2022 05:19:29 -0700 (PDT) Received: from e126815.warwick.arm.com (e126815.arm.com [10.32.32.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B5A263F7B4; Fri, 28 Oct 2022 05:19:21 -0700 (PDT) From: James Clark <james.clark@arm.com> To: linux-perf-users@vger.kernel.org, acme@kernel.org, atrajeev@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, Anshuman.Khandual@arm.com, James Clark <james.clark@arm.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Kajol Jain <kjain@linux.ibm.com> Subject: [PATCH] perf test: Fix skipping branch stack sampling test Date: Fri, 28 Oct 2022 13:19:13 +0100 Message-Id: <20221028121913.745307-1-james.clark@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747934193246461597?= X-GMAIL-MSGID: =?utf-8?q?1747934193246461597?= |
Series |
perf test: Fix skipping branch stack sampling test
|
|
Commit Message
James Clark
Oct. 28, 2022, 12:19 p.m. UTC
Commit f4a2aade6809 ("perf tests powerpc: Fix branch stack sampling test
to include sanity check for branch filter") added a skip if certain
branch options aren't available. But the change added both -b
(--branch-any) and --branch-filter options at the same time, which will
always result in a failure on any platform because the arguments can't
be used together.
Fix this by removing -b (--branch-any) and leaving --branch-filter which
already specifies 'any'. Also add warning messages to the test and perf
tool.
Output on x86 before this fix:
$ sudo ./perf test branch
108: Check branch stack sampling : Skip
After:
$ sudo ./perf test branch
108: Check branch stack sampling : Ok
Fixes: f4a2aade6809 ("perf tests powerpc: Fix branch stack sampling test to include sanity check for branch filter")
Signed-off-by: James Clark <james.clark@arm.com>
---
tools/perf/tests/shell/test_brstack.sh | 5 ++++-
tools/perf/util/parse-branch-options.c | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
Comments
On 28/10/2022 13:19, James Clark wrote: > Commit f4a2aade6809 ("perf tests powerpc: Fix branch stack sampling test > to include sanity check for branch filter") added a skip if certain > branch options aren't available. But the change added both -b > (--branch-any) and --branch-filter options at the same time, which will > always result in a failure on any platform because the arguments can't > be used together. > > Fix this by removing -b (--branch-any) and leaving --branch-filter which > already specifies 'any'. Also add warning messages to the test and perf > tool. > Hi Athira, Are you able to check if this still skips for you on PowerPC with this new change? Thanks James > Output on x86 before this fix: > > $ sudo ./perf test branch > 108: Check branch stack sampling : Skip > > After: > > $ sudo ./perf test branch > 108: Check branch stack sampling : Ok > > Fixes: f4a2aade6809 ("perf tests powerpc: Fix branch stack sampling test to include sanity check for branch filter") > Signed-off-by: James Clark <james.clark@arm.com> > --- > tools/perf/tests/shell/test_brstack.sh | 5 ++++- > tools/perf/util/parse-branch-options.c | 4 +++- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh > index ec801cffae6b..d7ff5c4b4da4 100755 > --- a/tools/perf/tests/shell/test_brstack.sh > +++ b/tools/perf/tests/shell/test_brstack.sh > @@ -13,7 +13,10 @@ fi > > # skip the test if the hardware doesn't support branch stack sampling > # and if the architecture doesn't support filter types: any,save_type,u > -perf record -b -o- -B --branch-filter any,save_type,u true > /dev/null 2>&1 || exit 2 > +if ! perf record -o- --no-buildid --branch-filter any,save_type,u -- true > /dev/null 2>&1 ; then > + echo "skip: system doesn't support filter types: any,save_type,u" > + exit 2 > +fi > > TMPDIR=$(mktemp -d /tmp/__perf_test.program.XXXXX) > > diff --git a/tools/perf/util/parse-branch-options.c b/tools/perf/util/parse-branch-options.c > index 00588b9db474..31faf2bb49ff 100644 > --- a/tools/perf/util/parse-branch-options.c > +++ b/tools/perf/util/parse-branch-options.c > @@ -102,8 +102,10 @@ parse_branch_stack(const struct option *opt, const char *str, int unset) > /* > * cannot set it twice, -b + --branch-filter for instance > */ > - if (*mode) > + if (*mode) { > + pr_err("Error: Can't use --branch-any (-b) with --branch-filter (-j).\n"); > return -1; > + } > > return parse_branch_str(str, mode); > }
> On 28-Oct-2022, at 5:52 PM, James Clark <james.clark@arm.com> wrote: > > > > On 28/10/2022 13:19, James Clark wrote: >> Commit f4a2aade6809 ("perf tests powerpc: Fix branch stack sampling test >> to include sanity check for branch filter") added a skip if certain >> branch options aren't available. But the change added both -b >> (--branch-any) and --branch-filter options at the same time, which will >> always result in a failure on any platform because the arguments can't >> be used together. >> >> Fix this by removing -b (--branch-any) and leaving --branch-filter which >> already specifies 'any'. Also add warning messages to the test and perf >> tool. >> > > Hi Athira, > > Are you able to check if this still skips for you on PowerPC with this > new change? > Hi James, Sorry for the late response. I was out on vacation couple of days. I tested with the new change and verified it skips on powerpc. Tested-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Thanks Athira > Thanks > James > >> Output on x86 before this fix: >> >> $ sudo ./perf test branch >> 108: Check branch stack sampling : Skip >> >> After: >> >> $ sudo ./perf test branch >> 108: Check branch stack sampling : Ok >> >> Fixes: f4a2aade6809 ("perf tests powerpc: Fix branch stack sampling test to include sanity check for branch filter") >> Signed-off-by: James Clark <james.clark@arm.com> >> --- >> tools/perf/tests/shell/test_brstack.sh | 5 ++++- >> tools/perf/util/parse-branch-options.c | 4 +++- >> 2 files changed, 7 insertions(+), 2 deletions(-) >> >> diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh >> index ec801cffae6b..d7ff5c4b4da4 100755 >> --- a/tools/perf/tests/shell/test_brstack.sh >> +++ b/tools/perf/tests/shell/test_brstack.sh >> @@ -13,7 +13,10 @@ fi >> >> # skip the test if the hardware doesn't support branch stack sampling >> # and if the architecture doesn't support filter types: any,save_type,u >> -perf record -b -o- -B --branch-filter any,save_type,u true > /dev/null 2>&1 || exit 2 >> +if ! perf record -o- --no-buildid --branch-filter any,save_type,u -- true > /dev/null 2>&1 ; then >> + echo "skip: system doesn't support filter types: any,save_type,u" >> + exit 2 >> +fi >> >> TMPDIR=$(mktemp -d /tmp/__perf_test.program.XXXXX) >> >> diff --git a/tools/perf/util/parse-branch-options.c b/tools/perf/util/parse-branch-options.c >> index 00588b9db474..31faf2bb49ff 100644 >> --- a/tools/perf/util/parse-branch-options.c >> +++ b/tools/perf/util/parse-branch-options.c >> @@ -102,8 +102,10 @@ parse_branch_stack(const struct option *opt, const char *str, int unset) >> /* >> * cannot set it twice, -b + --branch-filter for instance >> */ >> - if (*mode) >> + if (*mode) { >> + pr_err("Error: Can't use --branch-any (-b) with --branch-filter (-j).\n"); >> return -1; >> + } >> >> return parse_branch_str(str, mode); >> }
Em Wed, Nov 02, 2022 at 12:21:11PM +0530, Athira Rajeev escreveu: > > > > On 28-Oct-2022, at 5:52 PM, James Clark <james.clark@arm.com> wrote: > > > > > > > > On 28/10/2022 13:19, James Clark wrote: > >> Commit f4a2aade6809 ("perf tests powerpc: Fix branch stack sampling test > >> to include sanity check for branch filter") added a skip if certain > >> branch options aren't available. But the change added both -b > >> (--branch-any) and --branch-filter options at the same time, which will > >> always result in a failure on any platform because the arguments can't > >> be used together. > >> > >> Fix this by removing -b (--branch-any) and leaving --branch-filter which > >> already specifies 'any'. Also add warning messages to the test and perf > >> tool. > >> > > > > Hi Athira, > > > > Are you able to check if this still skips for you on PowerPC with this > > new change? > > > > Hi James, > > Sorry for the late response. I was out on vacation couple of days. > > I tested with the new change and verified it skips on powerpc. > > Tested-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Thanks, applied. - Arnaldo > Thanks > Athira > > Thanks > > James > > > >> Output on x86 before this fix: > >> > >> $ sudo ./perf test branch > >> 108: Check branch stack sampling : Skip > >> > >> After: > >> > >> $ sudo ./perf test branch > >> 108: Check branch stack sampling : Ok > >> > >> Fixes: f4a2aade6809 ("perf tests powerpc: Fix branch stack sampling test to include sanity check for branch filter") > >> Signed-off-by: James Clark <james.clark@arm.com> > >> --- > >> tools/perf/tests/shell/test_brstack.sh | 5 ++++- > >> tools/perf/util/parse-branch-options.c | 4 +++- > >> 2 files changed, 7 insertions(+), 2 deletions(-) > >> > >> diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh > >> index ec801cffae6b..d7ff5c4b4da4 100755 > >> --- a/tools/perf/tests/shell/test_brstack.sh > >> +++ b/tools/perf/tests/shell/test_brstack.sh > >> @@ -13,7 +13,10 @@ fi > >> > >> # skip the test if the hardware doesn't support branch stack sampling > >> # and if the architecture doesn't support filter types: any,save_type,u > >> -perf record -b -o- -B --branch-filter any,save_type,u true > /dev/null 2>&1 || exit 2 > >> +if ! perf record -o- --no-buildid --branch-filter any,save_type,u -- true > /dev/null 2>&1 ; then > >> + echo "skip: system doesn't support filter types: any,save_type,u" > >> + exit 2 > >> +fi > >> > >> TMPDIR=$(mktemp -d /tmp/__perf_test.program.XXXXX) > >> > >> diff --git a/tools/perf/util/parse-branch-options.c b/tools/perf/util/parse-branch-options.c > >> index 00588b9db474..31faf2bb49ff 100644 > >> --- a/tools/perf/util/parse-branch-options.c > >> +++ b/tools/perf/util/parse-branch-options.c > >> @@ -102,8 +102,10 @@ parse_branch_stack(const struct option *opt, const char *str, int unset) > >> /* > >> * cannot set it twice, -b + --branch-filter for instance > >> */ > >> - if (*mode) > >> + if (*mode) { > >> + pr_err("Error: Can't use --branch-any (-b) with --branch-filter (-j).\n"); > >> return -1; > >> + } > >> > >> return parse_branch_str(str, mode); > >> }
diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh index ec801cffae6b..d7ff5c4b4da4 100755 --- a/tools/perf/tests/shell/test_brstack.sh +++ b/tools/perf/tests/shell/test_brstack.sh @@ -13,7 +13,10 @@ fi # skip the test if the hardware doesn't support branch stack sampling # and if the architecture doesn't support filter types: any,save_type,u -perf record -b -o- -B --branch-filter any,save_type,u true > /dev/null 2>&1 || exit 2 +if ! perf record -o- --no-buildid --branch-filter any,save_type,u -- true > /dev/null 2>&1 ; then + echo "skip: system doesn't support filter types: any,save_type,u" + exit 2 +fi TMPDIR=$(mktemp -d /tmp/__perf_test.program.XXXXX) diff --git a/tools/perf/util/parse-branch-options.c b/tools/perf/util/parse-branch-options.c index 00588b9db474..31faf2bb49ff 100644 --- a/tools/perf/util/parse-branch-options.c +++ b/tools/perf/util/parse-branch-options.c @@ -102,8 +102,10 @@ parse_branch_stack(const struct option *opt, const char *str, int unset) /* * cannot set it twice, -b + --branch-filter for instance */ - if (*mode) + if (*mode) { + pr_err("Error: Can't use --branch-any (-b) with --branch-filter (-j).\n"); return -1; + } return parse_branch_str(str, mode); }