From: sashiko-bot@kernel.org
To: "Vinay Belgaumkar" <vinay.belgaumkar@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v5 1/2] drm/xe: Disallow freq changes while mert cap is active
Date: Fri, 20 Nov 2026 02:29:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-224364@kernel.org> (raw)
In-Reply-To: <20261120021606.1360244-3-vinay.belgaumkar@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/xe: xe_guc_pc_get_min/max_freq_locked() return freq instead
of 0
- [Medium] drm/xe: mert_freq_cap_active is not cleared on GuC PC stop or
restart
--
commit a5ffc89a51c9df2129a3327ea1a0076ff70c2a90
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,
defers user min/max frequency changes until the cap is lifted, and lifts
the cap even if GSC firmware load fails.
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 9558d7196a51a..7e9700f16bfb6 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
[ ... ]
> @@ -612,6 +613,10 @@ static int xe_guc_pc_get_min_freq_locked(struct xe_guc_pc *pc, u32 *freq)
> if (!pc->freq_ready)
> return -EAGAIN;
>
> + /* In the middle of a temporary freq cap, return stashed value */
> + if (XE_GT_WA(pc_to_gt(pc), 22019338487) && pc->mert_freq_cap_active)
> + return pc->stashed_min_freq;
> +
> ret = pc_action_query_task_state(pc);
> if (ret)
> return ret;
[ ... ]
> @@ -681,6 +695,10 @@ static int xe_guc_pc_get_max_freq_locked(struct xe_guc_pc *pc, u32 *freq)
> if (!pc->freq_ready)
> return -EAGAIN;
>
> + /* In the middle of a temporary freq cap, return stashed value */
> + if (XE_GT_WA(pc_to_gt(pc), 22019338487) && pc->mert_freq_cap_active)
> + return pc->stashed_max_freq;
> +
> ret = pc_action_query_task_state(pc);
> if (ret)
> return ret;
[Severity: High]
Should xe_guc_pc_get_min_freq_locked() and xe_guc_pc_get_max_freq_locked()
write the frequency into *freq and return 0 here instead of returning the
positive frequency value as the status code?
Callers such as min_freq_show() and max_freq_show() check if (ret) return
ret;, so returning a positive MHz value leaves *freq unassigned and causes
the sysfs show callbacks to return that positive integer as the byte count
without writing to buf. In addition, if a user sets a new min or max
frequency while the cap is active, it is saved in pc->user_requested_min /
pc->user_requested_max rather than pc->stashed_min_freq /
pc->stashed_max_freq, so *freq should probably be assigned
pc->user_requested_min ?: pc->stashed_min_freq (and similarly for max) to
match xe_guc_pc_restore_stashed_freq().
[ ... ]
> @@ -1094,6 +1121,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]
What happens if GuC PC is stopped and restarted (for example during a GT
reset) while pc->mert_freq_cap_active is still true?
Neither xe_guc_pc_stop() nor pc_set_mert_freq_cap() clears
pc->mert_freq_cap_active. When xe_guc_pc_start() calls
pc_set_mert_freq_cap() after pc_init_freqs(), its calls to
xe_guc_pc_get_min_freq_locked() and xe_guc_pc_get_max_freq_locked() will
hit the pc->mert_freq_cap_active early return instead of querying the
newly initialized SLPC state from GuC.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120021606.1360244-3-vinay.belgaumkar@intel.com?part=1
prev parent reply other threads:[~2026-11-20 2:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 2:16 [PATCH v5 1/2] drm/xe: Disallow freq changes while mert cap is active Vinay Belgaumkar
2026-11-20 2:16 ` [PATCH v5 2/2] drm/xe: Add sysfs to disable RPe Vinay Belgaumkar
2026-11-20 2:29 ` sashiko-bot [this message]
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-224364@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