Messages in this thread | | | From | Logan Gunthorpe <> | Date | Mon, 5 Jul 2021 10:11:55 -0600 | 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@google.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@google.com> > Cc: Dan Williams <dan.j.williams@intel.com> > Cc: Ira Weiny <ira.weiny@intel.com> > Cc: Logan Gunthorpe <logang@deltatee.com> > Cc: Bjorn Helgaas <bhelgaas@google.com> > Cc: Christoph Hellwig <hch@lst.de> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: "Jérôme Glisse" <jglisse@redhat.com> > Cc: "Rafael J. Wysocki" <rafael@kernel.org> > Cc: linux-pci@vger.kernel.org
Reviewed-by: Logan Gunthorpe <logang@deltatee.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
| |