Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] i915/pmu: sleep in atomic (PREEMPT_RT) lock inversion in 
i915_pmu_gt_parked()
--

commit 4674b42fb5bd16ec1392c65ea4ec0e37639b3618
Author: Anubhav Shelat <[email protected]>

drm/i915/pmu: convert i915_pmu->lock to raw_spinlock_t from spinlock_t

This commit converts the pmu lock from spinlock_t to raw_spinlock_t. The
conversion aims to avoid a sleep-in-atomic error on PREEMPT_RT kernels when
perf operations are called under a raw spinlock.

> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 1c3bafda9c708..65771e54b9b51 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
[ ... ]
> @@ -304,7 +304,7 @@ void i915_pmu_gt_parked(struct intel_gt *gt)
>       if (!pmu->registered)
>               return;
>  
> -     spin_lock_irq(&pmu->lock);
> +     raw_spin_lock_irq(&pmu->lock);
>  
>       park_rc6(gt);

[Severity: High]
Does this introduce a lock inversion on PREEMPT_RT kernels?

The patch converts pmu->lock to raw_spinlock_t, but i915_pmu_gt_parked() calls
into a path that acquires a regular spinlock_t while this raw lock is held:

i915_pmu_gt_parked()
  raw_spin_lock_irq(&pmu->lock);
  park_rc6()
    __get_rc6()
      intel_rc6_residency_ns()
        spin_lock_irqsave(&uncore->lock, flags);

Because uncore->lock is still a standard spinlock_t, it can sleep on PREEMPT_RT
kernels. Acquiring it while holding the raw pmu->lock violates the lock
hierarchy and can cause a sleep-in-atomic panic during normal power management
operations.

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

Reply via email to