linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: "John Garry" <john.garry@huawei.com>,
	"Will Deacon" <will@kernel.org>,
	"Mathieu Poirier" <mathieu.poirier@linaro.org>,
	"Leo Yan" <leo.yan@linaro.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"James Clark" <james.clark@arm.com>,
	"Alexandre Truong" <alexandre.truong@arm.com>,
	"German Gomez" <german.gomez@arm.com>,
	"Dave Marchevsky" <davemarchevsky@fb.com>,
	"Song Liu" <songliubraving@fb.com>,
	"Ravi Bangoria" <ravi.bangoria@amd.com>,
	"Li Huafei" <lihuafei1@huawei.com>,
	"Martin Liška" <mliska@suse.cz>,
	"William Cohen" <wcohen@redhat.com>,
	"Riccardo Mancini" <rickyman7@gmail.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Thomas Richter" <tmricht@linux.ibm.com>,
	"Lexi Shao" <shaolexi@huawei.com>,
	"Remi Bernon" <rbernon@codeweavers.com>,
	"Michael Petlan" <mpetlan@redhat.com>,
	"Denis Nikitin" <denik@chromium.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Stephane Eranian" <eranian@google.com>
Subject: Re: [PATCH v2 0/4] Tidy up symbol end fixup
Date: Tue, 12 Apr 2022 16:48:28 -0700	[thread overview]
Message-ID: <CAP-5=fUDQGtNn39xDSxagwVzN95dohNrfiU_a3pU8zkiv2-6tw@mail.gmail.com> (raw)
In-Reply-To: <YlX5U+Qelf/rBdau@google.com>

On Tue, Apr 12, 2022 at 3:12 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> Hi Ian,
>
> On Tue, Apr 12, 2022 at 08:48:13AM -0700, Ian Rogers wrote:
> > Fixing up more symbol ends as introduced in:
> > https://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com/
> > caused perf annotate to run into memory limits - every symbol holds
> > all the disassembled code in the annotation, and so making symbols
> > ends further away dramatically increased memory usage (40MB to
> >  >1GB). Modify the symbol end logic so that special kernel cases aren't
> > applied in the common case.
> >
> > v2. Drops a merged patch. Fixes a build issue with libbfd enabled.
>
> How about just like this?  We can get rid of arch functions as they
> mostly do the same thing (kernel vs module boundary check).
>
> Not tested. ;-)
>
> Thanks,
> Namhyung
>
> --------------8<-------------
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index dea0fc495185..df41d7266d91 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -35,6 +35,7 @@
>  #include "path.h"
>  #include <linux/ctype.h>
>  #include <linux/zalloc.h>
> +#include <internal/lib.h>  // page_size
>
>  #include <elf.h>
>  #include <limits.h>
> @@ -231,8 +226,16 @@ void symbols__fixup_end(struct rb_root_cached *symbols)
>                 prev = curr;
>                 curr = rb_entry(nd, struct symbol, rb_node);
>
> -               if (prev->end == prev->start || prev->end != curr->start)
> -                       arch__symbols__fixup_end(prev, curr);
> +               if (prev->end == prev->start) {
> +                       /* Last kernel symbol mapped to end of page */

I like the simpler logic but don't like applying this in symbol-elf
given the comment says it is kernel specific - so we could keep the
is_kernel change.

> +                       if (!strchr(prev->name, '[') != !strchr(curr->name, '['))

I find this condition not to be intention revealing. On ARM there is
also an || for the condition reversed. When this is in an is_kernel
block then I think it is clear this is kernel hack, so I think it is
good to comment on what the condition is for.

> +                               prev->end = roundup(prev->end + 1, page_size);

Currently the roundup varies per architecture, but it is not clear to
me that it matters.

> +                       else

I think we should comment here that we're extending zero sized symbols
to the start of the next symbol.

> +                               prev->end = curr->start;
> +
> +                       pr_debug4("%s sym:%s end:%#" PRIx64 "\n",
> +                                 __func__, prev->name, prev->end);
> +               }

Thanks,
Ian

>         }
>
>         /* Last entry */

  reply	other threads:[~2022-04-12 23:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 15:48 [PATCH v2 0/4] Tidy up symbol end fixup Ian Rogers
2022-04-12 15:48 ` [PATCH v2 1/4] perf symbols: Always do architecture specific fixups Ian Rogers
2022-04-12 15:48 ` [PATCH v2 2/4] perf symbols: Add is_kernel argument to fixup end Ian Rogers
2022-04-12 15:48 ` [PATCH v2 3/4] perf symbol: By default only fix zero length symbols Ian Rogers
2022-04-12 15:48 ` [PATCH v2 4/4] perf symbols: More specific architecture end fixing Ian Rogers
2022-04-12 16:20 ` [PATCH v2 0/4] Tidy up symbol end fixup Ian Rogers
2022-04-12 22:12 ` Namhyung Kim
2022-04-12 23:48   ` Ian Rogers [this message]
2022-04-13 20:28     ` Namhyung Kim

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='CAP-5=fUDQGtNn39xDSxagwVzN95dohNrfiU_a3pU8zkiv2-6tw@mail.gmail.com' \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexandre.truong@arm.com \
    --cc=davemarchevsky@fb.com \
    --cc=denik@chromium.org \
    --cc=eranian@google.com \
    --cc=german.gomez@arm.com \
    --cc=james.clark@arm.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@linaro.org \
    --cc=lihuafei1@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mliska@suse.cz \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=rbernon@codeweavers.com \
    --cc=rickyman7@gmail.com \
    --cc=shaolexi@huawei.com \
    --cc=songliubraving@fb.com \
    --cc=tmricht@linux.ibm.com \
    --cc=wcohen@redhat.com \
    --cc=will@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).