From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24F5A606A322 for ; Fri, 4 Dec 2026 02:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fxp9WCn4 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA05E10E156; Fri, 4 Dec 2026 02:04:58 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CCC910E156 for ; Fri, 4 Dec 2026 02:04:52 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 7322C61547; Fri, 4 Dec 2026 02:04:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 159D01F000C2; Fri, 4 Dec 2026 02:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796349891; bh=PIppfmTlnAopIePVxL/5dAdLJ+iYjg1vOrZ0CXKCNZw=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=fxp9WCn4LCddHri11o3XdgCUZbGTfuGFSEDPMQpVsvLKbE/5LI1OB+p4udCYdQsPd JE1xxfI2YJHtecsFAfo9jr3Cu9hrbZbuwrhMKHJXRSVDIbZAWztgNA6T3iBdXlXauW Fc2ga5f6lrtYfmmlPjgh3sE9QIClDC+XVgVC1B2IBHRLDjJaYJD/pF8rNHja9hSO3e abrpVxzTSvea8fM6TxWKYLtnHd0S7kT2rlqvvhGk1qo1mtqr5qXeBnvoBJE+apYQaJ vzXgUNWtuCg9pZgFm9LPgAucopW/eGk5/9kOAfAy1pAE0b+ptDcqLo5KKoDsNYmbVA 9f0pvht6abDcA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v8 1/2] drm/xe: Disallow freq changes while mert cap is active To: "Vinay Belgaumkar" , intel-xe@lists.freedesktop.org In-Reply-To: <20261204014137.2470389-3-vinay.belgaumkar@intel.com> References: <20261204014137.2470389-3-vinay.belgaumkar@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 02:04:50 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 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) > =20 > xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_TRANSFERRED); > =20 > - /* GSC load is done, restore expected GT frequencies */ > - xe_gt_sanitize_freq(gt); > - > xe_gt_dbg(gt, "GSC FW async load completed\n"); > =20 > /* 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); > } > =20 > 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_p= c.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 =3D pc_set_max_freq(pc, min(pc->rp0_freq, pc_max_freq_cap(pc))); > =20 > + if (!ret) > + pc->mert_freq_cap_active =3D 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_p= c *pc) > return 0; > =20 > mutex_lock(&pc->freq_lock); > - ret =3D 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 t= he stash. */ > + ret =3D pc_set_max_freq(pc, pc->user_requested_max ?: pc->stashed_max_f= req); > + > if (!ret) > - ret =3D pc_set_min_freq(pc, pc->stashed_min_freq); > + ret =3D pc_set_min_freq(pc, pc->user_requested_min ?: pc->stashed_min_= freq); > + if (!ret) > + pc->mert_freq_cap_active =3D false; > + > +done: > mutex_unlock(&pc->freq_lock); > =20 > 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204014137.2470= 389-3-vinay.belgaumkar@intel.com?part=3D1