[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <OSBPR01MB4600CAA1C7EC36CFCCEEDE95F7EA9@OSBPR01MB4600.jpnprd01.prod.outlook.com>
Date: Mon, 11 Apr 2022 08:31:47 +0000
From: "nakamura.shun@...itsu.com" <nakamura.shun@...itsu.com>
To: 'Jiri Olsa' <olsajiri@...il.com>
CC: "peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"acme@...nel.org" <acme@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"alexander.shishkin@...ux.intel.com"
<alexander.shishkin@...ux.intel.com>,
"jolsa@...hat.com" <jolsa@...hat.com>,
"namhyung@...nel.org" <namhyung@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>
Subject: RE: [RFC PATCH v2 4/7] libperf: Introduce perf_{evsel,
evlist}__open_opt with extensible struct opts
Hi jirka
> On Fri, Mar 25, 2022 at 01:38:26PM +0900, Shunsuke Nakamura wrote:
> > Introduce perf_{evsel, evlist}__open_opt with extensible structure opts.
> > The mechanism of the extensible structure opts imitates
> > tools/lib/bpf/libbpf.h. This allows the user to set the open_flags
> > specified in perf_event_open and a signal handler to receive overflow
> > notifications for sampling events.
> >
> > Signed-off-by: Shunsuke Nakamura <nakamura.shun@...itsu.com>
> > ---
> > tools/lib/perf/Documentation/libperf.txt | 14 +++
> > tools/lib/perf/evlist.c | 20 +++++
> > tools/lib/perf/evsel.c | 105
> +++++++++++++++++++++++
> > tools/lib/perf/include/perf/evlist.h | 3 +
> > tools/lib/perf/include/perf/evsel.h | 26 ++++++
> > tools/lib/perf/internal.h | 44 ++++++++++
> > tools/lib/perf/libperf.map | 2 +
> > 7 files changed, 214 insertions(+)
> >
> > diff --git a/tools/lib/perf/Documentation/libperf.txt
> > b/tools/lib/perf/Documentation/libperf.txt
> > index ae55e62fc4ce..700c1ce15159 100644
> > --- a/tools/lib/perf/Documentation/libperf.txt
> > +++ b/tools/lib/perf/Documentation/libperf.txt
> > @@ -131,6 +131,20 @@ SYNOPSIS
> > };
> > };
> >
> > + struct perf_evsel_open_opts {
> > + /* size of this struct, for forward/backward compatibility */
> > + size_t sz;
> > +
> > + unsigned long open_flags; /* perf_event_open flags */
> > + int flags; /* fcntl flags */
> > + unsigned int signal;
> > + int owner_type;
> > + struct sigaction *sig;
> > + };
> > + #define perf_evsel_open_opts__last_field sig
> > +
> > + #define LIBPERF_OPTS(TYPE, NAME, ...)
> > +
>
> SNIP
>
> > +
> > +int perf_evsel__open_opts(struct perf_evsel *evsel, struct perf_cpu_map
> *cpus,
> > + struct perf_thread_map *threads,
> > + struct perf_evsel_open_opts *opts) {
> > + int err = 0;
> > +
> > + if (!OPTS_VALID(opts, perf_evsel_open_opts)) {
> > + err = -EINVAL;
> > + return err;
> > + }
> > +
> > + evsel->open_flags = OPTS_GET(opts, open_flags, 0);
> > +
> > + err = perf_evsel__open(evsel, cpus, threads);
> > + if (err)
> > + return err;
> > +
> > + err = perf_evsel__set_signal_handler(evsel, opts);
> > + if (err)
> > + return err;
>
> please move the signal stuff handling into separate patch together with the
> related fields in opts struct
>
I'll fix it.
Best Regards
Shunsuke
Powered by blists - more mailing lists