linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
@ 2019-07-03  1:55 Kuehling, Felix
  2019-07-03  4:54 ` Stephen Rothwell
  2019-07-03 14:10 ` Jason Gunthorpe
  0 siblings, 2 replies; 15+ messages in thread
From: Kuehling, Felix @ 2019-07-03  1:55 UTC (permalink / raw)
  To: linux-next
  Cc: dri-devel, linux-mm, Yang, Philip, Kuehling, Felix,
	Stephen Rothwell, Jason Gunthorpe, Dave Airlie, Deucher,
	Alexander

From: Philip Yang <Philip.Yang@amd.com>

In order to pass mirror instead of mm to hmm_range_register, we need
pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
is part of amdgpu_mn structure, which is accessible from bo.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
CC: Stephen Rothwell <sfr@canb.auug.org.au>
CC: Jason Gunthorpe <jgg@mellanox.com>
CC: Dave Airlie <airlied@linux.ie>
CC: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/Kconfig                          |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
 8 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index ee01afbbcd90..3313378c743b 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -220,7 +220,6 @@ source "drivers/gpu/drm/radeon/Kconfig"
 
 config DRM_AMDGPU
 	tristate "AMD GPU"
-	depends on BROKEN
 	depends on DRM && PCI && MMU
 	select FW_LOADER
         select DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 0aa81456ec32..146700a51373 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -504,7 +504,7 @@ static int init_user_pages(struct kgd_mem *mem, struct mm_struct *mm,
 		goto out;
 	}
 
-	ret = amdgpu_ttm_tt_get_user_pages(bo->tbo.ttm, bo->tbo.ttm->pages);
+	ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages);
 	if (ret) {
 		pr_err("%s: Failed to get user pages: %d\n", __func__, ret);
 		goto unregister_out;
@@ -1729,8 +1729,7 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
 		bo = mem->bo;
 
 		/* Get updated user pages */
-		ret = amdgpu_ttm_tt_get_user_pages(bo->tbo.ttm,
-						   bo->tbo.ttm->pages);
+		ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages);
 		if (ret) {
 			pr_debug("%s: Failed to get user pages: %d\n",
 				__func__, ret);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 37adce981fa3..e069de8b54e6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -633,7 +633,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 			return -ENOMEM;
 		}
 
-		r = amdgpu_ttm_tt_get_user_pages(bo->tbo.ttm, e->user_pages);
+		r = amdgpu_ttm_tt_get_user_pages(bo, e->user_pages);
 		if (r) {
 			kvfree(e->user_pages);
 			e->user_pages = NULL;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 1f9f27061e2f..939f8305511b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -327,8 +327,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
 	}
 
 	if (args->flags & AMDGPU_GEM_USERPTR_VALIDATE) {
-		r = amdgpu_ttm_tt_get_user_pages(bo->tbo.ttm,
-						 bo->tbo.ttm->pages);
+		r = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages);
 		if (r)
 			goto release_object;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index 623f56a1485f..80e40898a507 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -398,6 +398,14 @@ struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
 	return ERR_PTR(r);
 }
 
+struct hmm_mirror *amdgpu_mn_get_mirror(struct amdgpu_mn *amn)
+{
+	if (!amn)
+		return NULL;
+
+	return &amn->mirror;
+}
+
 /**
  * amdgpu_mn_register - register a BO for notifier updates
  *
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
index f5b67c63ed6b..cb1678925415 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h
@@ -43,6 +43,7 @@ struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
 int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr);
 void amdgpu_mn_unregister(struct amdgpu_bo *bo);
 void amdgpu_hmm_init_range(struct hmm_range *range);
+struct hmm_mirror *amdgpu_mn_get_mirror(struct amdgpu_mn *amn);
 #else
 static inline void amdgpu_mn_lock(struct amdgpu_mn *mn) {}
 static inline void amdgpu_mn_unlock(struct amdgpu_mn *mn) {}
@@ -58,6 +59,10 @@ static inline int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
 	return -ENODEV;
 }
 static inline void amdgpu_mn_unregister(struct amdgpu_bo *bo) {}
+static inline struct hmm_mirror *amdgpu_mn_get_mirror(struct amdgpu_mn *amn)
+{
+	return NULL;
+}
 #endif
 
 #endif
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index c9faa69cd677..c602c994cb95 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -731,8 +731,10 @@ struct amdgpu_ttm_tt {
 
 #define MAX_RETRY_HMM_RANGE_FAULT	16
 
-int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
+int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
 {
+	struct hmm_mirror *mirror = amdgpu_mn_get_mirror(bo->mn);
+	struct ttm_tt *ttm = bo->tbo.ttm;
 	struct amdgpu_ttm_tt *gtt = (void *)ttm;
 	struct mm_struct *mm = gtt->usertask->mm;
 	unsigned long start = gtt->userptr;
@@ -746,6 +748,12 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
 	if (!mm) /* Happens during process shutdown */
 		return -ESRCH;
 
+	if (unlikely(!mirror)) {
+		DRM_DEBUG_DRIVER("Failed to get hmm_mirror\n");
+		r = -EFAULT;
+		goto out;
+	}
+
 	vma = find_vma(mm, start);
 	if (unlikely(!vma || start < vma->vm_start)) {
 		r = -EFAULT;
@@ -775,7 +783,7 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
 				0 : range->flags[HMM_PFN_WRITE];
 	range->pfn_flags_mask = 0;
 	range->pfns = pfns;
-	hmm_range_register(range, mm, start,
+	hmm_range_register(range, mirror, start,
 			   start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
 
 retry:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index c2b7669004ba..caa76c693700 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -102,10 +102,11 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo);
 int amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo);
 
 #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
-int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages);
+int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages);
 bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm);
 #else
-static inline int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
+static inline int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo,
+					       struct page **pages)
 {
 	return -EPERM;
 }
-- 
2.17.1


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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03  1:55 [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change Kuehling, Felix
@ 2019-07-03  4:54 ` Stephen Rothwell
  2019-07-03  8:30   ` Stephen Rothwell
  2019-07-03 14:10 ` Jason Gunthorpe
  1 sibling, 1 reply; 15+ messages in thread
From: Stephen Rothwell @ 2019-07-03  4:54 UTC (permalink / raw)
  To: Kuehling, Felix
  Cc: linux-next, dri-devel, linux-mm, Yang, Philip, Jason Gunthorpe,
	Dave Airlie, Deucher, Alexander

[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]

Hi all,

On Wed, 3 Jul 2019 01:55:08 +0000 "Kuehling, Felix" <Felix.Kuehling@amd.com> wrote:
>
> From: Philip Yang <Philip.Yang@amd.com>
> 
> In order to pass mirror instead of mm to hmm_range_register, we need
> pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
> is part of amdgpu_mn structure, which is accessible from bo.
> 
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> CC: Stephen Rothwell <sfr@canb.auug.org.au>
> CC: Jason Gunthorpe <jgg@mellanox.com>
> CC: Dave Airlie <airlied@linux.ie>
> CC: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/Kconfig                          |  1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
>  8 files changed, 30 insertions(+), 11 deletions(-)

I will apply this to the hmm tree merge today to see how it goes.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03  4:54 ` Stephen Rothwell
@ 2019-07-03  8:30   ` Stephen Rothwell
  0 siblings, 0 replies; 15+ messages in thread
From: Stephen Rothwell @ 2019-07-03  8:30 UTC (permalink / raw)
  To: Kuehling, Felix
  Cc: linux-next, dri-devel, linux-mm, Yang, Philip, Jason Gunthorpe,
	Dave Airlie, Deucher, Alexander

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

Hi all,

On Wed, 3 Jul 2019 14:54:43 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> On Wed, 3 Jul 2019 01:55:08 +0000 "Kuehling, Felix" <Felix.Kuehling@amd.com> wrote:
> >
> > From: Philip Yang <Philip.Yang@amd.com>
> > 
> > In order to pass mirror instead of mm to hmm_range_register, we need
> > pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
> > is part of amdgpu_mn structure, which is accessible from bo.
> > 
> > Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> > Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > CC: Stephen Rothwell <sfr@canb.auug.org.au>
> > CC: Jason Gunthorpe <jgg@mellanox.com>
> > CC: Dave Airlie <airlied@linux.ie>
> > CC: Alex Deucher <alexander.deucher@amd.com>
> > ---
> >  drivers/gpu/drm/Kconfig                          |  1 -
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
> >  8 files changed, 30 insertions(+), 11 deletions(-)  
> 
> I will apply this to the hmm tree merge today to see how it goes.

This (at least) build for me.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03  1:55 [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change Kuehling, Felix
  2019-07-03  4:54 ` Stephen Rothwell
@ 2019-07-03 14:10 ` Jason Gunthorpe
  2019-07-03 21:03   ` Kuehling, Felix
  1 sibling, 1 reply; 15+ messages in thread
From: Jason Gunthorpe @ 2019-07-03 14:10 UTC (permalink / raw)
  To: Kuehling, Felix
  Cc: linux-next, dri-devel, linux-mm, Yang, Philip, Stephen Rothwell,
	Dave Airlie, Deucher, Alexander

On Wed, Jul 03, 2019 at 01:55:08AM +0000, Kuehling, Felix wrote:
> From: Philip Yang <Philip.Yang@amd.com>
> 
> In order to pass mirror instead of mm to hmm_range_register, we need
> pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
> is part of amdgpu_mn structure, which is accessible from bo.
> 
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> CC: Stephen Rothwell <sfr@canb.auug.org.au>
> CC: Jason Gunthorpe <jgg@mellanox.com>
> CC: Dave Airlie <airlied@linux.ie>
> CC: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/Kconfig                          |  1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
>  8 files changed, 30 insertions(+), 11 deletions(-)

This is too big to use as a conflict resolution, what you could do is
apply the majority of the patch on top of your tree as-is (ie keep
using the old hmm_range_register), then the conflict resolution for
the updated AMD GPU tree can be a simple one line change:

 -	hmm_range_register(range, mm, start,
 +	hmm_range_register(range, mirror, start,
  			   start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);

Which is trivial for everone to deal with, and solves the problem.

This is probably a much better option than rebasing the AMD gpu tree.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> index 623f56a1485f..80e40898a507 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> @@ -398,6 +398,14 @@ struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
>  	return ERR_PTR(r);
>  }
>  
> +struct hmm_mirror *amdgpu_mn_get_mirror(struct amdgpu_mn *amn)
> +{
> +	if (!amn)
> +		return NULL;
> +
> +	return &amn->mirror;
> +}

I think it is better make the struct amdgpu_mn public rather than add
this wrapper.

Jason


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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03 14:10 ` Jason Gunthorpe
@ 2019-07-03 21:03   ` Kuehling, Felix
  2019-07-03 21:09     ` Alex Deucher
  2019-07-03 21:33     ` Stephen Rothwell
  0 siblings, 2 replies; 15+ messages in thread
From: Kuehling, Felix @ 2019-07-03 21:03 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: linux-next, dri-devel, linux-mm, Yang, Philip, Stephen Rothwell,
	Dave Airlie, Deucher, Alexander

On 2019-07-03 10:10 a.m., Jason Gunthorpe wrote:
> On Wed, Jul 03, 2019 at 01:55:08AM +0000, Kuehling, Felix wrote:
>> From: Philip Yang <Philip.Yang@amd.com>
>>
>> In order to pass mirror instead of mm to hmm_range_register, we need
>> pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
>> is part of amdgpu_mn structure, which is accessible from bo.
>>
>> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
>> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
>> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
>> CC: Stephen Rothwell <sfr@canb.auug.org.au>
>> CC: Jason Gunthorpe <jgg@mellanox.com>
>> CC: Dave Airlie <airlied@linux.ie>
>> CC: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>   drivers/gpu/drm/Kconfig                          |  1 -
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
>>   8 files changed, 30 insertions(+), 11 deletions(-)
> This is too big to use as a conflict resolution, what you could do is
> apply the majority of the patch on top of your tree as-is (ie keep
> using the old hmm_range_register), then the conflict resolution for
> the updated AMD GPU tree can be a simple one line change:
>
>   -	hmm_range_register(range, mm, start,
>   +	hmm_range_register(range, mirror, start,
>    			   start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
>
> Which is trivial for everone to deal with, and solves the problem.

Good idea.


>
> This is probably a much better option than rebasing the AMD gpu tree.

I think Alex is planning to merge hmm.git into an updated drm-next and 
then rebase amd-staging-drm-next on top of that. Rebasing our 
amd-staging-drm-next is something we do every month or two anyway.


>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>> index 623f56a1485f..80e40898a507 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>> @@ -398,6 +398,14 @@ struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
>>   	return ERR_PTR(r);
>>   }
>>   
>> +struct hmm_mirror *amdgpu_mn_get_mirror(struct amdgpu_mn *amn)
>> +{
>> +	if (!amn)
>> +		return NULL;
>> +
>> +	return &amn->mirror;
>> +}
> I think it is better make the struct amdgpu_mn public rather than add
> this wrapper.

Sure. I can do that. It won't make the patch smaller, though, if that 
was your intention.

It looks like Stephen already applied my patch as a conflict resolution 
on linux-next, though. I see linux-next/master is getting updated 
non-fast-forward. So is the idea that its history will updated again 
with the final resolution on drm-next or drm-fixes?

Regards,
   Felix

>
> Jason
>

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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03 21:03   ` Kuehling, Felix
@ 2019-07-03 21:09     ` Alex Deucher
  2019-07-03 21:32       ` Stephen Rothwell
                         ` (2 more replies)
  2019-07-03 21:33     ` Stephen Rothwell
  1 sibling, 3 replies; 15+ messages in thread
From: Alex Deucher @ 2019-07-03 21:09 UTC (permalink / raw)
  To: Kuehling, Felix
  Cc: Jason Gunthorpe, Stephen Rothwell, Yang, Philip, Dave Airlie,
	dri-devel, linux-mm, linux-next, Deucher, Alexander

On Wed, Jul 3, 2019 at 5:03 PM Kuehling, Felix <Felix.Kuehling@amd.com> wrote:
>
> On 2019-07-03 10:10 a.m., Jason Gunthorpe wrote:
> > On Wed, Jul 03, 2019 at 01:55:08AM +0000, Kuehling, Felix wrote:
> >> From: Philip Yang <Philip.Yang@amd.com>
> >>
> >> In order to pass mirror instead of mm to hmm_range_register, we need
> >> pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
> >> is part of amdgpu_mn structure, which is accessible from bo.
> >>
> >> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> >> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> >> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> >> CC: Stephen Rothwell <sfr@canb.auug.org.au>
> >> CC: Jason Gunthorpe <jgg@mellanox.com>
> >> CC: Dave Airlie <airlied@linux.ie>
> >> CC: Alex Deucher <alexander.deucher@amd.com>
> >> ---
> >>   drivers/gpu/drm/Kconfig                          |  1 -
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
> >>   8 files changed, 30 insertions(+), 11 deletions(-)
> > This is too big to use as a conflict resolution, what you could do is
> > apply the majority of the patch on top of your tree as-is (ie keep
> > using the old hmm_range_register), then the conflict resolution for
> > the updated AMD GPU tree can be a simple one line change:
> >
> >   -   hmm_range_register(range, mm, start,
> >   +   hmm_range_register(range, mirror, start,
> >                          start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
> >
> > Which is trivial for everone to deal with, and solves the problem.
>
> Good idea.
>
>
> >
> > This is probably a much better option than rebasing the AMD gpu tree.
>
> I think Alex is planning to merge hmm.git into an updated drm-next and
> then rebase amd-staging-drm-next on top of that. Rebasing our
> amd-staging-drm-next is something we do every month or two anyway.
>

Go ahead and respin your patch as per the suggestion above.  then I
can apply it I can either merge hmm into amd's drm-next or we can just
provide the conflict fix patch whichever is easier.  Which hmm branch
is for 5.3?
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/?h=hmm


>
> >
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> >> index 623f56a1485f..80e40898a507 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> >> @@ -398,6 +398,14 @@ struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
> >>      return ERR_PTR(r);
> >>   }
> >>
> >> +struct hmm_mirror *amdgpu_mn_get_mirror(struct amdgpu_mn *amn)
> >> +{
> >> +    if (!amn)
> >> +            return NULL;
> >> +
> >> +    return &amn->mirror;
> >> +}
> > I think it is better make the struct amdgpu_mn public rather than add
> > this wrapper.
>
> Sure. I can do that. It won't make the patch smaller, though, if that
> was your intention.
>
> It looks like Stephen already applied my patch as a conflict resolution
> on linux-next, though. I see linux-next/master is getting updated
> non-fast-forward. So is the idea that its history will updated again
> with the final resolution on drm-next or drm-fixes?
>

linux-next can deal with rebases, etc.  If the contributing trees
rebase or change, linux-next will update.

Alex

> Regards,
>    Felix
>
> >
> > Jason
> >
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03 21:09     ` Alex Deucher
@ 2019-07-03 21:32       ` Stephen Rothwell
  2019-07-03 23:11         ` Dave Airlie
  2019-07-04  2:01       ` Jason Gunthorpe
  2019-07-07 23:30       ` Stephen Rothwell
  2 siblings, 1 reply; 15+ messages in thread
From: Stephen Rothwell @ 2019-07-03 21:32 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Kuehling, Felix, Jason Gunthorpe, Yang, Philip, Dave Airlie,
	dri-devel, linux-mm, linux-next, Deucher, Alexander

[-- Attachment #1: Type: text/plain, Size: 814 bytes --]

Hi Alex,

On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <alexdeucher@gmail.com> wrote:
>
> Go ahead and respin your patch as per the suggestion above.  then I
> can apply it I can either merge hmm into amd's drm-next or we can just
> provide the conflict fix patch whichever is easier.  Which hmm branch
> is for 5.3?
> https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/?h=hmm

Please do not merge the hmm tree into yours - especially if the
conflict comes down to just a few lines.  Linus has addressed this in
the past.  There is a possibility that he may take some objection to
the hmm tree (for example) and then your tree (and consequently the drm
tree) would also not be mergeable.

Just supply Linus with a hint about the conflict resolution.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03 21:03   ` Kuehling, Felix
  2019-07-03 21:09     ` Alex Deucher
@ 2019-07-03 21:33     ` Stephen Rothwell
  1 sibling, 0 replies; 15+ messages in thread
From: Stephen Rothwell @ 2019-07-03 21:33 UTC (permalink / raw)
  To: Kuehling, Felix
  Cc: Jason Gunthorpe, linux-next, dri-devel, linux-mm, Yang, Philip,
	Dave Airlie, Deucher, Alexander

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

Hi Felix,

On Wed, 3 Jul 2019 21:03:32 +0000 "Kuehling, Felix" <Felix.Kuehling@amd.com> wrote:
>
> It looks like Stephen already applied my patch as a conflict resolution 
> on linux-next, though. I see linux-next/master is getting updated 
> non-fast-forward. So is the idea that its history will updated again 
> with the final resolution on drm-next or drm-fixes?

linux-next gets rebased every day (that is its nature).  Do not worry
about that, I will cope with whatever you do.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03 21:32       ` Stephen Rothwell
@ 2019-07-03 23:11         ` Dave Airlie
  2019-07-04  2:00           ` Jason Gunthorpe
  0 siblings, 1 reply; 15+ messages in thread
From: Dave Airlie @ 2019-07-03 23:11 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Alex Deucher, Yang, Philip, Dave Airlie, Kuehling, Felix,
	dri-devel, linux-mm, Jason Gunthorpe, linux-next, Deucher,
	Alexander

On Thu, 4 Jul 2019 at 07:32, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi Alex,
>
> On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <alexdeucher@gmail.com> wrote:
> >
> > Go ahead and respin your patch as per the suggestion above.  then I
> > can apply it I can either merge hmm into amd's drm-next or we can just
> > provide the conflict fix patch whichever is easier.  Which hmm branch
> > is for 5.3?
> > https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/?h=hmm
>
> Please do not merge the hmm tree into yours - especially if the
> conflict comes down to just a few lines.  Linus has addressed this in
> the past.  There is a possibility that he may take some objection to
> the hmm tree (for example) and then your tree (and consequently the drm
> tree) would also not be mergeable.
>

I'm fine with merging the hmm tree if Jason has a stable non-rebasing
base. I'd rather merge into drm tree and then have amd backmerge if it
we are doing it.

But if we can just reduce the conflicts to a small amount it's easier
for everyone to just do that.

Dave.


> Just supply Linus with a hint about the conflict resolution.
>
> --
> Cheers,
> Stephen Rothwell
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03 23:11         ` Dave Airlie
@ 2019-07-04  2:00           ` Jason Gunthorpe
  0 siblings, 0 replies; 15+ messages in thread
From: Jason Gunthorpe @ 2019-07-04  2:00 UTC (permalink / raw)
  To: Dave Airlie
  Cc: Stephen Rothwell, Alex Deucher, Yang, Philip, Dave Airlie,
	Kuehling, Felix, dri-devel, linux-mm, linux-next, Deucher,
	Alexander

On Thu, Jul 04, 2019 at 09:11:33AM +1000, Dave Airlie wrote:
> On Thu, 4 Jul 2019 at 07:32, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > Hi Alex,
> >
> > On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <alexdeucher@gmail.com> wrote:
> > >
> > > Go ahead and respin your patch as per the suggestion above.  then I
> > > can apply it I can either merge hmm into amd's drm-next or we can just
> > > provide the conflict fix patch whichever is easier.  Which hmm branch
> > > is for 5.3?
> > > https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/?h=hmm
> >
> > Please do not merge the hmm tree into yours - especially if the
> > conflict comes down to just a few lines.  Linus has addressed this in
> > the past.  There is a possibility that he may take some objection to
> > the hmm tree (for example) and then your tree (and consequently the drm
> > tree) would also not be mergeable.
> >
> 
> I'm fine with merging the hmm tree if Jason has a stable non-rebasing
> base. I'd rather merge into drm tree and then have amd backmerge if it
> we are doing it.

Yes, it is a stable non-rebasing tree for this purpose.

> But if we can just reduce the conflicts to a small amount it's easier
> for everyone to just do that.

Yes, I concur with Stephen. hmm.git is setup so we can merge it across
trees as a feature branch if we need to - but merging to avoid a
trivial conflict is something Linus has frowned on in the past.

If we can get the resolution down to one line then I would forward it
to Linus. Since it is a build break only it should be highlighted in
the DRM PR.

For RDMA we often have conflicts and I usually send Linus a 2nd tag
(ie for-linus-merged) with the conflicts all resolved so he can
compare his and my resolution as a sanity check. Linus wrote a nice
email on this topic..

Jason


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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03 21:09     ` Alex Deucher
  2019-07-03 21:32       ` Stephen Rothwell
@ 2019-07-04  2:01       ` Jason Gunthorpe
  2019-07-07 23:30       ` Stephen Rothwell
  2 siblings, 0 replies; 15+ messages in thread
From: Jason Gunthorpe @ 2019-07-04  2:01 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Kuehling, Felix, Stephen Rothwell, Yang, Philip, Dave Airlie,
	dri-devel, linux-mm, linux-next, Deucher, Alexander

On Wed, Jul 03, 2019 at 05:09:16PM -0400, Alex Deucher wrote:
> On Wed, Jul 3, 2019 at 5:03 PM Kuehling, Felix <Felix.Kuehling@amd.com> wrote:
> >
> > On 2019-07-03 10:10 a.m., Jason Gunthorpe wrote:
> > > On Wed, Jul 03, 2019 at 01:55:08AM +0000, Kuehling, Felix wrote:
> > >> From: Philip Yang <Philip.Yang@amd.com>
> > >>
> > >> In order to pass mirror instead of mm to hmm_range_register, we need
> > >> pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
> > >> is part of amdgpu_mn structure, which is accessible from bo.
> > >>
> > >> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> > >> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > >> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > >> CC: Stephen Rothwell <sfr@canb.auug.org.au>
> > >> CC: Jason Gunthorpe <jgg@mellanox.com>
> > >> CC: Dave Airlie <airlied@linux.ie>
> > >> CC: Alex Deucher <alexander.deucher@amd.com>
> > >>   drivers/gpu/drm/Kconfig                          |  1 -
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
> > >>   8 files changed, 30 insertions(+), 11 deletions(-)
> > > This is too big to use as a conflict resolution, what you could do is
> > > apply the majority of the patch on top of your tree as-is (ie keep
> > > using the old hmm_range_register), then the conflict resolution for
> > > the updated AMD GPU tree can be a simple one line change:
> > >
> > >   -   hmm_range_register(range, mm, start,
> > >   +   hmm_range_register(range, mirror, start,
> > >                          start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
> > >
> > > Which is trivial for everone to deal with, and solves the problem.
> >
> > Good idea.
> >
> >
> > >
> > > This is probably a much better option than rebasing the AMD gpu tree.
> >
> > I think Alex is planning to merge hmm.git into an updated drm-next and
> > then rebase amd-staging-drm-next on top of that. Rebasing our
> > amd-staging-drm-next is something we do every month or two anyway.
> >
> 
> Go ahead and respin your patch as per the suggestion above.  then I
> can apply it I can either merge hmm into amd's drm-next or we can just
> provide the conflict fix patch whichever is easier.  Which hmm branch
> is for 5.3?
> https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/?h=hmm

Yes, anything for 5.2 should go to Andrew.

Jason


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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-03 21:09     ` Alex Deucher
  2019-07-03 21:32       ` Stephen Rothwell
  2019-07-04  2:01       ` Jason Gunthorpe
@ 2019-07-07 23:30       ` Stephen Rothwell
  2019-07-08 14:09         ` Jason Gunthorpe
  2019-07-08 15:26         ` Kuehling, Felix
  2 siblings, 2 replies; 15+ messages in thread
From: Stephen Rothwell @ 2019-07-07 23:30 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Kuehling, Felix, Jason Gunthorpe, Yang, Philip, Dave Airlie,
	dri-devel, linux-mm, linux-next, Deucher, Alexander

[-- Attachment #1: Type: text/plain, Size: 3040 bytes --]

Hi all,

On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Wed, Jul 3, 2019 at 5:03 PM Kuehling, Felix <Felix.Kuehling@amd.com> wrote:
> >
> > On 2019-07-03 10:10 a.m., Jason Gunthorpe wrote:  
> > > On Wed, Jul 03, 2019 at 01:55:08AM +0000, Kuehling, Felix wrote:  
> > >> From: Philip Yang <Philip.Yang@amd.com>
> > >>
> > >> In order to pass mirror instead of mm to hmm_range_register, we need
> > >> pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
> > >> is part of amdgpu_mn structure, which is accessible from bo.
> > >>
> > >> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> > >> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > >> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > >> CC: Stephen Rothwell <sfr@canb.auug.org.au>
> > >> CC: Jason Gunthorpe <jgg@mellanox.com>
> > >> CC: Dave Airlie <airlied@linux.ie>
> > >> CC: Alex Deucher <alexander.deucher@amd.com>
> > >> ---
> > >>   drivers/gpu/drm/Kconfig                          |  1 -
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
> > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
> > >>   8 files changed, 30 insertions(+), 11 deletions(-)  
> > > This is too big to use as a conflict resolution, what you could do is
> > > apply the majority of the patch on top of your tree as-is (ie keep
> > > using the old hmm_range_register), then the conflict resolution for
> > > the updated AMD GPU tree can be a simple one line change:
> > >
> > >   -   hmm_range_register(range, mm, start,
> > >   +   hmm_range_register(range, mirror, start,
> > >                          start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
> > >
> > > Which is trivial for everone to deal with, and solves the problem.  
> >
> > Good idea.

With the changes added to the amdgpu tree over the weekend, I will
apply the following merge fix patch to the hmm merge today:

From: Philip Yang <Philip.Yang@amd.com>
Sibject: drm/amdgpu: adopt to hmm_range_register API change

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -783,7 +783,7 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
 				0 : range->flags[HMM_PFN_WRITE];
 	range->pfn_flags_mask = 0;
 	range->pfns = pfns;
-	hmm_range_register(range, mm, start,
+	hmm_range_register(range, mirror, start,
 			   start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
 
 retry:

And someone just needs to make sure Linus is aware of this needed merge fix.
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-07 23:30       ` Stephen Rothwell
@ 2019-07-08 14:09         ` Jason Gunthorpe
  2019-07-08 15:26         ` Kuehling, Felix
  1 sibling, 0 replies; 15+ messages in thread
From: Jason Gunthorpe @ 2019-07-08 14:09 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Alex Deucher, Kuehling, Felix, Yang, Philip, Dave Airlie,
	dri-devel, linux-mm, linux-next, Deucher, Alexander

On Mon, Jul 08, 2019 at 09:30:20AM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <alexdeucher@gmail.com> wrote:
> >
> > On Wed, Jul 3, 2019 at 5:03 PM Kuehling, Felix <Felix.Kuehling@amd.com> wrote:
> > >
> > > On 2019-07-03 10:10 a.m., Jason Gunthorpe wrote:  
> > > > On Wed, Jul 03, 2019 at 01:55:08AM +0000, Kuehling, Felix wrote:  
> > > >> From: Philip Yang <Philip.Yang@amd.com>
> > > >>
> > > >> In order to pass mirror instead of mm to hmm_range_register, we need
> > > >> pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
> > > >> is part of amdgpu_mn structure, which is accessible from bo.
> > > >>
> > > >> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> > > >> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > > >> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > > >> CC: Stephen Rothwell <sfr@canb.auug.org.au>
> > > >> CC: Jason Gunthorpe <jgg@mellanox.com>
> > > >> CC: Dave Airlie <airlied@linux.ie>
> > > >> CC: Alex Deucher <alexander.deucher@amd.com>
> > > >>   drivers/gpu/drm/Kconfig                          |  1 -
> > > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
> > > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
> > > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
> > > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
> > > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
> > > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
> > > >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
> > > >>   8 files changed, 30 insertions(+), 11 deletions(-)  
> > > > This is too big to use as a conflict resolution, what you could do is
> > > > apply the majority of the patch on top of your tree as-is (ie keep
> > > > using the old hmm_range_register), then the conflict resolution for
> > > > the updated AMD GPU tree can be a simple one line change:
> > > >
> > > >   -   hmm_range_register(range, mm, start,
> > > >   +   hmm_range_register(range, mirror, start,
> > > >                          start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
> > > >
> > > > Which is trivial for everone to deal with, and solves the problem.  
> > >
> > > Good idea.
> 
> With the changes added to the amdgpu tree over the weekend, I will
> apply the following merge fix patch to the hmm merge today:
> 
> From: Philip Yang <Philip.Yang@amd.com>
> Sibject: drm/amdgpu: adopt to hmm_range_register API change
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -783,7 +783,7 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
>  				0 : range->flags[HMM_PFN_WRITE];
>  	range->pfn_flags_mask = 0;
>  	range->pfns = pfns;
> -	hmm_range_register(range, mm, start,
> +	hmm_range_register(range, mirror, start,
>  			   start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
>  
>  retry:
> 
> And someone just needs to make sure Linus is aware of this needed merge fix.

Great, thanks everyone

Jason


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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-07 23:30       ` Stephen Rothwell
  2019-07-08 14:09         ` Jason Gunthorpe
@ 2019-07-08 15:26         ` Kuehling, Felix
  2019-07-08 15:35           ` Stephen Rothwell
  1 sibling, 1 reply; 15+ messages in thread
From: Kuehling, Felix @ 2019-07-08 15:26 UTC (permalink / raw)
  To: Stephen Rothwell, Alex Deucher
  Cc: Jason Gunthorpe, Yang, Philip, Dave Airlie, dri-devel, linux-mm,
	linux-next, Deucher, Alexander

On 2019-07-07 7:30 p.m., Stephen Rothwell wrote:
> Hi all,
>
> On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <alexdeucher@gmail.com> wrote:
>> On Wed, Jul 3, 2019 at 5:03 PM Kuehling, Felix <Felix.Kuehling@amd.com> wrote:
>>> On 2019-07-03 10:10 a.m., Jason Gunthorpe wrote:
>>>> On Wed, Jul 03, 2019 at 01:55:08AM +0000, Kuehling, Felix wrote:
>>>>> From: Philip Yang <Philip.Yang@amd.com>
>>>>>
>>>>> In order to pass mirror instead of mm to hmm_range_register, we need
>>>>> pass bo instead of ttm to amdgpu_ttm_tt_get_user_pages because mirror
>>>>> is part of amdgpu_mn structure, which is accessible from bo.
>>>>>
>>>>> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
>>>>> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
>>>>> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
>>>>> CC: Stephen Rothwell <sfr@canb.auug.org.au>
>>>>> CC: Jason Gunthorpe <jgg@mellanox.com>
>>>>> CC: Dave Airlie <airlied@linux.ie>
>>>>> CC: Alex Deucher <alexander.deucher@amd.com>
>>>>> ---
>>>>>    drivers/gpu/drm/Kconfig                          |  1 -
>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  5 ++---
>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  2 +-
>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          |  3 +--
>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c           |  8 ++++++++
>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h           |  5 +++++
>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c          | 12 ++++++++++--
>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h          |  5 +++--
>>>>>    8 files changed, 30 insertions(+), 11 deletions(-)
>>>> This is too big to use as a conflict resolution, what you could do is
>>>> apply the majority of the patch on top of your tree as-is (ie keep
>>>> using the old hmm_range_register), then the conflict resolution for
>>>> the updated AMD GPU tree can be a simple one line change:
>>>>
>>>>    -   hmm_range_register(range, mm, start,
>>>>    +   hmm_range_register(range, mirror, start,
>>>>                           start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
>>>>
>>>> Which is trivial for everone to deal with, and solves the problem.
>>> Good idea.
> With the changes added to the amdgpu tree over the weekend, I will
> apply the following merge fix patch to the hmm merge today:
>
> From: Philip Yang <Philip.Yang@amd.com>
> Sibject: drm/amdgpu: adopt to hmm_range_register API change
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -783,7 +783,7 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
>   				0 : range->flags[HMM_PFN_WRITE];
>   	range->pfn_flags_mask = 0;
>   	range->pfns = pfns;
> -	hmm_range_register(range, mm, start,
> +	hmm_range_register(range, mirror, start,
>   			   start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT);
>   
>   retry:
>
> And someone just needs to make sure Linus is aware of this needed merge fix.

Thank you! Who will be that someone? It should probably be one of the 
maintainers of the trees Linux pulls from ...

Regards,
   Felix



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

* Re: [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change
  2019-07-08 15:26         ` Kuehling, Felix
@ 2019-07-08 15:35           ` Stephen Rothwell
  0 siblings, 0 replies; 15+ messages in thread
From: Stephen Rothwell @ 2019-07-08 15:35 UTC (permalink / raw)
  To: Kuehling, Felix
  Cc: Alex Deucher, Jason Gunthorpe, Yang, Philip, Dave Airlie,
	dri-devel, linux-mm, linux-next, Deucher, Alexander

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

Hi Felix,

On Mon, 8 Jul 2019 15:26:22 +0000 "Kuehling, Felix" <Felix.Kuehling@amd.com> wrote:
>
> Thank you! Who will be that someone? It should probably be one of the 
> maintainers of the trees Linux pulls from ...

That would be Dave (pushing drm) or Jason (pushing hmm), or both.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-07-08 15:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03  1:55 [PATCH 1/1] drm/amdgpu: adopt to hmm_range_register API change Kuehling, Felix
2019-07-03  4:54 ` Stephen Rothwell
2019-07-03  8:30   ` Stephen Rothwell
2019-07-03 14:10 ` Jason Gunthorpe
2019-07-03 21:03   ` Kuehling, Felix
2019-07-03 21:09     ` Alex Deucher
2019-07-03 21:32       ` Stephen Rothwell
2019-07-03 23:11         ` Dave Airlie
2019-07-04  2:00           ` Jason Gunthorpe
2019-07-04  2:01       ` Jason Gunthorpe
2019-07-07 23:30       ` Stephen Rothwell
2019-07-08 14:09         ` Jason Gunthorpe
2019-07-08 15:26         ` Kuehling, Felix
2019-07-08 15:35           ` Stephen Rothwell
2019-07-03 21:33     ` Stephen Rothwell

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).