drm/amdgpu/nv: add navi GPU reset handler
Subsystems (2)
PATCH 4/4 drm/amdgpu/nv: add navi GPU reset handler
From 899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4 Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler
This patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
--- drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/amd/amdgpu/nv.c +28 -0
@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ +int r =0 , i; + +/* original raven doesn't have full asic reset */ +if ((adev->apu_flags &AMD_APU_IS_RAVEN ) && + !(adev->apu_flags &AMD_APU_IS_RAVEN2 )) +return ; +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid) +continue ; +if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) +continue ; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps (adev); + +if (r) +DRM_ERROR ("reset_reg_dumps of IP block <%s> failed %d\n" , + adev->ip_blocks[i].version->funcs->name, r); + } + +/* Schedule work to send uevent */ +if (!queue_work (system_unbound_wq, &adev->gpu_reset_work)) +DRM_ERROR ("failed to add GPU reset work\n" ); + +dump_stack (); +} +static int nv_asic_reset (struct amdgpu_device *adev) {int ret =0 ; +amdgpu_reset_dumps (adev);switch (nv_asic_reset_method (adev)) {case AMD_RESET_METHOD_PCI :dev_info (adev->dev,"PCI reset\n" );
Signature · 1 line
2.32.0
Quoted 46 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/nv.c +22
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps(adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed %d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work))
drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device *adev) · line 562
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/nv.c +6
-0+ DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev);
Had a comment on this before. Now there are different reasons (or even no reason like a precautionary reset) to perform reset. A user would be interested in a trace only if the reason is valid.
To clarify on why a work shouldn't be scheduled on every reset, check here -
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c#L2188
Thanks,
Lijo
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/nv.c +0
-0switch (nv_asic_reset_method(adev)) { case AMD_RESET_METHOD_PCI: dev_info(adev->dev, "PCI reset\n");
Hey Lijo,
I somehow missed to respond on this comment, pls find inline:
Regards
Shashank
Quoted 58 lines · Lijo
Quoted 55 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++1 file changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/nv.c +27
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps(adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed %d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work)) + DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0;
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device *adev) · line 562
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/nv.c +1
-0+ amdgpu_reset_dumps(adev);Had a comment on this before. Now there are different reasons (or even no reason like a precautionary reset) to perform reset. A user would be interested in a trace only if the reason is valid.
To clarify on why a work shouldn't be scheduled on every reset, check here -
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c#L2188
In the example you pointed to, they have a criteria to decide what is a valid reset in their context, in the kernel side itself. So they can take a call if they want to do something about it or not.
But, in our case, we want to send the trace_event to user with some register values on every reset, and it is actually up to the profiling app to interpret (along with what it wants to call a GPU reset). So I don't think this is causing a considerable overhead.
- Shashank
Quoted 9 lines
Thanks,
LijoQuoted 3 lines
drivers/gpu/drm/amd/amdgpu/nv.c +0
-0switch (nv_asic_reset_method(adev)) {case
AMD_RESET_METHOD_PCI:
dev_info(adev->dev, "PCI reset\n");
[AMD Official Use Only]
To explain more -
It's an unconditional reset done by the kernel on every suspend (S3/S4). In such a case which process is going to receive the trace events?
Most likely use case would be related to gpu recovery. Triggering a trace on every reset doesn't look like a good idea.
Thanks,
Lijo
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:09 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler
Hey Lijo,
I somehow missed to respond on this comment, pls find inline:
Regards
Shashank
Quoted 68 lines · Lijo
Quoted 50 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++1 file changed, 28 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex01efda4398e5..ada35d4c5245100644drivers/gpu/drm/amd/amdgpu/nv.c +23
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) { + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = +adev->ip_blocks[i].version->funcs->reset_reg_dumps (adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed +%d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work))drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device · line 564
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/nv.c +6
-0+ DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev);Had a comment on this before. Now there are different reasons (or even no reason like a precautionary reset) to perform reset. A user would be interested in a trace only if the reason is valid.
Quoted 5 lines
To clarify on why a work shouldn't be scheduled on every reset, check here -
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/amd
gpu/amdgpu_drv.c#L2188
In the example you pointed to, they have a criteria to decide what is a valid reset in their context, in the kernel side itself. So they can take a call if they want to do something about it or not.
But, in our case, we want to send the trace_event to user with some register values on every reset, and it is actually up to the profiling app to interpret (along with what it wants to call a GPU reset). So I don't think this is causing a considerable overhead.
- Shashank
Quoted 9 lines
Thanks,
LijoQuoted 3 lines
drivers/gpu/drm/amd/amdgpu/nv.c +0
-0switch (nv_asic_reset_method(adev)) {case
AMD_RESET_METHOD_PCI:
dev_info(adev->dev, "PCI reset\n");
Quoted 7 lines · Lijo
[AMD Official Use Only]
To explain more -
It's an unconditional reset done by the kernel on every suspend (S3/S4). In such a case which process is going to receive the trace events?Most likely use case would be related to gpu recovery. Triggering a trace on every reset doesn't look like a good idea.
If you observer carefully, we are just providing an infrastructure, the application's intention is unknown to us. In my opinion it's rather not a good idea to apply a filter in kernel, with our interpretation of intention.
For example if an app just wants to count how many resets are happening due to S3/S4 transition, this infra might become useless. It would rather be a better idea for the app to learn and ignore these scenarios which it is not interested in.
This could eventually be just difference in design philosophy maybe :)
- Shashank
Quoted 104 lines
Thanks,
Lijo-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:09 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerHey Lijo,
I somehow missed to respond on this comment, pls find inline:Regards
ShashankQuoted 68 lines · Lijo
Quoted 50 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00
2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex01efda4398e5..ada35d4c5245100644drivers/gpu/drm/amd/amdgpu/nv.c +23
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) { + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = +adev->ip_blocks[i].version->funcs->reset_reg_dumps (adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed +%d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work))drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device · line 564
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/nv.c +6
-0+ DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev);Had a comment on this before. Now there are different reasons (or even no reason like a precautionary reset) to perform reset. A user would be interested in a trace only if the reason is valid.
Quoted 5 lines
To clarify on why a work shouldn't be scheduled on every reset, check here -
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/amd
gpu/amdgpu_drv.c#L2188In the example you pointed to, they have a criteria to decide what is a valid reset in their context, in the kernel side itself. So they can take a call if they want to do something about it or not.
But, in our case, we want to send the
trace_eventto user with some register values on every reset, and it is actually up to the profiling app to interpret (along with what it wants to call a GPU reset). So I don't think this is causing a considerable overhead.- Shashank
Quoted 9 lines
Thanks,
LijoQuoted 3 lines
drivers/gpu/drm/amd/amdgpu/nv.c +0
-0switch (nv_asic_reset_method(adev)) { case AMD_RESET_METHOD_PCI: dev_info(adev->dev, "PCI reset\n");
[Public]
The problem is app doesn't know why the reset happened. It just receives a bunch of registers to be read. On what basis an app can filter this out?
Thanks,
Lijo
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:29 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler
Quoted 7 lines · Lijo
[AMD Official Use Only]
To explain more -
It's an unconditional reset done by the kernel on every suspend (S3/S4). In such a case which process is going to receive the trace events?Most likely use case would be related to gpu recovery. Triggering a trace on every reset doesn't look like a good idea.
If you observer carefully, we are just providing an infrastructure, the application's intention is unknown to us. In my opinion it's rather not a good idea to apply a filter in kernel, with our interpretation of intention.
For example if an app just wants to count how many resets are happening due to S3/S4 transition, this infra might become useless. It would rather be a better idea for the app to learn and ignore these scenarios which it is not interested in.
This could eventually be just difference in design philosophy maybe :)
- Shashank
Quoted 107 lines
Thanks,
Lijo-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:09 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerHey Lijo,
I somehow missed to respond on this comment, pls find inline:Regards
ShashankQuoted 68 lines · Lijo
Quoted 50 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00
2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex01efda4398e5..ada35d4c5245100644drivers/gpu/drm/amd/amdgpu/nv.c +23
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) { + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = +adev->ip_blocks[i].version->funcs->reset_reg_dumps (adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed +%d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work))drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device · line 564
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/nv.c +6
-0+ DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev);Had a comment on this before. Now there are different reasons (or even no reason like a precautionary reset) to perform reset. A user would be interested in a trace only if the reason is valid.
Quoted 6 lines
To clarify on why a work shouldn't be scheduled on every reset, check here -
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/am
d
gpu/amdgpu_drv.c#L2188In the example you pointed to, they have a criteria to decide what is a valid reset in their context, in the kernel side itself. So they can take a call if they want to do something about it or not.
But, in our case, we want to send the
trace_eventto user with some register values on every reset, and it is actually up to the profiling app to interpret (along with what it wants to call a GPU reset). So I don't think this is causing a considerable overhead.- Shashank
Quoted 9 lines
Thanks,
LijoQuoted 3 lines
drivers/gpu/drm/amd/amdgpu/nv.c +0
-0switch (nv_asic_reset_method(adev)) { case AMD_RESET_METHOD_PCI: dev_info(adev->dev, "PCI reset\n");
Quoted 4 lines · Lijo
[Public]
The problem is app doesn't know why the reset happened. It just receives a bunch of registers to be read. On what basis an app can filter this out?
Again, that is contextual analysis capability, which needs to be embedded in the reader app. Even if we filter out the S3/S4 resets in the kernel, the situation remains the same, isn't it ?
- Shashank
Quoted 136 lines
Thanks,
Lijo-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:29 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerQuoted 7 lines · Lijo
[AMD Official Use Only]
To explain more -
It's an unconditional reset done by the kernel on every suspend (S3/S4). In such a case which process is going to receive the trace events?Most likely use case would be related to gpu recovery. Triggering a trace on every reset doesn't look like a good idea.
If you observer carefully, we are just providing an infrastructure, the application's intention is unknown to us. In my opinion it's rather not a good idea to apply a filter in kernel, with our interpretation of intention.
For example if an app just wants to count how many resets are happening due to S3/S4 transition, this infra might become useless. It would rather be a better idea for the app to learn and ignore these scenarios which it is not interested in.
This could eventually be just difference in design philosophy maybe :)
- Shashank
Quoted 107 lines
Thanks,
Lijo-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:09 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerHey Lijo,
I somehow missed to respond on this comment, pls find inline:Regards
ShashankQuoted 68 lines · Lijo
Quoted 50 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00
2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex01efda4398e5..ada35d4c5245100644drivers/gpu/drm/amd/amdgpu/nv.c +23
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) { + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = +adev->ip_blocks[i].version->funcs->reset_reg_dumps (adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed +%d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work))drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device · line 564
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/nv.c +6
-0+ DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev);Had a comment on this before. Now there are different reasons (or even no reason like a precautionary reset) to perform reset. A user would be interested in a trace only if the reason is valid.
Quoted 6 lines
To clarify on why a work shouldn't be scheduled on every reset, check here -
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/am
d
gpu/amdgpu_drv.c#L2188In the example you pointed to, they have a criteria to decide what is a valid reset in their context, in the kernel side itself. So they can take a call if they want to do something about it or not.
But, in our case, we want to send the
trace_eventto user with some register values on every reset, and it is actually up to the profiling app to interpret (along with what it wants to call a GPU reset). So I don't think this is causing a considerable overhead.- Shashank
Quoted 9 lines
Thanks,
LijoQuoted 3 lines
drivers/gpu/drm/amd/amdgpu/nv.c +0
-0switch (nv_asic_reset_method(adev)) { case AMD_RESET_METHOD_PCI: dev_info(adev->dev, "PCI reset\n");
[AMD Official Use Only]
No, otherwise driver reset only for GPU recovery purpose. S3/S4 is not meant for recovery purpose. It's just a precautionary reset to make sure that everything works fine on resume.
BTW, since this is already providing a set of values it would be useful to provide one more field as the reset reason - RAS error recovery, GPU hung recovery or something else.
Thanks,
Lijo
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:37 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler
Quoted 4 lines · Lijo
[Public]
The problem is app doesn't know why the reset happened. It just receives a bunch of registers to be read. On what basis an app can filter this out?
Again, that is contextual analysis capability, which needs to be embedded in the reader app. Even if we filter out the S3/S4 resets in the kernel, the situation remains the same, isn't it ?
- Shashank
Quoted 141 lines
Thanks,
Lijo-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:29 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerQuoted 7 lines · Lijo
[AMD Official Use Only]
To explain more -
It's an unconditional reset done by the kernel on every suspend (S3/S4). In such a case which process is going to receive the trace events?Most likely use case would be related to gpu recovery. Triggering a trace on every reset doesn't look like a good idea.
If you observer carefully, we are just providing an infrastructure, the application's intention is unknown to us. In my opinion it's rather not a good idea to apply a filter in kernel, with our interpretation of intention.
For example if an app just wants to count how many resets are happening due to S3/S4 transition, this infra might become useless. It would rather be a better idea for the app to learn and ignore these scenarios which it is not interested in.
This could eventually be just difference in design philosophy maybe :)
- Shashank
Quoted 110 lines
Thanks,
Lijo-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:09 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerHey Lijo,
I somehow missed to respond on this comment, pls find inline:Regards
ShashankQuoted 70 lines · Lijo
Quoted 52 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17
00:00:00
2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by: Somalapuram Amaranath
<[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex01efda4398e5..ada35d4c5245100644drivers/gpu/drm/amd/amdgpu/nv.c +23
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) { + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = +adev->ip_blocks[i].version->funcs->reset_reg_dumps (adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed +%d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work))drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device · line 564
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/nv.c +6
-0+ DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev);Had a comment on this before. Now there are different reasons (or even no reason like a precautionary reset) to perform reset. A user would be interested in a trace only if the reason is valid.
Quoted 7 lines
To clarify on why a work shouldn't be scheduled on every reset, check here -
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/a
m
d
gpu/amdgpu_drv.c#L2188In the example you pointed to, they have a criteria to decide what is a valid reset in their context, in the kernel side itself. So they can take a call if they want to do something about it or not.
But, in our case, we want to send the
trace_eventto user with some register values on every reset, and it is actually up to the profiling app to interpret (along with what it wants to call a GPU reset). So I don't think this is causing a considerable overhead.- Shashank
Quoted 9 lines
Thanks,
LijoQuoted 3 lines
drivers/gpu/drm/amd/amdgpu/nv.c +0
-0switch (nv_asic_reset_method(adev)) { case AMD_RESET_METHOD_PCI: dev_info(adev->dev, "PCI reset\n");
Quoted 1 line · Lijo
BTW, since this is already providing a set of values it would be useful to provide one more field as the reset reason - RAS error recovery, GPU hung recovery or something else.
Adding this additional parameter instead of blocking something in kernel, seems like a better idea. The app can filter out and read what it is interested into.
- Shashank
[AMD Official Use Only]
One more thing
In suspend-reset case, won't this cause to schedule a work item on suspend? I don't know if that is a good idea, ideally we would like to clean up all work items before going to suspend.
Thanks,
Lijo
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler
Quoted 1 line · Lijo
BTW, since this is already providing a set of values it would be useful to provide one more field as the reset reason - RAS error recovery, GPU hung recovery or something else.
Adding this additional parameter instead of blocking something in kernel, seems like a better idea. The app can filter out and read what it is interested into.
- Shashank
Quoted 7 lines · Lijo
[AMD Official Use Only]
One more thing
In suspend-reset case, won't this cause to schedule a work item on suspend? I don't know if that is a good idea, ideally we would like to clean up all work items before going to suspend.Thanks,
Lijo
Again, this opens scope for discussion. What if there is a GPU error during suspend-reset, which is very probable case.
- Shashank
Quoted 16 lines
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerQuoted 1 line · Lijo
BTW, since this is already providing a set of values it would be useful to provide one more field as the reset reason - RAS error recovery, GPU hung recovery or something else.
Adding this additional parameter instead of blocking something in kernel, seems like a better idea. The app can filter out and read what it is interested into.
- Shashank
Deucher, Alexander
maintainer[Public]
In the suspend and hibernate cases, we don't care. In most cases the power rail will be cut once the system enters suspend so it doesn't really matter. That's why we call the asic reset callback directly rather than going through the whole recovery process. The device is already quiescent at this point we just want to make sure the device is in a known state when we come out of suspend (in case suspend overall fails).
Alex
________________________________
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 12:22 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler
Quoted 7 lines · Lijo
[AMD Official Use Only]
One more thing
In suspend-reset case, won't this cause to schedule a work item on suspend? I don't know if that is a good idea, ideally we would like to clean up all work items before going to suspend.Thanks,
Lijo
Again, this opens scope for discussion. What if there is a GPU error during suspend-reset, which is very probable case.
- Shashank
Quoted 16 lines
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerQuoted 1 line · Lijo
BTW, since this is already providing a set of values it would be useful to provide one more field as the reset reason - RAS error recovery, GPU hung recovery or something else.
Adding this additional parameter instead of blocking something in kernel, seems like a better idea. The app can filter out and read what it is interested into.
- Shashank
Deucher, Alexander
maintainer[Public]
Seems like this functionality should be moved up into the callers. Maybe add new IP callbacks (dump_reset_registers()) so that each IP can specify what registers are relevant for a reset debugging and then we can walk the IP list and call the callback before we call the asic_reset callbacks.
Alex
________________________________
From: amd-gfx <[email protected]> on behalf of Deucher, Alexander <[email protected]>
Sent: Friday, February 4, 2022 1:41 PM
To: Sharma, Shashank <[email protected]>; Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler
[Public]
[Public]
In the suspend and hibernate cases, we don't care. In most cases the power rail will be cut once the system enters suspend so it doesn't really matter. That's why we call the asic reset callback directly rather than going through the whole recovery process. The device is already quiescent at this point we just want to make sure the device is in a known state when we come out of suspend (in case suspend overall fails).
Alex
________________________________
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 12:22 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler
Quoted 7 lines · Lijo
[AMD Official Use Only]
One more thing
In suspend-reset case, won't this cause to schedule a work item on suspend? I don't know if that is a good idea, ideally we would like to clean up all work items before going to suspend.Thanks,
Lijo
Again, this opens scope for discussion. What if there is a GPU error during suspend-reset, which is very probable case.
- Shashank
Quoted 16 lines
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerQuoted 1 line · Lijo
BTW, since this is already providing a set of values it would be useful to provide one more field as the reset reason - RAS error recovery, GPU hung recovery or something else.
Adding this additional parameter instead of blocking something in kernel, seems like a better idea. The app can filter out and read what it is interested into.
- Shashank
Hey Alex,
Agree, we are moving it above, Christian also had the same feedback.
- Shashank
Quoted 63 lines · Alexander
[Public]
Seems like this functionality should be moved up into the callers. Maybe add new IP callbacks (
dump_reset_registers()) so that each IP can specify what registers are relevant for a reset debugging and then we can walk the IP list and call the callback before we call theasic_resetcallbacks.Alex
------------------------------------------------------------------------
*From:* amd-gfx <[email protected]> on behalf of Deucher, Alexander <[email protected]> *Sent:* Friday, February 4, 2022 1:41 PM
*To:* Sharma, Shashank <[email protected]>; Lazar, Lijo <[email protected]>; [email protected] <[email protected]> *Cc:* Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
*Subject:* Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handler[Public]
[Public]
In the suspend and hibernate cases, we don't care. In most cases the power rail will be cut once the system enters suspend so it doesn't really matter. That's why we call the asic reset callback directly rather than going through the whole recovery process. The device is already quiescent at this point we just want to make sure the device is in a known state when we come out of suspend (in case suspend overall fails).
Alex
------------------------------------------------------------------------
*From:* Sharma, Shashank <[email protected]>
*Sent:* Friday, February 4, 2022 12:22 PM
*To:* Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
*Cc:* Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]> *Subject:* Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerQuoted 7 lines · Lijo
[AMD Official Use Only]
One more thing
In suspend-reset case, won't this cause to schedule a work item on suspend? I don't know if that is a good idea, ideally we would like to clean up all work items before going to suspend.Thanks,
LijoAgain, this opens scope for discussion. What if there is a GPU error during suspend-reset, which is very probable case.
- Shashank
Quoted 16 lines
-----Original Message-----
From: Sharma, Shashank <[email protected]>
Sent: Friday, February 4, 2022 10:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Somalapuram, Amaranath <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerQuoted 1 line · Lijo
BTW, since this is already providing a set of values it would be useful to provide one more field as the reset reason - RAS error recovery, GPU hung recovery or something else.
Adding this additional parameter instead of blocking something in kernel, seems like a better idea. The app can filter out and read what it is interested into.
- Shashank
Christian König
maintainerAm 21.01.22 um 21:34 schrieb Sharma, Shashank:
Quoted 21 lines
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++1 file changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/nv.c +0
-0
drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device *adev) · line 533
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/nv.c +3
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ + int r = 0, i;
Please don't initialize variables if it isn't absolutely necessary.
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/nv.c +14
-0+ + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps(adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed %d\n",
drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device *adev) · line 557
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/nv.c +10
-0+ adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work)) + DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} +
I'm pretty sure that should be inside common code and not here.
In other words that is absolutely not ASIC specific at all.
Regards,
Christian.
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/nv.c +1
-0static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev); switch (nv_asic_reset_method(adev)) {case
AMD_RESET_METHOD_PCI:
dev_info(adev->dev, "PCI reset\n");
Quoted 27 lines · Christian König
Am 21.01.22 um 21:34 schrieb Sharma, Shashank:
Quoted 24 lines
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++1 file changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/nv.c +0
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } }
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device *adev) · line 533
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/nv.c +3
-0+static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ + int r = 0, i;Please don't initialize variables if it isn't absolutely necessary.
Agree, @Amar please check this out.
Quoted 27 lines
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/nv.c +14
-0+ + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps(adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed %d\n",drivers/gpu/drm/amd/amdgpu/nv.c nv_asic_reset_method(struct amdgpu_device *adev) · line 557
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/nv.c +10
-0+ adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work)) + DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} +I'm pretty sure that should be inside common code and not here.
Quoted 1 line
In other words that is absolutely not ASIC specific at all.
Yeah, I agree. I think the initial problem for Amar was that some offsets were only valid for particular ASICs, but nothing is stopping us to make this in a generic function followed by a asic special function.
We might have to move the asic.fptr to a more generic higher level fptr.
- Shashank
Quoted 13 lines
Regards,
Christian.Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/nv.c +1
-0static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev); switch (nv_asic_reset_method(adev)) {case
AMD_RESET_METHOD_PCI:
dev_info(adev->dev, "PCI reset\n");
You probably can add the STB dump we worked on a while ago to your info dump - a reminder on the feature is here https://www.spinics.net/lists/amd-gfx/msg70751.html
Andrey
Quoted 59 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++1 file changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/nv.c +28
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps(adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed %d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work)) + DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev); switch (nv_asic_reset_method(adev)) {case
AMD_RESET_METHOD_PCI:
dev_info(adev->dev, "PCI reset\n");
Hey Andrey,
That seems like a good idea, may I know if there is a trigger for STB dump ? or is it just the infrastructure which one can use when they feel a need to dump info ? Also, how reliable is the STB infra during a reset ?
Regards
Shashank
Quoted 65 lines · Andrey Grodzovsky
You probably can add the STB dump we worked on a while ago to your info dump - a reminder on the feature is here https://www.spinics.net/lists/amd-gfx/msg70751.html
Andrey
Quoted 59 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++1 file changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/nv.c +28
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps(adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed %d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work)) + DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev); switch (nv_asic_reset_method(adev)) {case
AMD_RESET_METHOD_PCI:
dev_info(adev->dev, "PCI reset\n");
It's just an infrastructure you use when you need.
I never tested it during reset i think but, we deliberately did it very self reliant where you simply iterate a FIFO of the dump through PMI3 registers interface and dump out the content. It currently supposed to work for the NV family.
In case you encounter issues during reset let me know and I will do my best to resolve them.
Andrey
Quoted 71 lines · Shashank
Hey Andrey,
That seems like a good idea, may I know if there is a trigger for STB dump ? or is it just the infrastructure which one can use when they feel a need to dump info ? Also, how reliable is the STB infra during a reset ?Regards
ShashankQuoted 65 lines · Andrey Grodzovsky
You probably can add the STB dump we worked on a while ago to your info dump - a reminder on the feature is here https://www.spinics.net/lists/amd-gfx/msg70751.html
Andrey
Quoted 59 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++1 file changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/nv.c +28
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps(adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed %d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work)) + DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev); switch (nv_asic_reset_method(adev)) {case
AMD_RESET_METHOD_PCI:
dev_info(adev->dev, "PCI reset\n");
Quoted 3 lines · Andrey Grodzovsky
It's just an infrastructure you use when you need.
I never tested it during reset i think but, we deliberately did it very self reliant where you simply iterate a FIFO of the dump through PMI3 registers interface and dump out the content. It currently supposed to work for the NV family.
Got it, thanks for the suggestion. Let me check the feasibility of plug-in STB in out existing design and use case.
- Shashank
Quoted 76 lines
In case you encounter issues during reset let me know and I will do my best to resolve them.
Andrey
Quoted 71 lines · Shashank
Hey Andrey,
That seems like a good idea, may I know if there is a trigger for STB dump ? or is it just the infrastructure which one can use when they feel a need to dump info ? Also, how reliable is the STB infra during a reset ?Regards
ShashankQuoted 65 lines · Andrey Grodzovsky
You probably can add the STB dump we worked on a while ago to your info dump - a reminder on the feature is here https://www.spinics.net/lists/amd-gfx/msg70751.html
Andrey
Quoted 59 lines · Shashank
From
899ec6060eb7d8a3d4d56ab439e4e6cdd74190a4Mon Sep 17 00:00:00 2001
From: Somalapuram Amaranath <[email protected]>
Date: Fri, 21 Jan 2022 14:19:42 +0530
Subject: [PATCH 4/4] drm/amdgpu/nv: add navi GPU reset handlerThis patch adds a GPU reset handler for Navi ASIC family, which typically dumps some of the registersand sends a trace event.
V2: Accomodated call to work function to send uevent
Signed-off-by Somalapuram Amaranath <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/nv.c | 28 ++++++++++++++++++++++++++++1 file changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/nv.c +28
-0@@ -528,10 +528,38 @@ nv_asic_reset_method(struct amdgpu_device *adev) } } +static void amdgpu_reset_dumps (struct amdgpu_device *adev) +{ + int r = 0, i; + + /* original raven doesn't have full asic reset */ + if ((adev->apu_flags & AMD_APU_IS_RAVEN) && + !(adev->apu_flags & AMD_APU_IS_RAVEN2)) + return; + for (i = 0; i < adev->num_ip_blocks; i++) { + if (!adev->ip_blocks[i].status.valid) + continue; + if (!adev->ip_blocks[i].version->funcs->reset_reg_dumps) + continue; + r = adev->ip_blocks[i].version->funcs->reset_reg_dumps(adev); + + if (r) + DRM_ERROR("reset_reg_dumps of IP block <%s> failed %d\n", + adev->ip_blocks[i].version->funcs->name, r); + } + + /* Schedule work to send uevent */ + if (!queue_work(system_unbound_wq, &adev->gpu_reset_work)) + DRM_ERROR("failed to add GPU reset work\n"); + + dump_stack(); +} + static int nv_asic_reset(struct amdgpu_device *adev) { int ret = 0; + amdgpu_reset_dumps(adev); switch (nv_asic_reset_method(adev)) {case
AMD_RESET_METHOD_PCI:
dev_info(adev->dev, "PCI reset\n");