Skip to content

Commit cd3a8a5

Browse files
drm/ttm: remove ttm_bo_(un)lock_delayed_workqueue
Those functions never worked correctly since it is still perfectly possible that a buffer object is released and the background worker restarted even after calling them. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221125102137.1801-2-christian.koenig@amd.com
1 parent 3ea4410 commit cd3a8a5

File tree

6 files changed

+3
-46
lines changed

6 files changed

+3
-46
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ static void amdgpu_ib_preempt_mark_partial_job(struct amdgpu_ring *ring)
17171717

17181718
static int amdgpu_debugfs_ib_preempt(void *data, u64 val)
17191719
{
1720-
int r, resched, length;
1720+
int r, length;
17211721
struct amdgpu_ring *ring;
17221722
struct dma_fence **fences = NULL;
17231723
struct amdgpu_device *adev = (struct amdgpu_device *)data;
@@ -1747,8 +1747,6 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val)
17471747
/* stop the scheduler */
17481748
kthread_park(ring->sched.thread);
17491749

1750-
resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
1751-
17521750
/* preempt the IB */
17531751
r = amdgpu_ring_preempt_ib(ring);
17541752
if (r) {
@@ -1785,8 +1783,6 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val)
17851783

17861784
up_read(&adev->reset_domain->sem);
17871785

1788-
ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, resched);
1789-
17901786
pro_end:
17911787
kfree(fences);
17921788

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3983,10 +3983,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
39833983
}
39843984
amdgpu_fence_driver_hw_fini(adev);
39853985

3986-
if (adev->mman.initialized) {
3986+
if (adev->mman.initialized)
39873987
flush_delayed_work(&adev->mman.bdev.wq);
3988-
ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
3989-
}
39903988

39913989
if (adev->pm_sysfs_en)
39923990
amdgpu_pm_sysfs_fini(adev);

drivers/gpu/drm/radeon/radeon_device.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,6 @@ int radeon_gpu_reset(struct radeon_device *rdev)
17721772
bool saved = false;
17731773

17741774
int i, r;
1775-
int resched;
17761775

17771776
down_write(&rdev->exclusive_lock);
17781777

@@ -1784,8 +1783,6 @@ int radeon_gpu_reset(struct radeon_device *rdev)
17841783
atomic_inc(&rdev->gpu_reset_counter);
17851784

17861785
radeon_save_bios_scratch_regs(rdev);
1787-
/* block TTM */
1788-
resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev);
17891786
radeon_suspend(rdev);
17901787
radeon_hpd_fini(rdev);
17911788

@@ -1844,8 +1841,6 @@ int radeon_gpu_reset(struct radeon_device *rdev)
18441841
/* reset hpd state */
18451842
radeon_hpd_init(rdev);
18461843

1847-
ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
1848-
18491844
rdev->in_reset = true;
18501845
rdev->needs_reset = false;
18511846

drivers/gpu/drm/radeon/radeon_pm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,11 +1853,10 @@ static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish
18531853
static void radeon_dynpm_idle_work_handler(struct work_struct *work)
18541854
{
18551855
struct radeon_device *rdev;
1856-
int resched;
1856+
18571857
rdev = container_of(work, struct radeon_device,
18581858
pm.dynpm_idle_work.work);
18591859

1860-
resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev);
18611860
mutex_lock(&rdev->pm.mutex);
18621861
if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) {
18631862
int not_processed = 0;
@@ -1908,7 +1907,6 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
19081907
msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
19091908
}
19101909
mutex_unlock(&rdev->pm.mutex);
1911-
ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
19121910
}
19131911

19141912
/*

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -418,20 +418,6 @@ void ttm_bo_put(struct ttm_buffer_object *bo)
418418
}
419419
EXPORT_SYMBOL(ttm_bo_put);
420420

421-
int ttm_bo_lock_delayed_workqueue(struct ttm_device *bdev)
422-
{
423-
return cancel_delayed_work_sync(&bdev->wq);
424-
}
425-
EXPORT_SYMBOL(ttm_bo_lock_delayed_workqueue);
426-
427-
void ttm_bo_unlock_delayed_workqueue(struct ttm_device *bdev, int resched)
428-
{
429-
if (resched)
430-
schedule_delayed_work(&bdev->wq,
431-
((HZ / 100) < 1) ? 1 : HZ / 100);
432-
}
433-
EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue);
434-
435421
static int ttm_bo_bounce_temp_buffer(struct ttm_buffer_object *bo,
436422
struct ttm_resource **mem,
437423
struct ttm_operation_ctx *ctx,

include/drm/ttm/ttm_bo_api.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -290,22 +290,6 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo);
290290
void ttm_bo_set_bulk_move(struct ttm_buffer_object *bo,
291291
struct ttm_lru_bulk_move *bulk);
292292

293-
/**
294-
* ttm_bo_lock_delayed_workqueue
295-
*
296-
* Prevent the delayed workqueue from running.
297-
* Returns
298-
* True if the workqueue was queued at the time
299-
*/
300-
int ttm_bo_lock_delayed_workqueue(struct ttm_device *bdev);
301-
302-
/**
303-
* ttm_bo_unlock_delayed_workqueue
304-
*
305-
* Allows the delayed workqueue to run.
306-
*/
307-
void ttm_bo_unlock_delayed_workqueue(struct ttm_device *bdev, int resched);
308-
309293
/**
310294
* ttm_bo_eviction_valuable
311295
*

0 commit comments

Comments
 (0)