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 v6 1/2] drm/xe: Disallow freq changes while mert cap is active
Date: Fri, 20 Nov 2026 23:20:05 +0000	[thread overview]
Message-ID: <sashiko-outbox-226342@kernel.org> (raw)
In-Reply-To: <20261120225325.1460380-3-vinay.belgaumkar@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe: missing freq_ready and cap check in
  xe_guc_pc_restore_stashed_freq()
--

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

drm/xe: Disallow freq changes while mert cap is active

This commit tracks whether the Wa_22019338487 MERT frequency cap is
active, defers user min/max frequency changes while the cap is in force,
and restores the cap after GSC load completes or fails.

> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 9558d7196a51a..7cbdb7985843d 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
[ ... ]
> @@ -1112,9 +1146,13 @@ 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);
> +	/* 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);
>  	if (!ret)
> -		ret = pc_set_min_freq(pc, pc->stashed_min_freq);
> +		pc->mert_freq_cap_active = false;
>  	mutex_unlock(&pc->freq_lock);
>  
>  	return ret;

[Severity: Medium]
Should xe_guc_pc_restore_stashed_freq() check pc->freq_ready and
pc->mert_freq_cap_active under pc->freq_lock before calling
pc_set_max_freq() and pc_set_min_freq()?

If a GT reset runs while gsc_work() is in flight, xe_guc_pc_stop() clears
both pc->freq_ready and pc->mert_freq_cap_active while GuC CT is disabled:

kworker (gsc_work)                kworker (gt_reset_worker)
gsc_upload_and_init()
                                  do_gt_reset()
                                  xe_uc_stop_prepare()
                                    xe_guc_pc_stop()
                                      mutex_lock(&pc->freq_lock)
                                      pc->mert_freq_cap_active = false
                                      pc->freq_ready = false
                                      mutex_unlock(&pc->freq_lock)
xe_gt_sanitize_freq()
  xe_guc_pc_restore_stashed_freq()
    mutex_lock(&pc->freq_lock)
    pc_set_max_freq()             <-- sends SLPC H2G while PC is stopped

Because xe_gsc_stop_prepare() does not flush gsc->work, gsc_work() can
reach xe_guc_pc_restore_stashed_freq() while GuC PC is stopped, causing
pc_action_set_param() to fail and log false xe_gt_err() messages.

In addition, during normal probe, gsc_upload_and_init() sets the firmware
status to XE_UC_FIRMWARE_TRANSFERRED before xe_huc_auth() and
xe_gsc_proxy_start().  Because xe_uc_fw_is_loaded() returns true once the
status is XE_UC_FIRMWARE_TRANSFERRED, both xe_device_probe() and
gsc_work() can call xe_gt_sanitize_freq() ->
xe_guc_pc_restore_stashed_freq(), lifting the cap early and sending
duplicate SLPC requests if pc->mert_freq_cap_active is not checked.

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

      parent reply	other threads:[~2026-11-20 23:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 22:53 [PATCH v6 1/2] drm/xe: Disallow freq changes while mert cap is active Vinay Belgaumkar
2026-11-20 22:53 ` [PATCH v6 2/2] drm/xe: Add sysfs to disable RPe Vinay Belgaumkar
2026-11-20 23:04   ` sashiko-bot
2026-11-20 23:12 ` ✓ CI.KUnit: success for series starting with [v6,1/2] drm/xe: Disallow freq changes while mert cap is active Patchwork
2026-11-20 23:20 ` 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-226342@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