amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Set correct context adev for gem object
@ 2019-03-26 15:51 Liu, Shaoyun
       [not found] ` <1553615471-2633-1-git-send-email-shaoyun.liu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Liu, Shaoyun @ 2019-03-26 15:51 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org; +Cc: Liu, Shaoyun

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

Change-Id: I7b2338858126d75350b65ff04d9bb419e1eae15c
Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 9ee8d7a..a82c3b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -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;
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: Set correct context adev for gem object
       [not found] ` <1553615471-2633-1-git-send-email-shaoyun.liu-5C7GfCeVMHo@public.gmane.org>
@ 2019-03-26 18:56   ` Christian König
       [not found]     ` <4bab60f1-5784-d3e4-5e07-3b1d74184f94-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2019-03-26 18:56 UTC (permalink / raw)
  To: Liu, Shaoyun,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

Am 26.03.19 um 16:51 schrieb Liu, Shaoyun:
> 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.

>
> Change-Id: I7b2338858126d75350b65ff04d9bb419e1eae15c
> Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 9ee8d7a..a82c3b1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -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;

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: Set correct context adev for gem object
       [not found]     ` <4bab60f1-5784-d3e4-5e07-3b1d74184f94-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2019-03-26 19:33       ` Liu, Shaoyun
       [not found]         ` <35c54043-3939-4a44-954e-50fc5b6ec637-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Liu, Shaoyun @ 2019-03-26 19:33 UTC (permalink / raw)
  To: Koenig, Christian,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

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

On 2019-03-26 2:56 p.m., Christian König wrote:
> Am 26.03.19 um 16:51 schrieb Liu, Shaoyun:
>> 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.
>
>>
>> Change-Id: I7b2338858126d75350b65ff04d9bb419e1eae15c
>> Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> index 9ee8d7a..a82c3b1 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> @@ -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;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: Set correct context adev for gem object
       [not found]         ` <35c54043-3939-4a44-954e-50fc5b6ec637-5C7GfCeVMHo@public.gmane.org>
@ 2019-03-26 19:35           ` Koenig, Christian
  0 siblings, 0 replies; 4+ messages in thread
From: Koenig, Christian @ 2019-03-26 19:35 UTC (permalink / raw)
  To: Liu, Shaoyun,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

Am 26.03.19 um 20:33 schrieb Liu, Shaoyun:
> 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.

>
> Regards
>
> shaoyun.liu
>
> On 2019-03-26 2:56 p.m., Christian König wrote:
>> Am 26.03.19 um 16:51 schrieb Liu, Shaoyun:
>>> 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.
>>
>>> Change-Id: I7b2338858126d75350b65ff04d9bb419e1eae15c
>>> Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> index 9ee8d7a..a82c3b1 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> @@ -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;

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-26 19:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-26 15:51 [PATCH] drm/amdgpu: Set correct context adev for gem object Liu, Shaoyun
     [not found] ` <1553615471-2633-1-git-send-email-shaoyun.liu-5C7GfCeVMHo@public.gmane.org>
2019-03-26 18:56   ` Christian König
     [not found]     ` <4bab60f1-5784-d3e4-5e07-3b1d74184f94-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-26 19:33       ` Liu, Shaoyun
     [not found]         ` <35c54043-3939-4a44-954e-50fc5b6ec637-5C7GfCeVMHo@public.gmane.org>
2019-03-26 19:35           ` Koenig, Christian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).