Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2251899rwj; Mon, 19 Dec 2022 01:43:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf4c+b7Rgjx+wbaLoz/CSkjrmSGEpMmZMhbB3MFD4untVEO6rMJjtwgrEk3MMvS2jgbo+J71 X-Received: by 2002:a17:902:6b8b:b0:188:a4a3:7bb3 with SMTP id p11-20020a1709026b8b00b00188a4a37bb3mr41595555plk.9.1671443025254; Mon, 19 Dec 2022 01:43:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671443025; cv=none; d=google.com; s=arc-20160816; b=jMU+srWhawXDTn0cRF+bBkxxXXa1i7eSoFvBzcxIvdc0Xdva6y9cggh8SZeuC2sGgc IwwpidWQffA8juNO/siD0aCgN2TjMrfqxJBrPYA55xbhU38Y5hsvMEEwzVD8e/qyEKLK S3WQEfvss7uFVMS/i2DQyhGsyh/pT4PRsQZA0Eb6cQXQzzJxVumt7ms+xmkrspdRTD8F AmQpvAjoBdAXCD8Ugo7zfZwti5mtE0SWu8q2aO7fbpu4gLXRSxdlHWaa/LlcZKhhb4DQ TDkIYC+Huq3iT2Sof7gA4kIkOBt0Adt1GVG6BNI+v26zB87ZSHY5dURU77IS/wlgICzd /RFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=zBzBR3fc5JLhnbeLT61BFoOykDwE0U1Rp3Vnfv2cRYc=; b=mg12mHDpfdKGcQbPM4cpogK++wuhFLQUkv6pDLkKJ5M4oToK41zid5gkxMbHlo630k BvSXCO0qTb6BLGsaP10D4Jz0h4ZARyzTDrLoCKaBVGtPfqGltLuYB44n5oOA2Y0UOsPa W68E/hFL5NbGvQ69r3SeCG52zUPtoaTEyC/HP/zwrkWprOorl5Jwja/HnxqO41w1EVXR HKZQtV+kPJUMI2TV8cYmI7yuIRZse3T8SkGOsJ6mulFBZGcfHWKNzkctvLIFQWvxDn9X u2GI+b7yh/uyt/ekFd2OtwclI4Ak970MhtAJPmPd4dSpuaa+w29cKMjEnVvHyskPq+Zt r/Og== 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 c10-20020a170903234a00b00188fead2329si11269178plh.135.2022.12.19.01.43.36; Mon, 19 Dec 2022 01:43:45 -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 S231616AbiLSJ2K (ORCPT + 71 others); Mon, 19 Dec 2022 04:28:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbiLSJ2I (ORCPT ); Mon, 19 Dec 2022 04:28:08 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 170FA65EB; Mon, 19 Dec 2022 01:28:07 -0800 (PST) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NbDqh4KHVzmWZV; Mon, 19 Dec 2022 17:26:56 +0800 (CST) Received: from [10.67.111.205] (10.67.111.205) 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; Mon, 19 Dec 2022 17:28:01 +0800 Subject: Re: [PATCH] perf tool: Fix output unexpected messages in quiet mode To: Adrian Hunter , , , , , , , , , , , , , , References: <20221219024911.62741-1-yangjihong1@huawei.com> <194c676b-3a73-7f34-1f29-a157b5e4731f@intel.com> From: Yang Jihong Message-ID: <7aecae79-5b6d-09ea-dfd5-4d4810875f3d@huawei.com> Date: Mon, 19 Dec 2022 17:28:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <194c676b-3a73-7f34-1f29-a157b5e4731f@intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.111.205] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 Hello, On 2022/12/19 14:59, Adrian Hunter wrote: > On 19/12/22 04:49, Yang Jihong wrote: >> When perf uses quiet mode, perf_quiet_option sets debug_peo_args to -1, > > Seems like redirect_to_stderr has similar issue? The redirect_to_stderr is used only in the veprintf function: int veprintf(int level, int var, const char *fmt, va_list args) { int ret = 0; if (var >= level) { if (use_browser >= 1 && redirect_to_stderr <= 0) { ui_helpline__vshow(fmt, args); } else { ret = fprintf_time(debug_file); ret += vfprintf(debug_file, fmt, args); } } return ret; } If use quiet mode, verbose sets to -1. (also assigned in the perf_quiet_option function) Because "var >= level" is false, veprintf function returns directly, which avoids this problem. However, there are cases where: # perf --debug stderr=-1 report -vvv 2>/tmp/debug If stderr is -1, should we redirect pr_debug in this case? Because I'm not sure if this is a problem, if redirect_to_stderr needs to be fixed as well, let me know and I'll submit a patch to fix it. > >> 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 >> # >> >> Fixes: ccd26741f5e6 ("perf tool: Provide an option to print perf_event_open args and return value") >> Signed-off-by: Yang Jihong > > Reviewed-by: Adrian Hunter > Thanks for reviewed-by. Thanks, Yang