public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Chia-I Wu <olvaffe@gmail.com>
Cc: Steven Price <steven.price@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Grant Likely <grant.likely@linaro.org>,
	Heiko Stuebner <heiko@sntech.de>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	ashley.smith@collabora.com
Subject: Re: [PATCH] drm/panthor: fix queue_reset_timeout_locked
Date: Tue, 2 Dec 2025 19:05:25 +0100	[thread overview]
Message-ID: <20251202190525.60973e38@fedora> (raw)
In-Reply-To: <20251202174028.1600218-1-olvaffe@gmail.com>

On Tue,  2 Dec 2025 09:40:28 -0800
Chia-I Wu <olvaffe@gmail.com> wrote:

> queue_check_job_completion calls queue_reset_timeout_locked to reset the
> timeout when progress is made. We want the reset to happen when the
> timeout is running, not when it is suspended.
> 
> Fixes: 345c5b7cc0f85 ("drm/panthor: Make the timeout per-queue instead of per-job")
> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
> ---
>  drivers/gpu/drm/panthor/panthor_sched.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index 389d508b3848e..47e81fc45fb56 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -1052,18 +1052,6 @@ group_is_idle(struct panthor_group *group)
>  	return hweight32(inactive_queues) == group->queue_count;
>  }
>  
> -static void
> -queue_reset_timeout_locked(struct panthor_queue *queue)
> -{
> -	lockdep_assert_held(&queue->fence_ctx.lock);
> -
> -	if (queue->timeout.remaining != MAX_SCHEDULE_TIMEOUT) {
> -		mod_delayed_work(queue->scheduler.timeout_wq,
> -				 &queue->timeout.work,
> -				 msecs_to_jiffies(JOB_TIMEOUT_MS));
> -	}
> -}
> -
>  static bool
>  group_can_run(struct panthor_group *group)
>  {
> @@ -1080,6 +1068,18 @@ queue_timeout_is_suspended(struct panthor_queue *queue)
>  	return queue->timeout.remaining != MAX_SCHEDULE_TIMEOUT;
>  }
>  
> +static void
> +queue_reset_timeout_locked(struct panthor_queue *queue)
> +{
> +	lockdep_assert_held(&queue->fence_ctx.lock);
> +
> +	if (!queue_timeout_is_suspended(queue)) {
> +		mod_delayed_work(queue->scheduler.timeout_wq,
> +				 &queue->timeout.work,
> +				 msecs_to_jiffies(JOB_TIMEOUT_MS));
> +	}

Oops. If queue_reset_timeout_locked() is called in a context where the
timeout is suspended, shouldn't we adjust the remaining value?

static void
queue_reset_timeout_locked(struct panthor_queue *queue)
{
        lockdep_assert_held(&queue->fence_ctx.lock);

        if (queue_timeout_is_suspended(queue)) { 
                queue->timeout.remaining = msecs_to_jiffies(JOB_TIMEOUT_MS);
	} else {
                mod_delayed_work(queue->scheduler.timeout_wq,
                                 &queue->timeout.work,
                                 msecs_to_jiffies(JOB_TIMEOUT_MS));
        }
}


> +}
> +
>  static void
>  queue_suspend_timeout_locked(struct panthor_queue *queue)
>  {


      reply	other threads:[~2025-12-02 18:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 17:40 [PATCH] drm/panthor: fix queue_reset_timeout_locked Chia-I Wu
2025-12-02 18:05 ` Boris Brezillon [this message]

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=20251202190525.60973e38@fedora \
    --to=boris.brezillon@collabora.com \
    --cc=airlied@gmail.com \
    --cc=ashley.smith@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=grant.likely@linaro.org \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=olvaffe@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=tzimmermann@suse.de \
    /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