Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vinay Belgaumkar" <vinay.belgaumkar@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 2/2] drm/xe: Add sysfs to disable RPe
Date: Wed, 18 Nov 2026 01:50:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-219913@kernel.org> (raw)
In-Reply-To: <20261118012453.626087-4-vinay.belgaumkar@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/xe/guc_pc: BMG_MIN_FREQ floor skipped in
  pc_adjust_freq_bounds()
- [Low] drm/xe: inverted ignore_eff_freq comment in
  xe_guc_pc_set_use_rpe()
--

commit 2fd6d49cd723e98d7b71d44470ecf548dc1dcd33
Author: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

drm/xe: Add sysfs to disable RPe

This commit adds a use_rpe sysfs attribute to control SLPC efficient
frequency behavior and decouples SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY from
pc_set_min_freq().

> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index ea47b0ded83a4..5ff3df99464b8 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
[ ... ]
> @@ -1091,12 +1099,23 @@ void xe_guc_pc_remove_flush_freq_limit(struct xe_guc_pc *pc)
>  static int pc_set_mert_freq_cap(struct xe_guc_pc *pc)
>  {
>  	int ret;
> +	u32 mert_freq_cap;
>  
>  	if (!XE_GT_WA(pc_to_gt(pc), 22019338487))
>  		return 0;
>  
>  	guard(mutex)(&pc->freq_lock);
>  
> +	/*
> +	 * Disable the RPe floor so the min queried below reflects the real
> +	 * underlying minimum (RPn or user_requested_min) instead of a value
> +	 * GuC may have elevated to RPe. This stays disabled until
> +	 * xe_guc_pc_restore_stashed_freq() reinstates it.
> +	 */
> +	ret = pc_set_ignore_eff_freq(pc, 1);
> +	if (ret)
> +		return ret;
> +
>  	/*
>  	 * Get updated min/max and stash them.
>  	 */
[ ... ]
> @@ -1192,6 +1215,36 @@ static int pc_action_set_strategy(struct xe_guc_pc *pc, u32 val)
>  	return ret;
>  }
>  
> +int xe_guc_pc_set_use_rpe(struct xe_guc_pc *pc, u32 val)
> +{
> +	int ret = 0;
> +
> +	guard(mutex)(&pc->freq_lock);
> +
> +	/* Might be in the middle of a gt reset */
> +	if (!pc->freq_ready)
> +		return -EAGAIN;
> +
> +	/*
> +	 * While the Wa_22019338487 cap is active, ignore_eff_freq must stay
> +	 * forced off. xe_guc_pc_restore_stashed_freq() will apply this value
> +	 * once the cap is lifted.
> +	 */
> +	if (!pc->mert_freq_cap_active) {
> +		/**
> +		 * If use_rpe == 1, ignore_eff_freq = false. GuC elevates min_freq to
> +		 * RPe when enabled, and resets it back to the previously set min
> +		 * when disabled, so no explicit set_min_freq request is needed here.
> +		 */
> +		ret = pc_set_ignore_eff_freq(pc, !val);
> +	}

[Severity: Low]
This isn't a bug, but pc_set_mert_freq_cap() forces ignore_eff_freq on (1)
to keep the RPe floor disabled, whereas the first comment says
ignore_eff_freq must stay forced off.  Also, the inner comment uses a /**
kernel-doc marker instead of /*.

[ ... ]
> @@ -1340,6 +1393,10 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
>  	if (ret)
>  		return ret;
>  
> +	ret = pc_set_ignore_eff_freq(pc, !pc->use_rpe);
> +	if (unlikely(ret))
> +		return ret;
> +
>  	ret = pc_init_freqs(pc);
>  	if (ret)
>  		return ret;

[Severity: Medium]
Does calling pc_set_ignore_eff_freq(pc, !pc->use_rpe) before pc_init_freqs()
cause pc_adjust_freq_bounds() to skip the BMG_MIN_FREQ floor when RPe is at
or above BMG_MIN_FREQ?

With pc->use_rpe defaulting to true, RPe is enabled when pc_init_freqs() ->
pc_adjust_freq_bounds() queries GuC:

drivers/gpu/drm/xe/xe_guc_pc.c:pc_adjust_freq_bounds() {
	...
	min_freq = pc_get_min_freq(pc);
	...
	if (pc_needs_min_freq_change(pc) && min_freq < BMG_MIN_FREQ)
		ret = pc_set_min_freq(pc, BMG_MIN_FREQ);
}

Whenever RPe >= BMG_MIN_FREQ (1200 MHz), min_freq < BMG_MIN_FREQ is false,
so pc_set_min_freq(pc, BMG_MIN_FREQ) is not called and GuC's underlying
minimum remains at RPn.  On BMG, pc_set_mert_freq_cap() then immediately
disables RPe and stashes RPn into pc->stashed_min_freq, which
xe_guc_pc_restore_stashed_freq() writes back as the global min frequency.
If the user later disables use_rpe or PCODE lowers RPe below 1200 MHz, the
minimum frequency drops to RPn instead of respecting the 1200 MHz floor
required on BMG (Wa_14022085890) and CRI.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118012453.626087-3-vinay.belgaumkar@intel.com?part=2

  reply	other threads:[~2026-11-18  1:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  1:24 [PATCH v3 1/2] drm/xe: Disallow freq changes while mert cap is active Vinay Belgaumkar
2026-11-18  1:24 ` [PATCH v3 2/2] drm/xe: Add sysfs to disable RPe Vinay Belgaumkar
2026-11-18  1:50   ` sashiko-bot [this message]
2026-11-18  1:34 ` ✓ CI.KUnit: success for series starting with [v3,1/2] drm/xe: Disallow freq changes while mert cap is active Patchwork
2026-11-18  2:01 ` [PATCH v3 1/2] " sashiko-bot
2026-11-18  2:10 ` ✗ Xe.CI.BAT: failure for series starting with [v3,1/2] " 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=sashiko-outbox-219913@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vinay.belgaumkar@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