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]
Message-ID: <CAP-5=fUXoOFueaeSD2D9H+xoH5tKXRHK1164yPSX8_m_Nx_AeQ@mail.gmail.com>
Date:   Tue, 10 Jan 2023 11:54:58 -0800
From:   Ian Rogers <irogers@...gle.com>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Yang Jihong <yangjihong1@...wei.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Kim Phillips <kim.phillips@....com>,
        German Gomez <german.gomez@....com>,
        Sean Christopherson <seanjc@...gle.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Eelco Chaudron <echaudro@...hat.com>,
        Leo Yan <leo.yan@...aro.org>,
        Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
        Stephane Eranian <eranian@...gle.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/2] perf tools: Remove HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE

On Tue, Jan 10, 2023 at 11:09 AM Namhyung Kim <namhyung@...nel.org> wrote:
>
> On Mon, Jan 9, 2023 at 3:38 PM Ian Rogers <irogers@...gle.com> wrote:
> >
> > On Mon, Jan 9, 2023 at 2:57 PM Namhyung Kim <namhyung@...nel.org> wrote:
> > >
> > > Hi Ian,
> > >
> > > On Mon, Jan 9, 2023 at 2:31 PM Ian Rogers <irogers@...gle.com> wrote:
> > > > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> > > > index e188f74698dd..cfcc253239f0 100644
> > > > --- a/tools/perf/util/sort.c
> > > > +++ b/tools/perf/util/sort.c
> > > > @@ -28,6 +28,7 @@
> > > >  #include "time-utils.h"
> > > >  #include "cgroup.h"
> > > >  #include "machine.h"
> > > > +#include "trace-event.h"
> > > >  #include <linux/kernel.h>
> > > >  #include <linux/string.h>
> > > >
> > > > @@ -2667,7 +2668,7 @@ static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt,
> > > >                 tep_read_number_field(field, a->raw_data, &dyn);
> > > >                 offset = dyn & 0xffff;
> > > >                 size = (dyn >> 16) & 0xffff;
> > > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE
> > > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
> > > >                 if (field->flags & TEP_FIELD_IS_RELATIVE)
> > > >                         offset += field->offset + field->size;
> > >
> > > Maybe I missed the previous discussion.
> > >
> > > As it's only used in the bit test, can we have something like this
> > > in the header file?
> > >
> > > #if LIBTRACE_EVENT_VERSION < ...(1, 5, 0)
> > > # define TEP_FIELD_IS_RELATIVE  0
> > > #endif
> > >
> > > Thanks,
> > > Namhyung
> >
> > We could but I think we lose some of the intention revealing-ness that
> > TEP_FIELD_IS_RELATIVE is only present with libtraceevent 1.5.0 or
> > newer.
>
> I'm not sure how important it is to reveal the intention.
> I think we wanted to minimize #ifdef-ery in the .c file and
> moved the conditionals to the header.  Maybe we can add
> a wrapper like this.
>
> #if LIBTRACEEVENT_VERSION >= ...(1, 5, 0)
> static inline bool is_relative_field(field)
> {
>     return field->flags & TEP_FIELD_IS_RELATIVE;
> }
> #else
> static inline bool is_relative_field(field)
> {
>     return false;
> }
> #endif
>
> Thanks,
> Namhyung

Sounds good. Should the change be part of this one or a follow up
patch? A follow up patch seems cleanest, I can add it to v2.

Thanks,
Ian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ