[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <986ec985-a42c-9107-564d-5878a669388b@deltatee.com>
Date: Mon, 5 Jul 2021 10:11:55 -0600
From: Logan Gunthorpe <logang@...tatee.com>
To: Eric Dumazet <eric.dumazet@...il.com>,
Bjorn Helgaas <bhelgaas@...gle.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
Dan Williams <dan.j.williams@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Christoph Hellwig <hch@....de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jérôme Glisse <jglisse@...hat.com>,
"Rafael J. Wysocki" <rafael@...nel.org>, linux-pci@...r.kernel.org
Subject: Re: [PATCH] PCI/P2PDMA: finish RCU conversion of pdev->p2pdma
On 2021-07-01 3:56 a.m., Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> 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 <edumazet@...gle.com>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: Ira Weiny <ira.weiny@...el.com>
> Cc: Logan Gunthorpe <logang@...tatee.com>
> Cc: Bjorn Helgaas <bhelgaas@...gle.com>
> Cc: Christoph Hellwig <hch@....de>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: "Jérôme Glisse" <jglisse@...hat.com>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Cc: linux-pci@...r.kernel.org
Reviewed-by: Logan Gunthorpe <logang@...tatee.com>
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
Powered by blists - more mailing lists