From: sashiko-bot@kernel.org
To: "Vinay Belgaumkar" <vinay.belgaumkar@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v8 1/2] drm/xe: Disallow freq changes while mert cap is active
Date: Fri, 04 Dec 2026 02:04:50 +0000 [thread overview]
Message-ID: <sashiko-outbox-248939@kernel.org> (raw)
In-Reply-To: <20261204014137.2470389-3-vinay.belgaumkar@intel.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/xe: moving xe_gt_sanitize_freq() delays MERT cap lift
across proxy wait
- [Medium] drm/xe: xe_guc_pc_restore_stashed_freq() failure leaves MERT
cap stuck active
- [Low] drm/xe: mert_freq_cap_active not cleared on start error and
wedge paths
--
commit 324821a3b1afa8ebd5627931e88f81a3653c11e8
Author: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
drm/xe: Disallow freq changes while mert cap is active
This commit tracks when the Wa_22019338487 MERT frequency cap is active so
sysfs min/max frequency changes are deferred until the cap is lifted, and
moves cap removal in xe_gsc.c so it also runs when GSC load fails.
> diff --git a/drivers/gpu/drm/xe/xe_gsc.c b/drivers/gpu/drm/xe/xe_gsc.c
> index 8edb8cee3cbd8..c818a4e7863ef 100644
> --- a/drivers/gpu/drm/xe/xe_gsc.c
> +++ b/drivers/gpu/drm/xe/xe_gsc.c
> @@ -290,9 +290,6 @@ static int gsc_upload_and_init(struct xe_gsc *gsc)
>
> xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_TRANSFERRED);
>
> - /* GSC load is done, restore expected GT frequencies */
> - xe_gt_sanitize_freq(gt);
> -
> xe_gt_dbg(gt, "GSC FW async load completed\n");
>
> /* HuC auth failure is not fatal */
> @@ -376,6 +373,9 @@ static void gsc_work(struct work_struct *work)
> xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_LOAD_FAIL);
> else
> xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_RUNNING);
> +
> + /* Undo the mert cap now that GSC load was attempted */
> + xe_gt_sanitize_freq(gt);
> }
>
> if (actions & GSC_ACTION_SW_PROXY)
[Severity: Medium]
Does moving xe_gt_sanitize_freq() to gsc_work() keep the Media GT throttled
for up to 20 seconds during GSC proxy initialization?
gsc_upload_and_init() now runs xe_huc_auth() and xe_gsc_proxy_start() before
returning to gsc_work(). xe_gsc_proxy_start() synchronously calls
xe_gsc_proxy_request_handler(), which polls for gsc->proxy.component for up
to GSC_PROXY_INIT_TIMEOUT_MS (20 seconds) before talking to CSME.
While that runs, the Media GT stays capped at 800 MHz and sysfs min/max
frequency writes are deferred.
Since xe_guc_pc_restore_stashed_freq() is now idempotent via
mert_freq_cap_active, keeping xe_gt_sanitize_freq(gt) right after
XE_UC_FIRMWARE_TRANSFERRED in gsc_upload_and_init() as well as in gsc_work()
would lift the cap on upload failure without stalling across proxy init.
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 9558d7196a51a..cc1869e6bcbef 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
[ ... ]
> @@ -1094,11 +1125,14 @@ static int pc_set_mert_freq_cap(struct xe_guc_pc *pc)
> if (!ret)
> ret = pc_set_max_freq(pc, min(pc->rp0_freq, pc_max_freq_cap(pc)));
>
> + if (!ret)
> + pc->mert_freq_cap_active = true;
> +
> return ret;
> }
[Severity: Low]
Can pc->mert_freq_cap_active stay stuck true if startup fails after
pc_set_mert_freq_cap() or if the device is wedged?
If xe_guc_pc_set_power_profile() fails in xe_guc_pc_start(), or
xe_guc_rc_enable() fails in xe_uc_load_hw() before xe_gsc_load_start(),
neither path calls xe_guc_pc_stop(). On a failed xe_gt_resume(), the GT
stays capped while sysfs min/max writes silently succeed and are discarded.
Likewise, xe_guc_wedge_declare() stops CT without calling xe_guc_pc_stop(),
so sysfs min/max accesses on a wedged device return 0 with cached values
instead of failing via GuC CT. Calling xe_guc_pc_stop() on those error
unwind paths and in xe_guc_wedge_declare() would clear the flag.
[ ... ]
> @@ -1112,9 +1146,20 @@ int xe_guc_pc_restore_stashed_freq(struct xe_guc_pc *pc)
> return 0;
>
> mutex_lock(&pc->freq_lock);
> - ret = pc_set_max_freq(pc, pc->stashed_max_freq);
> +
> + /* Restore not needed any more */
> + if (!pc->freq_ready || !pc->mert_freq_cap_active)
> + goto done;
> +
> + /* 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->stashed_min_freq);
> + ret = pc_set_min_freq(pc, pc->user_requested_min ?: pc->stashed_min_freq);
> + if (!ret)
> + pc->mert_freq_cap_active = false;
> +
> +done:
> mutex_unlock(&pc->freq_lock);
>
> return ret;
[Severity: Medium]
What happens if pc_set_max_freq() or pc_set_min_freq() fails here?
Both call pc_action_set_param(), which can fail with -EAGAIN if
wait_for_pc_state() times out, and all callers of xe_gt_sanitize_freq()
ignore the return value with no retry. Because mert_freq_cap_active is only
cleared on success, it stays stuck true until a GT reset or suspend.
While stuck true, the GT stays capped (or half-restored), sysfs min/max
writes silently return 0 without programming GuC, and sysfs reads return the
cached values instead of querying GuC.
Logging the error and clearing mert_freq_cap_active unconditionally, as
xe_guc_pc_remove_flush_freq_limit() does, would let userspace see the actual
frequencies and override them via sysfs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204014137.2470389-3-vinay.belgaumkar@intel.com?part=1
next prev parent reply other threads:[~2026-12-04 2:05 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
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 ` sashiko-bot [this message]
2026-12-04 2:26 ` ✗ Xe.CI.BAT: failure " 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-248939@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.