Skip to contentSkip to conversation

drm/amdgpu: reset kfd during amdgpu reset

PATCH In review Shaoyun Liu 4 participants 10 messages Jan 26, 2018 8 messages not in the archive

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

PATCH 3/3 drm/amdgpu: reset kfd during amdgpu reset

Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
 3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +19 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
 	return r;
 }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev)
+{
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev)
+{
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd)
+{
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);
+}
+
 int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
 				uint32_t vmid, uint64_t gpu_addr,
 				uint32_t *ib_cmd, uint32_t ib_len)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
index 7c36e52..230761f 100644
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
 bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
 			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
 /* Shared API */
 int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
 		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
index 94f837b..61e7d35 100644
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 	atomic_inc(&adev->gpu_reset_counter);
 	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
 	/* block TTM */
 	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
 	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
 	} else {
 		dev_info(adev->dev, "GPU reset(%d) successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
 	}
 
 	amdgpu_vf_error_trans_all(adev);
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1516988315-4114-1-git-send-email-Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 23 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
  3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +7 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
  	return r;
  }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev)
+{
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 258

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+{
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd)
+{
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 37 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
  int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
  				uint32_t vmid, uint64_t gpu_addr,
  				uint32_t *ib_cmd, uint32_t ib_len)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
index 7c36e52..230761f 100644
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
  bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
  			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
  /* Shared API */
  int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
  		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
index 94f837b..61e7d35 100644
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  	atomic_inc(&adev->gpu_reset_counter);
  	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
  	/* block TTM */
  	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
  	/* store modesetting */

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 2775

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
  	} else {
  		dev_info(adev->dev, "GPU reset(%d) successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
  	}
 
  	amdgpu_vf_error_trans_all(adev);

_______________________________________________
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): 29603b61-a57b-548e-46ae-f260c60d52bc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

If we did use force flag and amdgpu_gpu_recovery = 0 , the reset will be ignored . I'm kind of like this reset can go through like sriov . If we depends on the parameter amdgpu_gpu_recovery , it may think the GPU is hang and trigger the GPU reset when rocm submit some heavy compute stuff running and actually not hang .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 12:41 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 21 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
  3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
  	return r;
  }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 255

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 47 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
  int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
  				uint32_t vmid, uint64_t gpu_addr,
  				uint32_t *ib_cmd, uint32_t ib_len) diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 7c36e52..230761f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
  bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
  			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
  /* Shared API */
  int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
  		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va); diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94f837b..61e7d35 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  	atomic_inc(&adev->gpu_reset_counter);
  	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
  	/* block TTM */
  	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
  	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
  	} else {
  		dev_info(adev->dev, "GPU reset(%d) 
 successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
  	}
 
Quoted 1 line
  	amdgpu_vf_error_trans_all(adev);

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

#5 lore raw
In reply to Christian König

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

-----Original Message-----
From: Liu, Shaoyun
Sent: Friday, January 26, 2018 12:54 PM
To: Koenig, Christian; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

If we did use force flag and amdgpu_gpu_recovery = 0 , the reset will be ignored . I'm kind of like this reset can go through like sriov . If we depends on the parameter amdgpu_gpu_recovery , it may think the GPU is hang and trigger the GPU reset when rocm submit some heavy compute stuff running and actually not hang .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 12:41 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 21 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
  3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
  	return r;
  }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 255

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 47 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
  int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
  				uint32_t vmid, uint64_t gpu_addr,
  				uint32_t *ib_cmd, uint32_t ib_len) diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 7c36e52..230761f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
  bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
  			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
  /* Shared API */
  int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
  		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va); diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94f837b..61e7d35 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  	atomic_inc(&adev->gpu_reset_counter);
  	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
  	/* block TTM */
  	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
  	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
  	} else {
  		dev_info(adev->dev, "GPU reset(%d) 
 successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
  	}
 
Quoted 1 line
  	amdgpu_vf_error_trans_all(adev);

_______________________________________________
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): DM5PR12MB117930E809E8E97422D00088F4E00-2J9CzHegvk8p/[email protected]

#7 lore raw
Quoted 1 line

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

And exactly that is the intention here. So please use the false flag, apart from that the patch looks good to me.

Regards,
Christian.

Am 26.01.2018 um 18:56 schrieb Liu, Shaoyun:

Quoted 103 lines

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

-----Original Message-----
From: Liu, Shaoyun
Sent: Friday, January 26, 2018 12:54 PM
To: Koenig, Christian; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

If we did use force flag and amdgpu_gpu_recovery = 0 , the reset will be ignored . I'm kind of like this reset can go through like sriov . If we depends on the parameter amdgpu_gpu_recovery , it may think the GPU is hang and trigger the GPU reset when rocm submit some heavy compute stuff running and actually not hang .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 12:41 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 21 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
   3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
   	return r;
   }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 255

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 47 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
   int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
   				uint32_t vmid, uint64_t gpu_addr,
   				uint32_t *ib_cmd, uint32_t ib_len) diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 7c36e52..230761f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
   bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
   			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
   /* Shared API */
   int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
   		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va); diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94f837b..61e7d35 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
   	atomic_inc(&adev->gpu_reset_counter);
   	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
   	/* block TTM */
   	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
   	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
   		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
   	} else {
   		dev_info(adev->dev, "GPU reset(%d)
 successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
   	}
 
Quoted 1 line
Quoted 1 line
   	amdgpu_vf_error_trans_all(adev);

_______________________________________________
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): e36ecacb-4406-5c62-7f05-0a0873455473-5C7GfCeVMHo@public.gmane.org

#9 lore raw

Ok, the wrong hang detection when amdgpu_gpu_recovery is enabled may be another issue , we can fix it later .

Changed to 'false' flag as suggested and submitted .

Regards
Shaoyun.liu

-----Original Message-----
From: Koenig, Christian
Sent: Friday, January 26, 2018 1:28 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Quoted 1 line

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

And exactly that is the intention here. So please use the false flag, apart from that the patch looks good to me.

Regards,
Christian.

Am 26.01.2018 um 18:56 schrieb Liu, Shaoyun:

Quoted 103 lines

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

-----Original Message-----
From: Liu, Shaoyun
Sent: Friday, January 26, 2018 12:54 PM
To: Koenig, Christian; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

If we did use force flag and amdgpu_gpu_recovery = 0 , the reset will be ignored . I'm kind of like this reset can go through like sriov . If we depends on the parameter amdgpu_gpu_recovery , it may think the GPU is hang and trigger the GPU reset when rocm submit some heavy compute stuff running and actually not hang .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 12:41 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 21 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
   3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
   	return r;
   }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 255

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 47 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
   int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
   				uint32_t vmid, uint64_t gpu_addr,
   				uint32_t *ib_cmd, uint32_t ib_len) diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 7c36e52..230761f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
   bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
   			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
   /* Shared API */
   int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
   		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va); diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94f837b..61e7d35 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
   	atomic_inc(&adev->gpu_reset_counter);
   	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
   	/* block TTM */
   	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
   	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
   		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
   	} else {
   		dev_info(adev->dev, "GPU reset(%d) 
 successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
   	}
 
Quoted 1 line
Quoted 1 line
   	amdgpu_vf_error_trans_all(adev);

_______________________________________________
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): DM5PR12MB1179B5AA1BBE48B93DFDCAC8F4E00-2J9CzHegvk8p/[email protected]

#11 lore raw

Alternatively if you really want to add some distinction here you could add an enum like trigger source.

Something like manual, SRIOV host, GPU scheduler, KFD, interrupt etc... And then use the user configurable option as bitmask to enable/disable GPU recovery for each trigger source.

Regards,
Christian.

Am 26.01.2018 um 19:37 schrieb Liu, Shaoyun:

Quoted 124 lines

Ok, the wrong hang detection when amdgpu_gpu_recovery is enabled may be another issue , we can fix it later .

Changed to 'false' flag as suggested and submitted .

Regards
Shaoyun.liu

-----Original Message-----
From: Koenig, Christian
Sent: Friday, January 26, 2018 1:28 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Quoted 1 line

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

And exactly that is the intention here. So please use the false flag, apart from that the patch looks good to me.

Regards,
Christian.

Am 26.01.2018 um 18:56 schrieb Liu, Shaoyun:

Quoted 103 lines

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

-----Original Message-----
From: Liu, Shaoyun
Sent: Friday, January 26, 2018 12:54 PM
To: Koenig, Christian; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

If we did use force flag and amdgpu_gpu_recovery = 0 , the reset will be ignored . I'm kind of like this reset can go through like sriov . If we depends on the parameter amdgpu_gpu_recovery , it may think the GPU is hang and trigger the GPU reset when rocm submit some heavy compute stuff running and actually not hang .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 12:41 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 21 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
    3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
    	return r;
    }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 255

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 47 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
    int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
    				uint32_t vmid, uint64_t gpu_addr,
    				uint32_t *ib_cmd, uint32_t ib_len) diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 7c36e52..230761f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
    bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
    			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
    /* Shared API */
    int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
    		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va); diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94f837b..61e7d35 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
    	atomic_inc(&adev->gpu_reset_counter);
    	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
    	/* block TTM */
    	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
    	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
    		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
    	} else {
    		dev_info(adev->dev, "GPU reset(%d)
 successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
    	}
 
Quoted 5 lines
Quoted 1 line
Quoted 1 line
    	amdgpu_vf_error_trans_all(adev);

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

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

A message that is not in the archive (sent off-list or not yet received): 914ef1a4-8c0c-7450-4c4a-b874b45a7255-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#13 lore raw

It could be done in next step .
I just notice my change is based on amd-kfd-staging , I will add you as the reviewer again .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 1:42 PM
To: Liu, Shaoyun; Koenig, Christian; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Alternatively if you really want to add some distinction here you could add an enum like trigger source.

Something like manual, SRIOV host, GPU scheduler, KFD, interrupt etc...
And then use the user configurable option as bitmask to enable/disable GPU recovery for each trigger source.

Regards,
Christian.

Am 26.01.2018 um 19:37 schrieb Liu, Shaoyun:

Quoted 124 lines

Ok, the wrong hang detection when amdgpu_gpu_recovery is enabled may be another issue , we can fix it later .

Changed to 'false' flag as suggested and submitted .

Regards
Shaoyun.liu

-----Original Message-----
From: Koenig, Christian
Sent: Friday, January 26, 2018 1:28 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Quoted 1 line

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

And exactly that is the intention here. So please use the false flag, apart from that the patch looks good to me.

Regards,
Christian.

Am 26.01.2018 um 18:56 schrieb Liu, Shaoyun:

Quoted 103 lines

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

-----Original Message-----
From: Liu, Shaoyun
Sent: Friday, January 26, 2018 12:54 PM
To: Koenig, Christian; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

If we did use force flag and amdgpu_gpu_recovery = 0 , the reset will be ignored . I'm kind of like this reset can go through like sriov . If we depends on the parameter amdgpu_gpu_recovery , it may think the GPU is hang and trigger the GPU reset when rocm submit some heavy compute stuff running and actually not hang .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 12:41 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 21 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
    3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
    	return r;
    }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 255

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 47 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
    int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
    				uint32_t vmid, uint64_t gpu_addr,
    				uint32_t *ib_cmd, uint32_t ib_len) diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 7c36e52..230761f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
    bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
    			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
    /* Shared API */
    int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
    		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va); diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94f837b..61e7d35 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
    	atomic_inc(&adev->gpu_reset_counter);
    	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
    	/* block TTM */
    	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
    	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
    		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
    	} else {
    		dev_info(adev->dev, "GPU reset(%d) 
 successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
    	}
 
Quoted 5 lines
Quoted 1 line
Quoted 1 line
    	amdgpu_vf_error_trans_all(adev);

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

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

A message that is not in the archive (sent off-list or not yet received): DM5PR12MB1179D92470591323724ED01DF4E00-2J9CzHegvk8p/[email protected]

#15 lore raw

Hi Shaoyun,

As I'm upstreaming GPUVM support for KFD right now, a bunch of amdgpu_amdkfd_... changes are going to go through Oded's tree. To avoid conflicts when merging with Alex's tree, I'd recommend we don't submit your changes to amd-staging-drm-next.

Instead submit them to amd-kfd-staging, and I can take care of upstreaming them via Oded later.

We can still do code review on the amd-gfx mailing list to get valuable feedback.

Regards,
  Felix

Quoted 150 lines · Shaoyun

It could be done in next step .
I just notice my change is based on amd-kfd-staging , I will add you as the reviewer again .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 1:42 PM
To: Liu, Shaoyun; Koenig, Christian; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Alternatively if you really want to add some distinction here you could add an enum like trigger source.

Something like manual, SRIOV host, GPU scheduler, KFD, interrupt etc...
And then use the user configurable option as bitmask to enable/disable GPU recovery for each trigger source.

Regards,
Christian.

Am 26.01.2018 um 19:37 schrieb Liu, Shaoyun:

Quoted 124 lines

Ok, the wrong hang detection when amdgpu_gpu_recovery is enabled may be another issue , we can fix it later .

Changed to 'false' flag as suggested and submitted .

Regards
Shaoyun.liu

-----Original Message-----
From: Koenig, Christian
Sent: Friday, January 26, 2018 1:28 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Quoted 1 line

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

And exactly that is the intention here. So please use the false flag, apart from that the patch looks good to me.

Regards,
Christian.

Am 26.01.2018 um 18:56 schrieb Liu, Shaoyun:

Quoted 103 lines

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

-----Original Message-----
From: Liu, Shaoyun
Sent: Friday, January 26, 2018 12:54 PM
To: Koenig, Christian; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

If we did use force flag and amdgpu_gpu_recovery = 0 , the reset will be ignored . I'm kind of like this reset can go through like sriov . If we depends on the parameter amdgpu_gpu_recovery , it may think the GPU is hang and trigger the GPU reset when rocm submit some heavy compute stuff running and actually not hang .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 12:41 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 21 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
    3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
    	return r;
    }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 255

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 47 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
    int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
    				uint32_t vmid, uint64_t gpu_addr,
    				uint32_t *ib_cmd, uint32_t ib_len) diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 7c36e52..230761f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -0
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
    bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
    			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
    /* Shared API */
    int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
    		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va); diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94f837b..61e7d35 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
    	atomic_inc(&adev->gpu_reset_counter);
    	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
    	/* block TTM */
    	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
    	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
    		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
    	} else {
    		dev_info(adev->dev, "GPU reset(%d) 
 successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
    	}
 
Quoted 5 lines
Quoted 1 line
Quoted 1 line
    	amdgpu_vf_error_trans_all(adev);

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

Quoted 4 lines

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

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

A message that is not in the archive (sent off-list or not yet received): 3c803642-63ce-c01b-6a5e-7c1fb023c89a-5C7GfCeVMHo@public.gmane.org

#17 lore raw

Yes, understood . I already rebased the changes on amd-kfd-staging and add you and Christian as reviewer.

Regards
Shaoyun.liu

-----Original Message-----
From: Kuehling, Felix
Sent: Friday, January 26, 2018 2:47 PM
To: Liu, Shaoyun; Koenig, Christian; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Hi Shaoyun,

As I'm upstreaming GPUVM support for KFD right now, a bunch of amdgpu_amdkfd_... changes are going to go through Oded's tree. To avoid conflicts when merging with Alex's tree, I'd recommend we don't submit your changes to amd-staging-drm-next.

Instead submit them to amd-kfd-staging, and I can take care of upstreaming them via Oded later.

We can still do code review on the amd-gfx mailing list to get valuable feedback.

Regards,
  Felix

Quoted 150 lines · Shaoyun

It could be done in next step .
I just notice my change is based on amd-kfd-staging , I will add you as the reviewer again .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 1:42 PM
To: Liu, Shaoyun; Koenig, Christian; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Alternatively if you really want to add some distinction here you could add an enum like trigger source.

Something like manual, SRIOV host, GPU scheduler, KFD, interrupt etc...
And then use the user configurable option as bitmask to enable/disable GPU recovery for each trigger source.

Regards,
Christian.

Am 26.01.2018 um 19:37 schrieb Liu, Shaoyun:

Quoted 124 lines

Ok, the wrong hang detection when amdgpu_gpu_recovery is enabled may be another issue , we can fix it later .

Changed to 'false' flag as suggested and submitted .

Regards
Shaoyun.liu

-----Original Message-----
From: Koenig, Christian
Sent: Friday, January 26, 2018 1:28 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Quoted 1 line

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

And exactly that is the intention here. So please use the false flag, apart from that the patch looks good to me.

Regards,
Christian.

Am 26.01.2018 um 18:56 schrieb Liu, Shaoyun:

Quoted 103 lines

Sorry , I meant if I use the "false" flag and gpu_recovery is not enabled , the reset will be ignored.

-----Original Message-----
From: Liu, Shaoyun
Sent: Friday, January 26, 2018 12:54 PM
To: Koenig, Christian; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

If we did use force flag and amdgpu_gpu_recovery = 0 , the reset will be ignored . I'm kind of like this reset can go through like sriov . If we depends on the parameter amdgpu_gpu_recovery , it may think the GPU is hang and trigger the GPU reset when rocm submit some heavy compute stuff running and actually not hang .

Regards
Shaoyun.liu

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, January 26, 2018 12:41 PM
To: Liu, Shaoyun; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: reset kfd during amdgpu reset

Am 26.01.2018 um 18:38 schrieb Shaoyun Liu:

Quoted 21 lines
Change-Id I222f4bb2c9a91c7a4764e6aa706e7d7f2e6d948d
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 19 +++++++++++++++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  6 ++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 +++++
    3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +4 -0
index 2d99099..cb1ee26 100644
@@ -239,6 +239,25 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)
    	return r;
    }
 
+void amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->pre_reset(adev->kfd);
+}

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c int amdgpu_amdkfd_resume(struct amdgpu_device *adev) · line 255

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 -0
+
+void amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) {
+	if (adev->kfd)
+		kgd2kfd->post_reset(adev->kfd);
+}
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	amdgpu_device_gpu_recover(adev, NULL, true);

Use false for the force parameter here, apart from that the set looks good to me.

Regards,
Christian.

Quoted 47 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -0
+}
+
    int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
    				uint32_t vmid, uint64_t gpu_addr,
    				uint32_t *ib_cmd, uint32_t ib_len) diff --git 

a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 7c36e52..230761f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +6 -1
@@ -155,6 +155,12 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
    bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev,
    			u32 vmid);
 
+int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
+
+int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
+
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
    /* Shared API */
    int map_bo(struct amdgpu_device *rdev, uint64_t va, void *vm,
    		struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va); diff 
--git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 94f837b..61e7d35 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2660,6 +2660,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
    	atomic_inc(&adev->gpu_reset_counter);
    	adev->in_gpu_reset = 1;
 
+	/* Block kfd */
+	amdgpu_amdkfd_pre_reset(adev);
+
    	/* block TTM */
    	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
    	/* store modesetting */
@@ -2765,6 +2768,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
    		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
    	} else {
    		dev_info(adev->dev, "GPU reset(%d) 
 successed!\n",atomic_read(&adev->gpu_reset_counter));
+		/*unlock kfd after a successfully recovery*/
+		amdgpu_amdkfd_post_reset(adev);
    	}
 
Quoted 5 lines
Quoted 1 line
Quoted 1 line
    	amdgpu_vf_error_trans_all(adev);

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

Quoted 4 lines

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

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