Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3739072ybv; Mon, 10 Feb 2020 05:36:34 -0800 (PST) X-Google-Smtp-Source: APXvYqydMzClfhThzpxaH/NCY174grwlI/JJARkD4BDdtVr8L2j0GP5D/CTBhf/btP2Jgh0IXepK X-Received: by 2002:a05:6808:8e1:: with SMTP id d1mr817820oic.68.1581341794058; Mon, 10 Feb 2020 05:36:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581341794; cv=none; d=google.com; s=arc-20160816; b=mNfD9Uet7CBh+eBbMDRZ6WDTxWjJPFAK8wE2OyLH59OnGh9FNyOAH9vwsUcGl116t1 yF6A5y2YawlzUenMpR/JDAo5rVws8R4Pv//1kggJxSmb1zSfmEcayXz5nb2PxU9d6KRo ZOiUrFaNDvXZfmRJ5MKub+8hSDqUMFYCT8rcCdeVPCOjpgWZFijhenopfC3BWcIQ1EUz CquUAbADXdAbK1vi1Slf0bPTR+QYV+1L+YeUDj2BT8EJyTay9ExnweScgfud3F5A62ND 3JrBa4dxnnngUaFleUm/YKvDlOFg4AVv49Qvfkcxw401nsenE6vnL7VIihx+ItPbu+ns jfXw== 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=GPPTGGCsRaytIz1LpgQIb2TA2p+fTyCYKNF1pAC5bG4=; b=fJxi+dApeEtjkD2ZcZqecq6JxyWuc3VTB972QPCL85Ux8AucOWqGx9ipqWLh5vy5jn 0t3UKO/wbWDJiz7uU7UZxujM0E2Z/zvG3c7TlMs1Cr33iPb49y2paHdlz7fahsX/WjXJ W8ZUqdOV+Z8KnxYbOaAVqDR7pHz3zNWTBstgxEFT2+C7ES4bo7UwsQCK6XJ7j41aiDBE Q9c8zRhFwtd+VE74qE/FqfWcFtcGDqpZcbYzNJmokYFn2PD0WjnCfrT9AzNhlT/0WHFG D3YYBm4tuS4zaBgAfM36FSmwpLTVdOgXCkzYfhpOGzpYarGJodoNom/qE+4L8Yzu50Q2 rnRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=AJMpgVkV; 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 x6si158988ota.322.2020.02.10.05.36.21; Mon, 10 Feb 2020 05:36: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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=AJMpgVkV; 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 S1731498AbgBJNfL (ORCPT + 99 others); Mon, 10 Feb 2020 08:35:11 -0500 Received: from merlin.infradead.org ([205.233.59.134]:49618 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731363AbgBJNfI (ORCPT ); Mon, 10 Feb 2020 08:35:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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; bh=GPPTGGCsRaytIz1LpgQIb2TA2p+fTyCYKNF1pAC5bG4=; b=AJMpgVkVmCduDmkUDkFI4Q6Ve0 n861FSp5OdNAlagaT4f/pBQ26Pe4rHAfaU62EOxUI72Um/BdtZGXQFjqHcJoR36KiUQrvnnNzcqPl 9jYruYDZBmad2L3X/R5ClNIUQO32OCiiA8QXAQGGInaeH8dhHlnQxDV8uzaHdVO+YxFAdN9fkJeru VwoepytTdDPFdNWgUQ7nA+3aUyNHnUSPnn+F0XY7KoX25L+/HpcNN0ajmyl+mxNZMWNtyDu+JMrvw ZT+VnylQiEBuaUyx3oh11pgOfCOy5o+qJYwJNbgRiSuWZk5rb9vtFDbJRsxpoXj3UEE44Qq7mKXn9 qAHA2ycQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1j19DI-0006c3-NL; Mon, 10 Feb 2020 13:35:00 +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 C56B630066E; Mon, 10 Feb 2020 14:33:10 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0CA2829C83CBE; Mon, 10 Feb 2020 14:34:59 +0100 (CET) Date: Mon, 10 Feb 2020 14:34:59 +0100 From: Peter Zijlstra To: Amol Grover Cc: 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, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" Subject: Re: [PATCH] events: Annotate parent_ctx with __rcu Message-ID: <20200210133459.GJ14897@hirez.programming.kicks-ass.net> References: <20200208144648.18833-1-frextrite@gmail.com> <20200210093624.GB14879@hirez.programming.kicks-ass.net> <20200210125948.GA16485@workstation-portable> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200210125948.GA16485@workstation-portable> 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 Mon, Feb 10, 2020 at 06:29:48PM +0530, Amol Grover wrote: > On Mon, Feb 10, 2020 at 10:36:24AM +0100, Peter Zijlstra wrote: > > On Sat, Feb 08, 2020 at 08:16:49PM +0530, Amol Grover wrote: > > > @@ -3106,26 +3106,31 @@ static void ctx_sched_out(struct perf_event_context *ctx, > > > static int context_equiv(struct perf_event_context *ctx1, > > > struct perf_event_context *ctx2) > > > { > > > + struct perf_event_context *parent_ctx1, *parent_ctx2; > > > + > > > lockdep_assert_held(&ctx1->lock); > > > lockdep_assert_held(&ctx2->lock); > > > > > > + parent_ctx1 = rcu_dereference(ctx1->parent_ctx); > > > + parent_ctx2 = rcu_dereference(ctx2->parent_ctx); > > > > Bah. > > > > Why are you fixing all this sparse crap and making the code worse? > > Hi Peter, > > Sparse is quite noisy and we need to eliminate false-positives, right? Dunno, I've been happy just ignoring it all. > __rcu will tell the developer, this pointer could change and he needs to > take the required steps to make sure the code doesn't break. I know what it does; what I don't know is why you need to make the code worse. In paricular, __rcu doesn't mandate rcu_dereference(), esp. not when you're actually holding the write side lock.