]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: Switch user queues to use preempt/restore for eviction
authorJesse.Zhang <Jesse.Zhang@amd.com>
Tue, 5 Aug 2025 04:23:18 +0000 (12:23 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 15 Sep 2025 21:02:33 +0000 (17:02 -0400)
commitbb1d7f157e3d2357daf3146f7bcd03bcdbcefd25
treee2448c294c202990291229bcb940d1878b6f4ff9
parent5cefcbb306d6b4fa3ac5fba86db94cac81f0b457
drm/amdgpu: Switch user queues to use preempt/restore for eviction

This patch modifies the user queue management to use preempt/restore
operations instead of full map/unmap for queue eviction scenarios where
applicable. The changes include:

1. Introduces new helper functions:
   - amdgpu_userqueue_preempt_helper()
   - amdgpu_userqueue_restore_helper()

2. Updates queue state management to track PREEMPTED state

3. Modifies eviction handling to use preempt instead of unmap:
   - amdgpu_userq_evict_all() now uses preempt_helper
   - amdgpu_userq_restore_all() now uses restore_helper

The preempt/restore approach provides better performance during queue
eviction by avoiding the overhead of full queue teardown and setup.
Full map/unmap operations are still used for initial setup/teardown
and system suspend scenarios.

v2: rename amdgpu_userqueue_restore_helper/amdgpu_userqueue_preempt_helper to
amdgpu_userq_restore_helper/amdgpu_userq_preempt_helper for consistency. (Alex)

v3: amdgpu_userq_stop_sched_for_enforce_isolation() and
amdgpu_userq_start_sched_for_enforce_isolation() should use preempt and restore (Alex)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c