From: sashiko-bot@kernel.org
To: "Vinay Belgaumkar" <vinay.belgaumkar@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 1/2] drm/xe: Disallow freq changes while mert cap is active
Date: Wed, 18 Nov 2026 02:01:45 +0000 [thread overview]
Message-ID: <sashiko-outbox-219921@kernel.org> (raw)
In-Reply-To: <20261118012453.626087-3-vinay.belgaumkar@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe: mert_freq_cap_active left set if async gsc_upload()
fails
--
commit 122f6e08f3dbfe345a69d449458dd10c810ca28c
Author: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
drm/xe: Disallow freq changes while mert cap is active
This commit adds a mert_freq_cap_active flag to defer user min/max GT
frequency changes while the Wa_22019338487 frequency cap is in force, and
applies any deferred requests when restoring stashed frequencies.
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 9558d7196a51a..ea47b0ded83a4 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
[ ... ]
> @@ -638,17 +639,26 @@ int xe_guc_pc_get_min_freq(struct xe_guc_pc *pc, u32 *freq)
>
> static int xe_guc_pc_set_min_freq_locked(struct xe_guc_pc *pc, u32 freq)
> {
> - int ret;
> -
> lockdep_assert_held(&pc->freq_lock);
>
> /* Might be in the middle of a gt reset */
> if (!pc->freq_ready)
> return -EAGAIN;
>
> - ret = pc_set_min_freq(pc, freq);
> - if (ret)
> - return ret;
> + /*
> + * While the Wa_22019338487 cap is active, defer applying the new min
> + * to GuC; xe_guc_pc_restore_stashed_freq() will apply it once the
> + * cap is removed.
> + */
> + if (pc->mert_freq_cap_active) {
> + if (!pc_freq_in_range(pc, freq))
> + return -EINVAL;
> + } else {
> + int ret = pc_set_min_freq(pc, freq);
> +
> + if (ret)
> + return ret;
> + }
>
> pc->user_requested_min = freq;
>
> @@ -707,17 +717,26 @@ int xe_guc_pc_get_max_freq(struct xe_guc_pc *pc, u32 *freq)
>
> static int xe_guc_pc_set_max_freq_locked(struct xe_guc_pc *pc, u32 freq)
> {
> - int ret;
> -
> lockdep_assert_held(&pc->freq_lock);
>
> /* Might be in the middle of a gt reset */
> if (!pc->freq_ready)
> return -EAGAIN;
>
> - ret = pc_set_max_freq(pc, freq);
> - if (ret)
> - return ret;
> + /*
> + * While the Wa_22019338487 cap is active, defer applying the new max
> + * to GuC; xe_guc_pc_restore_stashed_freq() will apply it once the
> + * cap is lifted.
> + */
> + if (pc->mert_freq_cap_active) {
> + if (!pc_freq_in_range(pc, freq))
> + return -EINVAL;
> + } else {
> + int ret = pc_set_max_freq(pc, freq);
> +
> + if (ret)
> + return ret;
> + }
>
> pc->user_requested_max = freq;
>
> @@ -1094,6 +1113,9 @@ 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: Medium]
Can pc->mert_freq_cap_active remain stuck at true if asynchronous GSC
firmware upload fails?
During xe_device_probe(), xe_gt_sanitize_freq() is a no-op while gsc_work()
is still uploading the GSC firmware (status XE_UC_FIRMWARE_LOADABLE). If
gsc_upload() subsequently fails, gsc_upload_and_init() returns early before
calling xe_gt_sanitize_freq(), and gsc_work() transitions the firmware to
XE_UC_FIRMWARE_LOAD_FAIL without restoring the stashed frequencies:
drivers/gpu/drm/xe/xe_gsc.c:gsc_upload_and_init() {
...
ret = gsc_upload(gsc);
...
if (ret)
return ret;
xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_TRANSFERRED);
/* GSC load is done, restore expected GT frequencies */
xe_gt_sanitize_freq(gt);
...
}
drivers/gpu/drm/xe/xe_gsc.c:gsc_work() {
...
if (actions & GSC_ACTION_FW_LOAD) {
ret = gsc_upload_and_init(gsc);
if (ret && ret != -EEXIST)
xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_LOAD_FAIL);
...
}
Because xe_guc_pc_restore_stashed_freq() is never called on that error
path, pc->mert_freq_cap_active stays true and all subsequent sysfs writes
to min_freq and max_freq only update pc->user_requested_min and
pc->user_requested_max without sending the new limits to GuC, leaving GT
frequency locked at the cap. Calling xe_gt_sanitize_freq(gt) in gsc_work()
after setting XE_UC_FIRMWARE_LOAD_FAIL would lift the cap on load failure.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118012453.626087-3-vinay.belgaumkar@intel.com?part=1
next prev parent reply other threads:[~2026-11-18 2:01 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
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 ` sashiko-bot [this message]
2026-11-18 2:10 ` ✗ Xe.CI.BAT: 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=sashiko-outbox-219921@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