From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6993CC4727C for ; Tue, 29 Sep 2020 14:54:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E51B2076B for ; Tue, 29 Sep 2020 14:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731520AbgI2Oy1 (ORCPT ); Tue, 29 Sep 2020 10:54:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:51892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728627AbgI2Oy0 (ORCPT ); Tue, 29 Sep 2020 10:54:26 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45DEF20757; Tue, 29 Sep 2020 14:54:25 +0000 (UTC) Date: Tue, 29 Sep 2020 10:54:16 -0400 From: Steven Rostedt To: "Paul E. McKenney" Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , kim.phillips@amd.com Subject: Re: [PATCH] rcu,ftrace: Fix ftrace recursion Message-ID: <20200929105416.757c47f0@gandalf.local.home> In-Reply-To: <20200929144105.GU29330@paulmck-ThinkPad-P72> References: <20200929113340.GN2628@hirez.programming.kicks-ass.net> <20200929103620.06762622@gandalf.local.home> <20200929144105.GU29330@paulmck-ThinkPad-P72> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 Sep 2020 07:41:06 -0700 "Paul E. McKenney" wrote: > On Tue, Sep 29, 2020 at 10:36:20AM -0400, Steven Rostedt wrote: > > On Tue, 29 Sep 2020 13:33:40 +0200 > > Peter Zijlstra wrote: > > > > > Kim reported that perf-ftrace made his box unhappy. It turns out that > > > commit: > > > > > > ff5c4f5cad33 ("rcu/tree: Mark the idle relevant functions noinstr") > > > > > > removed one too many notrace. Probably due to there not being a helpful > > > comment. > > > > > > Reinstate the notrace and add a comment to avoid loosing it again. > > > > > > Fixes: ff5c4f5cad33 ("rcu/tree: Mark the idle relevant functions noinstr") > > > Reported-by: Kim Phillips > > > Signed-off-by: Peter Zijlstra (Intel) > > > --- > > > kernel/rcu/tree.c | 5 ++++- > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > > index ee5e595501e8..33020d84ec6b 100644 > > > --- a/kernel/rcu/tree.c > > > +++ b/kernel/rcu/tree.c > > > @@ -1098,8 +1098,11 @@ noinstr bool __rcu_is_watching(void) > > > * CPU can safely enter RCU read-side critical sections. In other words, > > > * if the current CPU is not in its idle loop or is in an interrupt or > > > * NMI handler, return true. > > > + * > > > + * Must be notrace because __ftrace_ops_list_func() / ftrace_ops_assist_func() > > > + * will call this (for every function) outside of recursion protection. > > > */ > > > -bool rcu_is_watching(void) > > > +notrace bool rcu_is_watching(void) > > > { > > > bool ret; > > > > > > > I think the patch I suggested is more suitable. > > OK, I will let you guys fight it out. ;-) > Well, I think we should actually apply both, but the comment needs to be updated, as it will no longer be outside recursion. And the comment is wrong now as well, as its only outside recursion protection for the assist_func(). But it does prevent it from being always called for perf. * Make notrace because it can be called by the internal functions of * ftrace, and making this notrace removes unnecessary recursion calls. -- Steve