Re: [PATCH v7 26/26] drm/i915/gt: Add a spinlock to prevent starvation of irq_work.

Sebastian Andrzej Siewior
2026-03-12T11:38:30Z

On 2026-03-10 20:03:14 [+0100], Maarten Lankhorst wrote:
> Hey,
Hi,

> Den 2026-03-10 kl. 18:22, skrev Sebastian Andrzej Siewior:
> > On 2026-03-10 12:57:08 [+0100], Maarten Lankhorst wrote:
> >> --- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> >> +++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> >> @@ -487,8 +490,11 @@ void intel_context_remove_breadcrumbs(struct intel_context *ce,
> >> if (release)
> >> intel_context_put(ce);
> >>
> >> - while (atomic_read(&b->signaler_active))
> >> + while (atomic_read(&b->signaler_active)) {
> >> + spin_lock(&b->signaler_active_sync);
> >> + spin_unlock(&b->signaler_active_sync);
> >> cpu_relax();
> >
> > Forgot to mention: This is fine on PREEMPT_RT but on !RT you might need
> >
> > spin_lock_irqsave(&b->signaler_active_sync, flags);
> > spin_unlock_irqrestore(&b->signaler_active_sync, flags);
> >
> > if the function can be called from !IRQ context which might be the case
> > due to the irqsave() earlier in this function.
> Yeah seems a bit of an oversight. I'll change it to use flags.
>
> Is it correct to assume that irq_work disables interrupts on !RT?

Yes. It runs either directly as an interrupt or gets kicked from the
timer interrupt. Either way, interrupts are always disabled. Only on RT
interrupts are enabled unless the IRQ-work has been explicitly requested
to be run in interrupt context.

> Kind regards,
> ~Maarten Lankhorst

Sebastian