Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936573AbcKNTYc (ORCPT ); Mon, 14 Nov 2016 14:24:32 -0500 Received: from smtprelay0076.hostedemail.com ([216.40.44.76]:37716 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932343AbcKNTYb (ORCPT ); Mon, 14 Nov 2016 14:24:31 -0500 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:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2907:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:5007:6261:7875:7903:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12296:12438:12555:12740:12760:13069:13311:13357:13439:14181:14659:14721:21080:21451:30054:30064: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: trees33_445c24d47de2c X-Filterd-Recvd-Size: 2462 Date: Mon, 14 Nov 2016 14:24:28 -0500 From: Steven Rostedt To: Alexei Starovoitov Cc: Dave Jones , Martin KaFai Lau , , Subject: Re: [PATCH] tracing: ignore FTRACE_FL_DISABLED while walking dyn_ftrace records Message-ID: <20161114142428.1091961b@gandalf.local.home> In-Reply-To: <1478560460-3818619-1-git-send-email-ast@fb.com> References: <1478560460-3818619-1-git-send-email-ast@fb.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: 1506 Lines: 42 On Mon, 7 Nov 2016 15:14:20 -0800 Alexei Starovoitov wrote: > ftrace_shutdown() checks for sanity of ftrace records > and if dyn_ftrace->flags is not zero, it will warn. > It can happen that 'flags' are set to FTRACE_FL_DISABLED at this point, > since some module was loaded, but before ftrace_module_enable() > cleared the flags for this module. > > In other words the module.c is doing: > ftrace_module_init(mod); // calls ftrace_update_code() that sets flags=FTRACE_FL_DISABLED > ... // here ftrace_shutdown() is called that warns, since > err = prepare_coming_module(mod); // didn't have a chance to clear FTRACE_FL_DISABLED > > Fix it by ignoring disabled records. > It's similar to what __ftrace_hash_rec_update() is already doing. > Alexei, Do you have a clear reproducer of this bug? -- Steve > Signed-off-by: Alexei Starovoitov > --- > kernel/trace/ftrace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 2050a7652a86..326498baab83 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -2763,7 +2763,7 @@ static int ftrace_shutdown(struct ftrace_ops *ops, int command) > struct dyn_ftrace *rec; > > do_for_each_ftrace_rec(pg, rec) { > - if (FTRACE_WARN_ON_ONCE(rec->flags)) > + if (FTRACE_WARN_ON_ONCE(rec->flags & ~FTRACE_FL_DISABLED)) > pr_warn(" %pS flags:%lx\n", > (void *)rec->ip, rec->flags); > } while_for_each_ftrace_rec();