lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 16 Sep 2020 10:24:43 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Ian Rogers <irogers@...gle.com>
Subject: Re: [PATCH 3/3] perf inject: Do not load map/dso when injecting
 build-id

On Tue, Sep 15, 2020 at 11:55:34PM +0900, Namhyung Kim wrote:
> On Tue, Sep 15, 2020 at 7:05 PM Jiri Olsa <jolsa@...hat.com> wrote:
> >
> > On Mon, Sep 14, 2020 at 11:18:59PM +0900, Namhyung Kim wrote:
> > > No need to load symbols in a DSO when injecting build-id.  I guess the
> > > reason was to check the DSO is a special file like anon files.  Use
> > > some helper functions in map.c to check them before reading build-id.
> > > Also pass sample event's cpumode to a new build-id event.
> > >
> > > Original-patch-by: Stephane Eranian <eranian@...gle.com>
> > > Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> > > ---
> > >  tools/perf/builtin-inject.c | 30 ++++++++++--------------------
> > >  tools/perf/util/map.c       | 17 +----------------
> > >  tools/perf/util/map.h       | 14 ++++++++++++++
> > >  3 files changed, 25 insertions(+), 36 deletions(-)
> > >
> > > diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
> > > index a2804d906d2a..6d4e6833efed 100644
> > > --- a/tools/perf/builtin-inject.c
> > > +++ b/tools/perf/builtin-inject.c
> > > @@ -436,21 +436,22 @@ static int dso__read_build_id(struct dso *dso)
> > >  }
> > >
> > >  static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool,
> > > -                             struct machine *machine)
> > > +                             struct machine *machine, u8 cpumode)
> > >  {
> > > -     u16 misc = PERF_RECORD_MISC_USER;
> > >       int err;
> > >
> > > +     if (is_anon_memory(dso->long_name))
> > > +             return 0;
> > > +     if (is_no_dso_memory(dso->long_name))
> > > +             return 0;
> >
> > should we check for vdso as well? I don't think it has build id
> 
> I don't know.. But I guess there's no reason it shouldn't?

I haven't checked, it's just I always saw only zeros for vdso build ids

jirka
> 
> 
> >
> > > +
> > >       if (dso__read_build_id(dso) < 0) {
> > >               pr_debug("no build_id found for %s\n", dso->long_name);
> > >               return -1;
> > >       }
> > >
> > > -     if (dso->kernel)
> > > -             misc = PERF_RECORD_MISC_KERNEL;
> > > -
> > > -     err = perf_event__synthesize_build_id(tool, dso, misc, perf_event__repipe,
> > > -                                           machine);
> > > +     err = perf_event__synthesize_build_id(tool, dso, cpumode,
> > > +                                           perf_event__repipe, machine);
> > >       if (err) {
> > >               pr_err("Can't synthesize build_id event for %s\n", dso->long_name);
> > >               return -1;
> > > @@ -478,19 +479,8 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
> > >       if (thread__find_map(thread, sample->cpumode, sample->ip, &al)) {
> > >               if (!al.map->dso->hit) {
> > >                       al.map->dso->hit = 1;
> > > -                     if (map__load(al.map) >= 0) {
> >
> > nice, that might do some nice speedup, did you see any?
> 
> Yes, I believe so.  But my quick test on a laptop was too short.
> I will test it again and share the speedup.
> 
> Thanks
> Namhyung
> 
> 
> >
> > jirka
> >
> > > -                             dso__inject_build_id(al.map->dso, tool, machine);
> > > -                             /*
> > > -                              * If this fails, too bad, let the other side
> > > -                              * account this as unresolved.
> > > -                              */
> > > -                     } else {
> > > -#ifdef HAVE_LIBELF_SUPPORT
> > > -                             pr_warning("no symbols found in %s, maybe "
> > > -                                        "install a debug package?\n",
> > > -                                        al.map->dso->long_name);
> > > -#endif
> > > -                     }
> > > +                     dso__inject_build_id(al.map->dso, tool, machine,
> > > +                                          sample->cpumode);
> > >               }
> >
> > SNIP
> >
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ