Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3516228rwj; Mon, 19 Dec 2022 20:36:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf6J3CthPR3vtFYR9vddR6unmHwQsw+/uQSdOoOkrcsE4BIZ9qwVFuJT+K73SI0iu45nhHpN X-Received: by 2002:a17:907:629c:b0:7c0:bf26:2cf with SMTP id nd28-20020a170907629c00b007c0bf2602cfmr57929114ejc.49.1671510959875; Mon, 19 Dec 2022 20:35:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671510959; cv=none; d=google.com; s=arc-20160816; b=kZJRNz2xpnPNFFBGrxt7mZTKdxSEouph/SsHV2/VBgsh2ZBGj9ViJQIQFUAAOU2Ube s3uBRBm61hl71nzEjX7euioycgNLuGb2GHtR6ujUdQZcZFL7QHoGGwpQkJIPeqNfbEFV hXVjVet0FSnd3RjovY5WQjtSOuMgtXZderuESECoeYdUAsvydM48eh8Hgm68j8Y7YAxJ JgdAABWW7uQla4kANlO0Bp8Zy8A4PgD2C0DyKDuj3LQ6utzZ+Ksg02ABrpc5uA/v2aWZ fcBb1CFjy6RDcpF4vdrfBzMJdK5WY6fVhAqXXLjhx8MZYxdFOZFSer1jMm6cFVO4sJ6w B0WA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw16-20020a170906fcb000b007af0ca23299si681996ejb.841.2022.12.19.20.35.43; Mon, 19 Dec 2022 20:35:59 -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 + 71 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 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; } -- 2.30.GIT