Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1540721 > unrolled thread

Re: [PATCH v2 1/2] tracing/kprobes: add a helper method to return number of probe hits

Started bySteven Rostedt <rostedt@goodmis.org>
First post2016-12-13 00:00 +0100
Last post2016-12-13 00:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 1/2] tracing/kprobes: add a helper method to return  number of probe hits Steven Rostedt <rostedt@goodmis.org> - 2016-12-13 00:00 +0100

#1540721 — Re: [PATCH v2 1/2] tracing/kprobes: add a helper method to return number of probe hits

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-12-13 00:00 +0100
SubjectRe: [PATCH v2 1/2] tracing/kprobes: add a helper method to return number of probe hits
Message-ID<sNHJE-1GL-5@gated-at.bofh.it>
Masami,

I just noticed that you were not Cc'd. Can you give your ack on this
and the other patch. I'll bounce both of them to you.

Thanks!

-- Steve


On Fri, 9 Dec 2016 15:19:37 +0100
Marcin Nowakowski <marcin.nowakowski@imgtec.com> wrote:

> The number of probe hits is stored in a percpu variable and therefore
> can't be read directly. Add a helper method trace_kprobe_nhit() that
> performs the required calculation.
> 
> It will be used in a follow-up commit that changes kprobe selftests to
> verify the number of probe hits.
> 
> Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
> ---
>  kernel/trace/trace_kprobe.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
>  v2: improved commit message as suggested by Steven Rostedt
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index eb6c9f1..a2af1bc 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -73,6 +73,17 @@ static nokprobe_inline bool trace_kprobe_is_on_module(struct trace_kprobe *tk)
>  	return !!strchr(trace_kprobe_symbol(tk), ':');
>  }
>  
> +static nokprobe_inline unsigned long trace_kprobe_nhit(struct trace_kprobe *tk)
> +{
> +	unsigned long nhit = 0;
> +	int cpu;
> +
> +	for_each_possible_cpu(cpu)
> +		nhit += *per_cpu_ptr(tk->nhit, cpu);
> +
> +	return nhit;
> +}
> +
>  static int register_kprobe_event(struct trace_kprobe *tk);
>  static int unregister_kprobe_event(struct trace_kprobe *tk);
>  
> @@ -882,14 +893,10 @@ static const struct file_operations kprobe_events_ops = {
>  static int probes_profile_seq_show(struct seq_file *m, void *v)
>  {
>  	struct trace_kprobe *tk = v;
> -	unsigned long nhit = 0;
> -	int cpu;
> -
> -	for_each_possible_cpu(cpu)
> -		nhit += *per_cpu_ptr(tk->nhit, cpu);
>  
>  	seq_printf(m, "  %-44s %15lu %15lu\n",
> -		   trace_event_name(&tk->tp.call), nhit,
> +		   trace_event_name(&tk->tp.call),
> +		   trace_kprobe_nhit(tk),
>  		   tk->rp.kp.nmissed);
>  
>  	return 0;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web