Message ID | 20221220035702.188413-4-yangjihong1@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2765791wrn; Mon, 19 Dec 2022 20:22:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXv3rMpnFBl8k36FnfDGbTzgdsVtUR18QQJmkQYZNGJL0ASok8Fzb8KZYYVYFbMHcfu72YhI X-Received: by 2002:a17:906:468d:b0:812:d53e:11f6 with SMTP id a13-20020a170906468d00b00812d53e11f6mr629757ejr.70.1671510134935; Mon, 19 Dec 2022 20:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671510134; cv=none; d=google.com; s=arc-20160816; b=cM0p8kjRSqUHHaHaPLKjiCQ6k/9eu51b8Zc7aSf78BFikmkCOvBcejLf15UTcuAXhC LsnX68FWnEsrWHbHUatF48mq9pqYjxwnC3wzuG2NkvPzzBPt/tjCtpTV5mtC3DbnCx5l +Anm1CxWFrOy6/XwHkdXzNxirGqugkgNn8ONT24OQlXnZN/OgkihXWa5QvLW/3JIR//w X8EyNJZNo18i0PM6l4+6zhdfM4B6FPfLKQeZ4DRAzrVmLILVo2Iui6gbeaECZXN50nvN w7p5j13x2N152LRyKWPgIVy3P/1yuOdpBKkVyBxKPJCJrGXhUvg/cZYQnbRcTo1fYwoh eaXQ== 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=72tEFgv/+w4y8SxpSnAeKXvCHK/PzXkRPXP7tnCOgdg=; b=J2fErslSLOqcp5LllOKyeQHSmWbfF1+9Wp3yQHUKpNqlDfjCH1+WWWiPUEreLL82Vc hK2ll3JcC8m8DnP9Ue0P6U+fwPhmIQbrG3lwt8SAj8/xdbptU209alA3WFqez8lawC5x tNJyYcfZ6PI0Ov4PY8nFlU02OWxFAyYjEDVoUmOEen7TRPPtx370ll7fSkSUXy2kQ/QM A5FRgcWaPJWVA3OXieMEBvwXgeIJp5/081P93XmjqbSU/dgb4Jgx49QaDBSB2dfeVe41 zJTLq2nK7WOsKtJlzFMZeGPGzgyo6V3tYdWPRzBcFKL9lnj+LwF1uqWqeO8L4mEnikZd Tycw== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc44-20020a17090716ac00b007bd6264c2dbsi11204100ejc.28.2022.12.19.20.21.50; Mon, 19 Dec 2022 20:22:14 -0800 (PST) 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233101AbiLTEAB (ORCPT <rfc822;abdi.embedded@gmail.com> + 99 others); Mon, 19 Dec 2022 23:00:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232989AbiLTD7x (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 19 Dec 2022 22:59:53 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E03D13E04; Mon, 19 Dec 2022 19:59:52 -0800 (PST) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NbjQk62wKzqT7Z; Tue, 20 Dec 2022 11:55:26 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.61) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 20 Dec 2022 11:59:49 +0800 From: Yang Jihong <yangjihong1@huawei.com> To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>, <mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>, <jolsa@kernel.org>, <namhyung@kernel.org>, <irogers@google.com>, <carsten.haitzler@arm.com>, <leo.yan@linaro.org>, <ravi.bangoria@amd.com>, <martin.lau@kernel.org>, <adrian.hunter@intel.com>, <ak@linux.intel.com>, <masami.hiramatsu.pt@hitachi.com>, <linux-perf-users@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <yangjihong1@huawei.com> Subject: [PATCH 3/3] perf probe: Check -v and -q options in the right place Date: Tue, 20 Dec 2022 11:57:02 +0800 Message-ID: <20221220035702.188413-4-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20221220035702.188413-1-yangjihong1@huawei.com> References: <20221220035702.188413-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.61] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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?1752705411346877443?= X-GMAIL-MSGID: =?utf-8?q?1752705411346877443?= |
Series |
Fixes for debug variables
|
|
Commit Message
Yang Jihong
Dec. 20, 2022, 3:57 a.m. UTC
Check the -q and -v options first to return earlier on error.
Before:
# perf probe -q -v test
probe-definition(0): test
symbol:test file:(null) line:0 offset:0 return:0 lazy:(null)
0 arguments
Error: -v and -q are exclusive.
After:
# perf probe -q -v test
Error: -v and -q are exclusive.
Fixes: 5e17b28f1e24 ("perf probe: Add --quiet option to suppress output result message")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
tools/perf/builtin-probe.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
Comments
On 20/12/22 05:57, Yang Jihong wrote: > Check the -q and -v options first to return earlier on error. > > Before: > # perf probe -q -v test > probe-definition(0): test > symbol:test file:(null) line:0 offset:0 return:0 lazy:(null) > 0 arguments > Error: -v and -q are exclusive. > > After: > # perf probe -q -v test > Error: -v and -q are exclusive. > > Fixes: 5e17b28f1e24 ("perf probe: Add --quiet option to suppress output result message") > Signed-off-by: Yang Jihong <yangjihong1@huawei.com> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> > --- > tools/perf/builtin-probe.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c > index 2ae50fc9e597..ed73d0b89ca2 100644 > --- a/tools/perf/builtin-probe.c > +++ b/tools/perf/builtin-probe.c > @@ -612,6 +612,15 @@ __cmd_probe(int argc, const char **argv) > > argc = parse_options(argc, argv, options, probe_usage, > PARSE_OPT_STOP_AT_NON_OPTION); > + > + if (quiet) { > + if (verbose != 0) { > + pr_err(" Error: -v and -q are exclusive.\n"); > + return -EINVAL; > + } > + verbose = -1; > + } > + > if (argc > 0) { > if (strcmp(argv[0], "-") == 0) { > usage_with_options_msg(probe_usage, options, > @@ -633,14 +642,6 @@ __cmd_probe(int argc, const char **argv) > if (ret) > return ret; > > - if (quiet) { > - if (verbose != 0) { > - pr_err(" Error: -v and -q are exclusive.\n"); > - return -EINVAL; > - } > - verbose = -1; > - } > - > if (probe_conf.max_probes == 0) > probe_conf.max_probes = MAX_PROBES; >
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 2ae50fc9e597..ed73d0b89ca2 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -612,6 +612,15 @@ __cmd_probe(int argc, const char **argv) argc = parse_options(argc, argv, options, probe_usage, PARSE_OPT_STOP_AT_NON_OPTION); + + if (quiet) { + if (verbose != 0) { + pr_err(" Error: -v and -q are exclusive.\n"); + return -EINVAL; + } + verbose = -1; + } + if (argc > 0) { if (strcmp(argv[0], "-") == 0) { usage_with_options_msg(probe_usage, options, @@ -633,14 +642,6 @@ __cmd_probe(int argc, const char **argv) if (ret) return ret; - if (quiet) { - if (verbose != 0) { - pr_err(" Error: -v and -q are exclusive.\n"); - return -EINVAL; - } - verbose = -1; - } - if (probe_conf.max_probes == 0) probe_conf.max_probes = MAX_PROBES;