dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] drm/i915: Fix harmfull driver register/unregister assymetry
@ 2025-03-05 19:11 Janusz Krzysztofik
  2025-03-05 19:11 ` [PATCH v3 1/4] drm/i915: Skip harmful unregister steps if not registered Janusz Krzysztofik
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Janusz Krzysztofik @ 2025-03-05 19:11 UTC (permalink / raw)
  To: intel-gfx, Jani Nikula, Andi Shyti
  Cc: dri-devel, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	Chris Wilson, Lucas De Marchi, Alan Previn, Ashutosh Dixit,
	Daniele Ceraolo Spurio, Janusz Krzysztofik

Starting with commit ec3e00b4ee27 ("drm/i915: stop registering if
drm_dev_register() fails"), we may return from i915_driver_register()
immediately, skipping remaining registration steps.  However, the
_unregister() counterpart called at device remove knows nothing about that
skip and executes reverts of all those steps.  As a consequence, a number
of kernel warnings that taint the kernel are triggered.

Introduce a flag that indicates device registration status and raise it on
device registration success.  As a minimum (first patch), when that flag
is found not set while unregistering the driver, jump over those reverts
of registration steps omitted after device registration failure that are
not ready for being called unconditionally (and trigger the kernel
warnings).

With the second patch, also jump over reverts of other driver registration
steps that were not called due to device registration failure.  Some
unregister function calls, found implementing additional steps beyond the
register reverts, are still executed.

To simplify i915_driver_unregister() code, the third patch makes sure
reverts of driver registration steps executed before potentially
unsuccessful device registration are symmetrically called after
the device unplug.

Finally, the last patch further simplifies the i915_driver_unregister()
code by moving two required steps down, right after device unplug.

The first patch may be squashed with one or more of its follow-ups if so
decided.

Janusz Krzysztofik (4):
  drm/i915: Skip harmful unregister steps if not registered
  drm/i915: Omit unnecessary driver unregister steps
  drm/i915: Fix asymmetry in PMU register/unregister step order
  drm/i915: Group not skipped unregister steps

 drivers/gpu/drm/i915/gt/intel_gt.c |  6 ++++++
 drivers/gpu/drm/i915/i915_driver.c | 18 ++++++++++++------
 drivers/gpu/drm/i915/i915_drv.h    |  2 ++
 3 files changed, 20 insertions(+), 6 deletions(-)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-03-06 13:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-05 19:11 [PATCH v3 0/4] drm/i915: Fix harmfull driver register/unregister assymetry Janusz Krzysztofik
2025-03-05 19:11 ` [PATCH v3 1/4] drm/i915: Skip harmful unregister steps if not registered Janusz Krzysztofik
2025-03-06 10:25   ` Jani Nikula
2025-03-06 10:50     ` Janusz Krzysztofik
2025-03-05 19:11 ` [PATCH v3 2/4] drm/i915: Omit unnecessary driver unregister steps Janusz Krzysztofik
2025-03-05 19:11 ` [PATCH v3 3/4] drm/i915: Fix asymmetry in PMU register/unregister step order Janusz Krzysztofik
2025-03-05 19:11 ` [PATCH v3 4/4] drm/i915: Group not skipped unregister steps Janusz Krzysztofik
2025-03-06 11:00 ` [PATCH v3 0/4] drm/i915: Fix harmfull driver register/unregister assymetry Krzysztof Karas
2025-03-06 11:40   ` Janusz Krzysztofik
2025-03-06 13:49     ` Krzysztof Karas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).