All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Umesh Nerlige Ramappa" <umesh.nerlige.ramappa@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915/pmu: Use a delayed wakeref put in get_rc6()
Date: Thu, 10 Sep 2026 18:54:18 +0000	[thread overview]
Message-ID: <20260910185418.A98ED1F0089D@smtp.kernel.org> (raw)
In-Reply-To: <20260910184253.1231313-6-umesh.nerlige.ramappa@intel.com>

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

Pre-existing issues:
- [High] PMU callbacks acquire `spinlock_t` locks while the scheduler holds the runqueue lock (`raw_spinlock_t`), violating lock nesting rules on PREEMPT_RT.
--

commit aeee9e0e0071ac1defceaf4b6ea0f13bad5f5898
Author: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

drm/i915/pmu: Use a delayed wakeref put in get_rc6()

This commit replaces intel_gt_pm_put_async() with intel_gt_pm_put_delay()
in get_rc6() to avoid waking a workqueue worker while the scheduler holds
the runqueue lock.

> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 1c3bafda9c708..4598d9b5678a2 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -229,7 +229,12 @@ static u64 get_rc6(struct intel_gt *gt)
>  	wakeref = intel_gt_pm_get_if_awake(gt);
>  	if (wakeref) {
>  		val = __get_rc6(gt);
> -		intel_gt_pm_put_async(gt, wakeref);
> +		/*
> +		 * We are reached from the perf callbacks, which perf may invoke
> +		 * from the scheduler with the runqueue lock held. Defer the put
> +		 * on a timer so that it can never wake a task from here.
> +		 */
> +		intel_gt_pm_put_delay(gt, wakeref, 1);
>  	}
>  
>  	spin_lock_irqsave(&pmu->lock, flags);

[Severity: High]
This is a pre-existing issue, but does this still cause a lock nesting
violation on PREEMPT_RT?

Since get_rc6() is reached from PMU callbacks with the runqueue lock held
(which is a raw_spinlock_t), acquiring a spinlock_t here (pmu->lock) will
cause a scheduling while atomic panic on PREEMPT_RT kernels, because
spinlock_t becomes a sleepable rt_mutex.

Does __get_rc6() also trigger this panic? It looks like it acquires 
uncore->lock via intel_rc6_residency_ns(), which is also a spinlock_t.

Similarly, guc_engine_busyness() appears to have the same underlying issue 
with guc->timestamp.lock in the PMU callback path. 

Are there plans to convert these locks to raw_spinlock_t or avoid acquiring
them entirely when called from perf scheduler contexts?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910184253.1231313-4-umesh.nerlige.ramappa@intel.com?part=2

  reply	other threads:[~2026-09-10 18:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 18:42 [PATCH 0/2] Fixup deadlock scenarios in the PMU path Umesh Nerlige Ramappa
2026-09-10 18:42 ` [PATCH 1/2] drm/i915/guc: Use a delayed wakeref put in guc_engine_busyness() Umesh Nerlige Ramappa
2026-09-22 22:09   ` Belgaumkar, Vinay
2026-09-24 17:55     ` Umesh Nerlige Ramappa
2026-09-10 18:42 ` [PATCH 2/2] drm/i915/pmu: Use a delayed wakeref put in get_rc6() Umesh Nerlige Ramappa
2026-09-10 18:54   ` sashiko-bot [this message]
2026-09-16 21:50     ` Umesh Nerlige Ramappa
2026-09-22 22:11   ` Belgaumkar, Vinay
2026-09-24 17:02     ` Umesh Nerlige Ramappa
2026-09-10 22:13 ` ✓ i915.CI.BAT: success for Fixup deadlock scenarios in the PMU path Patchwork
2026-09-11 17:04 ` ✗ i915.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260910185418.A98ED1F0089D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=umesh.nerlige.ramappa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.