> On Jun 9, 2022, at 12:29 PM, Dmitrii Dolgov <9erthalion6@xxxxxxxxx> wrote: > > Enable specifying maxactive for fd based kretprobe. This will be useful > for tracing tools like bcc and bpftrace (see for example discussion [1]). > Use highest 12 bit (bit 52-63) to allow maximal maxactive of 4095. > > The original patch [2] seems to be fallen through the cracks and wasn't > applied. I've merely rebased the work done by Song Liu and verififed it > still works. > > [1]: https://github.com/iovisor/bpftrace/issues/835 > [2]: https://lore.kernel.org/all/20191007223111.1142454-1-songliubraving@xxxxxx/ Thanks for pulling this out of the cracks. :) Since there isn't much change from [2], I think this should still show "From:" me, and with "Signed-off-by" both of us. And a nit below: Thanks, Song > > Signed-off-by: Dmitrii Dolgov <9erthalion6@xxxxxxxxx> > --- > include/linux/trace_events.h | 3 ++- > kernel/events/core.c | 20 ++++++++++++++++---- > kernel/trace/trace_event_perf.c | 5 +++-- > kernel/trace/trace_kprobe.c | 4 ++-- > kernel/trace/trace_probe.h | 2 +- > 5 files changed, 24 insertions(+), 10 deletions(-) > > diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h > index e6e95a9f07a5..7ca453a73252 100644 > --- a/include/linux/trace_events.h > +++ b/include/linux/trace_events.h > @@ -850,7 +850,8 @@ extern void perf_trace_destroy(struct perf_event *event); > extern int perf_trace_add(struct perf_event *event, int flags); > extern void perf_trace_del(struct perf_event *event, int flags); > #ifdef CONFIG_KPROBE_EVENTS > -extern int perf_kprobe_init(struct perf_event *event, bool is_retprobe); > +extern int perf_kprobe_init(struct perf_event *event, bool is_retprobe, > + int max_active); > extern void perf_kprobe_destroy(struct perf_event *event); > extern int bpf_get_kprobe_info(const struct perf_event *event, > u32 *fd_type, const char **symbol, > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 23bb19716ad3..f0e936b3dfc4 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -9809,24 +9809,34 @@ static struct pmu perf_tracepoint = { > * PERF_PROBE_CONFIG_IS_RETPROBE if set, create kretprobe/uretprobe > * if not set, create kprobe/uprobe > * > - * The following values specify a reference counter (or semaphore in the > - * terminology of tools like dtrace, systemtap, etc.) Userspace Statically > - * Defined Tracepoints (USDT). Currently, we use 40 bit for the offset. > + * PERF_UPROBE_REF_CTR_OFFSET_* specify a reference counter (or semaphore > + * in the terminology of tools like dtrace, systemtap, etc.) Userspace > + * Statically Defined Tracepoints (USDT). Currently, we use 40 bit for the 40 bit is not accurate anymore, let's fix it (32). Otherwise, LGTM. [...]