Skip to contentSkip to conversation

drm/amdgpu: Set correct context adev for gem object

PATCH In review Liu, Shaoyun 3 participants 4 messages Mar 26, 2019 3 messages not in the archive

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

PATCH 1/1 drm/amdgpu: Set correct context adev for gem object

The context device pointer could be different of the object been acctually allocated

Change-Id I7b2338858126d75350b65ff04d9bb419e1eae15c
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -2
index 9ee8d7a..a82c3b1 100644
@@ -117,8 +117,8 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
 			   struct drm_file *file_priv)
 {
 	struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
 	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
+	struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
 	struct amdgpu_vm *vm = &fpriv->vm;
 	struct amdgpu_bo_va *bo_va;
 	struct mm_struct *mm;
@@ -150,8 +150,8 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
 			     struct drm_file *file_priv)
 {
 	struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
 	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
+	struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
 	struct amdgpu_vm *vm = &fpriv->vm;
 
 	struct amdgpu_bo_list_entry vm_pd;
Signature · 6 lines
2.7.4

_______________________________________________
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): 1553615471-2633-1-git-send-email-shaoyun.liu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 26.03.19 um 16:51 schrieb Liu, Shaoyun:

Quoted 1 line

The context device pointer could be different of the object been acctually allocated

Actually that is unnecessary, cause the GEM adev is always identical to the file_priv.

E.g. we don't support the hack using in the KFD for BO sharing here.

Quoted 22 lines
Change-Id I7b2338858126d75350b65ff04d9bb419e1eae15c
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
index 9ee8d7a..a82c3b1 100644
@@ -117,8 +117,8 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
  			   struct drm_file *file_priv)
  {
  	struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
  	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
+	struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
  	struct amdgpu_vm *vm = &fpriv->vm;
  	struct amdgpu_bo_va *bo_va;
  	struct mm_struct *mm;

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c void amdgpu_gem_object_close(struct drm_gem_object *obj, · line 157

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
@@ -150,8 +150,8 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
  			     struct drm_file *file_priv)
  {
  	struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
  	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
+	struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
  	struct amdgpu_vm *vm = &fpriv->vm;
 
  	struct amdgpu_bo_list_entry vm_pd;

_______________________________________________
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): 4bab60f1-5784-d3e4-5e07-3b1d74184f94-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

OK , just ignore it . BTW , if you think it's a hack currently used in KFD  to share the memory among GPUs,  what's your plane to use the peer GPU through XGMI from GEM  point of view ?

Regards

shaoyun.liu

Quoted 34 lines · Christian König

Am 26.03.19 um 16:51 schrieb Liu, Shaoyun:

Quoted 2 lines

The context device pointer could be different of the object been acctually allocated

Actually that is unnecessary, cause the GEM adev is always identical to the file_priv.

E.g. we don't support the hack using in the KFD for BO sharing here.

Quoted 25 lines
Change-Id I7b2338858126d75350b65ff04d9bb419e1eae15c

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
index 9ee8d7a..a82c3b1 100644
@@ -117,8 +117,8 @@ int amdgpu_gem_object_open(struct drm_gem_object 
 *obj,
                  struct drm_file *file_priv)
   {
       struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
-    struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
       struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
+    struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
       struct amdgpu_vm *vm = &fpriv->vm;
       struct amdgpu_bo_va *bo_va;

      struct mm_struct *mm;

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
@@ -150,8 +150,8 @@ void amdgpu_gem_object_close(struct 
 drm_gem_object *obj,
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c void amdgpu_gem_object_close(struct drm_gem_object *obj, · line 157

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
                    struct drm_file *file_priv)
   {
       struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-    struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
       struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
+    struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
       struct amdgpu_vm *vm = &fpriv->vm;
         struct amdgpu_bo_list_entry vm_pd;

_______________________________________________
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): 35c54043-3939-4a44-954e-50fc5b6ec637-5C7GfCeVMHo@public.gmane.org

#6 lore raw

Am 26.03.19 um 20:33 schrieb Liu, Shaoyun:

Quoted 3 lines

OK , just ignore it . BTW , if you think it's a hack currently used in KFD  to share the memory among GPUs,  what's your plane to use the peer GPU through XGMI from GEM  point of view ?

We just need to unpack the root bo while doing the XGMI check, e.g. we have a BO structure in the importing device and use this one while doing the mapping.

Christian.

Quoted 38 lines

Regards

shaoyun.liu

Quoted 32 lines · Christian König

Am 26.03.19 um 16:51 schrieb Liu, Shaoyun:

Quoted 2 lines

The context device pointer could be different of the object been acctually allocated

Actually that is unnecessary, cause the GEM adev is always identical to the file_priv.

E.g. we don't support the hack using in the KFD for BO sharing here.

Quoted 24 lines
Change-Id I7b2338858126d75350b65ff04d9bb419e1eae15c
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
index 9ee8d7a..a82c3b1 100644
@@ -117,8 +117,8 @@ int amdgpu_gem_object_open(struct drm_gem_object
 *obj,
                  struct drm_file *file_priv)
   {
       struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
-    struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
       struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
+    struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
       struct amdgpu_vm *vm = &fpriv->vm;
       struct amdgpu_bo_va *bo_va;

      struct mm_struct *mm;

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
@@ -150,8 +150,8 @@ void amdgpu_gem_object_close(struct
 drm_gem_object *obj,
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c void amdgpu_gem_object_close(struct drm_gem_object *obj, · line 157

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -1
                    struct drm_file *file_priv)
   {
       struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-    struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
       struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
+    struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
       struct amdgpu_vm *vm = &fpriv->vm;
         struct amdgpu_bo_list_entry vm_pd;

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