Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753064AbcLLWxM (ORCPT ); Mon, 12 Dec 2016 17:53:12 -0500 Received: from smtprelay0253.hostedemail.com ([216.40.44.253]:54090 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752650AbcLLWxL (ORCPT ); Mon, 12 Dec 2016 17:53:11 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::,RULES_HIT:41:355:379:541:560:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2915:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4362:5007:6261:7875:7903:8660:9040:10004:10400:10848:10967:11026:11232:11658:11914:12043:12296:12438:12555:12740:12760:13095:13141:13148:13230:13255:13439:13972:14181:14659:14721:21067:21080:21088:21433:21451:30034:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: bag25_1b99c0cc7f215 X-Filterd-Recvd-Size: 3017 Date: Mon, 12 Dec 2016 17:53:08 -0500 From: Steven Rostedt To: Masami Hiramatsu Cc: Marcin Nowakowski , Ingo Molnar , Subject: Re: [PATCH v2 1/2] tracing/kprobes: add a helper method to return number of probe hits Message-ID: <20161212175308.4284b706@gandalf.local.home> In-Reply-To: <1481293178-3128-1-git-send-email-marcin.nowakowski@imgtec.com> References: <1481293178-3128-1-git-send-email-marcin.nowakowski@imgtec.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2004 Lines: 66 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 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 > --- > 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;