[Intel-xe] [PATCH 02/12] drm/xe: Skip calling drm_dev_put on probe error
Matthew Brost
matthew.brost at intel.com
Wed Nov 8 10:23:20 UTC 2023
On Wed, Nov 08, 2023 at 06:18:19PM +0100, Michał Winiarski wrote:
> On Wed, Nov 08, 2023 at 09:33:40AM +0000, Matthew Brost wrote:
> > On Wed, Nov 08, 2023 at 01:33:34AM +0100, Michał Winiarski wrote:
> > > DRM device used by Xe is managed, which means that final ref will be
> > > dropped on driver detach.
> > >
> >
> > Where is the detach called if xe_pci_probe() fails? I'm struggling to find that.
>
> By "DRM device used by Xe is managed" I mean that it is allocated using
> devres. In other words - devm_drm_dev_init adds
> devm_drm_dev_init_release to the parent of DRM device devres stack
> (which is the pci device in our case). That's the final ref being
> dropped:
> https://elixir.bootlin.com/linux/v6.6/source/drivers/gpu/drm/drm_drv.c#L708
>
> Now - on probe in the core device driver model:
> https://elixir.bootlin.com/linux/v6.6/source/drivers/base/dd.c#L658
> Upon failure, we end up callng device_unbind_cleanup, which then calls
> devres_release_all:
> https://elixir.bootlin.com/linux/v6.6/source/drivers/base/dd.c#L549
> Which then calls all of the "actions" added to the devres stack.
>
> We can then expect to see something like this on probe failure in dmesg:
> [27215.580902] xe 0000:00:02.0: DEVRES ADD ffff88810ca9c540 devm_drm_dev_init_release (16 bytes)
> (...probe failure happens here...)
> [27215.698659] xe 0000:00:02.0: DEVRES REL ffff88810ca9c540 devm_drm_dev_init_release (16 bytes)
> [27215.707388] xe 0000:00:02.0: [drm:drm_managed_release [drm]] drmres release begin
> (...all DRM-managed resources are released here...)
>
Thanks for the detailed explaination, makes sense now.
With that:
Reviewed-by: Matthew Brost <matthew.brost at intel.com>
> Thanks,
> -Michał
>
> >
> > Matt
> >
More information about the Intel-xe
mailing list