Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] Looping with IRQs disabled causes soft-deadlocks and CT buffer 
breakage because the G2H draining tasklet cannot run.
--

commit fa66d9f372062707343fef0e57e8f112f58ecabc
Author: Sebastian Andrzej Siewior <[email protected]>

drm/i915/guc: Consider also RCU depth in busy loop.

This commit updates the not_atomic condition in intel_guc_send_busy_loop
to additionally check rcu_preempt_depth. This prevents RCU splats on
PREEMPT_RT systems where sleeping spinlocks are acquired, which would
cause in_atomic and irqs_disabled to report false.

> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.h 
> b/drivers/gpu/drm/i915/gt/uc/intel_guc.h
> index 053780f562c1a..b25fa8f4dc4bd 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.h
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.h
> @@ -362,7 +362,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();

[Severity: High]
This isn't a bug introduced by this patch, but does spinning with IRQs
disabled here cause a soft-deadlock that breaks the GuC CT buffer?

If the G2H buffer fills up and intel_guc_send_nb returns -EBUSY, the code
enters a busy loop. If the caller acquired spinlocks that disabled IRQs,
not_atomic will evaluate to false, causing the loop to use cpu_relax
instead of sleeping.

Inside this process, has_room_nb is called, which attempts to drain the
credits by queuing a tasklet:

drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c:has_room_nb() {
    ...
    tasklet_hi_schedule(&ct->receive_tasklet);
    ...
}

This schedules the tasklet on the local CPU's tasklet list and sets
TASKLET_STATE_SCHED. However, because the local CPU is spinning in
cpu_relax with IRQs disabled, softirqs will never run.

Since the tasklet is pinned to the local deadlocked CPU, other CPUs
cannot drain the buffer even if they receive the GuC hard interrupt.
The G2H buffer never drains, and after 1.5 seconds, ct_deadlocked
returns true, permanently breaking the CT buffer.

>  
>       /*
>        * FIXME: Have caller pass in if we are in an atomic context to avoid
>        * using in_atomic() as it doesn't work for all configs (e.g. PREEMPT).

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to