From patchwork Thu Mar 21 00:34:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10862735 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 F2E76139A for ; Thu, 21 Mar 2019 00:35:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA9BB29E99 for ; Thu, 21 Mar 2019 00:35:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB92C29EEC; Thu, 21 Mar 2019 00:35:12 +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 0974929E99 for ; Thu, 21 Mar 2019 00:35:11 +0000 (UTC) Received: (qmail 24257 invoked by uid 550); 21 Mar 2019 00:35:03 -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 Received: (qmail 24094 invoked from network); 21 Mar 2019 00:35:02 -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=VXwps16vASwoCwctvt+c7hXAgg4xM5xUnznKf8pbr4E=; b=F+wz+KBU6c5XYVr/XcGDyV8lbJqiOM6t2n2UMRjLGYEIzbqDnCXLYtyMgsA1jQ2bQn GgFFejHln14tX5vHSLeCEAW1tHV/ESEx6IoFxdMXP2NMF/jY59mukSwgijpo+z5nJTPk 3qL6iVy/YQQWkqwwADVfoo7cDFIVUbNehoA3E= 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=VXwps16vASwoCwctvt+c7hXAgg4xM5xUnznKf8pbr4E=; b=Q1tTux/oZW/w9XE6/YIuF9v5f6j7LuD1AGtwh5fCUgjFr/kCjDSGtAzztXS+U4qzPQ M8IBNvt2hLgy/Y/rL2hc+61wDTpIK26z+IF+jFNpMo4paP2E/dd/dFfSZUKFAU+iwX9+ kh8hXzrJCDQvwZl6c8APYnUVUE7ddKyg85BlijDJkUFC8/uNwwMnsnubI3dpGjeCL7d+ wEb7/HPHqUF700C4SZwC2AQndp9N45OdQkYSyvT6nQO8YXuXMIqXPqyrOnI5YhJrcL98 FyS3p8c+s52dp+Z3ozvRswgSzMqpEsIin/f2/O+889pP4FLr+Lz3rKZNKORqXPBP42zX j+tg== X-Gm-Message-State: APjAAAXoCVfT4G5rbipbd7frL4CthzyOGhdCGz3M5CCR6J1Ks6iTUREV 3+KWo7Az8fNOmUzlVhdCol0ZdA== X-Google-Smtp-Source: APXvYqxOrY9pxSJR9LMG73HalrbnXN5RofP5xjcWc9GfONoexUhjKRrzzIdMjcZl5HeL2MvlhfK9NQ== X-Received: by 2002:aed:20e3:: with SMTP id 90mr624928qtb.357.1553128491194; Wed, 20 Mar 2019 17:34:51 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , "Paul E . McKenney" , Ingo Molnar , Josh Triplett , keescook@chromium.org, kernel-hardening@lists.openwall.com, kernel-team@android.com, Lai Jiangshan , Luc Van Oostenryck , Mathieu Desnoyers , Morten Rasmussen , Peter Zijlstra , rcu@vger.kernel.org, Steven Rostedt Subject: [PATCH v2 1/4] sched/cpufreq: Annotate cpufreq_update_util_data pointer with __rcu Date: Wed, 20 Mar 2019 20:34:23 -0400 Message-Id: <20190321003426.160260-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog In-Reply-To: <20190321003426.160260-1-joel@joelfernandes.org> References: <20190321003426.160260-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. [From an RCU perspective] Reviewed-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- 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 835671f0f917..b5dcd1d83c7f 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 efa686eeff26..713715dd00cf 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2185,7 +2185,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.