Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2043886ybv; Fri, 14 Feb 2020 10:21:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzT9lu9n9uja8G3JXrpXpkU8FZFAScMFG5VvzmmmL0TdtdUknYIQL6e2sD7kw4iGYRESnKa X-Received: by 2002:aca:ec15:: with SMTP id k21mr2780705oih.35.1581704481136; Fri, 14 Feb 2020 10:21:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581704481; cv=none; d=google.com; s=arc-20160816; b=j3NHp/8U2SkXLDGwtJnjaLsIUaAziUqGta+AcSqIcxaJemg74oKAdaQAljsUMbwYpb aTV5Cw0WKCO9QkYbL3TC+ol8k0dUDS94WbuRyzesDrVaFZRGgnMXLkF1jKmLytoxJMis FiPwXBy3DMu+4tLfOALaeJygUWdWkCiJxa6SlUddyYMqc8MQy6NpmOfVXVi1qms5KyVc UMyFHRzNOFb5CkPws8iv3vG6akTt/+F6EGunhhj8991AjEdUOh2IYHpf08fvJRZK96WM PPMn9K1+bvDe51TV+P0atDRco3FqJXBuLQWB/VgOwjvpYMF81oinJ0t4six41Z70TBMv 2ylw== 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=ErA6jWmmhfb1QGDKOQtEER5Ilc0UgOh2Gqv2PGMN0HE=; b=cmKGgT4vjS7+nrB26P49cwRQefXReDOe7/Wr8fEQ4442WP5c+aQbrUa5XfDa1fkb+E nbxQM96koi5zCJljtxJvqjVsXHMtl+bWAA/GcWm0st29X7sgmYb7/mJFj7BIRhJ/GtlQ xsb/ABlmQrpgGYsgukP3Run9AvtPkiIT92YUvVCAFCxDk6sNgEGCdokXQE+PYbH3RvND OlP2kufruYVmVGUD8GF0DHoBI8L5yEqXH9G+6nGfc19Wtkz1zl//Cz6ewwguMREqAQeV GlufCbxmBjg2pkrqTYjs+RrF3yRcYGg9h0GLvdw0Hr64cpRkegk3nFgK1BJpFJLUphG/ 2Kig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AlN8Rr9w; 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 l80si3073291oib.268.2020.02.14.10.21.09; Fri, 14 Feb 2020 10:21:21 -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=AlN8Rr9w; 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 S2405299AbgBNSUj (ORCPT + 99 others); Fri, 14 Feb 2020 13:20:39 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43943 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729283AbgBNSUh (ORCPT ); Fri, 14 Feb 2020 13:20:37 -0500 Received: by mail-pg1-f196.google.com with SMTP id u12so4990187pgb.10 for ; Fri, 14 Feb 2020 10:20:37 -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=ErA6jWmmhfb1QGDKOQtEER5Ilc0UgOh2Gqv2PGMN0HE=; b=AlN8Rr9wAt7e/JdQ398Ln/0Pgz9LEQu52lKml03hoYL+Kej1LX1Cr4EeA10Qe8zdrP RK5SP9i2jYx35aykVGR2g/0onBcpFUJNpFwV4ymCb2LK76xcOP9aPMs6fRWoa5WdtKQd 0lbSub1/AJjFLlTVC6kAYd/C/yWF/VPZ9UVBw4Dxnn1dVhBoMDo0d09btXNlKci2LOb3 TONpvgLieMjffTOazxw56KMEaMYiO5AfO5eZKVow4wKVjpBiKetJn4EUQoKoyYoQbL30 ldK/cUpZwYrhB+k/33T0vmnMq6nS5FeADc4EdcgS/WPWtsgWAw88v+i2+w59r7ob/irL 7HNg== 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=ErA6jWmmhfb1QGDKOQtEER5Ilc0UgOh2Gqv2PGMN0HE=; b=g0X0LuqhjHE71Gr+Q7uifXSAZkzmKzbpfT3vVUtjEqkjgsF3BsoLVZ294aLUuJ5TRk dk0FgPzn/lblf/da1rDYhlX4zpASX+AFOJbRaTTe87q+y/FV+bl7i7NBEFl+laYijSwp q16LUK3ZOy+5bR+cAqXv9lmjzHe+3qh61iKzTTqQomNNKxd2sGlri86kv7u+liGfKFlP mpdYA4VeLzDT54qA1y2qsUatLatFeIc5AWfUNH+azUz0HAtTECUq9kw6Bz46HWoAH/+M mWuW8rYAZyKj3ncf1eLLIRsz+zQU+tbAXLCnzTXkZjsj1LhUlRw7Iqa/dTb+kiVAf7wZ P+/A== X-Gm-Message-State: APjAAAVjC5l3epf/bvh3dYpsi89qVH7uuMY9q189BeTltl5d63GBWDZL WnvqYq2sOxvX6ESI+t84hrk= X-Received: by 2002:a63:3712:: with SMTP id e18mr4918078pga.316.1581704436575; Fri, 14 Feb 2020 10:20:36 -0800 (PST) Received: from workstation-portable ([146.196.37.246]) by smtp.gmail.com with ESMTPSA id o11sm7196634pjs.6.2020.02.14.10.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 10:20:36 -0800 (PST) Date: Fri, 14 Feb 2020 23:50:27 +0530 From: Amol Grover To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" Subject: Re: [PATCH v2] callchain: Annotate RCU pointer with __rcu Message-ID: <20200214182027.GB15350@workstation-portable> References: <20200130141818.18391-1-frextrite@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200130141818.18391-1-frextrite@gmail.com> 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 07:48:19PM +0530, Amol Grover wrote: > Fixes following instances of sparse error > error: incompatible types in comparison expression > (different address spaces) > kernel/events/callchain.c:66:9: error: incompatible types in comparison > kernel/events/callchain.c:96:9: error: incompatible types in comparison > kernel/events/callchain.c:161:19: error: incompatible types in comparison > > This introduces the following warning > kernel/events/callchain.c:65:17: warning: incorrect type in assignment > which is fixed as below > > callchain_cpus_entries is annotated as an RCU pointer. > Hence rcu_dereference_protected or similar RCU API is > required to dereference the pointer. > > Signed-off-by: Amol Grover Hey Peter, Can you have a look at this patch as well? I have already done the requested changes. Thanks Amol > --- > v2: > - Squash both the commits into a single one. > > kernel/events/callchain.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c > index c2b41a263166..a672d02a1b3a 100644 > --- a/kernel/events/callchain.c > +++ b/kernel/events/callchain.c > @@ -32,7 +32,7 @@ static inline size_t perf_callchain_entry__sizeof(void) > static DEFINE_PER_CPU(int, callchain_recursion[PERF_NR_CONTEXTS]); > static atomic_t nr_callchain_events; > static DEFINE_MUTEX(callchain_mutex); > -static struct callchain_cpus_entries *callchain_cpus_entries; > +static struct callchain_cpus_entries __rcu *callchain_cpus_entries; > > > __weak void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, > @@ -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)); > RCU_INIT_POINTER(callchain_cpus_entries, NULL); > call_rcu(&entries->rcu_head, release_callchain_buffers_rcu); > } > -- > 2.24.1 >