[PATCH 4/4] drm/i915: Consider RCU read section as atomic.

Rodrigo Vivi rodrigo.vivi at intel.com
Tue Jul 15 19:08:46 UTC 2025


On Tue, Jul 15, 2025 at 05:41:30PM +0200, Maarten Lankhorst wrote:
> From: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
> 
> Locking and/ or running inside interrupt handler will not lead to an
> atomic section on PREEMPT_RT. The RCU read section needs to be
> considered because all locks, which become sleeping locks on
> PREEMPT_RT, start a RCU read section. Scheduling/ sleeping while within
> a RCU read section is invalid.
> 
> Check for also for RCU read section in stop_timeout() to determine if it
> is safe to sleep.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
> Link: https://lore.kernel.org/r/20250714153954.629393-9-bigeasy@linutronix.de
> Signed-off-by: Maarten Lankhorst <dev at lankhorst.se>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> ---
>  drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> index b721bbd233567..f5a6143ea8a24 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> @@ -1609,7 +1609,7 @@ u64 intel_engine_get_last_batch_head(const struct intel_engine_cs *engine)
>  
>  static unsigned long stop_timeout(const struct intel_engine_cs *engine)
>  {
> -	if (in_atomic() || irqs_disabled()) /* inside atomic preempt-reset? */
> +	if (in_atomic() || irqs_disabled() || rcu_preempt_depth()) /* inside atomic preempt-reset? */
>  		return 0;
>  
>  	/*
> -- 
> 2.45.2
> 


More information about the Intel-gfx mailing list