Re: [PATCH 1/3] tracing/kprobe: Add PERF_EVENT_IOC_QUERY_KPROBE ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 6, 2019, at 10:52 PM, Yonghong Song wrote:
> 
> 
> On 8/6/19 4:41 PM, Daniel Xu 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.
[...]
> > +/*
> > + * Structure used by below PERF_EVENT_IOC_QUERY_KPROE command
> 
> typo PERF_EVENT_IOC_QUERY_KPROE => PERF_EVENT_IOC_QUERY_KPROBE

Ok. Whoops.

> 
> > + * to query information about the kprobe attached to the perf
> > + * event.
> > + */
> > +struct perf_event_query_kprobe {
> > +       /*
> > +        * Size of structure for forward/backward compatibility
> > +        */
> > +       __u32   size;
> 
> Since this is perf_event UAPI change, could you cc to
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> as well?

Ok. Will add in V2.

> 
> We have 32 bit hole here. For UAPI, it would be best to remove
> the hole or make it explicit. So in this case, maybe something like
>            __u32   :32;
> 
> Also, what is in your mind for potential future extension?

The idea is we can extend this API if more kprobe stats are added. Similar
to how perf_event_open(2) has a size field. Not sure if it's a silly idea but
we could also make the size field a u64 to fill the hole.

> 
> This will only handle FD based kprobe. If this is the intention, best to
> clearly state it in the cover letter as well.
> 
> I suspect this should also work for debugfs trace event based kprobe,
> but I did not verify it through codes.
> 

Ok. Will update cover letter in v2.

[...]
> > +
> > +	if (copy_to_user(&uquery->nmissed, &nmissed, sizeof(nmissed)) ||
> > +	    copy_to_user(&uquery->nhit, &nhit, sizeof(nhit)))
> > +		return -EFAULT;
> 
> You can use put_user() instead of copy_to_user() to simplify the code.
> 

Ok.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux