Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3942815pxk; Tue, 29 Sep 2020 09:58:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3pAyjq0uDM5e4Mm1t6AjQ+H97Z4ey0B+UadllzJfFMyha1UwozzKWqU6oz9XHJu54xFv2 X-Received: by 2002:a17:906:2747:: with SMTP id a7mr4791439ejd.301.1601398700940; Tue, 29 Sep 2020 09:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601398700; cv=none; d=google.com; s=arc-20160816; b=nhKJguuUdPMztiRg1G/mcX/HCc0rxJKKyIJZcQgjc/qe0AXwdPqsE+mDtPJUfCSYOF 6birOVBjrhdbrLp1zqdPUi5ydgy0Sn3HLK8WXBV+bKSriS268hjRtYSGxVq7nhX4iPgl GBvSBLcQ4ouZptwBJKXQoVGQS52sDySYs+HD79gSDDzOYX8yUPpNepLV6nf4Q+psFBpi LLRUxZuBq8YBuTCGSSAgH06+M2cHVEl5zo8XAHnS9+WiWQH7GWPeMXE2H/nqeodRwgW9 lFUiwNLvki/l93k9bPr+mhR5Wb6xsrHmXzL4ACEMMUo62lfQHVcOM0FH/+rbm8DFLo15 uWcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=NIXggSovc7jDjp9vngI+VCOCq+0UNU5EMm3zVcP+Hhg=; b=TzMZhwXI1x4n7bRK1vwRPmy3+JmV8tSZM7xVtz/ScgDzqSqP7QIq70njkZOTn7SAb/ 83x9lF+1blHV4sTqT1Qurwy/1Ll8TnGTBoCgv2j6wsfgtHFJibOjeizU/QmbRyNu4kR4 Kp4FWmlfH7J+VCCk55i5bVIuaezRgSDNZuP+Y1wCqfu/z9zbrLWljHEqY9XPePp43I0k UUJX++yqe0/yfIjjPyg3i1O82J6Q8Y5wuBdi8q1AkCDPzJ/n1FZxjfrPyqnAB6K0kpYA jDzKzs4m6HoTtBVkKiEHzXoDah6SaPLTBbwwINjBDPWX0itP3TPQWPxI6Ukx1Klx0gRK 5T3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TBmJvy45; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi17si3356166edb.582.2020.09.29.09.57.56; Tue, 29 Sep 2020 09:58:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TBmJvy45; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728767AbgI2Q4m (ORCPT + 99 others); Tue, 29 Sep 2020 12:56:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:33654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727871AbgI2Q4m (ORCPT ); Tue, 29 Sep 2020 12:56:42 -0400 Received: from paulmck-ThinkPad-P72.home (unknown [50.45.173.55]) (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 2761C208B8; Tue, 29 Sep 2020 16:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601398601; bh=gEzCaMn5tSZSPBLZ7kMG+DMBiSLkCwAHal0wNfaaiB0=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=TBmJvy45vJvyRyPgCkPCWs1xJFG2fmDy1IpJjrXrfEOWf2iRs+24UyZMYjPr5fOdc N9Fu3Hqs8cyn01kugPzQcpCnDM0CPhO8UwAA5kN6WPG8d9ib2uHoIwTBqcMTbneMCT 83IOHG+btiTpnBSCgvZesvVGGMhSRSRkzEubiaIo= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 7A0213522C1A; Tue, 29 Sep 2020 09:56:40 -0700 (PDT) Date: Tue, 29 Sep 2020 09:56:40 -0700 From: "Paul E. McKenney" To: Steven Rostedt 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: <20200929165640.GV29330@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200929113340.GN2628@hirez.programming.kicks-ass.net> <20200929103620.06762622@gandalf.local.home> <20200929144105.GU29330@paulmck-ThinkPad-P72> <20200929105416.757c47f0@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200929105416.757c47f0@gandalf.local.home> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 10:54:16AM -0400, Steven Rostedt wrote: > 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. Fair enough. ;-) If I don't hear otherwise by late today (Tuesday), Pacific Time, I will update the comment and pull it into -rcu. If you guys have some other route to mainline in mind, you have my Reviewed-by. Either way, just let me know. Thanx, Paul