Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp175808ybv; Wed, 5 Feb 2020 03:36:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxJYd1/zxkHbz4w1mfq3v9rHXQnErhX2jlzXi97ILIS6YcoD/5sUy0d/nZQQOqPWQbrZasC X-Received: by 2002:a54:4085:: with SMTP id i5mr2543437oii.17.1580902604068; Wed, 05 Feb 2020 03:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580902604; cv=none; d=google.com; s=arc-20160816; b=qnnyV7xKPPHFvDpS362xqeRy+4VBZFFQB/44AZ3lW1EeUFsBJzYuURYojTAjUqrXz6 6nAQpGTJGr1oHTvnFScVXfhtX5Wcq6eZRzGd03+AfiQeWOnP6ol7OaP+mA8gIMnY5sqP 25Php+8Z2Ar8CiOaxQc5L7C1dBziih1tzAk3hgLNpctDQHcjzySkl5TJuxG/echHNp1y hjffU0vfaJ0sTmxu0M9xr33MGw8lQkB4ZVQ4uo6fn5VL2U0T8f3SAHw6oVPUrF3xVblQ b7tRdikhC0s56gZZI2ei5gT/YwI9tcX/kqMAGavxiADolWe9hQSRoxgo8ahZfleu8VzN CjPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=j+Al/R34f583hEirdRoYwTEu51vcHnqpZIwCeFtUI3Q=; b=wpMl55j/9bWwdpxXn/Makz9MG93Z83FEoFP6xAKR1+/tOgKkRS+u21R/ChWYBWs3IJ xo14OThGKI0/H/ADXwpQ8ajlkuzpoXvJCOEY7OM6raWC0icJEh37WCgKAZ/fJukMaAC1 N3a+bKFve32/9Xi1CfT3JHYAMmPv8AW7W4t7SE7F7IdiL8A9fGDttmRH/XPmQAboAyNZ yuyG2z9VO91fSa3jeHKy9RvBUvL7frUXGvxr5R7v98D7a5hpPq/SR44+pvE4t/nPu5vo Qh6R3dZqvDWq+I1IKIOti6VGFu8C+MVhXc7Ql5SVoVzZxTGpAvbRvp/MLyrM6EbSu9aA eYew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si13456727otq.238.2020.02.05.03.36.31; Wed, 05 Feb 2020 03:36:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728381AbgBELd4 (ORCPT + 99 others); Wed, 5 Feb 2020 06:33:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:39892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728244AbgBELdz (ORCPT ); Wed, 5 Feb 2020 06:33:55 -0500 Received: from oasis.local.home (unknown [212.187.182.165]) (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 CA2FD2072B; Wed, 5 Feb 2020 11:33:53 +0000 (UTC) Date: Wed, 5 Feb 2020 06:33:49 -0500 From: Steven Rostedt To: "Paul E. McKenney" , Joel Fernandes Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Amol Grover Subject: Re: [for-next][PATCH 4/4] ftrace: Add comment to why rcu_dereference_sched() is open coded Message-ID: <20200205063349.4c3df2c0@oasis.local.home> In-Reply-To: <20200205105113.283672584@goodmis.org> References: <20200205104929.313040579@goodmis.org> <20200205105113.283672584@goodmis.org> 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Paul and Joel, Care to ack this patch (or complain about it ;-) ? -- Steve On Wed, 05 Feb 2020 05:49:33 -0500 Steven Rostedt wrote: > From: "Steven Rostedt (VMware)" > > Because the function graph tracer can execute in sections where RCU is not > "watching", the rcu_dereference_sched() for the has needs to be open coded. > This is fine because the RCU "flavor" of the ftrace hash is protected by > its own RCU handling (it does its own little synchronization on every CPU > and does not rely on RCU sched). > > Signed-off-by: Steven Rostedt (VMware) > --- > kernel/trace/trace.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h > index 022def96d307..8c52f5de9384 100644 > --- a/kernel/trace/trace.h > +++ b/kernel/trace/trace.h > @@ -975,6 +975,11 @@ static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace) > > preempt_disable_notrace(); > > + /* > + * Have to open code "rcu_dereference_sched()" because the > + * function graph tracer can be called when RCU is not > + * "watching". > + */ > hash = rcu_dereference_protected(ftrace_graph_hash, !preemptible()); > > if (ftrace_hash_empty(hash)) { > @@ -1022,6 +1027,11 @@ static inline int ftrace_graph_notrace_addr(unsigned long addr) > > preempt_disable_notrace(); > > + /* > + * Have to open code "rcu_dereference_sched()" because the > + * function graph tracer can be called when RCU is not > + * "watching". > + */ > notrace_hash = rcu_dereference_protected(ftrace_graph_notrace_hash, > !preemptible()); >