All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maíra Canal" <mcanal@igalia.com>
To: Xiaolei Wang <xiaolei.wang@windriver.com>,
	mwen@igalia.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
	simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/v3d: Using spin_lock_irqsave instead of spin_lock in the RT kernel
Date: Wed, 4 Mar 2026 07:21:09 -0300	[thread overview]
Message-ID: <3ddab49b-d1a8-4efb-949c-12df119bf3fd@igalia.com> (raw)
In-Reply-To: <20260304031724.246404-1-xiaolei.wang@windriver.com>

Hi Xiaolei,


On 04/03/26 00:17, Xiaolei Wang wrote:
> Disabling interrupts before calling 'spin_lock()' is unnecessary;
> its implementation is only for satisfying lockdep's requirements.

Yeah, the idea is really to satisfy lockdep's requirements. See comment
in `v3d_job_start_stats()`.

However, I sent a series recently to address this workaround [1]. I
appreciate reviews and comments about the series.

[1] 
https://lore.kernel.org/dri-devel/20260217-v3d-reset-locking-improv-v1-0-0db848016869@igalia.com/T/

Best regards,
- Maíra

> Since preemption is disabled by default when calling 'spin_lock()'
> in the standard kernel, both 'local_irq_save()' and 'preempt_disable()'
> become redundant. Therefore, we can replace 'spin_lock()' with
> 'spin_lock_irqsave()' to ensure compatibility between the standard
> kernel and the rt kernel. Avoid the following warning:
> 
> Hardware name: Raspberry Pi 5 Model B Rev 1.0 (DT)
> Call trace:
> dump_backtrace.part.0+0xe0/0x100
> show_stack+0x20/0x40
> dump_stack_lvl+0x60/0x80 dump_stack+0x18/0x28
> __might_resched+0x134/0x168
> rt_spin_lock+0x5c/0xe0
> v3d_job_update_stats+0x64/0x1d0 [v3d]
> v3d_irq+0xf0/0x410 [v3d]
> irq_forced_thread_fn+0x44/0xd8
> irq_thread+0x1ac/0x2d8
> kthread+0x124/0x138
> ret_from_fork+0x10/0x20
> 
> Fixes: fa6a20c87470 ("drm/v3d: Address race-condition between per-fd GPU stats and fd release")
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
> ---
>   drivers/gpu/drm/v3d/v3d_sched.c | 15 ++-------------
>   1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c
> index 6dc871fc9a62..5eaacb1d1480 100644
> --- a/drivers/gpu/drm/v3d/v3d_sched.c
> +++ b/drivers/gpu/drm/v3d/v3d_sched.c
> @@ -203,24 +203,13 @@ v3d_job_update_stats(struct v3d_job *job, enum v3d_queue q)
>   	u64 now = local_clock();
>   	unsigned long flags;
>   
> -	/* See comment in v3d_job_start_stats() */
> -	if (IS_ENABLED(CONFIG_LOCKDEP))
> -		local_irq_save(flags);
> -	else
> -		preempt_disable();
> -
>   	/* Don't update the local stats if the file context has already closed */
> -	spin_lock(&queue->queue_lock);
> +	spin_lock_irqsave(&queue->queue_lock, flags);
>   	if (job->file_priv)
>   		v3d_stats_update(&job->file_priv->stats[q], now);
> -	spin_unlock(&queue->queue_lock);
> +	spin_unlock_irqrestore(&queue->queue_lock, flags);
>   
>   	v3d_stats_update(global_stats, now);
> -
> -	if (IS_ENABLED(CONFIG_LOCKDEP))
> -		local_irq_restore(flags);
> -	else
> -		preempt_enable();
>   }
>   
>   static struct dma_fence *v3d_bin_job_run(struct drm_sched_job *sched_job)


      reply	other threads:[~2026-03-04 10:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  3:17 [PATCH] drm/v3d: Using spin_lock_irqsave instead of spin_lock in the RT kernel Xiaolei Wang
2026-03-04 10:21 ` Maíra Canal [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=3ddab49b-d1a8-4efb-949c-12df119bf3fd@igalia.com \
    --to=mcanal@igalia.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=xiaolei.wang@windriver.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.