[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cjptc03upu7kct=MA3uxEwieO0Nt-r=LHSedDNDScSOQg@mail.gmail.com>
Date: Tue, 14 Feb 2023 10:03:19 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Song Liu <song@...nel.org>,
Stephane Eranian <eranian@...gle.com>,
Ravi Bangoria <ravi.bangoria@....com>,
Leo Yan <leo.yan@...aro.org>,
James Clark <james.clark@....com>, Hao Luo <haoluo@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH 1/7] perf bpf filter: Introduce basic BPF filter expression
On Tue, Feb 14, 2023 at 8:10 AM Ian Rogers <irogers@...gle.com> wrote:
>
> On Mon, Feb 13, 2023 at 9:05 PM Namhyung Kim <namhyung@...nel.org> wrote:
[SNIP]
> > diff --git a/tools/perf/util/bpf-filter.y b/tools/perf/util/bpf-filter.y
> > new file mode 100644
> > index 000000000000..0bf36ec30abf
> > --- /dev/null
> > +++ b/tools/perf/util/bpf-filter.y
> > @@ -0,0 +1,52 @@
> > +%parse-param {struct list_head *expr_head}
> > +
> > +%{
> > +
> > +#include <stdio.h>
> > +#include <string.h>
> > +#include <linux/compiler.h>
> > +#include <linux/list.h>
> > +#include "bpf-filter.h"
> > +
> > +static void perf_bpf_filter_error(struct list_head *expr __maybe_unused,
> > + char const *msg)
> > +{
> > + printf("perf_bpf_filter: %s\n", msg);
> > +}
> > +
> > +%}
> > +
> > +%union
> > +{
> > + unsigned long num;
> > + unsigned long sample;
> > + enum perf_bpf_filter_op op;
> > + struct perf_bpf_filter_expr *expr;
> > +}
> > +
> > +%token BFT_SAMPLE BFT_OP BFT_ERROR BFT_NUM
> > +%type <expr> filter_term
>
> To avoid memory leaks for parse errors, I think you want here:
> %destructor { free($$); } <expr>
Sure, thanks for the suggestion.
Namhyung
Powered by blists - more mailing lists