From patchwork Tue Dec 20 03:57:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 34898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2760404wrn; Mon, 19 Dec 2022 20:02:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf7wPJ7FytnJIeRGCwOjM5mZBzJWSx9mpYTnjgcJafRfvmadZswhGVUAlQX+KoXPabGZutdB X-Received: by 2002:a17:906:a886:b0:7c1:8f53:83a0 with SMTP id ha6-20020a170906a88600b007c18f5383a0mr21737129ejb.13.1671508960948; Mon, 19 Dec 2022 20:02:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671508960; cv=none; d=google.com; s=arc-20160816; b=V+kB+nFDb/IfbRRzjggObMyVFEpyp5lO5/XplWzyWL9wvtYFelwj5bnoMuNDUs2Whk Ja5LK2ZPLK7U/R8Xt/BJ8Ip8bdSflQvrwQubu3Stqd6/yqkOIJFOm02Z4TvPdh/aYaRD WZFuCZEfHMwUKtsGqclAop1huD0hB0SKoC/JXVaCZ+PGPZrBvDQJrgm1Jx4+p50JKltc lH0DE8oMjeTL76s/T7eGd4hFRSQ3Nm85oaojsSe9qTAbJPo96PblcKOagPVg/FS5IWVc hR7tZ8QOPW31gZy1Nsp57LdGZM+sE1ZmeUmobN0RGWtZY20LCmhcNNg6X/VTlc2ivj7w 4rug== 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=snOSs9Kb7QYxYt/LqO4n3OLaMMhIujp3Qjwb8oLgHrE=; b=sT8xTgbcP8Fq54pqnxAgwaxLAjeHoC25lWdEXWfPwd6g/73Va4RcKfxa5t53SVEOT6 t4qtdyMmhEuf+N+3Ws5jW3rtrv5V/LL9tySZxh9Fr/xAiFJydg69VNo39xG66XSkhHFK 00XVKUzEvN4ReGQVKm1ua6hwwwZO4bc97+K0L8HjKmgdewmuIzub+OgwtsNHUYZyzNIs w6mpWmKNiJ6Swk89jQAyzrnClOtok7m6cEtrcou9X1FS7WghTeGEKPwJNTS51Scxxm6F DnIEFdY7OZHsSMV0KyGMBmutoHufF8z/UYjvbmbX+ALVWpxH38xELUwmHUrk9AXgP8Ed jioQ== 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 hx9-20020a170906846900b00711da52c6e4si8174673ejc.309.2022.12.19.20.02.17; Mon, 19 Dec 2022 20:02:40 -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 S233028AbiLTD74 (ORCPT + 99 others); Mon, 19 Dec 2022 22:59:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbiLTD7w (ORCPT ); Mon, 19 Dec 2022 22:59:52 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFABF632B; Mon, 19 Dec 2022 19:59:50 -0800 (PST) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NbjVd67sbzJqV7; Tue, 20 Dec 2022 11:58:49 +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:48 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , , CC: Subject: [PATCH 1/3] perf tools: Set debug_peo_args and redirect_to_stderr to correct values in perf_quiet_option Date: Tue, 20 Dec 2022 11:57:00 +0800 Message-ID: <20221220035702.188413-2-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752704180098665552?= X-GMAIL-MSGID: =?utf-8?q?1752704180098665552?= When perf uses quiet mode, perf_quiet_option sets debug_peo_args to -1, and display_attr incorrectly determines the value of debug_peo_args. As a result, unexpected information is displayed. Before: # perf record --quiet -- ls > /dev/null ------------------------------------------------------------ perf_event_attr: size 128 { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|PERIOD read_format ID|LOST disabled 1 inherit 1 mmap 1 comm 1 freq 1 enable_on_exec 1 task 1 precise_ip 3 sample_id_all 1 exclude_guest 1 mmap2 1 comm_exec 1 ksymbol 1 bpf_event 1 ------------------------------------------------------------ ... After: # perf record --quiet -- ls > /dev/null # redirect_to_stderr is a similar problem. Fixes: f78eaef0e049 ("perf tools: Allow to force redirect pr_debug to stderr.") Fixes: ccd26741f5e6 ("perf tool: Provide an option to print perf_event_open args and return value") Suggested-by: Adrian Hunter Signed-off-by: Yang Jihong Reviewed-by: Adrian Hunter --- tools/perf/util/debug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 65e6c22f38e4..190e818a0717 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -241,6 +241,10 @@ int perf_quiet_option(void) opt++; } + /* For debug variables that are used as bool types, set to 0. */ + redirect_to_stderr = 0; + debug_peo_args = 0; + return 0; }