From patchwork Sat Feb 23 06:34:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10827427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9FD776C2 for ; Sat, 23 Feb 2019 10:40:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D0CE2F33D for ; Sat, 23 Feb 2019 10:40:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80CB12F365; Sat, 23 Feb 2019 10:40:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id B21992F33D for ; Sat, 23 Feb 2019 10:40:23 +0000 (UTC) Received: (qmail 8068 invoked by uid 550); 23 Feb 2019 10:40:17 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Delivered-To: moderator for kernel-hardening@lists.openwall.com Received: (qmail 15620 invoked from network); 23 Feb 2019 06:35:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j9uaH19zzwr4OSX1n04BhljetL/RmyflP+g9OcvA0u0=; b=s/78w0YGTc2XtFwNSTGRH7EzLpdGadOr9CbcH16Ykl04d98Jj2wGbWSxhbnjOTpfrZ OIuG3RiwNiWryVdu02ArDq7KDyDswe9l8C+bgbkSuPtmL8rpmqfWW2ShIN1TGHSegkj6 ErshRyL42Z8mIhldo1XK/Q7NCZuHNZKcERyNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j9uaH19zzwr4OSX1n04BhljetL/RmyflP+g9OcvA0u0=; b=Bfu6W0d7J1NosMX2z3us8PP0KONUWYTiAvTMVhOJH9JT8+xnbWhVCd0XZ/MSLkGyLe CcQD4p/0DCnr9680bNQHBRB/HmbInzX1Wls2MERGtrVHdfBnXNSctA2RhE6/Se3ZolCC muKVLczAIGzHqOkhWDotP9ulI6WP49CzFyzx9OD9ExKr31w1eZGGpWCeZ1mLBWcIICtG tMHJhawfJcQt/vUJe8gt8WSjNgVDCoiyNHkSYIH43QWg7E22CNcF7Tg9Rm78Cy2JRSBn MavLagnrFLCbAmz1glK9+SUPfKttGZoV5GUHiJ7IweiTMQNh7MsGyyxxdigJmJYuAiOz 3Otg== X-Gm-Message-State: AHQUAuaxXNFIXT7jYIEFA+bLmB+mFzXlaeWcTszCLmSfBEt2V3kkw4MG Ia51UA+gZPtOO0z4Y1Wcr8ZDgQ== X-Google-Smtp-Source: AHgI3IbH9rbs5/xUnSBNzQ1jBth6cKcBV/4cG/qubG7uaPWUv4MRKW8heTjLFYj1yn326XSsWSWbXg== X-Received: by 2002:ac8:29e8:: with SMTP id 37mr6232688qtt.153.1550903695498; Fri, 22 Feb 2019 22:34:55 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Alexei Starovoitov , Christian Brauner , Daniel Borkmann , David Ahern , "David S. Miller" , Ingo Molnar , Jakub Kicinski , Jeff Kirsher , Jesper Dangaard Brouer , John Fastabend , Josh Triplett , keescook@chromium.org, kernel-hardening@lists.openwall.com, kernel-team@android.com, Kirill Tkhai , Lai Jiangshan , Martin KaFai Lau , Mathieu Desnoyers , netdev@vger.kernel.org, "Paul E. McKenney" , Peter Zijlstra , Quentin Perret , rcu@vger.kernel.org, Song Liu , Steven Rostedt , Vincent Guittot , xdp-newbies@vger.kernel.org, Yonghong Song Subject: [PATCH v2 3/6] sched/cpufreq: Annotate cpufreq_update_util_data pointer with __rcu Date: Sat, 23 Feb 2019 01:34:31 -0500 Message-Id: <20190223063434.6793-4-joel@joelfernandes.org> X-Mailer: git-send-email 2.21.0.rc0.258.g878e2cd30e-goog In-Reply-To: <20190223063434.6793-1-joel@joelfernandes.org> References: <20190223063434.6793-1-joel@joelfernandes.org> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP Recently I added an RCU annotation check to rcu_assign_pointer(). All pointers assigned to RCU protected data are to be annotated with __rcu inorder to be able to use rcu_assign_pointer() similar to checks in other RCU APIs. This resulted in a sparse error: kernel//sched/cpufreq.c:41:9: sparse: error: incompatible types in comparison expression (different address spaces) Fix this by annotating cpufreq_update_util_data pointer with __rcu. This will also help sparse catch any future RCU misuage bugs. Signed-off-by: Joel Fernandes (Google) Reviewed-by: Paul E. McKenney --- kernel/sched/cpufreq.c | 2 +- kernel/sched/sched.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/cpufreq.c b/kernel/sched/cpufreq.c index 22bd8980f32f..e316ee7bb2e5 100644 --- a/kernel/sched/cpufreq.c +++ b/kernel/sched/cpufreq.c @@ -7,7 +7,7 @@ */ #include "sched.h" -DEFINE_PER_CPU(struct update_util_data *, cpufreq_update_util_data); +DEFINE_PER_CPU(struct update_util_data __rcu *, cpufreq_update_util_data); /** * cpufreq_add_update_util_hook - Populate the CPU's update_util_data pointer. diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index d04530bf251f..2ab545d40381 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2166,7 +2166,7 @@ static inline u64 irq_time_read(int cpu) #endif /* CONFIG_IRQ_TIME_ACCOUNTING */ #ifdef CONFIG_CPU_FREQ -DECLARE_PER_CPU(struct update_util_data *, cpufreq_update_util_data); +DECLARE_PER_CPU(struct update_util_data __rcu *, cpufreq_update_util_data); /** * cpufreq_update_util - Take a note about CPU utilization changes.