All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: "Liang, Kan" <kan.liang@linux.intel.com>
Cc: David Miller <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, Wang Nan <wangnan0@huawei.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Kan Liang <kan.liang@intel.com>, Andi Kleen <ak@linux.intel.com>,
	Jin Yao <yao.jin@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: A concern about overflow ring buffer mode
Date: Fri, 26 Oct 2018 16:12:31 -0300	[thread overview]
Message-ID: <20181026191231.GG3353@kernel.org> (raw)
In-Reply-To: <3b81c999-9039-94e9-7a74-cdbd48fca08b@linux.intel.com>

Em Fri, Oct 26, 2018 at 03:07:40PM -0400, Liang, Kan escreveu:
> On 10/26/2018 3:02 PM, Arnaldo Carvalho de Melo wrote:
> > So, I'm adding the following to my tree to help in diagnosing problems
> > with this overwrite mode:
 
> Actually, you can use per-event overwrite term to disable overwrite mode for
> perf top.
 
> /*
>  * Check per-event overwrite term.
>  * perf top should support consistent term for all events.
>  * - All events don't have per-event term
>  *   E.g. "cpu/cpu-cycles/,cpu/instructions/"
>  *   Nothing change, return 0.
>  * - All events have same per-event term
>  *   E.g. "cpu/cpu-cycles,no-overwrite/,cpu/instructions,no-overwrite/
>  *   Using the per-event setting to replace the opts->overwrite if
>  *   they are different, then return 0.
>  * - Events have different per-event term
>  *   E.g. "cpu/cpu-cycles,overwrite/,cpu/instructions,no-overwrite/"
>  *   Return -1
>  * - Some of the event set per-event term, but some not.
>  *   E.g. "cpu/cpu-cycles/,cpu/instructions,no-overwrite/"
>  *   Return -1
>  */
> static int perf_top__overwrite_check(struct perf_top *top)
> {

I see, it will disable that opts->overwrite if it finds the no-overwrite
in the per-event definition, so the equivalent of the option I added
below:

     perf top --no-overwrite

is:

     perf top -e cycles/no-overwrite/

I checked and both have the same result. But I still think there is
value in having the shorter form, ok?

- Arnaldo

> Thanks,
> Kan
> 
> > 
> >  From 40feb09001c7cc2ba8aeaa0a8f03b6d28fa4ca95 Mon Sep 17 00:00:00 2001
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Date: Fri, 26 Oct 2018 15:55:23 -0300
> > Subject: [PATCH 1/1] perf top: Allow disabling the overwrite mode
> > 
> > In ebebbf082357 ("perf top: Switch default mode to overwrite mode") we
> > forgot to leave a way to disable that new default, add a --overwrite
> > option that can be disabled using --no-overwrite, since the code already
> > in such a way that we can readily disable this mode.
> > 
> > This is useful when investigating bugs with this mode like the recent
> > report from David Miller where lots of unknown symbols appear due to
> > disabling the events while processing them which disables all record
> > types, not just PERF_RECORD_SAMPLE, which makes it impossible to resolve
> > maps when we lose PERF_RECORD_MMAP records.
> > 
> > This can be easily seen while building a kernel, when there are lots of
> > short lived processes.
> > 
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Andi Kleen <ak@linux.intel.com>
> > Cc: David Ahern <dsahern@gmail.com>
> > Cc: David Miller <davem@davemloft.net>
> > Cc: Jin Yao <yao.jin@linux.intel.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Kan Liang <kan.liang@intel.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Wang Nan <wangnan0@huawei.com>
> > Link: https://lkml.kernel.org/n/tip-oqgsz2bq4kgrnnajrafcdhie@git.kernel.org
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> >   tools/perf/Documentation/perf-top.txt | 5 +++++
> >   tools/perf/builtin-top.c              | 2 ++
> >   2 files changed, 7 insertions(+)
> > 
> > diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
> > index 114fda12aa49..d4be6061fe1c 100644
> > --- a/tools/perf/Documentation/perf-top.txt
> > +++ b/tools/perf/Documentation/perf-top.txt
> > @@ -242,6 +242,11 @@ Default is to monitor all CPUS.
> >   --hierarchy::
> >   	Enable hierarchy output.
> > +--overwrite::
> > +	This is the default, but for investigating problems with it or any other strange
> > +	behaviour like lots of unknown samples, we may want to disable this mode by using
> > +	--no-overwrite.
> > +
> >   --force::
> >   	Don't do ownership validation.
> > diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> > index d21d8751e749..214fad747b04 100644
> > --- a/tools/perf/builtin-top.c
> > +++ b/tools/perf/builtin-top.c
> > @@ -1372,6 +1372,8 @@ int cmd_top(int argc, const char **argv)
> >   		    "Show raw trace event output (do not use print fmt or plugins)"),
> >   	OPT_BOOLEAN(0, "hierarchy", &symbol_conf.report_hierarchy,
> >   		    "Show entries in a hierarchy"),
> > +	OPT_BOOLEAN(0, "overwrite", &top.record_opts.overwrite,
> > +		    "Use a backward ring buffer, default: yes"),
> >   	OPT_BOOLEAN(0, "force", &symbol_conf.force, "don't complain, do it"),
> >   	OPT_UINTEGER(0, "num-thread-synthesize", &top.nr_threads_synthesize,
> >   			"number of thread to run event synthesize"),
> > 

  reply	other threads:[~2018-10-26 19:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 17:45 A concern about overflow ring buffer mode David Miller
2018-10-26 18:38 ` Arnaldo Carvalho de Melo
2018-10-26 18:42   ` Arnaldo Carvalho de Melo
2018-10-26 19:02     ` Arnaldo Carvalho de Melo
2018-10-26 19:07       ` Liang, Kan
2018-10-26 19:12         ` Arnaldo Carvalho de Melo [this message]
2018-10-26 19:16           ` Liang, Kan
2018-10-26 19:24             ` Arnaldo Carvalho de Melo
2018-10-26 20:11               ` Liang, Kan
2018-10-26 20:43                 ` Arnaldo Carvalho de Melo
2018-10-29 13:03                 ` [PATCHES/RFC] " Arnaldo Carvalho de Melo
2018-10-29 14:33                   ` Liang, Kan
2018-10-29 14:35                     ` Arnaldo Carvalho de Melo
2018-10-29 15:11                       ` Liang, Kan
2018-10-29 17:43                         ` David Miller
2018-10-29 17:56                           ` Arnaldo Carvalho de Melo
2018-10-29 17:40                     ` David Miller
2018-10-29 17:42                       ` Liang, Kan
2018-10-29 17:48                         ` David Miller
2018-10-29 18:20                           ` Liang, Kan
2018-10-29 18:32                             ` Arnaldo Carvalho de Melo
2018-10-29 22:32                               ` Liang, Kan
2018-10-29 22:42                                 ` David Miller
2018-10-30  1:54                                   ` Liang, Kan
2018-10-29 21:16                             ` David Miller
2018-10-29 17:55                       ` Arnaldo Carvalho de Melo
2018-10-30 19:05                     ` David Miller
2018-10-31 22:03                 ` [tip:perf/urgent] perf top: Do not use overwrite mode by default tip-bot for Arnaldo Carvalho de Melo

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=20181026191231.GG3353@kernel.org \
    --to=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=wangnan0@huawei.com \
    --cc=yao.jin@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.