<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2024-01-08 18:17, Chen, Xiaogang
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:ba63e6cf-8162-1d99-00d6-62e4165a6b04@amd.com">With a
      nitpick below, this patch is
      <br>
      <br>
      Reviewed-by:Xiaogang Chen<a class="moz-txt-link-rfc2396E" href="mailto:Xiaogang.Chen@amd.com"><Xiaogang.Chen@amd.com></a>
      <br>
      <br>
      On 1/8/2024 4:36 PM, Philip Yang wrote:
      <br>
      <blockquote type="cite">After range spliting, set new range and
        old range actual_loc:
        <br>
        new range actual_loc is 0 if new->vram_pages is 0.
        <br>
        old range actual_loc is 0 if old->vram_pages -
        new->vram_pages == 0.
        <br>
        <br>
        Signed-off-by: Philip Yang <a class="moz-txt-link-rfc2396E" href="mailto:Philip.Yang@amd.com"><Philip.Yang@amd.com></a>
        <br>
        ---
        <br>
          drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 8 +++++---
        <br>
          1 file changed, 5 insertions(+), 3 deletions(-)
        <br>
        <br>
        diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
        b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
        <br>
        index cc24f30f88fb..cb09e1d3a643 100644
        <br>
        --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
        <br>
        +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
        <br>
        @@ -362,7 +362,6 @@ svm_range *svm_range_new(struct
        svm_range_list *svms, uint64_t start,
        <br>
              INIT_LIST_HEAD(&prange->child_list);
        <br>
              atomic_set(&prange->invalid, 0);
        <br>
              prange->validate_timestamp = 0;
        <br>
        -    prange->vram_pages = 0;
        <br>
      </blockquote>
      I think it is better to keep it, also:
      <br>
      <br>
      +new->actual_loc = 0;
      <br>
      <br>
      though not necessary as prange is allocated by kzalloc, just keep
      consistent with previous statements, or remove
      <br>
      <br>
      atomic_set(&prange->invalid, 0);
      <br>
      prange->validate_timestamp = 0;
      <br>
      <br>
      too.
      <br>
    </blockquote>
    <p>kzalloc memset prange to 0, we should remove unnecessary 0
      assignment. prange->validate_timestamp will be removed
      completely in the following patch.</p>
    <p>Will send out v2 patch to fix other related issues.<br>
    </p>
    <p>Regards,</p>
    <p>Philip<br>
    </p>
    <blockquote type="cite" cite="mid:ba63e6cf-8162-1d99-00d6-62e4165a6b04@amd.com">
      <br>
      Regards
      <br>
      Xiaogang
      <br>
      <br>
      <blockquote type="cite">     
        mutex_init(&prange->migrate_mutex);
        <br>
              mutex_init(&prange->lock);
        <br>
          @@ -980,8 +979,12 @@ svm_range_split_pages(struct svm_range
        *new, struct svm_range *old,
        <br>
                  if (r)
        <br>
                      return r;
        <br>
              }
        <br>
        -    if (old->actual_loc)
        <br>
        +    if (old->actual_loc && new->vram_pages) {
        <br>
                  old->vram_pages -= new->vram_pages;
        <br>
        +        new->actual_loc = old->actual_loc;
        <br>
        +        if (!old->vram_pages)
        <br>
        +            old->actual_loc = 0;
        <br>
        +    }
        <br>
                return 0;
        <br>
          }
        <br>
        @@ -1058,7 +1061,6 @@ svm_range_split_adjust(struct svm_range
        *new, struct svm_range *old,
        <br>
              new->flags = old->flags;
        <br>
              new->preferred_loc = old->preferred_loc;
        <br>
              new->prefetch_loc = old->prefetch_loc;
        <br>
        -    new->actual_loc = old->actual_loc;
        <br>
              new->granularity = old->granularity;
        <br>
              new->mapped_to_gpu = old->mapped_to_gpu;
        <br>
              bitmap_copy(new->bitmap_access, old->bitmap_access,
        MAX_GPU_INSTANCE);
        <br>
      </blockquote>
    </blockquote>
  </body>
</html>