Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp279231ybv; Tue, 4 Feb 2020 21:29:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyXkm6utSK+6keYl44WKsWEtZCdU6CNah9GjYKn+hIjAyFxoUB2qHJqiIFjHsOOmHusJq9W X-Received: by 2002:a9d:4711:: with SMTP id a17mr25425481otf.233.1580880574677; Tue, 04 Feb 2020 21:29:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580880574; cv=none; d=google.com; s=arc-20160816; b=loUkYqsfliQ5s+SKAfVFOV6nfZRq9wES31DWGR3ul6xnVlMXZ1JTwWTvfZFc/GSEk8 cElQet3xawD1UJpGIl0FNEp0cq8b5zakRa3S8HtewRKjQAfFypac139QN8M3Vw6zCH81 HCVqf7oX8mFUKFV3Cvlde4PAIPEHYHeC5cQ1yDu+SEE7JCcM+t+kveV58rLZ3WDZB4R4 jTaIR4CMMlI3xrgtrqniI+54ad2Hg5c4fK2QR7ws47kph9IpZR5goxNQLQUJs6WpcILw qv1kG97/oW1LHv0tBAVqxIe0UrX39xwikvTH9gZ3T0OO+MOj6wGHkZjDz+69ih1F2w6Z y7hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=lVCuHJnMuCmwTfOue9M7b3xZrfn6U2mf9Vp/kH0JJOs=; b=pTj1QKHCIEhoCAYjBxrEyUjm8pybTPZIVDLz+MMqznv9MPoX/s/QWvgiTKexwQX8wN XKiv9bkcx8dvQfDgXVOVeJlt7eIEsd7hhhv0qpTdmLr6lBo+c/CsA4g7JYdlHSixSU/h tbjLoJHoS9TCaS79oqnIi2Hra2haiktIj3dYZM3ekIzQ7rpvaX9skpxMwi8W6ldhlWqq FZWP/cIHzVqahbNQZrNRQbI389hH/CCQvWocOBIcVSQcIkGgyK3u6CZSPx28Jt1nXhYa J/t63GCMu0XvBsLsWiATkJC2w0MMrylx612uAkEE8cPSn7Bbq0tfyg9oyGoEW7P1zX3M YD3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cJayuJpZ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12si11229046oiz.131.2020.02.04.21.29.07; Tue, 04 Feb 2020 21:29:34 -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=@gmail.com header.s=20161025 header.b=cJayuJpZ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725913AbgBEF0k (ORCPT + 99 others); Wed, 5 Feb 2020 00:26:40 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:50186 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbgBEF0k (ORCPT ); Wed, 5 Feb 2020 00:26:40 -0500 Received: by mail-pj1-f66.google.com with SMTP id r67so467828pjb.0 for ; Tue, 04 Feb 2020 21:26:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lVCuHJnMuCmwTfOue9M7b3xZrfn6U2mf9Vp/kH0JJOs=; b=cJayuJpZmhN21d7X3rkS5Tr+K3EfQSzoT/0HJFSLNt66wGfiKSP0FyG6cTfzM/7oVF o8IpmfXRopueRDlU+qbkKLmIr9BLAJqgHU9SmiyJ9vi7AQ1ML9uzAs7buBBaa4oRPKxE hOTsjE0M6zFrn+PmyJiu0+8YwHmlGDBbxSzzzvemYGLOe2OMTgm25HXzn73akKPnO9Lk XJ9uGmJv8gsSv57jfVJxHXKLEA1hLu1mhbMixuxv79EgW0dYC38C5uyXgBVEyePyaGJ2 ilP1rvkY0dAGud8omj3cVnS64RFlkFHW63Zji/Qot9oxZkkoje0tGdx+58HmO1/9nBx6 +jtw== 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; bh=lVCuHJnMuCmwTfOue9M7b3xZrfn6U2mf9Vp/kH0JJOs=; b=nwO/oKHyrw7LBPSETDUuu2gZvVDJQX9dNB4+n0TVty0SRtQYKKEnIQy7oPVYCWoMpg jN+T5tXTrWKlI/KOMQq4aJeqZIyaAhOCZIAbAsNnAKh8UJ02IVU4degskNhkYnnvIMHW 3QLuWs/idTNA7EzChiEYKaknQMWcot8JWwt0qIIK5pxCiJ5yjw3OClgr+O2ob+O24/8A LqEYKzofeLWz1uM2v2BVObqsHoJm28UZYUIOu2Et+9lhrkQ4jcaF5TWqs3dqvdP8Wat0 qHFO38tAXT67V3vzJfBYPlKXoG8Sjoier5D9CEcG2fkyTMviziFetChZ47hZ2PfQolIS CLDw== X-Gm-Message-State: APjAAAWA61xqJUzm60ZIqJ48O8gGdnyuE6u3KQ64DnJUazqTRwThdSXF AmiOtYsaIEQJ2ko1GYzO1QI= X-Received: by 2002:a17:902:4a:: with SMTP id 68mr34234329pla.245.1580880399635; Tue, 04 Feb 2020 21:26:39 -0800 (PST) Received: from workstation-portable ([103.211.17.109]) by smtp.gmail.com with ESMTPSA id i3sm26130751pfg.94.2020.02.04.21.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 21:26:38 -0800 (PST) Date: Wed, 5 Feb 2020 10:56:32 +0530 From: Amol Grover To: Steven Rostedt Cc: Joel Fernandes , Ingo Molnar , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Madhuparna Bhowmik , "Paul E . McKenney" Subject: Re: [PATCH] tracing: Annotate ftrace_graph_hash pointer with __rcu Message-ID: <20200205052632.GB1540@workstation-portable> References: <20200201072703.17330-1-frextrite@gmail.com> <20200203163301.GB85781@google.com> <20200204200116.479f0c60@oasis.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200204200116.479f0c60@oasis.local.home> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 04, 2020 at 08:01:16PM -0500, Steven Rostedt wrote: > On Mon, 3 Feb 2020 11:33:01 -0500 > Joel Fernandes wrote: > > > > > --- a/kernel/trace/trace.h > > > +++ b/kernel/trace/trace.h > > > @@ -950,22 +950,25 @@ extern void __trace_graph_return(struct trace_array *tr, > > > unsigned long flags, int pc); > > > > > > #ifdef CONFIG_DYNAMIC_FTRACE > > > -extern struct ftrace_hash *ftrace_graph_hash; > > > +extern struct ftrace_hash __rcu *ftrace_graph_hash; > > > extern struct ftrace_hash *ftrace_graph_notrace_hash; > > > > > > static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace) > > > { > > > unsigned long addr = trace->func; > > > int ret = 0; > > > + struct ftrace_hash *hash; > > > > > > preempt_disable_notrace(); > > > > > > - if (ftrace_hash_empty(ftrace_graph_hash)) { > > > + hash = rcu_dereference_protected(ftrace_graph_hash, !preemptible()); > > > > I think you can use rcu_dereference_sched() here? That way no need to pass > > !preemptible. > > > > A preempt-disabled section is an RCU "sched flavor" section. Flavors are > > consolidated in the backend, but in the front end the dereference API still > > do have flavors. > > Unfortunately, doing it with rcu_dereference_sched() causes a lockdep > splat :-P. This is because ftrace can execute when rcu is not > "watching" and that will trigger a lockdep error. That means, this > origin patch *is* correct. I'm re-applying this one. > Something new to learn, thank you for the information Steve! Thanks Amol > -- Steve