lkml.org 
[lkml]   [2023]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/7] perf bpf filter: Introduce basic BPF filter expression
On Tue, Feb 14, 2023 at 8:10 AM Ian Rogers <irogers@google.com> wrote:
>
> On Mon, Feb 13, 2023 at 9:05 PM Namhyung Kim <namhyung@kernel.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

\
 
 \ /
  Last update: 2023-03-27 00:23    [W:0.052 / U:1.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site