dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 5/8] drm/panthor: Fix immediate ticking on a disabled tick
Date: Thu, 6 Nov 2025 17:33:03 +0100	[thread overview]
Message-ID: <20251106173303.192d509e@fedora> (raw)
In-Reply-To: <08c03b0b-79dc-4b4b-9c4d-81d188bc8f92@arm.com>

On Thu, 6 Nov 2025 16:23:24 +0000
Steven Price <steven.price@arm.com> wrote:

> On 06/11/2025 14:46, Boris Brezillon wrote:
> > We have a few path where we schedule the tick work immediately without  
> NIT: s/path/paths/> changing the resched_target. If the tick was
> stopped, this would lead
> > to a remaining_jiffies that's always > 0, and it wouldn't force a full
> > tick in that case. Add extra checks to cover that case properly.
> > 
> > Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> > ---
> >  drivers/gpu/drm/panthor/panthor_sched.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> > index b6489e9ba1f0..1eba56e7360d 100644
> > --- a/drivers/gpu/drm/panthor/panthor_sched.c
> > +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> > @@ -2358,8 +2358,12 @@ static void tick_work(struct work_struct *work)
> >  	if (drm_WARN_ON(&ptdev->base, ret))
> >  		goto out_dev_exit;
> >  
> > -	if (time_before64(now, sched->resched_target))
> > +	if (sched->resched_target != U64_MAX &&
> > +	    time_before64(now, sched->resched_target))
> >  		remaining_jiffies = sched->resched_target - now;
> > +	else if (sched->resched_target == U64_MAX &&
> > +		 time_before64(now, sched->last_tick + sched->tick_period))
> > +		remaining_jiffies = sched->last_tick + sched->tick_period - now;  
> 
> I'm wondering if this would be cleaner with an extra variable (and a
> comment):
> 
>    u64 resched_target = sched->resched_target;
> 
>    /* If the tick is stopped, calculate when the next tick would be */
>    if (resched_target == U64_MAX)
> 	   resched_target = sched->last_tick + sched->tick_period;
> 
>    if (time_before64(now, resched_target)
> 	   remaining_jiffies = resched_target - now;
> 
> It at least avoids some repetition.

Yep that looks better expressed like that. I'll go for your suggestion
in the next version.

  reply	other threads:[~2025-11-06 16:33 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
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 [this message]
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=20251106173303.192d509e@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox