Skip to contentSkip to conversation

drm/amdgpu: adopt to hmm_range_register API change

PATCH In review Kuehling, Felix 5 participants 15 messages Jul 3, 2019 – Jul 8, 2019

Subsystems (6)
lore
Share & tools
lore

Kuehling, Felix

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: adopt to hmm_range_register API change

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
---
 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(-)
drivers/gpu/drm/Kconfig +0 -1
index ee01afbbcd90..3313378c743b 100644
@@ -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
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +2 -3
index 0aa81456ec32..146700a51373 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index 37adce981fa3..e069de8b54e6 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -2
index 1f9f27061e2f..939f8305511b 100644
@@ -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;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +8 -0
index 623f56a1485f..80e40898a507 100644
@@ -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
  *
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h +5 -0
index f5b67c63ed6b..cb1678925415 100644
@@ -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
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +10 -2
index c9faa69cd677..c602c994cb95 100644
@@ -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:
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +3 -2
index c2b7669004ba..caa76c693700 100644
@@ -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;
 }
Signature · 6 lines
2.17.1

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

Hi all,

Quoted 14 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 10 lines
---
 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.

Signature · 2 lines
Cheers,
Stephen Rothwell

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

#2 lore raw

Hi all,

Quoted 27 lines · On Wed, 3 Jul 2019 14:54:43 +1000 Stephen Rothwell <[email protected]> wrote:
Quoted 14 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 10 lines
---
 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(-)  
Quoted 1 line

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

This (at least) build for me.

Signature · 2 lines
Cheers,
Stephen Rothwell

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

#3 lore raw
In reply to Kuehling, Felix
Quoted 13 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 10 lines
---
 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.

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +0 -0
index 623f56a1485f..80e40898a507 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev, · line 407

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +7 -0
@@ -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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#4 lore raw
Quoted 29 lines · Jason Gunthorpe
Quoted 13 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 10 lines
---
  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:

Quoted 5 lines

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

Quoted 2 lines

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.

Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +0 -0
index 623f56a1485f..80e40898a507 100644
@@ -398,6 +398,14 @@ struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
  	return ERR_PTR(r);
  }
 
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev, · line 407

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +7 -0
+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

Quoted 3 lines

Jason

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

#5 lore raw
Quoted 41 lines · Felix
Quoted 29 lines · Jason Gunthorpe
Quoted 13 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 10 lines
---
  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:

Quoted 5 lines

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

Quoted 1 line
Quoted 6 lines
Quoted 1 line

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

Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +0 -0
index 623f56a1485f..80e40898a507 100644
@@ -398,6 +398,14 @@ struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev,
     return ERR_PTR(r);
  }
 
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c struct amdgpu_mn *amdgpu_mn_get(struct amdgpu_device *adev, · line 407

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +7 -0
+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.

Quoted 8 lines

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

Quoted 10 lines

Regards,
Felix

Quoted 3 lines

Jason

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

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

#6 lore raw

Hi Alex,

Quoted 6 lines · On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <[email protected]> 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.

Signature · 2 lines
Cheers,
Stephen Rothwell
#14 lore raw
In reply to Kuehling, Felix

Hi Felix,

Quoted 5 lines · Felix

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.

Signature · 2 lines
Cheers,
Stephen Rothwell

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

maintainer
#7 lore raw
In reply to Stephen Rothwell
Quoted 11 lines · Stephen Rothwell

Hi Alex,

Quoted 6 lines · On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <[email protected]> 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

Quoted 6 lines

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.

Quoted 9 lines

Just supply Linus with a hint about the conflict resolution.

--
Cheers,
Stephen Rothwell
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

#8 lore raw
Quoted 19 lines · Dave Airlie
Quoted 11 lines · Stephen Rothwell

Hi Alex,

Quoted 6 lines · On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <[email protected]> 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

Quoted 6 lines

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.

Quoted 3 lines

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.

Quoted 2 lines

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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw
In reply to Alex Deucher
Quoted 48 lines · Alex Deucher
Quoted 40 lines · Felix
Quoted 28 lines · Jason Gunthorpe
Quoted 13 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 9 lines
  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:

Quoted 5 lines

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

Quoted 1 line
Quoted 6 lines
Quoted 1 line

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.

Quoted 5 lines

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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw
In reply to Alex Deucher

Hi all,

Quoted 33 lines · On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <[email protected]> wrote:
Quoted 31 lines · Felix
Quoted 29 lines · Jason Gunthorpe
Quoted 13 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 10 lines
---
  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:

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

- 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 <[email protected]>
Sibject: drm/amdgpu: adopt to hmm_range_register API change

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -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.

Signature · 2 lines
Cheers,
Stephen Rothwell

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

#11 lore raw
Quoted 62 lines · Stephen Rothwell

Hi all,

Quoted 32 lines · On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <[email protected]> wrote:
Quoted 30 lines · Felix
Quoted 28 lines · Jason Gunthorpe
Quoted 13 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 9 lines
  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:

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

- 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 <[email protected]>
Sibject: drm/amdgpu: adopt to hmm_range_register API change

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -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:
Quoted 1 line

And someone just needs to make sure Linus is aware of this needed merge fix.

Great, thanks everyone

Jason

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

author maintainer
#12 lore raw
In reply to Stephen Rothwell
Quoted 59 lines · Stephen Rothwell

Hi all,

Quoted 31 lines · On Wed, 3 Jul 2019 17:09:16 -0400 Alex Deucher <[email protected]> wrote:
Quoted 30 lines · Felix
Quoted 29 lines · Jason Gunthorpe
Quoted 13 lines · Felix

From: Philip Yang <[email protected]>

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.

CC Stephen Rothwell <[email protected]>
CC Jason Gunthorpe <[email protected]>
CC Dave Airlie <[email protected]>
CC Alex Deucher <[email protected]>
Quoted 10 lines
---
   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:

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

- 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 <[email protected]>
Sibject: drm/amdgpu: adopt to hmm_range_register API change

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -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:
Quoted 1 line

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

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