Commit cf13ae6b authored by Matthew Auld's avatar Matthew Auld

drm/xe/coredump: move over to devm

Here we are using drmm to ensure we release the coredump when unloading
the module, however the coredump is very much tied to the struct device
underneath. We can see this when we hotunplug the device, for which we
have already got a coredump attached. In such a case the coredump still
remains and adding another is not possible. However we still register
the release action via xe_driver_devcoredump_fini(), so in effect two or
more releases for one dump.  The other consideration is that the
coredump state is embedded in the xe_driver instance, so technically
once the drmm release action fires we might free the coredumpe state
from a different driver instance, assuming we have two release actions
and they can race. Rather use devm here to remove the coredump when the
device is released.

References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1679Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarAndrzej Hajda <andrzej.hajda@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240522102143.128069-29-matthew.auld@intel.com
parent cee70645
...@@ -238,13 +238,15 @@ void xe_devcoredump(struct xe_sched_job *job) ...@@ -238,13 +238,15 @@ void xe_devcoredump(struct xe_sched_job *job)
xe_devcoredump_read, xe_devcoredump_free); xe_devcoredump_read, xe_devcoredump_free);
} }
static void xe_driver_devcoredump_fini(struct drm_device *drm, void *arg) static void xe_driver_devcoredump_fini(void *arg)
{ {
struct drm_device *drm = arg;
dev_coredump_put(drm->dev); dev_coredump_put(drm->dev);
} }
int xe_devcoredump_init(struct xe_device *xe) int xe_devcoredump_init(struct xe_device *xe)
{ {
return drmm_add_action_or_reset(&xe->drm, xe_driver_devcoredump_fini, xe); return devm_add_action_or_reset(xe->drm.dev, xe_driver_devcoredump_fini, &xe->drm);
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment