diff mbox series

[v5,2/3] drm/i915: Fix PXP cleanup missing from probe error rewind

Message ID 20250314205202.809563-7-janusz.krzysztofik@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Fix harmful driver register/unregister asymmetry | expand

Commit Message

Janusz Krzysztofik March 14, 2025, 8:38 p.m. UTC
Commit f67986b0119c04 ("drm/i915/pxp: Promote pxp subsystem to top-level
of i915") added PXP initialization to driver probe path, but didn't add a
respective PXP cleanup on probe error.  That lack of cleanup seems
harmless as long as PXP is still unused and idle when a probe failure
occurs and error rewind path is entered, but as soon as PXP starts
consuming device and driver resources keeping them busy, kernel warnings
may be triggered when cleaning up resources provided by memory regions,
GGTT, GEM and/or VMA cache from the probe error rewind and/or module
unload paths because of missing PXP cleanup.  That scenario was observed
on attempts to fail the probe and enter the rewind path on injection of
now ignored error in device registration path.

Fix it.

Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_driver.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Krzysztof Niemiec March 17, 2025, 4:55 p.m. UTC | #1
Hi Janusz,

On 2025-03-14 at 21:38:34 GMT, Janusz Krzysztofik wrote:
> Commit f67986b0119c04 ("drm/i915/pxp: Promote pxp subsystem to top-level
> of i915") added PXP initialization to driver probe path, but didn't add a
> respective PXP cleanup on probe error.  That lack of cleanup seems
> harmless as long as PXP is still unused and idle when a probe failure
> occurs and error rewind path is entered, but as soon as PXP starts
> consuming device and driver resources keeping them busy, kernel warnings
> may be triggered when cleaning up resources provided by memory regions,
> GGTT, GEM and/or VMA cache from the probe error rewind and/or module
> unload paths because of missing PXP cleanup.  That scenario was observed
> on attempts to fail the probe and enter the rewind path on injection of
> now ignored error in device registration path.
> 
> Fix it.
> 
> Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>

Reviewed-by: Krzysztof Niemiec <krzysztof.niemiec@intel.com>

Thanks
Krzysztof
Andi Shyti March 19, 2025, 1 a.m. UTC | #2
Hi Janusz,

On Fri, Mar 14, 2025 at 09:38:34PM +0100, Janusz Krzysztofik wrote:
> Commit f67986b0119c04 ("drm/i915/pxp: Promote pxp subsystem to top-level
> of i915") added PXP initialization to driver probe path, but didn't add a
> respective PXP cleanup on probe error.  That lack of cleanup seems
> harmless as long as PXP is still unused and idle when a probe failure
> occurs and error rewind path is entered, but as soon as PXP starts
> consuming device and driver resources keeping them busy, kernel warnings
> may be triggered when cleaning up resources provided by memory regions,
> GGTT, GEM and/or VMA cache from the probe error rewind and/or module
> unload paths because of missing PXP cleanup.  That scenario was observed
> on attempts to fail the probe and enter the rewind path on injection of
> now ignored error in device registration path.
> 
> Fix it.
> 
> Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index e0dde7c0fa9c5..10d1d4f3c11c4 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -845,6 +845,7 @@  int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	return 0;
 
 out_cleanup_gem:
+	intel_pxp_fini(i915);
 	i915_gem_suspend(i915);
 	i915_gem_driver_remove(i915);
 	i915_gem_driver_release(i915);