Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1488694ybl; Thu, 30 Jan 2020 00:24:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwXUgY2QNTwZCVsbpiVK8SPawy1hlbIcAjj7QTbUYNXGacxXSAiWZj//MnR/tK+Adt8vhOg X-Received: by 2002:a05:6808:64e:: with SMTP id z14mr2032027oih.79.1580372693614; Thu, 30 Jan 2020 00:24:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580372693; cv=none; d=google.com; s=arc-20160816; b=P+n5MA0y5XSyT4DaY1vBZQ7IyWlJwPY/WkTrpYfWEiBtXa8m1DSct/lckuwR5mKcXy 2Ep+TQGzkr0Q/eIuw/G/bXV9aeD7yv3gAEciCYM6HNcauHvm79dtJ23rMKG/aLbWIuCY 3K/g70REibLzD1k/rM51nLhcoEkK4ioPLbYGK60R95d4+DnWtKzaVhpN8QdI/zqYPio1 nGY3Pz+xysLkM1/GrqnNBihoipX4BpxVI6pwEykM0V8/xA/v4BDuipYGoUCHVc7yZRrg MgVtItYNspMUSZhgy3O0TtEz92TFUcsWMGkiUvJUihhwr/n9/h7i2EZSYX71p+Vj47SP JooA== 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=MxbBT5cVT9PZ+R6Kb9xK5pFl3peGklWMMshROVhFqH4=; b=aKff97w074DCwCSUaAZSEoqNFUsWaB77aQ74KOSch/iW0xIk31QU3L4nWrgRFlWoM1 FX6xw6ix2LPUgWsqwgtZdufw0Kjybl6Lyug3A/auNVPf7/24pMB5tZQboEfsYXY1DHW/ 10pue3SE2im7t77pZ+gC0/RONlxeGSgm6gU2XGkSlaAYNx+0ZPGjC+4Eg+FWYXcaougp mx/i7B8tI514Lxh6vBChXdFTLnr77GNk9khQfwN84FD5Gf+8wSGTeMqk6wNJLiHqKvIt N3ILY8baXQKuzp8/We1CT9eKZfrLKLG1pvwsO7rWzDLjRzLIV5gFotSR4EaQe1j6xpjq zzHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=FOXXeizH; 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 r12si2521793otq.156.2020.01.30.00.24.41; Thu, 30 Jan 2020 00:24:53 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=FOXXeizH; 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 S1726885AbgA3IXe (ORCPT + 99 others); Thu, 30 Jan 2020 03:23:34 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48148 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbgA3IXe (ORCPT ); Thu, 30 Jan 2020 03:23:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MxbBT5cVT9PZ+R6Kb9xK5pFl3peGklWMMshROVhFqH4=; b=FOXXeizHC/8VqDRI9+L1FOBRm d2yG+jmwveMzeAGz4CIr5E49pumHPYsqyUryz55rGHUssAQeFacCSPNW9Kqsa8+NBIz08TpIhXNBr lvatJE9+cbp9a64izEz5oZdqI0ZPf3a7h8wqflYqMlx1Adb/qru+boGUNc1TmJ6AczeSg1k+PVJoh 8mZ2ZPpjArkO6d5LPWY/r6EjcDeyrMd9QemPEaiXjQV4gygDPaM0v6wl+Q9Hf2o4GYLfCv4yX8CTZ uqgnzJSxpOYGeTWSfXQF9o5oAiToszoC44oOgi/zaw6215hR6tRabxD57+h28SeBE6KQNlYHwK2Ps tvLLJPvUQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ix56i-0004Rc-3w; Thu, 30 Jan 2020 08:23:24 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DBCB0300E0C; Thu, 30 Jan 2020 09:21:38 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0426A2B7334D3; Thu, 30 Jan 2020 09:23:21 +0100 (CET) Date: Thu, 30 Jan 2020 09:23:21 +0100 From: Peter Zijlstra To: Joel Fernandes Cc: Amol Grover , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Madhuparna Bhowmik , "Paul E . McKenney" Subject: Re: [PATCH 2/2] events: callchain: Use RCU API to access RCU pointer Message-ID: <20200130082321.GX14879@hirez.programming.kicks-ass.net> References: <20200129160813.14263-1-frextrite@gmail.com> <20200129160813.14263-2-frextrite@gmail.com> <20200129221909.GA74354@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200129221909.GA74354@google.com> 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, Jan 29, 2020 at 05:19:09PM -0500, Joel Fernandes wrote: > On Wed, Jan 29, 2020 at 09:38:13PM +0530, Amol Grover wrote: > > callchain_cpus_entries is annotated as an RCU pointer. > > Hence rcu_dereference_protected or similar RCU API is > > required to dereference the pointer. > > > > This fixes the following sparse warning > > kernel/events/callchain.c:65:17: warning: incorrect type in assignment Seems silly to have this two patches; the first introduces the second issue, might as well fix it all in one go. Also look at the output of: git log --oneline kernel/events/ and then at your $subject. > > Signed-off-by: Amol Grover > > --- > > kernel/events/callchain.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c > > index f91e1f41d25d..a672d02a1b3a 100644 > > --- a/kernel/events/callchain.c > > +++ b/kernel/events/callchain.c > > @@ -62,7 +62,8 @@ static void release_callchain_buffers(void) > > { > > struct callchain_cpus_entries *entries; > > > > - entries = callchain_cpus_entries; > > + entries = rcu_dereference_protected(callchain_cpus_entries, > > + lockdep_is_held(&callchain_mutex)); > > > Reviewed-by: Joel Fernandes (Google) Do we really need that smp_read_barrier_depends() here? Then again, I don't suppose this is a fast path. IIRC even Alpha got the dependent write ordering right. > > RCU_INIT_POINTER(callchain_cpus_entries, NULL); > > call_rcu(&entries->rcu_head, release_callchain_buffers_rcu); > > } > > -- > > 2.24.1 > >