Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/amdgpu: Add Annotations to Process Isolation functions

This update adds explanations to key functions that manage how the
Kernel Fusion Driver (KFD) and Kernel Graphics Driver (KGD) share the
GPU.

amdgpu_gfx_enforce_isolation_wait_for_kfd: Controls the waiting period
for KFD to ensure it takes turns with KGD in using the GPU. It uses a
mutex to safely manage shared data, like timing and state, and tracks
when KFD starts and stops waiting.

amdgpu_gfx_enforce_isolation_ring_begin_use: Ensures KFD has enough time
to run before new tasks are submitted to the GPU ring. It uses a mutex
to synchronize access and may adjust the KFD scheduler.

amdgpu_gfx_enforce_isolation_ring_end_use: Handles cleanup and state
updates when finishing the use of a GPU ring. It may also adjust the KFD
scheduler, using a mutex to manage shared data access.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Srinivasan Shanmugam and committed by
Alex Deucher
55f4139b 57bcfa89

+29
+29
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
··· 1985 1985 mutex_unlock(&adev->enforce_isolation_mutex); 1986 1986 } 1987 1987 1988 + /** 1989 + * amdgpu_gfx_enforce_isolation_wait_for_kfd - Manage KFD wait period for process isolation 1990 + * @adev: amdgpu_device pointer 1991 + * @idx: Index of the GPU partition 1992 + * 1993 + * When kernel submissions come in, the jobs are given a time slice and once 1994 + * that time slice is up, if there are KFD user queues active, kernel 1995 + * submissions are blocked until KFD has had its time slice. Once the KFD time 1996 + * slice is up, KFD user queues are preempted and kernel submissions are 1997 + * unblocked and allowed to run again. 1998 + */ 1988 1999 static void 1989 2000 amdgpu_gfx_enforce_isolation_wait_for_kfd(struct amdgpu_device *adev, 1990 2001 u32 idx) ··· 2041 2030 msleep(GFX_SLICE_PERIOD_MS); 2042 2031 } 2043 2032 2033 + /** 2034 + * amdgpu_gfx_enforce_isolation_ring_begin_use - Begin use of a ring with enforced isolation 2035 + * @ring: Pointer to the amdgpu_ring structure 2036 + * 2037 + * Ring begin_use helper implementation for gfx which serializes access to the 2038 + * gfx IP between kernel submission IOCTLs and KFD user queues when isolation 2039 + * enforcement is enabled. The kernel submission IOCTLs and KFD user queues 2040 + * each get a time slice when both are active. 2041 + */ 2044 2042 void amdgpu_gfx_enforce_isolation_ring_begin_use(struct amdgpu_ring *ring) 2045 2043 { 2046 2044 struct amdgpu_device *adev = ring->adev; ··· 2077 2057 mutex_unlock(&adev->enforce_isolation_mutex); 2078 2058 } 2079 2059 2060 + /** 2061 + * amdgpu_gfx_enforce_isolation_ring_end_use - End use of a ring with enforced isolation 2062 + * @ring: Pointer to the amdgpu_ring structure 2063 + * 2064 + * Ring end_use helper implementation for gfx which serializes access to the 2065 + * gfx IP between kernel submission IOCTLs and KFD user queues when isolation 2066 + * enforcement is enabled. The kernel submission IOCTLs and KFD user queues 2067 + * each get a time slice when both are active. 2068 + */ 2080 2069 void amdgpu_gfx_enforce_isolation_ring_end_use(struct amdgpu_ring *ring) 2081 2070 { 2082 2071 struct amdgpu_device *adev = ring->adev;