drm/i915/gt: Flush retire.work timer object on unload
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 15 Nov 2019 15:08:39 +0000 (15:08 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 15 Nov 2019 16:43:33 +0000 (16:43 +0000)
We need to wait until the timer object is marked as deactivated before
unloading, so follow up our gentle cancel_delayed_work() with the
synchronous variant to ensure it is flushed off a remote cpu before we
mark the memory as freed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111994
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191115150841.880349-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_gt.c
drivers/gpu/drm/i915/gt/intel_gt_requests.c
drivers/gpu/drm/i915/gt/intel_gt_requests.h

index c39b21c8d3280c325bf2725776229fc876271ea1..b5a9b87e4ec9d89fbfbb9ef995f7ef411696dd0e 100644 (file)
@@ -397,6 +397,7 @@ void intel_gt_driver_release(struct intel_gt *gt)
 void intel_gt_driver_late_release(struct intel_gt *gt)
 {
        intel_uc_driver_late_release(&gt->uc);
+       intel_gt_fini_requests(gt);
        intel_gt_fini_reset(gt);
        intel_gt_fini_timelines(gt);
 }
index ccbddddbbd524d697abc08a957ea8fd08c24eae4..a79e6efb31a26b8341d5f3055c60c7a99fc85db0 100644 (file)
@@ -130,3 +130,9 @@ void intel_gt_unpark_requests(struct intel_gt *gt)
        schedule_delayed_work(&gt->requests.retire_work,
                              round_jiffies_up_relative(HZ));
 }
+
+void intel_gt_fini_requests(struct intel_gt *gt)
+{
+       /* Wait until the work is marked as finished before unloading! */
+       cancel_delayed_work_sync(&gt->requests.retire_work);
+}
index bd31cbce47e0f41dc36e7a5793ffafdf6e51dce4..fde546424c63a8f4fc0b2e564d6538ea9f21b4ce 100644 (file)
@@ -20,5 +20,6 @@ int intel_gt_wait_for_idle(struct intel_gt *gt, long timeout);
 void intel_gt_init_requests(struct intel_gt *gt);
 void intel_gt_park_requests(struct intel_gt *gt);
 void intel_gt_unpark_requests(struct intel_gt *gt);
+void intel_gt_fini_requests(struct intel_gt *gt);
 
 #endif /* INTEL_GT_REQUESTS_H */