Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1576655ybl; Thu, 30 Jan 2020 02:17:19 -0800 (PST) X-Google-Smtp-Source: APXvYqzvAMNhEnw1TqONyR5GJQyVTdldgvaViMRYt2cRrLdcFVg+qxjQTnodt1u8tH4cJZIPexk2 X-Received: by 2002:a05:6830:158:: with SMTP id j24mr3082393otp.316.1580379439236; Thu, 30 Jan 2020 02:17:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580379439; cv=none; d=google.com; s=arc-20160816; b=s6A6CBv+JXptNF3Xez0E9XRXK4Nudrude9nWdK0JS3vXdRX8uyl4vwWWUNOE6T51cs n7OyLGOBS2MMKZ8fjA3sBPemRpqxzxjk08GxIq2D2HCS6astOkdRDchtsPd5VRRRWI2m LSpFrgI6RrzhUpOSpfBO818wrK3IrrqFXjx0b/7QzgdV2mSahiycYSqQCB/0dwZAZB8i uu77Cwr9ZlQ5q3BC6Sa+jgx29lxB4mpuwF9xC6jf+/f57u3LPuXJDGIm9UYObACDedaM bqJfX0KcAxo8c1jFvJ30yfzWBQYtpYnAmMDed99J4h6Y8zTtdyN4YL0oD8NShKfNDorQ Ngow== 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=s3YyPLg09Gie8I9immsDwus8bgq4e1f49zZn8bTQ76E=; b=hKhTMjyTUQGx+Nxy3NT/NBcbNUPRZC2yy8FIgJJAb6tSZ4jNuse6msdiXlE6tyIKPh JlvQ69KaVDlLE5NDcHWpYZFnNdcLtl2mFd8f+pVRf/CgZxwfkYB7zAv6Dz0aAhyh0yYz kH5WR4BHhVke4aWTqt2VyikrVZVAbTDHeQ1YDgrUh/6XGQgwpfQEvPn88wPuJvRlRMux ad7eujS412lWiQ2NBJVXyZdPOkIvsnLR96TkUbBaIFP2jIuXmxGjka6gagx5eYtBTG9b gXx3jrjlRakHueWlEmFNyPnzwUx5eJuuzdO+AqOO72Rzyqb9bcCkxZ+HOIv50hTD5dvL 00Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CPM3H68r; 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 d8si2830662oti.306.2020.01.30.02.17.06; Thu, 30 Jan 2020 02:17:19 -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=CPM3H68r; 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 S1727148AbgA3KPA (ORCPT + 99 others); Thu, 30 Jan 2020 05:15:00 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34450 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbgA3KO7 (ORCPT ); Thu, 30 Jan 2020 05:14:59 -0500 Received: by mail-pg1-f195.google.com with SMTP id j4so1414238pgi.1 for ; Thu, 30 Jan 2020 02:14:58 -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=s3YyPLg09Gie8I9immsDwus8bgq4e1f49zZn8bTQ76E=; b=CPM3H68rFC7wby/Uyc1WbUYqMfObo7808jXDwUGqEOWfDNkV26QcnGYbtC8yimVHbM bHY4PaZGYDcoTmZkioEdFruVwOdGGSKwM4A81Vlx3OqMmOu8IKE1fPZAD50wbz9e0VXn u43Z6b9vlsJxnqG3SAZUpVm2PB0NuKdzorxecc7xVXbklK7SHJ4IvzIskIB3kttcdLWa LoakCpaPAIM94pjhnwpWo4w5HXz5BU8Fty7aoRFuSCc/Zxgu18oEk/8gDHXBkLI4pW4U RMp3JbpWhwySqVXF5MD/ebm22HTHphRQMdzC6ybI3p54geDmLuvR4cKWixCX6u1GfReG YfyA== 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=s3YyPLg09Gie8I9immsDwus8bgq4e1f49zZn8bTQ76E=; b=szi1kstKhuQF9vgocfLEP3QJfHO7mbGG3Jy/VNzkdaBRQ35v9guJPNB8043u+KFFyZ VuAJ7hfifeT7tEn9+l0xeovdRLz4YD4WplT2m/ddPOd/xDfRr8GrjtXoEygeKAcxlCWW TyuTglzsdhbRcRMXXnEL4Tmu/kVu7Q0iqRTIqMp7slyWi6BDwAJja+t3inEOpNBGKGa9 5st6hO+AN47ur3d29spYHcLaGIdh3cWk+2uQ2ZjmZ4KGfl07n5znS7utOpPgBuAQiMij bPC/x1CB0rzJTWTUAIIjD1wWE+VqDda6uCS6zxGsYmjefynropS/LJeY8pYfXV/K5N+t QSfg== X-Gm-Message-State: APjAAAUn9GJCZ2xx4egusWYSx/KM5iUxO+JvrkP0sa54+aR0jM0x/WTP WGKnkg4GItOWDlcTaQmSfqI= X-Received: by 2002:aa7:9f47:: with SMTP id h7mr4080251pfr.13.1580379298187; Thu, 30 Jan 2020 02:14:58 -0800 (PST) Received: from workstation-portable ([103.211.17.117]) by smtp.gmail.com with ESMTPSA id e16sm5681485pgk.77.2020.01.30.02.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jan 2020 02:14:57 -0800 (PST) Date: Thu, 30 Jan 2020 15:44:51 +0530 From: Amol Grover To: Peter Zijlstra Cc: Joel Fernandes , 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: <20200130101451.GA11015@workstation-portable> References: <20200129160813.14263-1-frextrite@gmail.com> <20200129160813.14263-2-frextrite@gmail.com> <20200129221909.GA74354@google.com> <20200130082321.GX14879@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200130082321.GX14879@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 30, 2020 at 09:23:21AM +0100, Peter Zijlstra wrote: > 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. > Got it. I'll combine them into a single patch and re-send. > 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. > rcu_dereference_protected is actually a lightweight API and IIRC it omits the READ_ONCE() and hence the memory barriers. Thanks Amol > 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 > > >