Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp93233ybv; Tue, 4 Feb 2020 17:06:01 -0800 (PST) X-Google-Smtp-Source: APXvYqwug34PWSwU6r4aRkqc6tRh4ylVaoLjAKO8QWPHp94+331uJ35w0auKkYo9429JuR8mbePC X-Received: by 2002:aca:d5d3:: with SMTP id m202mr1191599oig.161.1580864761026; Tue, 04 Feb 2020 17:06:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580864761; cv=none; d=google.com; s=arc-20160816; b=xemaYCWzdOeGhL9YfxZ8u14jpYAOuYaAhPnsYcbmriYbtn5ZQ8PyX1gnHFt4LeeCjQ pxKi1Oeyr2OZZ4/dTmodhYIu/S8OUyMDSxbGKeaRszZ07w/Ql01VhEcegb3jFBsROKuh gM7WoxMRC7v5JZrP3qbxNeqVVjJzXUZp30UwBc3A14A/fDBKKU6CviqF05NjfRO2jnmm E0/h+9s4SZxYb7SP+5/bgFLb8R7TrEXg2yaxIgQn/6Fq44mID3GzfruzP+Z8/EdT6n25 bcU6jrKf/w5EkYFRX3b6AcDHBVqGIpEtNUNQNb1+XLFasrJZnXzShyIfUwQR51GwA5c0 HMKQ== 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=Hq8wrb2YGc4vKzxMDOnn2lDtFfffFWN7pgJAoFDe4FY=; b=RAsB0rVhQiowYmR6HIQmQadFDwTBVrrtpmtcalHfP9J8HNpC1p8TpxK3OdXPXsFomo LOJ2LVqv8P1OUMbaGmNF/EMdKyTHtAeWPio5txVreiDdTICm5FOCfF5Ga0rJaP4A7xiq 9s3hWp7ZmBGEDHEnWlaeGzdL2R0tCew9WrNEzAhMfQvKOcyRctb1tesmvFSdVvuVnQkx 5z34PIaS7fBocWzIav02OcW3RT/BvyxVGPMdvUJdZ91QdUYKC3glZqeneG2ryDqMcdsy rKs9SDPTJdETZasA8jRk0B6/m4xDP9vVCK+qJKaeSudIZHhezCSj6dECOz/s+QGRC83J qrCA== 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 p7si13256442ota.299.2020.02.04.17.05.44; Tue, 04 Feb 2020 17:06:01 -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 S1727747AbgBEBBX (ORCPT + 99 others); Tue, 4 Feb 2020 20:01:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:37180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727664AbgBEBBX (ORCPT ); Tue, 4 Feb 2020 20:01:23 -0500 Received: from oasis.local.home (unknown [213.120.252.178]) (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 1AB942085B; Wed, 5 Feb 2020 01:01:20 +0000 (UTC) Date: Tue, 4 Feb 2020 20:01:16 -0500 From: Steven Rostedt To: Joel Fernandes Cc: Amol Grover , 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: <20200204200116.479f0c60@oasis.local.home> In-Reply-To: <20200203163301.GB85781@google.com> References: <20200201072703.17330-1-frextrite@gmail.com> <20200203163301.GB85781@google.com> 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 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. -- Steve