Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Belgaumkar, Vinay" <vinay.belgaumkar@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/i915/pmu: Use a delayed wakeref put in get_rc6()
Date: Tue, 22 Sep 2026 15:11:47 -0700	[thread overview]
Message-ID: <edee83e0-5c59-4997-9ec4-9f2fc58b3733@intel.com> (raw)
In-Reply-To: <20260910184253.1231313-6-umesh.nerlige.ramappa@intel.com>


On 9/10/2026 11:42 AM, Umesh Nerlige Ramappa wrote:
> get_rc6() has the same runqueue lock deadlock as guc_engine_busyness():
> it is reached from the PMU callbacks, which perf can invoke from the
> scheduler with the runqueue lock held, and intel_gt_pm_put_async() there
> can wake a workqueue worker via try_to_wake_up().
>
> Use intel_gt_pm_put_delay() so the deferred put arms a timer instead.
>
> The remaining async puts in atomic contexts (hrtimer, tasklet, irq_work,
> G2H handlers) cannot run with the runqueue lock held and are left alone.
>
> Fixes: 07779a76ee1f ("drm/i915: Mark up the calling context for intel_wakeref_put()")
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Assisted-by: Claude:claude-opus-5
> ---
>   drivers/gpu/drm/i915/i915_pmu.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 1c3bafda9c70..4598d9b5678a 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

rephrase "We are reached"? There is another put_async in 
frequency_sample(). Do we need to update that as well?

Thanks,

Vinay.

> +		 * 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);

  parent reply	other threads:[~2026-09-22 22:12 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
2026-09-16 21:50     ` Umesh Nerlige Ramappa
2026-09-22 22:11   ` Belgaumkar, Vinay [this message]
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=edee83e0-5c59-4997-9ec4-9f2fc58b3733@intel.com \
    --to=vinay.belgaumkar@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox