On Tue, Aug 6, 2019 at 4:41 PM Daniel Xu <dxu@xxxxxxxxx> wrote: > > It's useful to know kprobe's nmissed and nhit stats. For example with > tracing tools, it's important to know when events may have been lost. > There is currently no way to get that information from the perf API. > This patch adds a new ioctl that lets users query this information. > --- [...] > + > /* > * Ioctls that can be done on a perf event fd: > */ > @@ -462,6 +484,7 @@ struct perf_event_query_bpf { > #define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) > #define PERF_EVENT_IOC_QUERY_BPF _IOWR('$', 10, struct perf_event_query_bpf *) > #define PERF_EVENT_IOC_MODIFY_ATTRIBUTES _IOW('$', 11, struct perf_event_attr *) > +#define PERF_EVENT_IOC_QUERY_KPROBE _IOWR('$', 12, struct perf_event_query_kprobe *) This should be _IOR(). [...] > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > index 9d483ad9bb6c..5449182f3056 100644 > --- a/kernel/trace/trace_kprobe.c > +++ b/kernel/trace/trace_kprobe.c > @@ -196,6 +196,31 @@ bool trace_kprobe_error_injectable(struct trace_event_call *call) > return within_error_injection_list(trace_kprobe_address(tk)); > } > > +int perf_event_query_kprobe(struct perf_event *event, void __user *info) I think perf_kprobe_event_query() would be a better name, especially that we have struct perf_event_query_kprobe. Thanks, Song