From: sashiko-bot@kernel.org
To: "Vinay Belgaumkar" <vinay.belgaumkar@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v8 2/2] drm/xe: Add sysfs to disable RPe
Date: Fri, 04 Dec 2026 02:09:24 +0000 [thread overview]
Message-ID: <sashiko-outbox-248948@kernel.org> (raw)
In-Reply-To: <20261204014137.2470389-4-vinay.belgaumkar@intel.com>
Thank you for your contribution! Sashiko AI review found 6 potential
issues to consider:
- [Medium] drm/xe: disabling RPe without min_freq update breaks GuC 70.x
SLPC
- [Medium] drm/xe: partial error in xe_guc_pc_restore_stashed_freq()
locks mert cap
- [Medium] drm/xe: removing RPe override in pc_set_min_freq() breaks
min_freq sysfs ABI
- [Medium] drm/xe: D3cold skips xe_guc_pc_stop(), corrupting
stashed_min_freq
- [Low] drm/xe: unlocked direct pc->ignore_eff_freq read in
ignore_eff_freq_show()
- [Low] drm/xe: missing ignore_eff_freq restore on
pc_set_mert_freq_cap() error
--
commit 7df33a9238986839478707b9a4d3d637a6501d51
Author: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
drm/xe: Add sysfs to disable RPe
This patch adds an ignore_eff_freq sysfs attribute to control GuC SLPC's
use of efficient frequency (RPe), removes the implicit RPe override from
pc_set_min_freq(), and disables RPe while stashing frequencies for the
MERT frequency cap.
> diff --git a/drivers/gpu/drm/xe/xe_gt_freq.c b/drivers/gpu/drm/xe/xe_gt_freq.c
> index a40dd074106f3..b02a9c1fe33e1 100644
> --- a/drivers/gpu/drm/xe/xe_gt_freq.c
> +++ b/drivers/gpu/drm/xe/xe_gt_freq.c
> @@ -242,6 +242,40 @@ static ssize_t power_profile_store(struct kobject *kobj,
> }
> static struct kobj_attribute attr_power_profile = __ATTR_RW(power_profile);
>
> +static ssize_t ignore_eff_freq_show(struct kobject *kobj,
> + struct kobj_attribute *attr,
> + char *buff)
> +{
> + struct device *dev = kobj_to_dev(kobj);
> + struct xe_guc_pc *pc = dev_to_pc(dev);
> +
> + return sysfs_emit(buff, "%u\n", pc->ignore_eff_freq);
> +}
[Severity: Low]
Is this an unlocked data race on pc->ignore_eff_freq?
xe_guc_pc_set_ignore_eff_freq() updates pc->ignore_eff_freq under
pc->freq_lock, whereas ignore_eff_freq_show() performs a plain unlocked
read that can race with concurrent sysfs writes.
Every other callback in xe_gt_freq.c also reads struct xe_guc_pc through a
xe_guc_pc_*() helper rather than accessing fields directly, and
xe_guc_pc_set_ignore_eff_freq() takes u32 even though pc->ignore_eff_freq
is a bool. Adding a locked xe_guc_pc_get_ignore_eff_freq() accessor and
switching the parameter to bool would clean up all three.
[ ... ]
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index cc1869e6bcbef..bda0dde9c19f2 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
[ ... ]
> @@ -358,13 +373,6 @@ static int pc_set_min_freq(struct xe_guc_pc *pc, u32 freq)
> if (!pc_freq_in_range(pc, freq))
> return -EINVAL;
>
> - /*
> - * GuC policy is to elevate minimum frequency to the efficient levels
> - * Our goal is to have the admin choices respected.
> - */
> - pc_action_set_param(pc, SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY,
> - freq < xe_guc_pc_get_rpe_freq(pc));
> -
> return pc_action_set_param(pc,
> SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
> freq);
[Severity: Medium]
Does removing the SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY update here break
the existing freq0/min_freq sysfs ABI for values below rpe_freq?
Since commit dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel
GPUs"), writing min_freq < rpe_freq disabled RPe so admin minimum and
fixed-frequency (max_freq <= min_freq) requests below rpe_freq took effect.
With pc->ignore_eff_freq defaulting to false, existing tools writing a
lower min_freq now get a successful write return while GuC keeps the
effective minimum pinned at rpe_freq.
DOC: Xe GT Frequency Management in drivers/gpu/drm/xe/xe_gt_freq.c is also
not updated to document ignore_eff_freq or note that max <= min no longer
acts as a fixed-frequency request below rpe_freq by default.
> @@ -615,7 +623,10 @@ static int xe_guc_pc_get_min_freq_locked(struct xe_guc_pc *pc, u32 *freq)
>
> /* In the middle of a temporary freq cap, return stashed or min freq */
> if (pc->mert_freq_cap_active) {
> - *freq = pc->user_requested_min ?: pc->stashed_min_freq;
> + u32 min = pc->user_requested_min ?: pc->stashed_min_freq;
> +
> + /* Return what GuC would report based on ignore_eff_freq */
> + *freq = !pc->ignore_eff_freq ? max(min, xe_guc_pc_get_rpe_freq(pc)) : min;
> return 0;
> }
[Severity: Medium]
Can this synthetic RPe elevation corrupt pc->stashed_min_freq across a
D3cold runtime suspend/resume cycle?
If xe_guc_pc_restore_stashed_freq() fails on a platform with Wa_22019338487,
callers such as xe_device_probe() and do_gt_restart() ignore the error from
xe_gt_sanitize_freq() and leave pc->mert_freq_cap_active true. On D3cold
runtime suspend, xe_pm_runtime_suspend() calls xe_gt_suspend() directly
without calling xe_guc_pc_stop(), so pc->mert_freq_cap_active is still true
when resume reaches pc_set_mert_freq_cap().
pc_set_mert_freq_cap() then calls xe_guc_pc_get_min_freq_locked() to stash
the underlying minimum, which hits this branch instead of querying GuC and
overwrites pc->stashed_min_freq with the RPe-elevated value. Once
xe_guc_pc_restore_stashed_freq() programs that stashed value as GuC's
global minimum, setting ignore_eff_freq to 1 can no longer lower min_freq
below RPe. Clearing pc->mert_freq_cap_active in pc_init_freqs() (or
calling xe_guc_pc_stop() during D3cold suspend) would avoid this.
[ ... ]
> @@ -1103,12 +1123,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.
> */
> @@ -1121,7 +1152,9 @@ static int pc_set_mert_freq_cap(struct xe_guc_pc *pc)
> /*
> * Ensure min and max are bound by MERT_FREQ_CAP until driver loads.
> */
> - ret = pc_set_min_freq(pc, min(xe_guc_pc_get_rpe_freq(pc), pc_max_freq_cap(pc)));
> + mert_freq_cap = min(xe_guc_pc_get_rpe_freq(pc), pc_max_freq_cap(pc));
> +
> + ret = pc_set_min_freq(pc, mert_freq_cap);
> if (!ret)
> ret = pc_set_max_freq(pc, min(pc->rp0_freq, pc_max_freq_cap(pc)));
[Severity: Low]
If querying or programming the frequencies fails after
pc_set_ignore_eff_freq(pc, 1), does this leave GuC with RPe disabled while
pc->ignore_eff_freq stays false?
Because pc->mert_freq_cap_active remains false on error,
xe_guc_pc_restore_stashed_freq() will not reinstate the saved setting. On
non-fatal resume paths such as xe_device_resume() (when !flr) or a canceled
D3cold runtime suspend in xe_pci_runtime_suspend(), pc_init_freqs() has
already set pc->freq_ready = true, leaving the device live with sysfs
reporting ignore_eff_freq as 0 while GuC ignores RPe. Restoring
pc_set_ignore_eff_freq(pc, pc->ignore_eff_freq) on the error path would
keep them in sync.
> @@ -1153,9 +1186,11 @@ int xe_guc_pc_restore_stashed_freq(struct xe_guc_pc *pc)
>
> /* Apply any user min/max request made while the cap was active, else the stash. */
> ret = pc_set_max_freq(pc, pc->user_requested_max ?: pc->stashed_max_freq);
> -
> if (!ret)
> ret = pc_set_min_freq(pc, pc->user_requested_min ?: pc->stashed_min_freq);
> + /* Restore ignore_eff_freq override from pc_set_mert_freq_cap(). */
> + if (!ret)
> + ret = pc_set_ignore_eff_freq(pc, pc->ignore_eff_freq);
> if (!ret)
> pc->mert_freq_cap_active = false;
[Severity: Medium]
If pc_set_ignore_eff_freq() (or pc_set_min_freq()) fails after
pc_set_max_freq() succeeds, does pc->mert_freq_cap_active stay stuck true?
Every caller invokes xe_guc_pc_restore_stashed_freq() via
xe_gt_sanitize_freq() (xe_device_probe(), gsc_work(), and do_gt_restart())
and discards the return value without retrying. While
pc->mert_freq_cap_active remains stuck true, subsequent sysfs writes to
min_freq, max_freq, and ignore_eff_freq silently skip GuC updates and
return success, while min_freq and max_freq reads return cached values
instead of querying GuC.
[ ... ]
> @@ -1211,6 +1251,32 @@ static int pc_action_set_strategy(struct xe_guc_pc *pc, u32 val)
> return ret;
> }
>
> +int xe_guc_pc_set_ignore_eff_freq(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;
> +
> + if (!pc->mert_freq_cap_active) {
> + /*
> + * If ignore_eff_freq == 0, GuC elevates min_freq to RPe when
> + * enabled, and resets it back to the previously set min when
> + * disabled (ignore_eff_freq == 1), so no explicit set_min_freq
> + * request is needed here.
> + */
> + ret = pc_set_ignore_eff_freq(pc, val);
> + }
> +
> + if (!ret)
> + pc->ignore_eff_freq = val;
> +
> + return ret;
> +}
[Severity: Medium]
Does setting SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY to 1 without also
sending SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ actually lower GuC's
minimum frequency on GuC 70.x firmware?
Commit 28e671114fb0 ("drm/i915/guc/slpc: Restore efficient freq earlier")
noted that GuC does not bring min_freq back down to RPn on its own when
SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY is set to 1, so i915 follows it
with an explicit min frequency update:
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:intel_guc_slpc_set_ignore_eff_freq() {
...
/* Set min to RPn when we disable efficient freq */
if (val)
ret = slpc_set_param(slpc,
SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
slpc->min_freq);
...
}
Because xe loads the same i915/*_guc_70.bin firmware family without
requiring a newer minor version (full_ver_required is false in
xe_uc_fw_check_version_requirements()), relying on GuC to lower min_freq
automatically can leave min_freq stuck at RPe here, after GT reset/resume
in pc_init_freqs() (which restores ignore_eff_freq after
pc_adjust_requested_freq()), and when pc_adjust_freq_bounds() or
pc_set_mert_freq_cap() queries the underlying minimum right after disabling
RPe.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204014137.2470389-3-vinay.belgaumkar@intel.com?part=2
next prev parent reply other threads:[~2026-12-04 2:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 1:41 [PATCH v8 1/2] drm/xe: Disallow freq changes while mert cap is active Vinay Belgaumkar
2026-12-04 1:41 ` [PATCH v8 2/2] drm/xe: Add sysfs to disable RPe Vinay Belgaumkar
2026-12-04 2:09 ` sashiko-bot [this message]
2026-12-04 1:51 ` ✓ CI.KUnit: success for series starting with [v8,1/2] drm/xe: Disallow freq changes while mert cap is active Patchwork
2026-12-04 2:04 ` [PATCH v8 1/2] " sashiko-bot
2026-12-04 2:26 ` ✗ Xe.CI.BAT: failure for series starting with [v8,1/2] " Patchwork
2026-12-05 3:31 ` ✗ Xe.CI.FULL: " 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-248948@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 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.