Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp755165ybv; Wed, 5 Feb 2020 14:01:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyDHdxkDdp1QR1nOhlYvy/oTa1K4DuetVmPVqfHGVylUe2ks8VoqScSoxAXDxlhCp+ZT5sY X-Received: by 2002:a9d:4706:: with SMTP id a6mr26016986otf.331.1580940090843; Wed, 05 Feb 2020 14:01:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580940090; cv=none; d=google.com; s=arc-20160816; b=f1FgkUuXYz+oaquKuhXHHzXUxbBC1R8hmeXAXv2wLoQIsdQnUHopPSsMPnHAap0ehL 6KGcKVxhLqNuQOngTMk1FoijjojUHuFwwY2GpLVjeTEgUHK0/XkQUTudqtp2K4LIPM91 g9TpdlnPPy8HUgRTN/Uwayq21LOD6WkkktrcKVdB7mW2yo5Lwdj7AnlF06wMCspeqFL9 pCoFFnanmKLeqb0keYK6Y6EZHIJJCXQNWFklU0invrwhvPdeUycByk4hbP5eUlhC54He 1kukt3cVIpn8jjwkbIbQrjUEkYtCzPqg8z/4TZi8DpRApwovh2r87RJQZAQEqCZyjQiz mABg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JmqShO+oicTB5Tq9SUtiS1B0Y2ynlqicj6cz0OZE5pE=; b=GC6mYCEqLJFsKO+5e+SyQYrxctJw4jChSsDdHjxR7J4BnjXOPvSSBOB9mqTCtNgXoj 8EyvEPdAoDICbyupVWayL5BYNRQGUPfQacQ9tXrWMRNvgSqFfzH3q/3fbz7TcuSMwlBe wZIUglE40Ld2/+Lt1gJVFWeoE8ak21vwrTiE5bVr6x2FueNC2z2nIIusT6Cs8jqjAcWY 32OVkfRe8kYRSCJEoKppm2Ag54Ow/MNPBsEKNI3gFcx79n3u+pXkhLd8tK0nIsfDSl+q tZ6fsAkc41jbvSzoBgqfPbN4mq60p7NK0aen/wJVOOW/+2Bg9RNAg5eKSHwHbpgYNVok 5SrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=I1ycIKZv; 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 s6si530535otq.115.2020.02.05.14.01.18; Wed, 05 Feb 2020 14:01:30 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=I1ycIKZv; 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 S1727473AbgBEV7U (ORCPT + 99 others); Wed, 5 Feb 2020 16:59:20 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37854 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbgBEV7T (ORCPT ); Wed, 5 Feb 2020 16:59:19 -0500 Received: by mail-pf1-f196.google.com with SMTP id p14so1913130pfn.4 for ; Wed, 05 Feb 2020 13:59:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JmqShO+oicTB5Tq9SUtiS1B0Y2ynlqicj6cz0OZE5pE=; b=I1ycIKZvIH/lI0zJi4VMZd0NzIKrLnsr6jHp9SyuTYdhiWZb/wCPJAf323z8594a/j CTRTqaEOga4GWtOJJtvV5i98leyXlIAEoLggdl/cBN+uFArL9wHG6tk4Hdt930O9ZXqO hu+OVhcihoGIhLB2nHXOlXXWlGIHwmNoor2f0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JmqShO+oicTB5Tq9SUtiS1B0Y2ynlqicj6cz0OZE5pE=; b=JLBNeXGmw8wdAsUJOh5A4+skSg5Jb+g2bx194ajxBsqiAq7nh+wNNf6knm8uisrqRv XMDkKkY/YhxryqlQuRpCCkee0xTZ9t1j8Mn08B6Ec0hkxExodsylGEAEfW4QGKE5BlML kKrT43xFPejca1s8GHD70KJdL6JYGCryTCKuludJQfsWP9nzfsvQIaEq1qlNb2wozAtT ezgX8BErM2WsIdJDhGVEsIxhrOD3F4tO/AAX44LULAzgQsQfU0nB1Zu+cT3C3J/RmEp3 mshbZwwviIKg6FlzyksWg6fmqKCF9NGXYHEEL7NgrAwKnqbE8FD3HzBFaOAa9Q0cPcbM 2O4w== X-Gm-Message-State: APjAAAUQd4wVZtmwSqGnuPALbIpjkNJdfPBs0rW2K1Ev3eia0mUWVoUU Pr5wnCkXOoy4ERYIAZIAWygz0A== X-Received: by 2002:aa7:9891:: with SMTP id r17mr48679pfl.205.1580939957953; Wed, 05 Feb 2020 13:59:17 -0800 (PST) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id g7sm479938pfq.33.2020.02.05.13.59.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 13:59:17 -0800 (PST) Date: Wed, 5 Feb 2020 16:59:16 -0500 From: Joel Fernandes To: Steven Rostedt Cc: "Paul E. McKenney" , 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: <20200205215916.GL142103@google.com> References: <20200205104929.313040579@goodmis.org> <20200205105113.283672584@goodmis.org> <20200205063349.4c3df2c0@oasis.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200205063349.4c3df2c0@oasis.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 05, 2020 at 06:33:49AM -0500, Steven Rostedt wrote: > > 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) Acked-by: Joel Fernandes (Google) thanks, - Joel > > --- > > 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()); > > >