Skip to contentSkip to conversation

drm/amdkfd: Enable userptr support when KFD is enabled

PATCH Superseded Felix Kuehling 3 participants 8 messages Jan 15, 2021 – Jan 18, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Felix Kuehling

author maintainer
#0 lore raw

PATCH 1/1 drm/amdkfd: Enable userptr support when KFD is enabled

ROCm user mode depends on userptr support. Without it, KFD is basically useless.

---
 drivers/gpu/drm/amd/amdkfd/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/Kconfig +1 -0
index e8fb10c41f16..2800b2bb2522 100644
@@ -8,5 +8,6 @@ config HSA_AMD
 	depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)
 	imply AMD_IOMMU_V2 if X86_64
 	select MMU_NOTIFIER
+	select DRM_AMDGPU_USERPTR
 	help
 	  Enable this if you want to use HSA features on AMD GPU devices.
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

Am 15.01.21 um 19:24 schrieb Felix Kuehling:

Quoted 13 lines

ROCm user mode depends on userptr support. Without it, KFD is basically useless.

---
  drivers/gpu/drm/amd/amdkfd/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -0
index e8fb10c41f16..2800b2bb2522 100644

drivers/gpu/drm/amd/amdkfd/Kconfig config HSA_AMD · line 11

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +1 -0
@@ -8,5 +8,6 @@ config HSA_AMD
  	depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)
  	imply AMD_IOMMU_V2 if X86_64
  	select MMU_NOTIFIER
+	select DRM_AMDGPU_USERPTR

I think we should rather make that a depends on. Otherwise we select a visible config option.

Christian.

drivers/gpu/drm/amd/amdkfd/Kconfig config HSA_AMD · line 13

Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -0
  	help
  	  Enable this if you want to use HSA features on AMD GPU devices.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author maintainer
#2 lore raw

Am 2021-01-18 um 2:53 a.m. schrieb Christian König:

Quoted 9 lines

Am 15.01.21 um 19:24 schrieb Felix Kuehling:

Quoted 8 lines

ROCm user mode depends on userptr support. Without it, KFD is basically useless.

---
  drivers/gpu/drm/amd/amdkfd/Kconfig | 1 +

  1 file changed, 1 insertion(+)
Quoted 13 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -0
index e8fb10c41f16..2800b2bb2522 100644
@@ -8,5 +8,6 @@ config HSA_AMD
       depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)

      imply AMD_IOMMU_V2 if X86_64
      select MMU_NOTIFIER
+    select DRM_AMDGPU_USERPTR

I think we should rather make that a depends on. Otherwise we select a visible config option.

I was considering that. The problem with that is, that the HSA_AMD option won't even show up in menuconfig unless DRM_AMDGPU_USERPTR is selected. I'd rather always show the HSA_AMD option and select what it needs.

Is there a good reason why AMDGPU_USERPTR is a "visible" config option? What would be a reason for a user to deliberately disable this?

Regards,
  Felix

Quoted 6 lines

Christian.

Quoted 2 lines

      help
        Enable this if you want to use HSA features on AMD GPU devices.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#3 lore raw

Am 18.01.21 um 15:37 schrieb Felix Kuehling:

Quoted 22 lines

Am 2021-01-18 um 2:53 a.m. schrieb Christian König:

Quoted 9 lines

Am 15.01.21 um 19:24 schrieb Felix Kuehling:

Quoted 8 lines

ROCm user mode depends on userptr support. Without it, KFD is basically useless.

---
   drivers/gpu/drm/amd/amdkfd/Kconfig | 1 +
   1 file changed, 1 insertion(+)
Quoted 12 lines

drivers/gpu/drm/amd/amdkfd/Kconfig config HSA_AMD · line 11

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +1 -0
index e8fb10c41f16..2800b2bb2522 100644
@@ -8,5 +8,6 @@ config HSA_AMD
       depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)
       imply AMD_IOMMU_V2 if X86_64
       select MMU_NOTIFIER
+    select DRM_AMDGPU_USERPTR

I think we should rather make that a depends on. Otherwise we select a visible config option.

Quoted 7 lines

I was considering that. The problem with that is, that the HSA_AMD option won't even show up in menuconfig unless DRM_AMDGPU_USERPTR is selected. I'd rather always show the HSA_AMD option and select what it needs.

Is there a good reason why AMDGPU_USERPTR is a "visible" config option? What would be a reason for a user to deliberately disable this?

The problem is the MMU notifier dependency, not everybody wants its.

I'm just not sure if it's legal to forcefully select a visible config option. E.g. what happens if an user unselects DRM_AMDGPU_USERPTR after it was selected here?

Regards,
Christian.

Quoted 9 lines

Regards,
  Felix

Quoted 4 lines

Christian.

Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -0
       help
         Enable this if you want to use HSA features on AMD GPU devices.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author maintainer
#4 lore raw

Am 2021-01-18 um 9:53 a.m. schrieb Christian König:

Quoted 29 lines

Am 18.01.21 um 15:37 schrieb Felix Kuehling:

Quoted 28 lines

Am 2021-01-18 um 2:53 a.m. schrieb Christian König:

Quoted 10 lines

Am 15.01.21 um 19:24 schrieb Felix Kuehling:

Quoted 9 lines

ROCm user mode depends on userptr support. Without it, KFD is basically
useless.

---
   drivers/gpu/drm/amd/amdkfd/Kconfig | 1 +

   1 file changed, 1 insertion(+)
Quoted 12 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -0
index e8fb10c41f16..2800b2bb2522 100644
@@ -8,5 +8,6 @@ config HSA_AMD
        depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)

       imply AMD_IOMMU_V2 if X86_64
       select MMU_NOTIFIER
+    select DRM_AMDGPU_USERPTR

I think we should rather make that a depends on. Otherwise we select a visible config option.

I was considering that. The problem with that is, that the HSA_AMD option won't even show up in menuconfig unless DRM_AMDGPU_USERPTR is selected. I'd rather always show the HSA_AMD option and select what it needs.

Quoted 4 lines
Quoted 2 lines

Is there a good reason why AMDGPU_USERPTR is a "visible" config option? What would be a reason for a user to deliberately disable this?

The problem is the MMU notifier dependency, not everybody wants its.

Well, KFD already selects MMU_NOTIFIER. So selecting DRM_AMDGPU_USERPTR won't do any more harm.

Regards,
  Felix

Quoted 19 lines

I'm just not sure if it's legal to forcefully select a visible config option. E.g. what happens if an user unselects DRM_AMDGPU_USERPTR after it was selected here?

Regards,
Christian.

Quoted 10 lines

Regards,
   Felix

Quoted 5 lines

Christian.

Quoted 3 lines

       help
         Enable this if you want to use HSA features on AMD GPU devices.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#5 lore raw

Am 18.01.21 um 15:55 schrieb Felix Kuehling:

Quoted 30 lines

Am 2021-01-18 um 9:53 a.m. schrieb Christian König:

Quoted 29 lines

Am 18.01.21 um 15:37 schrieb Felix Kuehling:

Quoted 28 lines

Am 2021-01-18 um 2:53 a.m. schrieb Christian König:

Quoted 10 lines

Am 15.01.21 um 19:24 schrieb Felix Kuehling:

Quoted 9 lines

ROCm user mode depends on userptr support. Without it, KFD is basically
useless.

---
    drivers/gpu/drm/amd/amdkfd/Kconfig | 1 +
    1 file changed, 1 insertion(+)
Quoted 12 lines

drivers/gpu/drm/amd/amdkfd/Kconfig config HSA_AMD · line 11

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +1 -0
index e8fb10c41f16..2800b2bb2522 100644
@@ -8,5 +8,6 @@ config HSA_AMD
        depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)
        imply AMD_IOMMU_V2 if X86_64
        select MMU_NOTIFIER
+    select DRM_AMDGPU_USERPTR

I think we should rather make that a depends on. Otherwise we select a visible config option.

I was considering that. The problem with that is, that the HSA_AMD option won't even show up in menuconfig unless DRM_AMDGPU_USERPTR is selected. I'd rather always show the HSA_AMD option and select what it needs.

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

Is there a good reason why AMDGPU_USERPTR is a "visible" config option? What would be a reason for a user to deliberately disable this?

The problem is the MMU notifier dependency, not everybody wants its.

Well, KFD already selects MMU_NOTIFIER. So selecting DRM_AMDGPU_USERPTR won't do any more harm.

Yeah, correct. But can you test what happens when you deselect USERPTR after selecting KFD?

Regards,
Christian.

Quoted 21 lines

Regards,
  Felix

Quoted 16 lines

I'm just not sure if it's legal to forcefully select a visible config option. E.g. what happens if an user unselects DRM_AMDGPU_USERPTR after it was selected here?

Regards,
Christian.

Quoted 9 lines

Regards,
   Felix

Quoted 5 lines

Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -0
        help
          Enable this if you want to use HSA features on AMD GPU

devices.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by on v1 1/1
#6 lore raw
In reply to Felix Kuehling

Am 15.01.21 um 19:24 schrieb Felix Kuehling:

Quoted 4 lines

ROCm user mode depends on userptr support. Without it, KFD is basically useless.

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdkfd/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -0
index e8fb10c41f16..2800b2bb2522 100644

drivers/gpu/drm/amd/amdkfd/Kconfig config HSA_AMD · line 13

Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +1 -0
@@ -8,5 +8,6 @@ config HSA_AMD
  	depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)
  	imply AMD_IOMMU_V2 if X86_64
  	select MMU_NOTIFIER
+	select DRM_AMDGPU_USERPTR
  	help
  	  Enable this if you want to use HSA features on AMD GPU devices.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author maintainer
#7 lore raw

Am 2021-01-18 um 10:04 a.m. schrieb Christian König:

Quoted 7 lines

Am 15.01.21 um 19:24 schrieb Felix Kuehling:

Quoted 4 lines

ROCm user mode depends on userptr support. Without it, KFD is basically useless.

Thank you. For the record, the documentation recommends some precautions when using "select" to avoid invalid configurations:

Quoted 6 lines

        By abusing select you are able to select a symbol FOO even if FOO depends on BAR that is not set.
        In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.

In this case I think we're fine because KFD already selects MMU_NOTIFIER. To be safe, KFD should also select HMM_MIRROR explicitly.

Regards,
  Felix

Quoted 5 lines
Quoted 5 lines

---
  drivers/gpu/drm/amd/amdkfd/Kconfig | 1 +

  1 file changed, 1 insertion(+)
Quoted 13 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -0
index e8fb10c41f16..2800b2bb2522 100644
@@ -8,5 +8,6 @@ config HSA_AMD
       depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)
Quoted 5 lines

      imply AMD_IOMMU_V2 if X86_64
      select MMU_NOTIFIER
+    select DRM_AMDGPU_USERPTR
      help
        Enable this if you want to use HSA features on AMD GPU devices.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx