Re: [PATCH] amd/amdkfd: Set correct svm range actual loc after spliting

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

 




On 2024-01-08 18:17, Chen, Xiaogang wrote:
With a nitpick below, this patch is

Reviewed-by:Xiaogang Chen<Xiaogang.Chen@xxxxxxx>

On 1/8/2024 4:36 PM, Philip Yang wrote:
After range spliting, set new range and old range actual_loc:
new range actual_loc is 0 if new->vram_pages is 0.
old range actual_loc is 0 if old->vram_pages - new->vram_pages == 0.

Signed-off-by: Philip Yang <Philip.Yang@xxxxxxx>
---
  drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index cc24f30f88fb..cb09e1d3a643 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -362,7 +362,6 @@ svm_range *svm_range_new(struct svm_range_list *svms, uint64_t start,
      INIT_LIST_HEAD(&prange->child_list);
      atomic_set(&prange->invalid, 0);
      prange->validate_timestamp = 0;
-    prange->vram_pages = 0;
I think it is better to keep it, also:

+new->actual_loc = 0;

though not necessary as prange is allocated by kzalloc, just keep consistent with previous statements, or remove

atomic_set(&prange->invalid, 0);
prange->validate_timestamp = 0;

too.

kzalloc memset prange to 0, we should remove unnecessary 0 assignment. prange->validate_timestamp will be removed completely in the following patch.

Will send out v2 patch to fix other related issues.

Regards,

Philip


Regards
Xiaogang

      mutex_init(&prange->migrate_mutex);
      mutex_init(&prange->lock);
  @@ -980,8 +979,12 @@ svm_range_split_pages(struct svm_range *new, struct svm_range *old,
          if (r)
              return r;
      }
-    if (old->actual_loc)
+    if (old->actual_loc && new->vram_pages) {
          old->vram_pages -= new->vram_pages;
+        new->actual_loc = old->actual_loc;
+        if (!old->vram_pages)
+            old->actual_loc = 0;
+    }
        return 0;
  }
@@ -1058,7 +1061,6 @@ svm_range_split_adjust(struct svm_range *new, struct svm_range *old,
      new->flags = old->flags;
      new->preferred_loc = old->preferred_loc;
      new->prefetch_loc = old->prefetch_loc;
-    new->actual_loc = old->actual_loc;
      new->granularity = old->granularity;
      new->mapped_to_gpu = old->mapped_to_gpu;
      bitmap_copy(new->bitmap_access, old->bitmap_access, MAX_GPU_INSTANCE);

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux