Skip to contentSkip to conversation

drm/amdgpu: disable userptr if swiotlb is active

PATCH In review Christian König 3 participants 4 messages Feb 20, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: disable userptr if swiotlb is active

Otherwise we can't be sure that we won't end up with a bounce buffer.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -0
index d21dd2f369da..abc65633119b 100644
@@ -289,6 +289,10 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
 	if (offset_in_page(args->addr | args->size))
 		return -EINVAL;
 
+	/* We can't do this when swiotlb is active */
+	if (adev->needs_swiotlb)
+		return -ENXIO;
+
 	/* reject unknown flag values */
 	if (args->flags & ~(AMDGPU_GEM_USERPTR_READONLY |
 	    AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_VALIDATE |
Signature · 6 lines
2.17.1

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

A message that is not in the archive (sent off-list or not yet received): 20190220134654.15406-1-christian.koenig-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Christian König <[email protected]>
Sent: Wednesday, February 20, 2019 8:46 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu: disable userptr if swiotlb is active

Otherwise we can't be sure that we won't end up with a bounce buffer.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -0
index d21dd2f369da..abc65633119b 100644
@@ -289,6 +289,10 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
         if (offset_in_page(args->addr | args->size))
                 return -EINVAL;
 
+       /* We can't do this when swiotlb is active */
+       if (adev->needs_swiotlb)
+               return -ENXIO;
+
         /* reject unknown flag values */
         if (args->flags & ~(AMDGPU_GEM_USERPTR_READONLY |
             AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_VALIDATE |

--
2.17.1

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

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

#3 lore raw
In reply to a message not in the archive

I guess we'll need something similar for KFD? I don't think we've ever intentionally tested KFD with swiotlb. But I've seen some backtraces with swiotlb in them before. I wonder how badly broken it is ...

Regards,
  Felix

Quoted 12 lines · Christian König

Otherwise we can't be sure that we won't end up with a bounce buffer.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index d21dd2f369da..abc65633119b 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, · line 298

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -0
@@ -289,6 +289,10 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
  	if (offset_in_page(args->addr | args->size))
  		return -EINVAL;
 
+	/* We can't do this when swiotlb is active */
+	if (adev->needs_swiotlb)
+		return -ENXIO;
+
  	/* reject unknown flag values */
  	if (args->flags & ~(AMDGPU_GEM_USERPTR_READONLY |
  	    AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_VALIDATE |

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

A message that is not in the archive (sent off-list or not yet received): 257989f9-7c9c-367b-3529-36b0bf81cfbc-5C7GfCeVMHo@public.gmane.org

#5 lore raw

Well in the worst case you could end up having a bounce buffer mapped instead of the real page.

Christian.

Am 20.02.19 um 18:02 schrieb Kuehling, Felix:

Quoted 23 lines

I guess we'll need something similar for KFD? I don't think we've ever intentionally tested KFD with swiotlb. But I've seen some backtraces with swiotlb in them before. I wonder how badly broken it is ...

Regards,
  Felix

Quoted 15 lines · Christian König

Otherwise we can't be sure that we won't end up with a bounce buffer.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
   1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index d21dd2f369da..abc65633119b 100644
@@ -289,6 +289,10 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
   	if (offset_in_page(args->addr | args->size))
   		return -EINVAL;
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, · line 298

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -0
+	/* We can't do this when swiotlb is active */
+	if (adev->needs_swiotlb)
+		return -ENXIO;
+
   	/* reject unknown flag values */
   	if (args->flags & ~(AMDGPU_GEM_USERPTR_READONLY |
   	    AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_VALIDATE |

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