From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938659AbcKNUar (ORCPT ); Mon, 14 Nov 2016 15:30:47 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33234 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936076AbcKNUaq (ORCPT ); Mon, 14 Nov 2016 15:30:46 -0500 Date: Mon, 14 Nov 2016 12:30:40 -0800 From: Alexei Starovoitov To: Steven Rostedt Cc: Alexei Starovoitov , Dave Jones , Martin KaFai Lau , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] tracing: ignore FTRACE_FL_DISABLED while walking dyn_ftrace records Message-ID: <20161114203039.GA1646@ast-mbp.thefacebook.com> References: <1478560460-3818619-1-git-send-email-ast@fb.com> <20161114142428.1091961b@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161114142428.1091961b@gandalf.local.home> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 14, 2016 at 02:24:28PM -0500, Steven Rostedt wrote: > 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? Nope. No reproducer. It's very rare. Only stack trace that I posted earlier. Since it kills ftrace everything that depends on it later spews a ton of other warnings. So it's an important fix.