drm/amdgpu: add post reset IP callback
Subsystems (2)
PATCH 1/1 drm/amdgpu: add post reset IP callback
There are use cases which need full GPU functionality (e.g., VM update, TLB inavildate) when doing a GPU reset.
Especially, the mes/umsch self tests which help validate the hw state after hw init like ring/ib tests.
Add a post reset IP callback to handle such use cases which will be executed after GPU reset succeeds.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24 ++++++++++++++++++++++ drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +24 -0
@@ -5556,6 +5556,27 @@ static int amdgpu_device_health_check(struct list_head *device_list_handle)return ret; } +static int amdgpu_device_ip_post_reset (struct amdgpu_device *adev) +{ +uint32_t i; +int r; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid || + !adev->ip_blocks[i].version->funcs->post_reset) +continue ; + + r = adev->ip_blocks[i].version->funcs->post_reset (adev); +if (r) { +DRM_ERROR ("post reset of IP block <%s> failed %d\n" , + adev->ip_blocks[i].version->funcs->name, r); +return r; + } + } + +return r; +} +/** * amdgpu_device_gpu_recover - reset the asic and recover scheduler *
@@ -5805,6 +5826,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,amdgpu_put_xgmi_hive (hive); } +if (!r && !job_signaled) + r =amdgpu_device_ip_post_reset (adev); +if (r)dev_info (adev->dev,"GPU reset end with ret = %d\n" , r);
drivers/gpu/drm/amd/include/amd_shared.h +3 -0
@@ -287,6 +287,7 @@ enum amd_dpm_forced_level;* @pre_soft_reset: pre soft reset the IP block * @soft_reset: soft reset the IP block * @post_soft_reset: post soft reset the IP block +* @post_reset: handles IP specific post reset stuff(e.g., self test) * @set_clockgating_state: enable/disable cg for the IP block * @set_powergating_state: enable/disable pg for the IP block * @get_clockgating_state: get current clockgating status
@@ -316,11 +317,13 @@ struct amd_ip_funcs {int (*pre_soft_reset)(void *handle);int (*soft_reset)(void *handle);int (*post_soft_reset)(void *handle); +int (*post_reset)(void *handle);int (*set_clockgating_state)(void *handle,enum amd_clockgating_state state);int (*set_powergating_state)(void *handle,enum amd_powergating_state state);void (*get_clockgating_state)(void *handle,u64 *flags); + };
Signature · 1 line
2.25.1
Am 28.03.24 um 05:40 schrieb Lang Yu:
Quoted 5 lines
There are use cases which need full GPU functionality (e.g., VM update, TLB inavildate) when doing a GPU reset.
Especially, the mes/umsch self tests which help validate the hw state after hw init like ring/ib tests.
I noted that before but just to repeat it once more: We can't do any MES or UMSCH validation while doing a GPU reset!
The ring and IB tests use some pre-allocated memory we put aside for the task during driver load and so can execute during GPU reset as well.
But for the MES/UMSCH we need a full blown environment with VM and submission infrastructure and setting that up isn't possible here.
Adding Shashank as well, but I think we should probably just completely remove those from the kernel.
Regards,
Christian.
Quoted 78 lines
Add a post reset IP callback to handle such use cases which will be executed after GPU reset succeeds.
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24 ++++++++++++++++++++++ drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +24
-0@@ -5556,6 +5556,27 @@ static int amdgpu_device_health_check(struct list_head *device_list_handle)return ret; } +static int amdgpu_device_ip_post_reset (struct amdgpu_device *adev) +{ +uint32_t i; +int r; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid || + !adev->ip_blocks[i].version->funcs->post_reset) +continue ; + + r = adev->ip_blocks[i].version->funcs->post_reset (adev); +if (r) { +DRM_ERROR ("post reset of IP block <%s> failed %d\n" , + adev->ip_blocks[i].version->funcs->name, r); +return r; + } + } + +return r; +} +/** * amdgpu_device_gpu_recover - reset the asic and recover scheduler * @@ -5805,6 +5826,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,amdgpu_put_xgmi_hive (hive); } +if (!r && !job_signaled) + r =amdgpu_device_ip_post_reset (adev); +if (r)dev_info (adev->dev,"GPU reset end with ret = %d\n" , r);drivers/gpu/drm/amd/include/amd_shared.h +3
-0@@ -287,6 +287,7 @@ enum amd_dpm_forced_level;* @pre_soft_reset: pre soft reset the IP block * @soft_reset: soft reset the IP block * @post_soft_reset: post soft reset the IP block +* @post_reset: handles IP specific post reset stuff(e.g., self test) * @set_clockgating_state: enable/disable cg for the IP block * @set_powergating_state: enable/disable pg for the IP block * @get_clockgating_state: get current clockgating status @@ -316,11 +317,13 @@ struct amd_ip_funcs {int (*pre_soft_reset)(void *handle);int (*soft_reset)(void *handle);int (*post_soft_reset)(void *handle); +int (*post_reset)(void *handle);int (*set_clockgating_state)(void *handle,enum amd_clockgating_state state);int (*set_powergating_state)(void *handle,enum amd_powergating_state state);void (*get_clockgating_state)(void *handle,u64 *flags); + };
[AMD Official Use Only - General]
Quoted 10 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, April 2, 2024 9:38 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add post reset IP callbackAm 28.03.24 um 05:40 schrieb Lang Yu:
Quoted 8 lines
Quoted 5 lines
There are use cases which need full GPU functionality (e.g., VM update, TLB inavildate) when doing a GPU reset.
Especially, the mes/umsch self tests which help validate the hw state after hw init like ring/ib tests.
I noted that before but just to repeat it once more: We can't do any MES or UMSCH validation while doing a GPU reset!
Yes, we can just easily disable it if it doesn't work well.
But it doesn't take too much effort to make it work.
It can expose issues as soon as possible and is useful for debugging purpose.
Quoted 2 lines
The ring and IB tests use some pre-allocated memory we put aside for the task during driver load and so can execute during GPU reset as well.
If user space can create a VM and allocate memory during GPU reset, it makes no sense to prevent kernel space from doing that.
Quoted 2 lines
But for the MES/UMSCH we need a full blown environment with VM and submission infrastructure and setting that up isn't possible here.
At least for UMSCH test, it only uses VM mapping functionality (if we can create a VM with cpu update mode, that's enough), it doesn't use other submission functionality.
It is actually a compute context.
Regards,
Lang
Quoted 89 lines
Adding Shashank as well, but I think we should probably just completely remove those from the kernel.
Regards,
Christian.Quoted 7 lines
Add a post reset IP callback to handle such use cases which will be executed after GPU reset succeeds.
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_health_check(struct
Quoted 9 lines
drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -5556,6 +5556,27 @@ static int amdgpu_device_health_check(struct
list_head*device_list_handle)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0return ret; } +static int amdgpu_device_ip_post_reset (struct amdgpu_device *adev) { +uint32_t i;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_health_check(struct list_head *device_list_handle)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+int r; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid || + !adev->ip_blocks[i].version->funcs->post_reset) +continue ; + + r = adev->ip_blocks[i].version->funcs->post_reset (adev); +if (r) { + DRM_ERROR("post reset of IP block <%s>failed %d\n",
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+ adev->ip_blocks[i].version->funcs->name, r); +return r; + } + } + +return r; +} +/** * amdgpu_device_gpu_recover - reset the asic and recover scheduler * @@ -5805,6 +5826,9 @@ int amdgpu_device_gpu_recover(struct
amdgpu_device*adev,Quoted 36 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0amdgpu_put_xgmi_hive (hive); } +if (!r && !job_signaled) + r =amdgpu_device_ip_post_reset (adev); +if (r)dev_info (adev->dev,"GPU reset end with ret = %d\n" , r);drivers/gpu/drm/amd/include/amd_shared.h +4
-0@@ -287,6 +287,7 @@ enum amd_dpm_forced_level;* @pre_soft_reset: pre soft reset the IP block * @soft_reset: soft reset the IP block * @post_soft_reset: post soft reset the IP block +* @post_reset: handles IP specific post reset stuff(e.g., self test) * @set_clockgating_state: enable/disable cg for the IP block * @set_powergating_state: enable/disable pg for the IP block * @get_clockgating_state: get current clockgating status @@ -316,11 +317,13 @@ struct amd_ip_funcs { int (*pre_soft_reset)(void *handle); int (*soft_reset)(void *handle); int (*post_soft_reset)(void *handle); +int (*post_reset)(void *handle); int (*set_clockgating_state)(void *handle, enum amd_clockgating_state state); int (*set_powergating_state)(void *handle, enum amd_powergating_state state); void (*get_clockgating_state)(void *handle, u64 *flags); +};
Hey Lang,
Quoted 15 lines · Lang
[AMD Official Use Only - General]
Quoted 13 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, April 2, 2024 9:38 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add post reset IP callbackAm 28.03.24 um 05:40 schrieb Lang Yu:
Quoted 3 lines
There are use cases which need full GPU functionality (e.g., VM update, TLB inavildate) when doing a GPU reset.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Especially, the mes/umsch self tests which help validate the hw state after hw init like ring/ib tests.
I noted that before but just to repeat it once more: We can't do any MES or UMSCH validation while doing a GPU reset!
Yes, we can just easily disable it if it doesn't work well.
But it doesn't take too much effort to make it work.
It can expose issues as soon as possible and is useful for debugging purpose.
IMO, its not that useful for debugging as well. In case of a problem, It will just timeout waiting for MES packet write and we will still have to find out the actual problem which caused MES to go into bad state in the last GPU reset.
Quoted 5 lines
Quoted 3 lines
The ring and IB tests use some pre-allocated memory we put aside for the task during driver load and so can execute during GPU reset as well.
If user space can create a VM and allocate memory during GPU reset, it makes no sense to prevent kernel space from doing that.
I think the objection here is mostly about why to do it at all, when it is not helpful. It would be just a maintenance overhead.
- Shashank
Quoted 99 lines
Quoted 2 lines
But for the MES/UMSCH we need a full blown environment with VM and submission infrastructure and setting that up isn't possible here.
At least for UMSCH test, it only uses VM mapping functionality (if we can create a VM with cpu update mode, that's enough), it doesn't use other submission functionality.
It is actually a compute context.Regards,
LangQuoted 88 lines
Adding Shashank as well, but I think we should probably just completely remove those from the kernel.
Regards,
Christian.Quoted 6 lines
Add a post reset IP callback to handle such use cases which will be executed after GPU reset succeeds.
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_health_check(struct
Quoted 9 lines
drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -5556,6 +5556,27 @@ static int amdgpu_device_health_check(struct
list_head*device_list_handle)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0return ret; } +static int amdgpu_device_ip_post_reset (struct amdgpu_device *adev) { +uint32_t i;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_health_check(struct list_head *device_list_handle)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+int r; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid || + !adev->ip_blocks[i].version->funcs->post_reset) +continue ; + + r = adev->ip_blocks[i].version->funcs->post_reset (adev); +if (r) { + DRM_ERROR("post reset of IP block <%s>failed %d\n",
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+ adev->ip_blocks[i].version->funcs->name, r); +return r; + } + } + +return r; +} +/** * amdgpu_device_gpu_recover - reset the asic and recover scheduler * @@ -5805,6 +5826,9 @@ int amdgpu_device_gpu_recover(struct
amdgpu_device*adev,Quoted 36 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0amdgpu_put_xgmi_hive (hive); } +if (!r && !job_signaled) + r =amdgpu_device_ip_post_reset (adev); +if (r)dev_info (adev->dev,"GPU reset end with ret = %d\n" , r);drivers/gpu/drm/amd/include/amd_shared.h +4
-0@@ -287,6 +287,7 @@ enum amd_dpm_forced_level;* @pre_soft_reset: pre soft reset the IP block * @soft_reset: soft reset the IP block * @post_soft_reset: post soft reset the IP block +* @post_reset: handles IP specific post reset stuff(e.g., self test) * @set_clockgating_state: enable/disable cg for the IP block * @set_powergating_state: enable/disable pg for the IP block * @get_clockgating_state: get current clockgating status @@ -316,11 +317,13 @@ struct amd_ip_funcs { int (*pre_soft_reset)(void *handle); int (*soft_reset)(void *handle); int (*post_soft_reset)(void *handle); +int (*post_reset)(void *handle); int (*set_clockgating_state)(void *handle, enum amd_clockgating_state state); int (*set_powergating_state)(void *handle, enum amd_powergating_state state); void (*get_clockgating_state)(void *handle, u64 *flags); +};
[AMD Official Use Only - General]
Quoted 39 lines
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Wednesday, April 3, 2024 3:19 PM
To: Yu, Lang <[email protected]>; Christian König <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add post reset IP callbackHey Lang,
Quoted 15 lines · Lang
[AMD Official Use Only - General]
Quoted 13 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, April 2, 2024 9:38 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add post reset IP callbackAm 28.03.24 um 05:40 schrieb Lang Yu:
Quoted 3 lines
There are use cases which need full GPU functionality (e.g., VM update, TLB inavildate) when doing a GPU reset.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Especially, the mes/umsch self tests which help validate the hw state after hw init like ring/ib tests.
I noted that before but just to repeat it once more: We can't do any MES or UMSCH validation while doing a GPU reset!
Yes, we can just easily disable it if it doesn't work well. But it doesn't take too much effort to make it work.
It can expose issues as soon as possible and is useful for debuggingpurpose.
IMO, its not that useful for debugging as well. In case of a problem, It will just timeout waiting for MES packet write and we will still have to find out the actual problem which caused MES to go into bad state in the last GPU reset.Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
The ring and IB tests use some pre-allocated memory we put aside for the task during driver load and so can execute during GPU reset as well.
If user space can create a VM and allocate memory during GPU reset, it makes no sense to prevent kernel space from doing that.
I think the objection here is mostly about why to do it at all, when it is not helpful. It would be just a maintenance overhead.
If you think it is not helpful, why doing ring/ib tests? I don't think such sanity test is not helpful.
I only talk UMSCH test(different with MES test) here, I don't think it has a maintenance overhead.
Regards,
Lang
Quoted 105 lines
- Shashank
Quoted 27 lines
Quoted 2 lines
But for the MES/UMSCH we need a full blown environment with VM and submission infrastructure and setting that up isn't possible here.
At least for UMSCH test, it only uses VM mapping functionality (if we can create a VM with cpu update mode, that's enough), it doesn't use other submission functionality.
It is actually a compute context.Regards,
LangQuoted 16 lines
Adding Shashank as well, but I think we should probably just completely remove those from the kernel.
Regards,
Christian.Quoted 6 lines
Add a post reset IP callback to handle such use cases which will be executed after GPU reset succeeds.
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24++++++++++++++++++++++
Quoted 3 lines
drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 27 insertions(+)Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -5556,6 +5556,27 @@ static intamdgpu_device_health_check(struct
Quoted 69 lines
Quoted 69 lines
list_head*device_list_handle)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0return ret; } +static int amdgpu_device_ip_post_reset (struct amdgpu_device *adev) { +uint32_t i;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_health_check(struct list_head *device_list_handle)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+int r; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid || + !adev->ip_blocks[i].version->funcs->post_reset) +continue ; + + r = adev->ip_blocks[i].version->funcs->post_reset (adev); +if (r) { + DRM_ERROR("post reset of IP block <%s>failed %d\n",
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+ adev->ip_blocks[i].version->funcs->name, r); +return r; + } + } + +return r; +} +/** * amdgpu_device_gpu_recover - reset the asic and recover scheduler * @@ -5805,6 +5826,9 @@ int amdgpu_device_gpu_recover(struct
amdgpu_device*adev,Quoted 39 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0amdgpu_put_xgmi_hive (hive); } +if (!r && !job_signaled) + r =amdgpu_device_ip_post_reset (adev); +if (r)dev_info (adev->dev,"GPU reset end with ret = %d\n" , r);drivers/gpu/drm/amd/include/amd_shared.h +5
-1@@ -287,6 +287,7 @@ enum amd_dpm_forced_level;* @pre_soft_reset: pre soft reset the IP block * @soft_reset: soft reset the IP block * @post_soft_reset: post soft reset the IP block +* @post_reset: handles IP specific post reset stuff(e.g., self +test) * @set_clockgating_state: enable/disable cg for the IP block * @set_powergating_state: enable/disable pg for the IP block * @get_clockgating_state: get current clockgating status @@ -316,11 +317,13 @@ struct amd_ip_funcs { int (*pre_soft_reset)(void *handle); int (*soft_reset)(void *handle); int (*post_soft_reset)(void *handle); +int (*post_reset)(void *handle); int (*set_clockgating_state)(void *handle, enum amd_clockgating_state state); int (*set_powergating_state)(void *handle, enum amd_powergating_state state); void (*get_clockgating_state)(void *handle, u64 *flags); +};
Quoted 40 lines · Lang
[AMD Official Use Only - General]
Quoted 38 lines
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Wednesday, April 3, 2024 3:19 PM
To: Yu, Lang <[email protected]>; Christian König <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add post reset IP callbackHey Lang,
Quoted 15 lines · Lang
[AMD Official Use Only - General]
Quoted 13 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, April 2, 2024 9:38 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add post reset IP callbackAm 28.03.24 um 05:40 schrieb Lang Yu:
Quoted 3 lines
There are use cases which need full GPU functionality (e.g., VM update, TLB inavildate) when doing a GPU reset.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Especially, the mes/umsch self tests which help validate the hw state after hw init like ring/ib tests.
I noted that before but just to repeat it once more: We can't do any MES or UMSCH validation while doing a GPU reset!
Yes, we can just easily disable it if it doesn't work well. But it doesn't take too much effort to make it work.
It can expose issues as soon as possible and is useful for debuggingpurpose.
IMO, its not that useful for debugging as well. In case of a problem, It will just timeout waiting for MES packet write and we will still have to find out the actual problem which caused MES to go into bad state in the last GPU reset.
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
The ring and IB tests use some pre-allocated memory we put aside for the task during driver load and so can execute during GPU reset as well.
If user space can create a VM and allocate memory during GPU reset, it makes no sense to prevent kernel space from doing that.
I think the objection here is mostly about why to do it at all, when it is not helpful. It would be just a maintenance overhead.
If you think it is not helpful, why doing ring/ib tests?
That's because they add value during the bootup, when we know that the HW is being initialized in a controlled/systematic way. But in case of a GPU reset, it could go anyway and could be neither of those.
Quoted 3 lines
I don't think such sanity test is not helpful.
I only talk UMSCH test(different with MES test) here,
Your comment above about ring tests talks about both MES/UMSCH self tests, so it attracts attention on both.
If its only about UMSCH tests, I will let someone else to comment on that.
- Shashank
Quoted 110 lines
I don't think it has a maintenance overhead.
Regards,
LangQuoted 105 lines
- Shashank
Quoted 27 lines
Quoted 2 lines
But for the MES/UMSCH we need a full blown environment with VM and submission infrastructure and setting that up isn't possible here.
At least for UMSCH test, it only uses VM mapping functionality (if we can create a VM with cpu update mode, that's enough), it doesn't use other submission functionality.
It is actually a compute context.Regards,
LangQuoted 16 lines
Adding Shashank as well, but I think we should probably just completely remove those from the kernel.
Regards,
Christian.Quoted 6 lines
Add a post reset IP callback to handle such use cases which will be executed after GPU reset succeeds.
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24++++++++++++++++++++++
Quoted 3 lines
drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 27 insertions(+)Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -5556,6 +5556,27 @@ static intamdgpu_device_health_check(struct
Quoted 69 lines
Quoted 69 lines
list_head*device_list_handle)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0return ret; } +static int amdgpu_device_ip_post_reset (struct amdgpu_device *adev) { +uint32_t i;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_health_check(struct list_head *device_list_handle)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+int r; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid || + !adev->ip_blocks[i].version->funcs->post_reset) +continue ; + + r = adev->ip_blocks[i].version->funcs->post_reset (adev); +if (r) { + DRM_ERROR("post reset of IP block <%s>failed %d\n",
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+ adev->ip_blocks[i].version->funcs->name, r); +return r; + } + } + +return r; +} +/** * amdgpu_device_gpu_recover - reset the asic and recover scheduler * @@ -5805,6 +5826,9 @@ int amdgpu_device_gpu_recover(struct
amdgpu_device*adev,Quoted 39 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0amdgpu_put_xgmi_hive (hive); } +if (!r && !job_signaled) + r =amdgpu_device_ip_post_reset (adev); +if (r)dev_info (adev->dev,"GPU reset end with ret = %d\n" , r);drivers/gpu/drm/amd/include/amd_shared.h +5
-1@@ -287,6 +287,7 @@ enum amd_dpm_forced_level;* @pre_soft_reset: pre soft reset the IP block * @soft_reset: soft reset the IP block * @post_soft_reset: post soft reset the IP block +* @post_reset: handles IP specific post reset stuff(e.g., self +test) * @set_clockgating_state: enable/disable cg for the IP block * @set_powergating_state: enable/disable pg for the IP block * @get_clockgating_state: get current clockgating status @@ -316,11 +317,13 @@ struct amd_ip_funcs { int (*pre_soft_reset)(void *handle); int (*soft_reset)(void *handle); int (*post_soft_reset)(void *handle); +int (*post_reset)(void *handle); int (*set_clockgating_state)(void *handle, enum amd_clockgating_state state); int (*set_powergating_state)(void *handle, enum amd_powergating_state state); void (*get_clockgating_state)(void *handle, u64 *flags); +};
Am 03.04.24 um 08:51 schrieb Yu, Lang:
Quoted 15 lines
[AMD Official Use Only - General]
Quoted 13 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, April 2, 2024 9:38 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add post reset IP callbackAm 28.03.24 um 05:40 schrieb Lang Yu:
Quoted 3 lines
There are use cases which need full GPU functionality (e.g., VM update, TLB inavildate) when doing a GPU reset.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Especially, the mes/umsch self tests which help validate the hw state after hw init like ring/ib tests.
I noted that before but just to repeat it once more: We can't do any MES or UMSCH validation while doing a GPU reset!
Yes, we can just easily disable it if it doesn't work well. But it doesn't take too much effort to make it work.
No, that is a completely false assumption. This is a fundamental problem.
Neither the MES test nor the UMSCH test will ever work correctly under a GPU reset.
Quoted 6 lines
It can expose issues as soon as possible and is useful for debugging purpose.
Quoted 2 lines
The ring and IB tests use some pre-allocated memory we put aside for the task during driver load and so can execute during GPU reset as well.
If user space can create a VM and allocate memory during GPU reset, it makes no sense to prevent kernel space from doing that.
Yes it does. The GPU reset must re-start the hardware as soon as possible because memory management might wait on it.
You can create a VM and allocate memory, but this must be independent of the GPU reset.
And when you do this it is not valuable any more since we can't say that the GPU reset hasn't worked later on.
Quoted 7 lines
Quoted 3 lines
But for the MES/UMSCH we need a full blown environment with VM and submission infrastructure and setting that up isn't possible here.
At least for UMSCH test, it only uses VM mapping functionality (if we can create a VM with cpu update mode, that's enough), it doesn't use other submission functionality.
It is actually a compute context.
Nope, that doesn't even remotely work correctly.
Regards,
Christian.
Quoted 93 lines
Regards,
LangQuoted 88 lines
Adding Shashank as well, but I think we should probably just completely remove those from the kernel.
Regards,
Christian.Quoted 6 lines
Add a post reset IP callback to handle such use cases which will be executed after GPU reset succeeds.
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_health_check(struct
Quoted 9 lines
drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -5556,6 +5556,27 @@ static int amdgpu_device_health_check(struct
list_head*device_list_handle)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0return ret; } +static int amdgpu_device_ip_post_reset (struct amdgpu_device *adev) { +uint32_t i;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_health_check(struct list_head *device_list_handle)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+int r; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid || + !adev->ip_blocks[i].version->funcs->post_reset) +continue ; + + r = adev->ip_blocks[i].version->funcs->post_reset (adev); +if (r) { + DRM_ERROR("post reset of IP block <%s>failed %d\n",
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+ adev->ip_blocks[i].version->funcs->name, r); +return r; + } + } + +return r; +} +/** * amdgpu_device_gpu_recover - reset the asic and recover scheduler * @@ -5805,6 +5826,9 @@ int amdgpu_device_gpu_recover(struct
amdgpu_device*adev,Quoted 36 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0amdgpu_put_xgmi_hive (hive); } +if (!r && !job_signaled) + r =amdgpu_device_ip_post_reset (adev); +if (r)dev_info (adev->dev,"GPU reset end with ret = %d\n" , r);drivers/gpu/drm/amd/include/amd_shared.h +4
-0@@ -287,6 +287,7 @@ enum amd_dpm_forced_level;* @pre_soft_reset: pre soft reset the IP block * @soft_reset: soft reset the IP block * @post_soft_reset: post soft reset the IP block +* @post_reset: handles IP specific post reset stuff(e.g., self test) * @set_clockgating_state: enable/disable cg for the IP block * @set_powergating_state: enable/disable pg for the IP block * @get_clockgating_state: get current clockgating status @@ -316,11 +317,13 @@ struct amd_ip_funcs { int (*pre_soft_reset)(void *handle); int (*soft_reset)(void *handle); int (*post_soft_reset)(void *handle); +int (*post_reset)(void *handle); int (*set_clockgating_state)(void *handle, enum amd_clockgating_state state); int (*set_powergating_state)(void *handle, enum amd_powergating_state state); void (*get_clockgating_state)(void *handle, u64 *flags); +};