Patch "drm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-amdkfd-fix-some-race-conditions-in-vram-buffer-a.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a6b8dbdf65ad54506dbe46bd5bf5286f04b505c9
Author: Xiaogang Chen <xiaogang.chen@xxxxxxx>
Date:   Wed Sep 20 11:02:51 2023 -0500

    drm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code
    
    [ Upstream commit 7bfaa160caed8192f8262c4638f552cad94bcf5a ]
    
    This patch fixes:
    1: ref number of prange's svm_bo got decreased by an async call from hmm. When
    wait svm_bo of prange got released we shoul also wait prang->svm_bo become NULL,
    otherwise prange->svm_bo may be set to null after allocate new vram buffer.
    
    2: During waiting svm_bo of prange got released in a while loop should reschedule
    current task to give other tasks oppotunity to run, specially the the workque
    task that handles svm_bo ref release, otherwise we may enter to softlock.
    
    Signed-off-by: Xiaogang.Chen <xiaogang.chen@xxxxxxx>
    Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 5ff1a5a89d968..a9b57c66cb7d7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -484,11 +484,11 @@ svm_range_validate_svm_bo(struct kfd_node *node, struct svm_range *prange)
 
 	/* We need a new svm_bo. Spin-loop to wait for concurrent
 	 * svm_range_bo_release to finish removing this range from
-	 * its range list. After this, it is safe to reuse the
-	 * svm_bo pointer and svm_bo_list head.
+	 * its range list and set prange->svm_bo to null. After this,
+	 * it is safe to reuse the svm_bo pointer and svm_bo_list head.
 	 */
-	while (!list_empty_careful(&prange->svm_bo_list))
-		;
+	while (!list_empty_careful(&prange->svm_bo_list) || prange->svm_bo)
+		cond_resched();
 
 	return false;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux