mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Jihong <yangjihong1@huawei.com>
To: Adrian Hunter <adrian.hunter@intel.com>, <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>,
	<kan.liang@linux.intel.com>, <kim.phillips@amd.com>,
	<german.gomez@arm.com>, <ravi.bangoria@amd.com>,
	<linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf tool: Fix output unexpected messages in quiet mode
Date: Mon, 19 Dec 2022 17:28:00 +0800	[thread overview]
Message-ID: <7aecae79-5b6d-09ea-dfd5-4d4810875f3d@huawei.com> (raw)
In-Reply-To: <194c676b-3a73-7f34-1f29-a157b5e4731f@intel.com>

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 <yangjihong1@huawei.com>
> 
> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> 
Thanks for reviewed-by.

Thanks,
Yang

  reply	other threads:[~2022-12-19  9:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19  2:49 Yang Jihong
2022-12-19  6:59 ` Adrian Hunter
2022-12-19  9:28   ` Yang Jihong [this message]
2022-12-19 10:28     ` Adrian Hunter
2022-12-19 13:14       ` Yang Jihong
2022-12-19 13:19         ` Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7aecae79-5b6d-09ea-dfd5-4d4810875f3d@huawei.com \
    --to=yangjihong1@huawei.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=german.gomez@arm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kim.phillips@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®