Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3934539pxv; Mon, 5 Jul 2021 09:13:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlQHk1fiCyXmKvgd/lyK0zYeic/3BddbUmryUyo+vIgvise+pPodoFjaZ8hg67poSQO2hQ X-Received: by 2002:a50:8fc3:: with SMTP id y61mr16766093edy.107.1625501617207; Mon, 05 Jul 2021 09:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625501617; cv=none; d=google.com; s=arc-20160816; b=JDwvnnKhvp77pSZsFbV4Sucfm7o3UfqzeECPcBVBOys9rCWFLBzj8G/AH7ORZK0Hp1 hBWlkPmk4sHxEBJL9KPMJZIq7SXpkLoCx+wTX5MSFmCwSOg7/wgbUy//mt3yFHDbEYZt BL61FSB+5nJPmrlbElpVhmvNUnYkzMPBRAwRxCyLGqKr69zz5PrSRghQdIZC2kQJzJDN H1qMdhkeGrr6T5gPByUv9D3BaQQviCC860VuCpTHiQaI6gZha2rQLB92y7VO+eR9ZXG3 ZfqlrHMQ96rvTChE73TIOQ7h1bVsoHjAI8rs3EKctqXQXY8+ceZ2fJ9swJ2h5OyktSZZ t3mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:dkim-signature; bh=Q3YIK3t9z+fN5nGyXTdIuXppJPkxUCeL7c4AVzJi+kY=; b=ALa8RtqtVVHsQ4KxqMkD05R2dyiAiOi8DqFOtos/Tlv31hdElsP2OWhOQpujUzZ5j4 +BfPCJIiAUjOn8fi9Yk7JQ/rezrZekejgPcNnYst+MZLO4bThqbB0b0x1ZJlPNR9FzTv Zl0V3efF+JP2Xb821zQrOwpew+F1FqpQ7OJ+rfTVrLCa9Ll+pvsCgR8mxw2ywtpjGoOB hjgbn52cww/UNhD3qMXWXtPLO+eqIr+tsXsJDg6ZcNbQ5mKTceCUaG5Urrsow8URwR1N 2kBgh/WUimH7yhl6f0VUNuMJoMwFYZoteMC4UELZ2Xc0Hv0GOAs1lMtDVLXKdW3w5uXg 1/FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=l6HJ3Dnw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hu7si10909988ejc.442.2021.07.05.09.13.09; Mon, 05 Jul 2021 09:13:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=l6HJ3Dnw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbhGEQOo (ORCPT + 99 others); Mon, 5 Jul 2021 12:14:44 -0400 Received: from ale.deltatee.com ([204.191.154.188]:40548 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbhGEQOo (ORCPT ); Mon, 5 Jul 2021 12:14:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:content-disposition; bh=Q3YIK3t9z+fN5nGyXTdIuXppJPkxUCeL7c4AVzJi+kY=; b=l6HJ3DnwxZZU6aKXCzjaIRSBsT LbVWl7FbsPNed0mxfaZYeSjZ9c+8xrk+2OoGr0VRbICRVllqYNWNz6P3qI5F5Hbi/yJzxfC6qaXyS yOyg762Y2AC2DmygosBJ8ljHE2PFFwpGB/NqLv0FdY9n0GHIea2PFxVbdRewWp5Qfaxpo0Ckd70t3 /05fNLEg6T9pgswty+tL7OVFlueljO2/Vpr0wEVGZWABzpXmcDWH2YSCi2mFUZjSKnh1DHadyrHNn JevsJ05ol0XwIxSLUv8X+oEfgDo9iidMUv0OITntKJuyIGvU4cnVPujmsLdCwWSMDnvqww98+xxsN vOlYnjhA==; Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1m0RCQ-0002b1-IF; Mon, 05 Jul 2021 10:12:01 -0600 To: Eric Dumazet , Bjorn Helgaas Cc: linux-kernel , Eric Dumazet , Dan Williams , Ira Weiny , Christoph Hellwig , Greg Kroah-Hartman , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , "Rafael J. Wysocki" , linux-pci@vger.kernel.org References: <20210701095621.3129283-1-eric.dumazet@gmail.com> From: Logan Gunthorpe Message-ID: <986ec985-a42c-9107-564d-5878a669388b@deltatee.com> Date: Mon, 5 Jul 2021 10:11:55 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210701095621.3129283-1-eric.dumazet@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: linux-pci@vger.kernel.org, rafael@kernel.org, jglisse@redhat.com, gregkh@linuxfoundation.org, hch@lst.de, ira.weiny@intel.com, dan.j.williams@intel.com, edumazet@google.com, linux-kernel@vger.kernel.org, bhelgaas@google.com, eric.dumazet@gmail.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_URI_HASH,NICE_REPLY_A autolearn=no autolearn_force=no version=3.4.2 Subject: Re: [PATCH] PCI/P2PDMA: finish RCU conversion of pdev->p2pdma X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-07-01 3:56 a.m., Eric Dumazet wrote: > From: Eric Dumazet > > While looking at pci_alloc_p2pmem() I found rcu protection > was not properly applied there, as pdev->p2pdma was > potentially read multiple times. > > I decided to fix pci_alloc_p2pmem(), add __rcu qualifier > to p2pdma field of struct pci_dev, and fix all > other accesses to this field with proper rcu verbs. > > Fixes: 1570175abd16 ("PCI/P2PDMA: track pgmap references per resource, not globally") > Signed-off-by: Eric Dumazet > Cc: Dan Williams > Cc: Ira Weiny > Cc: Logan Gunthorpe > Cc: Bjorn Helgaas > Cc: Christoph Hellwig > Cc: Greg Kroah-Hartman > Cc: "Jérôme Glisse" > Cc: "Rafael J. Wysocki" > Cc: linux-pci@vger.kernel.org Reviewed-by: Logan Gunthorpe For history, though, Dan had originally suggested the full RCU protection is not necessary and it was only a barrier to force the NULL check on teardown to resolve: https://lore.kernel.org/nvdimm/CAPcyv4jZiK+OHjwNqDARv4g326AQZx7N_Lmxj1Zux_bX1T2CLQ@mail.gmail.com/ Things may have changed since then and other uses might be racing with the teardown, so having it marked __rcu and fully protected sounds like a good idea to me. Logan