* [PATCH v2] drm/panthor: Reset queue slots if termination fails
@ 2025-05-19 14:50 Ashley Smith
2025-05-21 13:17 ` Liviu Dudau
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ashley Smith @ 2025-05-19 14:50 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: kernel, Ashley Smith, dri-devel, linux-kernel
This fixes a bug where if we timeout after a suspend and the termination
fails, due to waiting on a fence that will never be signalled for
example, we do not resume the group correctly. The fix forces a reset
for groups that are not terminated correctly.
Signed-off-by: Ashley Smith <ashley.smith@collabora.com>
---
Changes in v2:
- Fixed syntax error
---
drivers/gpu/drm/panthor/panthor_sched.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index 43ee57728de5..65d8ae3dcac1 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -2727,8 +2727,17 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
* automatically terminate all active groups, so let's
* force the state to halted here.
*/
- if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED)
+ if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED) {
csg_slot->group->state = PANTHOR_CS_GROUP_TERMINATED;
+
+ /* Reset the queue slots manually if the termination
+ * request failed.
+ */
+ for (i = 0; i < group->queue_count; i++) {
+ if (group->queues[i])
+ cs_slot_reset_locked(ptdev, csg_id, i);
+ }
+ }
slot_mask &= ~BIT(csg_id);
}
}
base-commit: 9934ab18051118385c7ea44d8e14175edbe6dc9c
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/panthor: Reset queue slots if termination fails
2025-05-19 14:50 [PATCH v2] drm/panthor: Reset queue slots if termination fails Ashley Smith
@ 2025-05-21 13:17 ` Liviu Dudau
2025-05-21 15:04 ` Steven Price
2025-05-26 7:18 ` Boris Brezillon
2 siblings, 0 replies; 4+ messages in thread
From: Liviu Dudau @ 2025-05-21 13:17 UTC (permalink / raw)
To: Ashley Smith
Cc: Boris Brezillon, Steven Price, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, kernel, dri-devel,
linux-kernel
On Mon, May 19, 2025 at 03:50:19PM +0100, Ashley Smith wrote:
> This fixes a bug where if we timeout after a suspend and the termination
> fails, due to waiting on a fence that will never be signalled for
> example, we do not resume the group correctly. The fix forces a reset
> for groups that are not terminated correctly.
>
> Signed-off-by: Ashley Smith <ashley.smith@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> Changes in v2:
> - Fixed syntax error
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index 43ee57728de5..65d8ae3dcac1 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -2727,8 +2727,17 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
> * automatically terminate all active groups, so let's
> * force the state to halted here.
> */
> - if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED)
> + if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED) {
> csg_slot->group->state = PANTHOR_CS_GROUP_TERMINATED;
> +
> + /* Reset the queue slots manually if the termination
> + * request failed.
> + */
> + for (i = 0; i < group->queue_count; i++) {
> + if (group->queues[i])
> + cs_slot_reset_locked(ptdev, csg_id, i);
> + }
> + }
> slot_mask &= ~BIT(csg_id);
> }
> }
>
> base-commit: 9934ab18051118385c7ea44d8e14175edbe6dc9c
> --
> 2.43.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/panthor: Reset queue slots if termination fails
2025-05-19 14:50 [PATCH v2] drm/panthor: Reset queue slots if termination fails Ashley Smith
2025-05-21 13:17 ` Liviu Dudau
@ 2025-05-21 15:04 ` Steven Price
2025-05-26 7:18 ` Boris Brezillon
2 siblings, 0 replies; 4+ messages in thread
From: Steven Price @ 2025-05-21 15:04 UTC (permalink / raw)
To: Ashley Smith, Boris Brezillon, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: kernel, dri-devel, linux-kernel
On 19/05/2025 15:50, Ashley Smith wrote:
> This fixes a bug where if we timeout after a suspend and the termination
> fails, due to waiting on a fence that will never be signalled for
> example, we do not resume the group correctly. The fix forces a reset
> for groups that are not terminated correctly.
>
> Signed-off-by: Ashley Smith <ashley.smith@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
> ---
> Changes in v2:
> - Fixed syntax error
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index 43ee57728de5..65d8ae3dcac1 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -2727,8 +2727,17 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
> * automatically terminate all active groups, so let's
> * force the state to halted here.
> */
> - if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED)
> + if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED) {
> csg_slot->group->state = PANTHOR_CS_GROUP_TERMINATED;
> +
> + /* Reset the queue slots manually if the termination
> + * request failed.
> + */
> + for (i = 0; i < group->queue_count; i++) {
> + if (group->queues[i])
> + cs_slot_reset_locked(ptdev, csg_id, i);
> + }
> + }
> slot_mask &= ~BIT(csg_id);
> }
> }
>
> base-commit: 9934ab18051118385c7ea44d8e14175edbe6dc9c
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/panthor: Reset queue slots if termination fails
2025-05-19 14:50 [PATCH v2] drm/panthor: Reset queue slots if termination fails Ashley Smith
2025-05-21 13:17 ` Liviu Dudau
2025-05-21 15:04 ` Steven Price
@ 2025-05-26 7:18 ` Boris Brezillon
2 siblings, 0 replies; 4+ messages in thread
From: Boris Brezillon @ 2025-05-26 7:18 UTC (permalink / raw)
To: Ashley Smith
Cc: Steven Price, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, kernel, dri-devel,
linux-kernel
On Mon, 19 May 2025 15:50:19 +0100
Ashley Smith <ashley.smith@collabora.com> wrote:
> This fixes a bug where if we timeout after a suspend and the termination
> fails, due to waiting on a fence that will never be signalled for
> example, we do not resume the group correctly. The fix forces a reset
> for groups that are not terminated correctly.
>
> Signed-off-by: Ashley Smith <ashley.smith@collabora.com>
We clearly need a Fixes tag, otherwise "drm/panthor: Make the timeout
per-queue instead of per-job" will be backported, but not this one,
which will lead to UAF. Can you send a v5 with both patches in the same
series, each with a proper Fixes tag?
> ---
> Changes in v2:
> - Fixed syntax error
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index 43ee57728de5..65d8ae3dcac1 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -2727,8 +2727,17 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
> * automatically terminate all active groups, so let's
> * force the state to halted here.
> */
> - if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED)
> + if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED) {
> csg_slot->group->state = PANTHOR_CS_GROUP_TERMINATED;
> +
> + /* Reset the queue slots manually if the termination
> + * request failed.
> + */
> + for (i = 0; i < group->queue_count; i++) {
> + if (group->queues[i])
> + cs_slot_reset_locked(ptdev, csg_id, i);
> + }
> + }
> slot_mask &= ~BIT(csg_id);
> }
> }
>
> base-commit: 9934ab18051118385c7ea44d8e14175edbe6dc9c
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-26 7:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 14:50 [PATCH v2] drm/panthor: Reset queue slots if termination fails Ashley Smith
2025-05-21 13:17 ` Liviu Dudau
2025-05-21 15:04 ` Steven Price
2025-05-26 7:18 ` Boris Brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).