Skip to content

Commit c045e03

Browse files
aradhyab7tejasup
authored andcommitted
drm/xe/migrate: Switch from drm to dev managed actions
Change the scope of the migrate subsystem to be dev managed instead of drm managed. The parent pci struct &device, that the xe struct &drm_device is a part of, gets removed when a hot unplug is triggered, which causes the underlying iommu group to get destroyed as well. The migrate subsystem, which handles the lifetime of the page-table tree (pt) BO, doesn't get a chance to keep the BO back during the hot unplug, as all the references to DRM haven't been put back. When all the references to DRM are indeed put back later, the migrate subsystem tries to put back the pt BO. Since the underlying iommu group has been already destroyed, a kernel NULL ptr dereference takes place while attempting to keep back the pt BO. Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3914 Suggested-by: Thomas Hellstrom <[email protected]> Reviewed-by: Tejas Upadhyay <[email protected]> Signed-off-by: Aradhya Bhatia <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Tejas Upadhyay <[email protected]>
1 parent b2d4b03 commit c045e03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct xe_exec_queue *xe_tile_migrate_exec_queue(struct xe_tile *tile)
9797
return tile->migrate->q;
9898
}
9999

100-
static void xe_migrate_fini(struct drm_device *dev, void *arg)
100+
static void xe_migrate_fini(void *arg)
101101
{
102102
struct xe_migrate *m = arg;
103103

@@ -401,7 +401,7 @@ struct xe_migrate *xe_migrate_init(struct xe_tile *tile)
401401
struct xe_vm *vm;
402402
int err;
403403

404-
m = drmm_kzalloc(&xe->drm, sizeof(*m), GFP_KERNEL);
404+
m = devm_kzalloc(xe->drm.dev, sizeof(*m), GFP_KERNEL);
405405
if (!m)
406406
return ERR_PTR(-ENOMEM);
407407

@@ -455,7 +455,7 @@ struct xe_migrate *xe_migrate_init(struct xe_tile *tile)
455455
might_lock(&m->job_mutex);
456456
fs_reclaim_release(GFP_KERNEL);
457457

458-
err = drmm_add_action_or_reset(&xe->drm, xe_migrate_fini, m);
458+
err = devm_add_action_or_reset(xe->drm.dev, xe_migrate_fini, m);
459459
if (err)
460460
return ERR_PTR(err);
461461

0 commit comments

Comments
 (0)