diff mbox series

[09/10] drm/i915/guc: Consider also RCU depth in busy loop.

Message ID 20240405142737.920626-10-bigeasy@linutronix.de (mailing list archive)
State New, archived
Headers show
Series drm/i915: PREEMPT_RT related fixups. | expand

Commit Message

Sebastian Andrzej Siewior April 5, 2024, 2:18 p.m. UTC
intel_guc_send_busy_loop() looks at in_atomic() and irqs_disabled() to
decide if it should busy-spin while waiting or if it may sleep.
Both checks will report false on PREEMPT_RT if sleeping spinlocks are
acquired leading to RCU splats while the function sleeps.

Check also if RCU has been disabled.

Reported-by: "John B. Wyatt IV" <jwyatt@redhat.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rodrigo Vivi June 11, 2024, 10:18 p.m. UTC | #1
On Fri, Apr 05, 2024 at 04:18:27PM +0200, Sebastian Andrzej Siewior wrote:
> intel_guc_send_busy_loop() looks at in_atomic() and irqs_disabled() to
> decide if it should busy-spin while waiting or if it may sleep.
> Both checks will report false on PREEMPT_RT if sleeping spinlocks are
> acquired leading to RCU splats while the function sleeps.
> 
> Check also if RCU has been disabled.
> 
> Reported-by: "John B. Wyatt IV" <jwyatt@redhat.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

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

> ---
>  drivers/gpu/drm/i915/gt/uc/intel_guc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.h b/drivers/gpu/drm/i915/gt/uc/intel_guc.h
> index be70c46604b49..387cc1911302f 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.h
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.h
> @@ -360,7 +360,7 @@ static inline int intel_guc_send_busy_loop(struct intel_guc *guc,
>  {
>  	int err;
>  	unsigned int sleep_period_ms = 1;
> -	bool not_atomic = !in_atomic() && !irqs_disabled();
> +	bool not_atomic = !in_atomic() && !irqs_disabled() && !rcu_preempt_depth();
>  
>  	/*
>  	 * FIXME: Have caller pass in if we are in an atomic context to avoid
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.h b/drivers/gpu/drm/i915/gt/uc/intel_guc.h
index be70c46604b49..387cc1911302f 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc.h
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.h
@@ -360,7 +360,7 @@  static inline int intel_guc_send_busy_loop(struct intel_guc *guc,
 {
 	int err;
 	unsigned int sleep_period_ms = 1;
-	bool not_atomic = !in_atomic() && !irqs_disabled();
+	bool not_atomic = !in_atomic() && !irqs_disabled() && !rcu_preempt_depth();
 
 	/*
 	 * FIXME: Have caller pass in if we are in an atomic context to avoid