[Very RFC 40/46] powernv/npu: Don't drop refcount when looking up GPU pci_devs
Greg Kurz
groug at kaod.org
Wed Nov 27 23:00:42 AEDT 2019
On Wed, 27 Nov 2019 20:40:00 +1100
"Oliver O'Halloran" <oohall at gmail.com> wrote:
> On Wed, Nov 27, 2019 at 8:34 PM Greg Kurz <groug at kaod.org> wrote:
> >
> >
> > If everyone is ok with leaking a reference in the NPU case, I guess
> > this isn't a problem. But if we move forward with Oliver's patch, a
> > pci_dev_put() would be needed for OpenCAPI, correct ?
>
> Yes, but I think that's fair enough. By convention it's the callers
> responsibility to drop the ref when it calls a function that returns a
> refcounted object. Doing anything else creates a race condition since
> the object's count could drop to zero before the caller starts using
> it.
>
Sure, you're right, especially with Frederic's patch that drops
the pci_dev_get(dev) in pnv_ioda_setup_dev_PE().
> Oliver
More information about the Linuxppc-dev
mailing list