From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965903AbcCOToB (ORCPT ); Tue, 15 Mar 2016 15:44:01 -0400 Received: from smtprelay0143.hostedemail.com ([216.40.44.143]:54621 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965880AbcCOTnz (ORCPT ); Tue, 15 Mar 2016 15:43:55 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::,RULES_HIT:41:355:379:541: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:2895:2907:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3870:3871:3872:3873:3874:4605:5007:6119:6261:7875:7903:9040:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12114:12296:12438:12517:12519:12740:13439:13972:14096:14097:14659:14721:21060:21080:30054:30070: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:5,LUA_SUMMARY:none X-HE-Tag: teeth67_4db9f93a3454 X-Filterd-Recvd-Size: 3840 Date: Tue, 15 Mar 2016 15:43:52 -0400 From: Steven Rostedt To: Namhyung Kim Cc: Jiri Olsa , Jiri Olsa , lkml , Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: Re: [PATCH 4/5] ftrace: Make ftrace_hash_rec_enable return update bool Message-ID: <20160315154352.2d69b998@gandalf.local.home> In-Reply-To: <20160312083502.GA27257@danjae.kornet> References: <1457556405-27717-1-git-send-email-jolsa@kernel.org> <1457556405-27717-5-git-send-email-jolsa@kernel.org> <20160311142800.GC25533@danjae.kornet> <20160311181506.GB1060@krava.redhat.com> <20160312083502.GA27257@danjae.kornet> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; 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 On Sat, 12 Mar 2016 17:35:02 +0900 Namhyung Kim wrote: > Hi Jiri, > > On Fri, Mar 11, 2016 at 07:15:06PM +0100, Jiri Olsa wrote: > > On Fri, Mar 11, 2016 at 11:28:00PM +0900, Namhyung Kim wrote: > > > > SNIP > > > > > > @@ -1694,7 +1695,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops, > > > > if (inc) { > > > > rec->flags++; > > > > if (FTRACE_WARN_ON(ftrace_rec_count(rec) == FTRACE_REF_MAX)) > > > > - return; > > > > + return false; > > > > > > > > /* > > > > * If there's only a single callback registered to a > > > > @@ -1720,7 +1721,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops, > > > > rec->flags |= FTRACE_FL_REGS; > > > > } else { > > > > if (FTRACE_WARN_ON(ftrace_rec_count(rec) == 0)) > > > > - return; > > > > + return false; > > > > rec->flags--; > > > > > > > > /* > > > > @@ -1753,22 +1754,27 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops, > > > > */ > > > > } > > > > count++; > > > > + > > > > + update |= ftrace_test_record(rec, 1) != FTRACE_UPDATE_IGNORE; Yeah, this is confusing. Mind adding a comment above this: /* Must match FTRACE_UPDATE_CALLS in ftrace_modify_all_code() */ That way others will know why this is a '1'. -- Steve > > > > > > Shouldn't it use 'inc' instead of 1 for the second argument of > > > the ftrace_test_record()? > > > > I dont think so, 1 is to update calls (FTRACE_UPDATE_CALLS) > > check ftrace_modify_all_code: > > > > if (command & FTRACE_UPDATE_CALLS) > > ftrace_replace_code(1); > > else if (command & FTRACE_DISABLE_CALLS) > > ftrace_replace_code(0); > > > > both ftrace_startup, ftrace_shutdown use FTRACE_UPDATE_CALLS > > Ah, ok. So the second argument of the ftrace_test_record() is not > 'enable' actually.. :-/ > > > > > you'd use 0 only to disable all, check ftrace_check_record comments: > > > > /* > > * If we are updating calls: > > * > > * If the record has a ref count, then we need to enable it > > * because someone is using it. > > * > > * Otherwise we make sure its disabled. > > * > > * If we are disabling calls, then disable all records that > > * are enabled. > > */ > > if (enable && ftrace_rec_count(rec)) > > flag = FTRACE_FL_ENABLED; > > > > > > used by ftrace_shutdown_sysctl > > I got it. Thank you for the explanation! > > Thanks, > Namhyung