From: Boris Brezillon <boris.brezillon@collabora.com>
To: Steven Price <steven.price@arm.com>
Cc: "Liviu Dudau" <liviu.dudau@arm.com>,
"Adrián Larumbe" <adrian.larumbe@collabora.com>,
dri-devel@lists.freedesktop.org,
"Florent Tomasin" <florent.tomasin@arm.com>,
"Heinrich Fink" <hfink@snap.com>,
kernel@collabora.com
Subject: Re: [PATCH v1 3/8] drm/panthor: Fix the group priority rotation logic
Date: Thu, 6 Nov 2025 17:30:48 +0100 [thread overview]
Message-ID: <20251106173048.468c63c4@fedora> (raw)
In-Reply-To: <13225a8e-f049-4e78-8630-748decb1be9d@arm.com>
On Thu, 6 Nov 2025 16:18:13 +0000
Steven Price <steven.price@arm.com> wrote:
> On 06/11/2025 14:46, Boris Brezillon wrote:
> > It's the group item that's supposed to be inserted before other_group,
> > not the other way around.
> >
> > Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
>
> Looks correct to me (but then I think I thought that about the old
> code... ;) ).
Actually, I realize I forgot to update the commit message, because
there's way more than the insertion order in the list that's
problematic.
>
> Reviewed-by: Steven Price <steven.price@arm.com>
>
> > ---
> > drivers/gpu/drm/panthor/panthor_sched.c | 46 +++++++++++++++----------
> > 1 file changed, 28 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> > index 94514d464e64..69cc1b4c23f2 100644
> > --- a/drivers/gpu/drm/panthor/panthor_sched.c
> > +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> > @@ -1960,31 +1960,22 @@ tick_ctx_pick_groups_from_list(const struct panthor_scheduler *sched,
> > static void
> > tick_ctx_insert_old_group(struct panthor_scheduler *sched,
> > struct panthor_sched_tick_ctx *ctx,
> > - struct panthor_group *group,
> > - bool full_tick)
> > + struct panthor_group *group)
> > {
> > struct panthor_csg_slot *csg_slot = &sched->csg_slots[group->csg_id];
> > struct panthor_group *other_group;
> >
> > - if (!full_tick) {
> > - list_add_tail(&group->run_node, &ctx->old_groups[group->priority]);
> > - return;
> > - }
> > -
> > - /* Rotate to make sure groups with lower CSG slot
> > - * priorities have a chance to get a higher CSG slot
> > - * priority next time they get picked. This priority
> > - * has an impact on resource request ordering, so it's
> > - * important to make sure we don't let one group starve
> > - * all other groups with the same group priority.
> > - */
> > + /* Class groups in descending priority order so we can easily rotate. */
> > list_for_each_entry(other_group,
> > &ctx->old_groups[csg_slot->group->priority],
> > run_node) {
> > struct panthor_csg_slot *other_csg_slot = &sched->csg_slots[other_group->csg_id];
> >
> > - if (other_csg_slot->priority > csg_slot->priority) {
> > - list_add_tail(&csg_slot->group->run_node, &other_group->run_node);
> > + /* Our group has a higher prio than the one we're testing against,
> > + * place it just before.
> > + */
> > + if (csg_slot->priority > other_csg_slot->priority) {
> > + list_add_tail(&group->run_node, &other_group->run_node);
> > return;
> > }
> > }
> > @@ -2033,7 +2024,7 @@ tick_ctx_init(struct panthor_scheduler *sched,
> > group->fatal_queues |= GENMASK(group->queue_count - 1, 0);
> > }
> >
> > - tick_ctx_insert_old_group(sched, ctx, group, full_tick);
> > + tick_ctx_insert_old_group(sched, ctx, group);
> > csgs_upd_ctx_queue_reqs(ptdev, &upd_ctx, i,
> > csg_iface->output->ack ^ CSG_STATUS_UPDATE,
> > CSG_STATUS_UPDATE);
> > @@ -2399,9 +2390,28 @@ static void tick_work(struct work_struct *work)
> > for (prio = PANTHOR_CSG_PRIORITY_COUNT - 1;
> > prio >= 0 && !tick_ctx_is_full(sched, &ctx);
> > prio--) {
> > + struct panthor_group *old_highest_prio_group =
> > + list_first_entry_or_null(&ctx.old_groups[prio],
> > + struct panthor_group, run_node);
> > +
> > + /* Pull out the group with the highest prio for rotation. */
> > + if (old_highest_prio_group)
> > + list_del(&old_highest_prio_group->run_node);
> > +
> > + /* Re-insert old active groups so they get a chance to run with higher prio. */
> > + tick_ctx_pick_groups_from_list(sched, &ctx, &ctx.old_groups[prio], true, true);
> > +
> > + /* Fill the remaining slots with runnable groups. */
> > tick_ctx_pick_groups_from_list(sched, &ctx, &sched->groups.runnable[prio],
> > true, false);
> > - tick_ctx_pick_groups_from_list(sched, &ctx, &ctx.old_groups[prio], true, true);
> > +
> > + /* Re-insert the old group with the highest prio, and give it a chance to be
> > + * scheduled again (but with a lower prio) if there's room left.
> > + */
> > + if (old_highest_prio_group) {
> > + list_add_tail(&old_highest_prio_group->run_node, &ctx.old_groups[prio]);
> > + tick_ctx_pick_groups_from_list(sched, &ctx, &ctx.old_groups[prio], true, true);
> > + }
> > }
> >
> > /* If we have free CSG slots left, pick idle groups */
>
next prev parent reply other threads:[~2025-11-06 16:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 14:46 [PATCH v1 0/8] drm/panthor: Misc scheduler fixes Boris Brezillon
2025-11-06 14:46 ` [PATCH v1 1/8] drm/panthor: Simplify group idleness tracking Boris Brezillon
2025-11-06 16:15 ` Steven Price
2025-11-06 14:46 ` [PATCH v1 2/8] drm/panthor: Don't try to enable extract events Boris Brezillon
2025-11-06 16:17 ` Steven Price
2025-11-06 14:46 ` [PATCH v1 3/8] drm/panthor: Fix the group priority rotation logic Boris Brezillon
2025-11-06 16:18 ` Steven Price
2025-11-06 16:30 ` Boris Brezillon [this message]
2025-11-06 14:46 ` [PATCH v1 4/8] drm/panthor: Fix the full_tick check Boris Brezillon
2025-11-06 16:20 ` Steven Price
2025-11-06 14:46 ` [PATCH v1 5/8] drm/panthor: Fix immediate ticking on a disabled tick Boris Brezillon
2025-11-06 16:23 ` Steven Price
2025-11-06 16:33 ` Boris Brezillon
2025-11-06 14:46 ` [PATCH v1 6/8] drm/panthor: Fix the logic that decides when to stop ticking Boris Brezillon
2025-11-06 16:29 ` Steven Price
2025-11-06 14:46 ` [PATCH v1 7/8] drm/panthor: Make sure we resume the tick when new jobs are submitted Boris Brezillon
2025-11-06 16:39 ` Steven Price
2025-11-06 14:46 ` [PATCH v1 8/8] drm/panthor: Kill panthor_sched_immediate_tick() Boris Brezillon
2025-11-06 16:44 ` Steven Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251106173048.468c63c4@fedora \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=florent.tomasin@arm.com \
--cc=hfink@snap.com \
--cc=kernel@collabora.com \
--cc=liviu.dudau@arm.com \
--cc=steven.price@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.