Skip to content

Commit 4209d63

Browse files
zehortigozarodrigovivi
authored andcommitted
drm/xe: Remove devcoredump during driver release
This will remove devcoredump from file system and free its resources during driver unload. This fix the driver unload after gpu hang happened, otherwise this it would report that Xe KMD is still in use and it would leave the kernel in a state that Xe KMD can't be unload without a reboot. Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Jonathan Cavitt <jonathan.cavitt@intel.com> Acked-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240409200206.108452-2-jose.souza@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent a28380f commit 4209d63

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

drivers/gpu/drm/xe/xe_devcoredump.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <linux/devcoredump.h>
1010
#include <generated/utsrelease.h>
1111

12+
#include <drm/drm_managed.h>
13+
1214
#include "xe_device.h"
1315
#include "xe_exec_queue.h"
1416
#include "xe_force_wake.h"
@@ -235,5 +237,14 @@ void xe_devcoredump(struct xe_sched_job *job)
235237
dev_coredumpm(xe->drm.dev, THIS_MODULE, coredump, 0, GFP_KERNEL,
236238
xe_devcoredump_read, xe_devcoredump_free);
237239
}
238-
#endif
239240

241+
static void xe_driver_devcoredump_fini(struct drm_device *drm, void *arg)
242+
{
243+
dev_coredump_put(drm->dev);
244+
}
245+
246+
int xe_devcoredump_init(struct xe_device *xe)
247+
{
248+
return drmm_add_action_or_reset(&xe->drm, xe_driver_devcoredump_fini, xe);
249+
}
250+
#endif

drivers/gpu/drm/xe/xe_devcoredump.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ struct xe_sched_job;
1111

1212
#ifdef CONFIG_DEV_COREDUMP
1313
void xe_devcoredump(struct xe_sched_job *job);
14+
int xe_devcoredump_init(struct xe_device *xe);
1415
#else
1516
static inline void xe_devcoredump(struct xe_sched_job *job)
1617
{
1718
}
19+
20+
static inline int xe_devcoredump_init(struct xe_device *xe)
21+
{
22+
return 0;
23+
}
1824
#endif
1925

2026
#endif

drivers/gpu/drm/xe/xe_device.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "regs/xe_regs.h"
2121
#include "xe_bo.h"
2222
#include "xe_debugfs.h"
23+
#include "xe_devcoredump.h"
2324
#include "xe_dma_buf.h"
2425
#include "xe_drm_client.h"
2526
#include "xe_drv.h"
@@ -579,6 +580,9 @@ int xe_device_probe(struct xe_device *xe)
579580
return err;
580581
}
581582

583+
err = xe_devcoredump_init(xe);
584+
if (err)
585+
return err;
582586
err = drmm_add_action_or_reset(&xe->drm, xe_driver_flr_fini, xe);
583587
if (err)
584588
return err;

0 commit comments

Comments
 (0)