Skip to contentSkip to conversation

drm/amdkfd: enable heavy-weight TLB flush on Arcturus

PATCH In review Eric Huang 5 participants 9 messages Jan 18, 2022 – Jan 19, 2022

Subsystems (3)
lore
Share & tools
lore

Eric Huang

author
#0 lore raw

PATCH 1/1 drm/amdkfd: enable heavy-weight TLB flush on Arcturus

SDMA FW fixes the hang issue for adding heavy-weight TLB flush on Arcturus, so we can enable it.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +++++---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c         | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5 -3
index a64cbbd943ba..7b24a920c12e 100644
@@ -1892,10 +1892,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
 				true);
 	ret = unreserve_bo_and_vms(&ctx, false, false);
 
-	/* Only apply no TLB flush on Aldebaran to
-	 * workaround regressions on other Asics.
+	/* Only apply no TLB flush on Aldebaran and Arcturus
+	 * to workaround regressions on other Asics.
 	 */
-	if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
+	if (table_freed &&
+	    (adev->asic_type != CHIP_ALDEBARAN) &&
+	    (adev->asic_type != CHIP_ARCTURUS))
 		*table_freed = true;
 
 	goto out;
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -1
index b570c0454ce9..ef4d676cc71c 100644
@@ -1806,7 +1806,8 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
 	}
 	mutex_unlock(&p->mutex);
 
-	if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {
+	if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+	    KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1)) {
 		err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,
 				(struct kgd_mem *) mem, true);
 		if (err) {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 3 lines · Eric Huang

SDMA FW fixes the hang issue for adding heavy-weight TLB flush on Arcturus, so we can enable it.

Do we need to check for a specific fw version?

Alex

Quoted 44 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +++++---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c         | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5 -3
index a64cbbd943ba..7b24a920c12e 100644
@@ -1892,10 +1892,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
                                true);
        ret = unreserve_bo_and_vms(&ctx, false, false);
 
-       /* Only apply no TLB flush on Aldebaran to
-        * workaround regressions on other Asics.
+       /* Only apply no TLB flush on Aldebaran and Arcturus
+        * to workaround regressions on other Asics.
         */
-       if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
+       if (table_freed &&
+           (adev->asic_type != CHIP_ALDEBARAN) &&
+           (adev->asic_type != CHIP_ARCTURUS))
                *table_freed = true;
 
        goto out;
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -2
index b570c0454ce9..ef4d676cc71c 100644
@@ -1806,7 +1806,8 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
        }
        mutex_unlock(&p->mutex);
 
-       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {
+       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+           KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1)) {
                err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,
                                (struct kgd_mem *) mem, true);
                if (err) {
--

2.25.1

author
#2 lore raw

The SDMA fix is generic and not in a specific version of FW, so we don't have to check.

Thanks,
Eric

Quoted 50 lines · Alex Deucher
Quoted 2 lines · Eric Huang

SDMA FW fixes the hang issue for adding heavy-weight TLB flush on Arcturus, so we can enable it.

Do we need to check for a specific fw version?

Alex

Quoted 43 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +++++---
  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c         | 3 ++-
  2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5 -3
index a64cbbd943ba..7b24a920c12e 100644
@@ -1892,10 +1892,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
                                 true);
         ret = unreserve_bo_and_vms(&ctx, false, false);
 
-       /* Only apply no TLB flush on Aldebaran to
-        * workaround regressions on other Asics.
+       /* Only apply no TLB flush on Aldebaran and Arcturus
+        * to workaround regressions on other Asics.
          */
-       if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
+       if (table_freed &&
+           (adev->asic_type != CHIP_ALDEBARAN) &&
+           (adev->asic_type != CHIP_ARCTURUS))
                 *table_freed = true;
 
         goto out;
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -2
index b570c0454ce9..ef4d676cc71c 100644
@@ -1806,7 +1806,8 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
         }
         mutex_unlock(&p->mutex);
 
-       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {
+       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+           KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1)) {
                 err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,
                                 (struct kgd_mem *) mem, true);
                 if (err) {
--

2.25.1

#3 lore raw

[AMD Official Use Only]

I think what he means is that if we are using SDMA v17, this will cause issues, won't it? Should we check that SDMA version is >=18 before enabling it? Or am I misunderstanding the fix?

Kent

Quoted 67 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Eric Huang
Sent: Tuesday, January 18, 2022 2:09 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdkfd: enable heavy-weight TLB flush on Arcturus

The SDMA fix is generic and not in a specific version of FW, so we don't have to check.

Thanks,
Eric

Quoted 7 lines · Alex Deucher
Quoted 2 lines · Eric Huang

SDMA FW fixes the hang issue for adding heavy-weight TLB flush on Arcturus, so we can enable it.

Do we need to check for a specific fw version?

Alex

Quoted 7 lines

Review

Quoted 7 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +++++---
  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c         | 3 ++-
  2 files changed, 7 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Quoted 18 lines
Quoted 18 lines

index a64cbbd943ba..7b24a920c12e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5 -3
@@ -1892,10 +1892,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
                                 true);
         ret = unreserve_bo_and_vms(&ctx, false, false);
 
-       /* Only apply no TLB flush on Aldebaran to
-        * workaround regressions on other Asics.
+       /* Only apply no TLB flush on Aldebaran and Arcturus
+        * to workaround regressions on other Asics.
          */
-       if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
+       if (table_freed &&
+           (adev->asic_type != CHIP_ALDEBARAN) &&
+           (adev->asic_type != CHIP_ARCTURUS))
                 *table_freed = true;
 
Quoted 2 lines

Review

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0 -0
         goto out;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

Quoted 4 lines

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int kfd_ioctl_unmap_memory_from_gpu(struct file

Quoted 4 lines

index b570c0454ce9..ef4d676cc71c 100644

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0 -0
@@ -1806,7 +1806,8 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file

*filep,

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -2
         }
         mutex_unlock(&p->mutex);
 
-       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {
+       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+           KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1)) {
                 err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,
                                 (struct kgd_mem *) mem, true);
                 if (err) {
--

2.25.1

#4 lore raw
Quoted 4 lines · Kent

[AMD Official Use Only]

I think what he means is that if we are using SDMA v17, this will cause issues, won't it? Should we check that SDMA version is >=18 before enabling it? Or am I misunderstanding the fix?

Yes, that was my concern.

Alex

Quoted 71 lines

Kent

Quoted 67 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Eric Huang
Sent: Tuesday, January 18, 2022 2:09 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdkfd: enable heavy-weight TLB flush on Arcturus

The SDMA fix is generic and not in a specific version of FW, so we don't have to check.

Thanks,
Eric

Quoted 7 lines · Alex Deucher
Quoted 2 lines · Eric Huang

SDMA FW fixes the hang issue for adding heavy-weight TLB flush on Arcturus, so we can enable it.

Do we need to check for a specific fw version?

Alex

Quoted 7 lines

Review

Quoted 7 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +++++---
  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c         | 3 ++-
  2 files changed, 7 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Quoted 18 lines
Quoted 18 lines

index a64cbbd943ba..7b24a920c12e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5 -3
@@ -1892,10 +1892,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
                                 true);
         ret = unreserve_bo_and_vms(&ctx, false, false);
 
-       /* Only apply no TLB flush on Aldebaran to
-        * workaround regressions on other Asics.
+       /* Only apply no TLB flush on Aldebaran and Arcturus
+        * to workaround regressions on other Asics.
          */
-       if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
+       if (table_freed &&
+           (adev->asic_type != CHIP_ALDEBARAN) &&
+           (adev->asic_type != CHIP_ARCTURUS))
                 *table_freed = true;
 
Quoted 2 lines

Review

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0 -0
         goto out;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

Quoted 4 lines

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int kfd_ioctl_unmap_memory_from_gpu(struct file

Quoted 4 lines

index b570c0454ce9..ef4d676cc71c 100644

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0 -0
@@ -1806,7 +1806,8 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file

*filep,

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -2
         }
         mutex_unlock(&p->mutex);
 
-       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {
+       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+           KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1)) {
                 err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,
                                 (struct kgd_mem *) mem, true);
                 if (err) {
--

2.25.1

author
#5 lore raw

I understand Alex's concern. I think usually we only check the version when a feature is only available in a specific version, and other version or newer version doesn't have.

In case of FW fix, we assume the driver and FWs have to be synchronous. If we have driver backward compatibility for FWs, there must be a lot of redundant codes for FW version check. So this patch and SDMA fix will be pushed into ROCm 5.1 release branch at the same time.

Regards,
Eric

Quoted 77 lines · Alex Deucher
Quoted 3 lines · Kent

[AMD Official Use Only]

I think what he means is that if we are using SDMA v17, this will cause issues, won't it? Should we check that SDMA version is >=18 before enabling it? Or am I misunderstanding the fix?

Yes, that was my concern.

Alex

Quoted 69 lines

Kent

Quoted 67 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Eric Huang
Sent: Tuesday, January 18, 2022 2:09 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdkfd: enable heavy-weight TLB flush on Arcturus

The SDMA fix is generic and not in a specific version of FW, so we don't have to check.

Thanks,
Eric

Quoted 7 lines · Alex Deucher
Quoted 2 lines · Eric Huang

SDMA FW fixes the hang issue for adding heavy-weight TLB flush on Arcturus, so we can enable it.

Do we need to check for a specific fw version?

Alex

Quoted 7 lines

Review

Quoted 7 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +++++---
   drivers/gpu/drm/amd/amdkfd/kfd_chardev.c         | 3 ++-
   2 files changed, 7 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Quoted 18 lines
Quoted 18 lines

index a64cbbd943ba..7b24a920c12e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5 -3
@@ -1892,10 +1892,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
                                  true);
          ret = unreserve_bo_and_vms(&ctx, false, false);
 
-       /* Only apply no TLB flush on Aldebaran to
-        * workaround regressions on other Asics.
+       /* Only apply no TLB flush on Aldebaran and Arcturus
+        * to workaround regressions on other Asics.
           */
-       if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
+       if (table_freed &&
+           (adev->asic_type != CHIP_ALDEBARAN) &&
+           (adev->asic_type != CHIP_ARCTURUS))
                  *table_freed = true;
 
Quoted 2 lines

Review

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0 -0
          goto out;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

Quoted 4 lines

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int kfd_ioctl_unmap_memory_from_gpu(struct file

Quoted 4 lines

index b570c0454ce9..ef4d676cc71c 100644

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0 -0
@@ -1806,7 +1806,8 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file

*filep,

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -2
          }
          mutex_unlock(&p->mutex);
 
-       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {
+       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+           KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1)) {
                  err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,
                                  (struct kgd_mem *) mem, true);
                  if (err) {
--

2.25.1

#6 lore raw
Quoted 9 lines · Eric Huang

I understand Alex's concern. I think usually we only check the version when a feature is only available in a specific version, and other version or newer version doesn't have.

In case of FW fix, we assume the driver and FWs have to be synchronous. If we have driver backward compatibility for FWs, there must be a lot of redundant codes for FW version check. So this patch and SDMA fix will be pushed into ROCm 5.1 release branch at the same time.

We need to check. The firmwares are not distributed in lock step with the driver.

Alex

Quoted 83 lines

Regards,
Eric

Quoted 77 lines · Alex Deucher
Quoted 3 lines · Kent

[AMD Official Use Only]

I think what he means is that if we are using SDMA v17, this will cause issues, won't it? Should we check that SDMA version is >=18 before enabling it? Or am I misunderstanding the fix?

Yes, that was my concern.

Alex

Quoted 69 lines

Kent

Quoted 67 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Eric Huang
Sent: Tuesday, January 18, 2022 2:09 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdkfd: enable heavy-weight TLB flush on Arcturus

The SDMA fix is generic and not in a specific version of FW, so we don't have to check.

Thanks,
Eric

Quoted 7 lines · Alex Deucher
Quoted 2 lines · Eric Huang

SDMA FW fixes the hang issue for adding heavy-weight TLB flush on Arcturus, so we can enable it.

Do we need to check for a specific fw version?

Alex

Quoted 7 lines

Review

Quoted 7 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +++++---
   drivers/gpu/drm/amd/amdkfd/kfd_chardev.c         | 3 ++-
   2 files changed, 7 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Quoted 18 lines
Quoted 18 lines

index a64cbbd943ba..7b24a920c12e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5 -3
@@ -1892,10 +1892,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
                                  true);
          ret = unreserve_bo_and_vms(&ctx, false, false);
 
-       /* Only apply no TLB flush on Aldebaran to
-        * workaround regressions on other Asics.
+       /* Only apply no TLB flush on Aldebaran and Arcturus
+        * to workaround regressions on other Asics.
           */
-       if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))
+       if (table_freed &&
+           (adev->asic_type != CHIP_ALDEBARAN) &&
+           (adev->asic_type != CHIP_ARCTURUS))
                  *table_freed = true;
 
Quoted 2 lines

Review

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0 -0
          goto out;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

Quoted 4 lines

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int kfd_ioctl_unmap_memory_from_gpu(struct file

Quoted 4 lines

index b570c0454ce9..ef4d676cc71c 100644

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0 -0
@@ -1806,7 +1806,8 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file

*filep,

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -2
          }
          mutex_unlock(&p->mutex);
 
-       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {
+       if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+           KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1)) {
                  err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,
                                  (struct kgd_mem *) mem, true);
                  if (err) {
--

2.25.1

maintainer
#7 lore raw
In reply to Eric Huang
Quoted 10 lines · Eric Huang

I understand Alex's concern. I think usually we only check the version when a feature is only available in a specific version, and other version or newer version doesn't have.

In case of FW fix, we assume the driver and FWs have to be synchronous. If we have driver backward compatibility for FWs, there must be a lot of redundant codes for FW version check. So this patch and SDMA fix will be pushed into ROCm 5.1 release branch at the same time.

Please remove that assumption from everwhere.

If you have released a fw into linux-firmware then you need to support it going forward, even if it means printing something in dmesg recommending people upgrade for features.

Dave.

maintainer
#8 lore raw
In reply to Eric Huang

Am 18.01.22 um 21:13 schrieb Eric Huang:

Quoted 3 lines

I understand Alex's concern. I think usually we only check the version when a feature is only available in a specific version, and other version or newer version doesn't have.

In case of FW fix, we assume the driver and FWs have to be synchronous. If we have driver backward compatibility for FWs, there must be a lot of redundant codes for FW version check. So this patch and SDMA fix will be pushed into ROCm 5.1 release branch at the same time.

Others replied as well, but just to make it clear this approach is an absolutely clear NAK.

Driver backward compatibility is a documented mandatory feature.

So if you already pushed this to ROCm 5.1 then please revert that ASAP.

Regards,
Christian.

Quoted 3 lines

Regards,
Eric