From patchwork Sat Feb 23 06:34:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10827423 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 1048B17E9 for ; Sat, 23 Feb 2019 10:40:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB96F2F33D for ; Sat, 23 Feb 2019 10:40:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDD8D2F365; Sat, 23 Feb 2019 10:40:08 +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 18A382F33D for ; Sat, 23 Feb 2019 10:40:07 +0000 (UTC) Received: (qmail 5812 invoked by uid 550); 23 Feb 2019 10:40: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 Delivered-To: moderator for kernel-hardening@lists.openwall.com Received: (qmail 15543 invoked from network); 23 Feb 2019 06:35:03 -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=Zc6wY8rNCewGZVDgSPtq8BlfOuPURI6nN/IPxD75L4o=; b=eDCPmLQERqkYYc/bGxU7OS66Icgp+XunDLdFECdIPqDGXVeyhvqvuBAhTiXdAR99Dq s+GbkyxtCPFUulsLNPUdRTKGM0yr1m9jKQr9M2WpCmNb5xL1jyylsgvJeD71CIg0p0eu pfWs7ErgnCkoanOoY6gZQxnaRcq5DSWNmDVWg= 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=Zc6wY8rNCewGZVDgSPtq8BlfOuPURI6nN/IPxD75L4o=; b=eOfXFaJ1z469vbJEuYz6BlhT5+TS6OG9UiIZZi0dbksYM2cCmJNL9bO1rHZ8z44F8c YSUH8Lb0rV9YjIeANq24oDHfyJ0m7eAX1yLxqpTtsme7ws6s355z3PQYsdPROiaWx46M F4yc2O/ebBR+V+S9OIko441KmHuce+zzVeeTq81JOo12Y9C6Wh5x840dGPX+VpeSupcl e5jHOySBbZ+PZigNphM2TBnZe6d1AMt3KRT36tChWtELM8i37mqTA7Xvq+D8zvCwnq1/ KPbqbULDTuji70wm/QKZeyaX2mTmCRC03pp6nUo9VuG6EplaMkgHhgSY3vomdWNrIzB1 lc0A== X-Gm-Message-State: AHQUAuYAmZEcsM4M5E71mMCpgbxnwpGJ2yfIaOwEGOVIC1/poXumQxx6 FtAztzBOYWh69t27d4qMPRBqJg== X-Google-Smtp-Source: AHgI3IYdAZ9LpDlYKNIOJJbI2dWRj2jR/BzqrefjE6BsZ3jOMxDi9AMbLP8ORBFoMg4jKW+d9sv/aQ== X-Received: by 2002:a0c:9802:: with SMTP id c2mr6078462qvd.13.1550903691926; Fri, 22 Feb 2019 22:34:51 -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 1/6] net: rtnetlink: Fix incorrect RCU API usage Date: Sat, 23 Feb 2019 01:34:29 -0500 Message-Id: <20190223063434.6793-2-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 rtnl_register_internal() and rtnl_unregister_all tries to directly dereference an RCU protected pointed outside RCU read side section. While this is Ok to do since a lock is held, let us use the correct API to avoid programmer bugs in the future. This also fixes sparse warnings arising from not using RCU API. net/core/rtnetlink.c:332:13: warning: incorrect type in assignment (different address spaces) net/core/rtnetlink.c:332:13: expected struct rtnl_link **tab net/core/rtnetlink.c:332:13: got struct rtnl_link *[noderef] * Signed-off-by: Joel Fernandes (Google) Reviewed-by: Paul E. McKenney --- net/core/rtnetlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 5ea1bed08ede..98be4b4818a9 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -188,7 +188,7 @@ static int rtnl_register_internal(struct module *owner, msgindex = rtm_msgindex(msgtype); rtnl_lock(); - tab = rtnl_msg_handlers[protocol]; + tab = rtnl_dereference(rtnl_msg_handlers[protocol]); if (tab == NULL) { tab = kcalloc(RTM_NR_MSGTYPES, sizeof(void *), GFP_KERNEL); if (!tab) @@ -329,7 +329,7 @@ void rtnl_unregister_all(int protocol) BUG_ON(protocol < 0 || protocol > RTNL_FAMILY_MAX); rtnl_lock(); - tab = rtnl_msg_handlers[protocol]; + tab = rtnl_dereference(rtnl_msg_handlers[protocol]); if (!tab) { rtnl_unlock(); return; From patchwork Sat Feb 23 06:34:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10827425 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 318B417E9 for ; Sat, 23 Feb 2019 10:40:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DF6C2F33D for ; Sat, 23 Feb 2019 10:40:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 113572F365; Sat, 23 Feb 2019 10:40:16 +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 00EF02F33D for ; Sat, 23 Feb 2019 10:40:14 +0000 (UTC) Received: (qmail 7312 invoked by uid 550); 23 Feb 2019 10:40:09 -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 15581 invoked from network); 23 Feb 2019 06:35:05 -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=+VRwkLma4QHsLodLyqLqscrFLAElLwMuFYkHuZgYCiA=; b=LXf4B9jiVhDDmWHqmpX8sitFrnlfo5OGBPgxZMG1SG9dPgcG05UwP/0ab87QJca35A +5vX47xZXK/bvlYBPDse0FJpr4WEcj+RtEPX3feM0h5vddYnqNxNRh1Wj7XVR3VJINey NNLEqhrf5Bc1rXkGgXSBIsTOm2/s0liaYt+t8= 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=+VRwkLma4QHsLodLyqLqscrFLAElLwMuFYkHuZgYCiA=; b=CCRKJc8Z2m1Ms6CLtJI2nOMzUcTg3pSI6zpz91tqg7t3ckWWcW3d1eOoKgGGGkgfIw 56dn3SIjwPOzeO8XBG3AqS0EBl86hHGqU2wkVC+0MRdzrPqm8tQap3K4a65fH5SwvchL AKYK2LjxZl8lC/OosZ6SVvgnge//ciHvrLqSj/VWz6xhCd9UMl5JO+NBWX3r1mqCGnJo JyqyWM7oZWsF+brVTFhgGvfjT59KXpXgwghblknMDarjUT12+/absVg+1Oeb27XgSLbv sgIce3lAZPxd33XJbciKboAdcfTAcCU0kncDsOStzw/vvxfpA7r9ydha4KpcyoRQdG3v W+fw== X-Gm-Message-State: AHQUAuYHRMXq14QyOLDrDRCgI1kTm2/Wpa16mBw1mcT1rOkHnS15KsIr aJCJLQDoFTiu+podIvLQdYYJ+Q== X-Google-Smtp-Source: AHgI3IahEVRnoZ+AHkPdERWnSNKPgReNQYpi0yxVo8XFjoaLgTIuIzDAlYYdutedD2WueyS54r/lCw== X-Received: by 2002:a0c:92ec:: with SMTP id c41mr6220040qvc.158.1550903693796; Fri, 22 Feb 2019 22:34:53 -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 2/6] ixgbe: Fix incorrect RCU API usage Date: Sat, 23 Feb 2019 01:34:30 -0500 Message-Id: <20190223063434.6793-3-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 in rcu_assign_pointer. This caused a sparse error to be reported by the ixgbe driver. Further looking, it seems the adapter->xdp_prog pointer is not annotated with __rcu. Annonating it fixed the error, but caused a bunch of other warnings. This patch tries to fix all warnings by using RCU API properly. This makes sense to do because not using RCU properly can result in various hard to find bugs. This is a best effort fix and is only build tested. The sparse errors and warnings go away with the change. I request maintainers / developers in this area to review / test it properly. The sparse error fixed is: ixgbe_main.c:10256:25: error: incompatible types in comparison expression Signed-off-by: Joel Fernandes (Google) Reviewed-by: Paul E. McKenney --- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 4 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 08d85e336bd4..3b14daf27516 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -311,7 +311,7 @@ struct ixgbe_ring { struct ixgbe_ring *next; /* pointer to next ring in q_vector */ struct ixgbe_q_vector *q_vector; /* backpointer to host q_vector */ struct net_device *netdev; /* netdev ring belongs to */ - struct bpf_prog *xdp_prog; + struct bpf_prog __rcu *xdp_prog; struct device *dev; /* device for DMA mapping */ void *desc; /* descriptor ring memory */ union { @@ -560,7 +560,7 @@ struct ixgbe_adapter { unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; /* OS defined structs */ struct net_device *netdev; - struct bpf_prog *xdp_prog; + struct bpf_prog __rcu *xdp_prog; struct pci_dev *pdev; struct mii_bus *mii_bus; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index daff8183534b..408a312aa6ba 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -2199,7 +2199,7 @@ static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter, u32 act; rcu_read_lock(); - xdp_prog = READ_ONCE(rx_ring->xdp_prog); + xdp_prog = rcu_dereference(rx_ring->xdp_prog); if (!xdp_prog) goto xdp_out; @@ -6547,7 +6547,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter, rx_ring->queue_index) < 0) goto err; - rx_ring->xdp_prog = adapter->xdp_prog; + rcu_assign_pointer(rx_ring->xdp_prog, adapter->xdp_prog); return 0; err: @@ -10246,7 +10246,8 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) if (nr_cpu_ids > MAX_XDP_QUEUES) return -ENOMEM; - old_prog = xchg(&adapter->xdp_prog, prog); + old_prog = rcu_access_pointer(adapter->xdp_prog); + rcu_assign_pointer(adapter->xdp_prog, prog); /* If transitioning XDP modes reconfigure rings */ if (!!prog != !!old_prog) { @@ -10271,13 +10272,17 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) static int ixgbe_xdp(struct net_device *dev, struct netdev_bpf *xdp) { struct ixgbe_adapter *adapter = netdev_priv(dev); + struct bpf_prog *prog; switch (xdp->command) { case XDP_SETUP_PROG: return ixgbe_xdp_setup(dev, xdp->prog); case XDP_QUERY_PROG: - xdp->prog_id = adapter->xdp_prog ? - adapter->xdp_prog->aux->id : 0; + rcu_read_lock(); + prog = rcu_dereference(adapter->xdp_prog); + xdp->prog_id = prog ? prog->aux->id : 0; + rcu_read_unlock(); + return 0; case XDP_QUERY_XSK_UMEM: return ixgbe_xsk_umem_query(adapter, &xdp->xsk.umem, 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. From patchwork Sat Feb 23 06:34:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10827429 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 5A3396C2 for ; Sat, 23 Feb 2019 10:40:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46B972F96A for ; Sat, 23 Feb 2019 10:40:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A7EF2F9AB; Sat, 23 Feb 2019 10:40:33 +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 D3A312F96A for ; Sat, 23 Feb 2019 10:40:31 +0000 (UTC) Received: (qmail 9373 invoked by uid 550); 23 Feb 2019 10:40:20 -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 15670 invoked from network); 23 Feb 2019 06:35:08 -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=jdV6wy+jDVHFrKow+yC2lWMVIASermFDO9APgnn8BDA=; b=e93WQJoNz7sL11KjqrcaGD5cGCsOh2htcsisG1aGdQYshASs4Jc8YIlLUcBv+PFM33 D5SWT5Nbb9ONDe8CUUIld7RbTnOXcTah8lcBA2VAi3xuQVZszD3UQ2BKlE/VdsuMB5KH PaecNNtBBlmH9U1q0e7SJNBT9GNC8OsaTTc0s= 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=jdV6wy+jDVHFrKow+yC2lWMVIASermFDO9APgnn8BDA=; b=DcMN7YCgfGiPuCsNKqDFwPQngnPbx1s81cgSi0qogNtgxPozgQNMWHZ0ntLCMmYT6i nJIgO2aFluqK9+zn0LVwONZNL2qZB8OZmu+SgiaG79g/KY+ZZ/nENn1SCknUaLAA2W/M JQJjicffOQ1Rnus8avj/Ew2dPBH8f5vjPmRYsFHn66grRVhrKeHv+RESBbF/WcqLptJl x81hwayTsKN1j+AjzCfgBmczmq0m2Doebnr/8Nf4aAiSs9XYr4cVRHG6QtZ3IvzAgDdU PSjpqL+sF4AAYuEfeA9HboNTnNpwHNAdb8sqcXyGNRROoDclUMypelvGrs+v6mGnuGqo oDeA== X-Gm-Message-State: AHQUAubtOA75QjxTr935CJk+5ZlWQgTS+JQOHtjHR3vEfHiCKH7mixxi cX3K9GvPayRIx/ppP1pdbM47MQ== X-Google-Smtp-Source: AHgI3IYUzePHeJZ/2cTwvTYtmlfODE8tk06HOknOJmB1l0wnBlQb5lzZBnzUiwOy8RZ2bqcwHt/XFQ== X-Received: by 2002:ac8:166b:: with SMTP id x40mr6020562qtk.363.1550903697258; Fri, 22 Feb 2019 22:34:57 -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 4/6] sched_domain: Annotate RCU pointers properly Date: Sat, 23 Feb 2019 01:34:32 -0500 Message-Id: <20190223063434.6793-5-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 The scheduler uses RCU API in various places to access sched_domain pointers. These cause sparse errors as below. Many new errors show up because of an annotation check I added to rcu_assign_pointer(). Let us annotate the pointers correctly which also will help sparse catch any potential future bugs. This fixes the following sparse errors: rt.c:1681:9: error: incompatible types in comparison expression deadline.c:1904:9: error: incompatible types in comparison expression core.c:519:9: error: incompatible types in comparison expression core.c:1634:17: error: incompatible types in comparison expression fair.c:6193:14: error: incompatible types in comparison expression fair.c:9883:22: error: incompatible types in comparison expression fair.c:9897:9: error: incompatible types in comparison expression sched.h:1287:9: error: incompatible types in comparison expression topology.c:612:9: error: incompatible types in comparison expression topology.c:615:9: error: incompatible types in comparison expression sched.h:1300:9: error: incompatible types in comparison expression topology.c:618:9: error: incompatible types in comparison expression sched.h:1287:9: error: incompatible types in comparison expression topology.c:621:9: error: incompatible types in comparison expression sched.h:1300:9: error: incompatible types in comparison expression topology.c:624:9: error: incompatible types in comparison expression topology.c:671:9: error: incompatible types in comparison expression stats.c:45:17: error: incompatible types in comparison expression fair.c:5998:15: error: incompatible types in comparison expression fair.c:5989:15: error: incompatible types in comparison expression fair.c:5998:15: error: incompatible types in comparison expression fair.c:5989:15: error: incompatible types in comparison expression fair.c:6120:19: error: incompatible types in comparison expression fair.c:6506:14: error: incompatible types in comparison expression fair.c:6515:14: error: incompatible types in comparison expression fair.c:6623:9: error: incompatible types in comparison expression fair.c:5970:17: error: incompatible types in comparison expression fair.c:8642:21: error: incompatible types in comparison expression fair.c:9253:9: error: incompatible types in comparison expression fair.c:9331:9: error: incompatible types in comparison expression fair.c:9519:15: error: incompatible types in comparison expression fair.c:9533:14: error: incompatible types in comparison expression fair.c:9542:14: error: incompatible types in comparison expression fair.c:9567:14: error: incompatible types in comparison expression fair.c:9597:14: error: incompatible types in comparison expression fair.c:9421:16: error: incompatible types in comparison expression fair.c:9421:16: error: incompatible types in comparison expression Signed-off-by: Joel Fernandes (Google) Reviewed-by: Paul E. McKenney --- include/linux/sched/topology.h | 4 ++-- kernel/sched/sched.h | 14 +++++++------- kernel/sched/topology.c | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index c31d3a47a47c..4819c9e01e42 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -76,8 +76,8 @@ struct sched_domain_shared { struct sched_domain { /* These fields must be setup */ - struct sched_domain *parent; /* top domain must be null terminated */ - struct sched_domain *child; /* bottom domain must be null terminated */ + struct sched_domain __rcu *parent; /* top domain must be null terminated */ + struct sched_domain __rcu *child; /* bottom domain must be null terminated */ struct sched_group *groups; /* the balancing groups of the domain */ unsigned long min_interval; /* Minimum balance interval ms */ unsigned long max_interval; /* Maximum balance interval ms */ diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 2ab545d40381..ca6a79f57e7a 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -866,8 +866,8 @@ struct rq { atomic_t nr_iowait; #ifdef CONFIG_SMP - struct root_domain *rd; - struct sched_domain *sd; + struct root_domain *rd; + struct sched_domain __rcu *sd; unsigned long cpu_capacity; unsigned long cpu_capacity_orig; @@ -1305,13 +1305,13 @@ static inline struct sched_domain *lowest_flag_domain(int cpu, int flag) return sd; } -DECLARE_PER_CPU(struct sched_domain *, sd_llc); +DECLARE_PER_CPU(struct sched_domain __rcu *, sd_llc); DECLARE_PER_CPU(int, sd_llc_size); DECLARE_PER_CPU(int, sd_llc_id); -DECLARE_PER_CPU(struct sched_domain_shared *, sd_llc_shared); -DECLARE_PER_CPU(struct sched_domain *, sd_numa); -DECLARE_PER_CPU(struct sched_domain *, sd_asym_packing); -DECLARE_PER_CPU(struct sched_domain *, sd_asym_cpucapacity); +DECLARE_PER_CPU(struct sched_domain_shared __rcu *, sd_llc_shared); +DECLARE_PER_CPU(struct sched_domain __rcu *, sd_numa); +DECLARE_PER_CPU(struct sched_domain __rcu *, sd_asym_packing); +DECLARE_PER_CPU(struct sched_domain __rcu *, sd_asym_cpucapacity); extern struct static_key_false sched_asym_cpucapacity; struct sched_group_capacity { diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 3f35ba1d8fde..0844ee757dad 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -586,13 +586,13 @@ static void destroy_sched_domains(struct sched_domain *sd) * the cpumask of the domain), this allows us to quickly tell if * two CPUs are in the same cache domain, see cpus_share_cache(). */ -DEFINE_PER_CPU(struct sched_domain *, sd_llc); +DEFINE_PER_CPU(struct sched_domain __rcu *, sd_llc); DEFINE_PER_CPU(int, sd_llc_size); DEFINE_PER_CPU(int, sd_llc_id); -DEFINE_PER_CPU(struct sched_domain_shared *, sd_llc_shared); -DEFINE_PER_CPU(struct sched_domain *, sd_numa); -DEFINE_PER_CPU(struct sched_domain *, sd_asym_packing); -DEFINE_PER_CPU(struct sched_domain *, sd_asym_cpucapacity); +DEFINE_PER_CPU(struct sched_domain_shared __rcu *, sd_llc_shared); +DEFINE_PER_CPU(struct sched_domain __rcu *, sd_numa); +DEFINE_PER_CPU(struct sched_domain __rcu *, sd_asym_packing); +DEFINE_PER_CPU(struct sched_domain __rcu *, sd_asym_cpucapacity); DEFINE_STATIC_KEY_FALSE(sched_asym_cpucapacity); static void update_top_cache_domain(int cpu) From patchwork Sat Feb 23 06:34:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10827431 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 550951823 for ; Sat, 23 Feb 2019 10:40:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41CF12F96A for ; Sat, 23 Feb 2019 10:40:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35CE52F9AB; Sat, 23 Feb 2019 10:40:42 +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 711CC2F96A for ; Sat, 23 Feb 2019 10:40:41 +0000 (UTC) Received: (qmail 9621 invoked by uid 550); 23 Feb 2019 10:40:23 -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 15711 invoked from network); 23 Feb 2019 06:35:10 -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=CqF7P151YJVMLZIvwWfeCbnvQFr03nry4lyp7ZYlhMI=; b=oR7uWW5YXfiw9asF+Ad74Itgz6k54aF+dHzzRvIVX3DTAM9N+XTP9dlnFfEdGhDwgq D+sBaV98aHp9dtAPdWiy1tr3ygPvTWz/EwwxVuZn7vjZGkZMyTYrbuAVsg2OoUn2s634 Oay9Xr5t8Npx4mvey2RRgU8Z0tRiRYhaSl8EM= 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=CqF7P151YJVMLZIvwWfeCbnvQFr03nry4lyp7ZYlhMI=; b=p6+NR7L6iBfn6ybYkS4eXA0aahT20p4wI3qqdTNnFwpkKwRMFKxNWhGGPSG6K9ADoT 5/h62L4AWA3Ot/NJBsvZAATRIfc21lORXnABUTqjNCD3eQZ7VTfHmvWWik9o9aK3nhUB aqJWfyXb5m/e/DQh6M+u3Q+uSy6ovKnqVANjeNsob3diHcQhRQkKCiKuT1Aq6dqoXDtt 14XxQf5ZF7C4/eNCBx8f9FnEOR5t1JC4rJI0unNfTKmJKnqWdjVaOv+NUGwcitWDJKUS sn41mKLVDuHUf8aDIsM6kPx5PC3gtSrp9ZFFv2A2TzOkzIZPGmD/YIMZ0309T+Q+Sncj N0Og== X-Gm-Message-State: AHQUAubZZkQXov/TQ0ggFspjKktXbXnlkL3KlKINvD+ltrJ1TCVfNJ52 Vz02Db8mFUyGIaPHlfY2zpgkLA== X-Google-Smtp-Source: AHgI3Ib9Txqt1JH00OmpwHDqOocPB8iKGf16Cn0P15mQw+j+/8JuXRaNYadfDGqeQAA2qPTefc1nGQ== X-Received: by 2002:a0c:ae27:: with SMTP id y36mr6195543qvc.185.1550903699062; Fri, 22 Feb 2019 22:34:59 -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 5/6] rcuwait: Annotate task_struct with __rcu Date: Sat, 23 Feb 2019 01:34:33 -0500 Message-Id: <20190223063434.6793-6-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 This suppresses sparse error generated due to the recently added rcu_assign_pointer sparse check. percpu-rwsem.c:162:9: sparse: error: incompatible types in comparison expression exit.c:316:16: sparse: error: incompatible types in comparison expression Signed-off-by: Joel Fernandes (Google) Reviewed-by: Paul E. McKenney --- include/linux/rcuwait.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h index 90bfa3279a01..563290fc194f 100644 --- a/include/linux/rcuwait.h +++ b/include/linux/rcuwait.h @@ -18,7 +18,7 @@ * awoken. */ struct rcuwait { - struct task_struct *task; + struct task_struct __rcu *task; }; #define __RCUWAIT_INITIALIZER(name) \ From patchwork Sat Feb 23 06:34:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10827433 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 938DA17E9 for ; Sat, 23 Feb 2019 10:40:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 811612F96A for ; Sat, 23 Feb 2019 10:40:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74B8E2F9AB; Sat, 23 Feb 2019 10:40:52 +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 A718E2F96A for ; Sat, 23 Feb 2019 10:40:51 +0000 (UTC) Received: (qmail 11369 invoked by uid 550); 23 Feb 2019 10:40:31 -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 15769 invoked from network); 23 Feb 2019 06:35:12 -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=c11Ywbk20nC8e/qjunfo9WwGcMogUJINp1i/rWGd08s=; b=PPEj7VcsX7GuoS9pbDmowmREOrTcSy3Dj461kk5FZcZJFK1aPfti5PndMTK4chG0Af v5egDRsZIECwwjGy3GGyr/aCNrEkUBjw2CnB+5LssuW0QOKPd20jb6sC1Br4Ew6WH2T/ ifjANVdD1BRTqfhSTjcMOQwJg4GPR2rK9OR8I= 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=c11Ywbk20nC8e/qjunfo9WwGcMogUJINp1i/rWGd08s=; b=dNBqLk2c/4kYiugWd/j70XXcPeXoyqNGpYL6hUUp9zPQOj0gnLjWXyw1NVlvV6UTJY tyxQJ5qpitCOEFkBbNupfUcKiGYB0HA3CuCM5g8xlRfEuAGVhhQkhAouV2GRdTULOn0h m2wvmBY8/x2p1nI4L/awoD2fJX8DEiK+9CRfl6DxiUWXRnMuEzg/9rrc7jBP4yL4AMxK vAZbEjvFAbXfealap21cvp9qIPsBQV21t+hudRzoIiSKk8rJCNMGE2TcCj3tpnO/V9hq S6VguJPoXE+btHSOaXZj5NUpkKlolUgHL6QXfkaARItarFpltmcPAMJFiaEWn7lQjHfx K1dA== X-Gm-Message-State: AHQUAuZhveH4KgQ/j/KVKd8Y+w8sPlg1JWrX1qlv5gpuiT4Q5jRJoo8e ImDG+9o3sqdmhGoHVDA1tMmztA== X-Google-Smtp-Source: AHgI3IaQaWIDhu712jidCK5mnMSqSaUBd1cvjuYOZ04s+y+aFdPkG7M0MgZpCLNFmNw19uUjpE6x6Q== X-Received: by 2002:ac8:19f5:: with SMTP id s50mr6018714qtk.25.1550903700787; Fri, 22 Feb 2019 22:35:00 -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 6/6] sched: Annotate perf_domain pointer with __rcu Date: Sat, 23 Feb 2019 01:34:34 -0500 Message-Id: <20190223063434.6793-7-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 This fixes the following sparse errors in sched/fair.c: fair.c:6506:14: error: incompatible types in comparison expression fair.c:8642:21: error: incompatible types in comparison expression Using __rcu will also help sparse catch any future bugs. Signed-off-by: Joel Fernandes (Google) Reviewed-by: Paul E. McKenney --- kernel/sched/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index ca6a79f57e7a..c8e6514433a9 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -780,7 +780,7 @@ struct root_domain { * NULL-terminated list of performance domains intersecting with the * CPUs of the rd. Protected by RCU. */ - struct perf_domain *pd; + struct perf_domain __rcu *pd; }; extern struct root_domain def_root_domain;