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 1B1E8606A31F for ; Sun, 6 Dec 2026 05:14:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cdvFC7mb Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D47010E091; Sun, 6 Dec 2026 05:14:05 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id C5F0810E091; Sun, 6 Dec 2026 05:13:59 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D4EEB60D56; Sun, 6 Dec 2026 05:13:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 737C51F00A11; Sun, 6 Dec 2026 05:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796534038; bh=B6k1IygbKM/h7aA03mu5/n2immIIOvye7A3fwKk12/Q=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=cdvFC7mbdKHh5tePJpvdCKjvCqK0rzSDQg1xbCqWPBftgvp3aHjrFGiA252229u3q KTot95LKgpzYeLgzgJajtlw2JkF9Ju6nWfOPwY/5F5OEij1mFKwzzEG+PP/rn74iki wjOirnTL3oCShw2c5KJwes4lFR6A4YWavtUn0mVlwkJJnAs8qjKFAbjIvpD9mF8/Dr Fjaufc8ZKowv/+UewXn8JKu3KgZGx1inJP82rOkEJM43h5BPS11WVme4drUjrC9wMb EXKkA+YB9hdQdXm1pR4OXbuFUazN8l2zkJpF7ca5qoXXS6oy9Dze9wn2CFBnNZWTlf mggA96vjw3UZw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 4/4] drm/amd/pm: stop disabling overdrive on Carrizo and Stoney To: "Joshua Horne" Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org In-Reply-To: <20261205-smu8-overdrive-v3-4-46890aa116e7@etsu.edu> References: <20261205-smu8-overdrive-v3-0-46890aa116e7@etsu.edu> <20261205-smu8-overdrive-v3-4-46890aa116e7@etsu.edu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 05:13:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-11.1 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/amd/pm: smu8_get_sclk_level() returns invalid SMU index after OD edits - [Medium] drm/amd/pm: TOCTOU race between smu8 OD commit validation and upload - [Low] drm/amd/pm: smu8 OD_RANGE upper bound conflicts with commit check on fused parts -- commit 410fd83012e58f829edb9505ba11ba13eadf9aa2 Author: Joshua Horne drm/amd/pm: stop disabling overdrive on Carrizo and Stoney This commit stops clearing hwmgr->od_enabled on AMDGPU_FAMILY_CZ so that PP_OVERDRIVE_MASK in amdgpu.ppfeaturemask controls overdrive on Carrizo and Stoney APUs, and documents the pp_od_clk_voltage format for them. > diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c b/drivers/gpu= /drm/amd/pm/powerplay/hwmgr/hwmgr.c > index 4d553be56396f..1567b8fa2a6b7 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c > @@ -120,7 +120,6 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr) > break; > case AMDGPU_FAMILY_CZ: > adev->pm.pp_feature &=3D ~PP_GFXOFF_MASK; > - hwmgr->od_enabled =3D false; > hwmgr->smumgr_funcs =3D &smu8_smu_funcs; > hwmgr->feature_mask &=3D ~PP_GFXOFF_MASK; > smu8_init_function_pointers(hwmgr); [Severity: Medium] Can smu8_get_sclk_level() now return out-of-range SMU level indices after overdrive edits? With overdrive enabled, userspace can edit hwmgr->dyn_state.vddc_dependency_on_sclk in place, but smu8_get_sclk_level() does not clamp its loop index on fall-through or cap it to smu8_get_max_sclk_level(hwmgr): drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c:smu8_get_sclk_level() { ... case PPSMC_MSG_SetSclkSoftMin: case PPSMC_MSG_SetSclkHardMin: for (i =3D 0; i < (int)table->count; i++) { if (clock <=3D table->entries[i].clk) break; } break; case PPSMC_MSG_SetSclkSoftMax: case PPSMC_MSG_SetSclkHardMax: for (i =3D table->count - 1; i >=3D 0; i--) { if (clock >=3D table->entries[i].clk) break; } break; ... return i; } If level 0 is raised above the unchanged VBIOS bootup_engine_clock, resume (hwmgr_resume() -> smu8_enable_dpm_tasks() -> smu8_program_bootup_state()) calls smu8_get_sclk_level() for PPSMC_MSG_SetSclkSoftMax and sends 0xffffffff to the SMU. In manual overdrive mode, smu8_dpm_force_dpm_level(AMD_DPM_FORCED_LEVEL_MANUAL) is a no-op during resume, leaving the invalid soft-max active and breaking DPM clock control. Similarly, underclocking all enabled levels below hwmgr->display_config->min_core_set_clock causes smu8_update_sclk_limit() to send table->count or a fused-off level index for SetSclkHardMin on overdrive commit. Clamping the return value of smu8_get_sclk_level() to [0, min(table->count, smu8_get_max_sclk_level(hwmgr)) - 1] would prevent passing out-of-range indices to the SMU. [Severity: Medium] Is there a race between overdrive commit validation in smu8_od_commit_sclk_table() and the upload in smu8_od_upload_sclk_table()? amdgpu_set_pp_od_clk_voltage() acquires and releases adev->pm.mutex separately for amdgpu_dpm_odn_edit_dpm_table() and amdgpu_dpm_dispatch_task(). Concurrent writes on separate open file descriptors can mutate data->od_edit_sclk in that unlocked window without re-checking monotonicity or clearing data->od_update_pending: CPU0 (write "c") CPU1 (write "s ..." or "r") amdgpu_set_pp_od_clk_voltage() amdgpu_dpm_odn_edit_dpm_table() mutex_lock(&adev->pm.mutex) smu8_od_commit_sclk_table() /* checks monotonicity */ data->od_update_pending =3D true mutex_unlock(&adev->pm.mutex) amdgpu_set_pp_od_clk_voltage() amdgpu_dpm_odn_edit_dpm_table() mutex_lock(&adev->pm.mutex) smu8_odn_edit_dpm_table() /* mutates od_edit_sclk */ mutex_unlock(&adev->pm.mutex) amdgpu_dpm_dispatch_task() mutex_lock(&adev->pm.mutex) smu8_od_upload_sclk_table() /* uploads live od_edit_sclk */ <-- unvalidated table uploaded mutex_unlock(&adev->pm.mutex) This can upload uncommitted, non-monotonic or duplicate SCLK entries into the power states and SMU firmware via smu8_upload_pptable_to_smu(), breaking the ascending-clock invariant assumed by smu8_get_sclk_level() and other DPM helpers. Snapshotting the validated table in smu8_od_commit_sclk_table() (or clearing od_update_pending on edits and resets) would close this window. [Severity: Low] On fused Carrizo and Stoney parts, can the OD_RANGE upper bound disagree with the monotonicity check in smu8_od_commit_sclk_table()? When smu8_get_max_sclk_level(hwmgr) < vddc_table->count, smu8_init_od_settings() exposes only levels 0 .. od->num_of_pl - 1, but leaves a non-zero VBIOS overdriveLimit.engineClock uncapped relative to the hidden disabled entry vddc_table->entries[od->num_of_pl].clk. OD_RANGE advertises clocks up to overdriveLimit.engineClock and smu8_od_edit_sclk_level() accepts them, yet smu8_od_commit_sclk_table() checks strict monotonicity across all table->count entries and rejects any value >=3D table->entries[od->num_of_pl].clk with -EINVAL. If disabled trailing VBIOS slots (i >=3D od->num_of_pl) contain zero or non-increasing clocks, smu8_od_commit_sclk_table() will reject every commit, including after a reset. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-smu8-overd= rive-v3-0-46890aa116e7@etsu.edu?part=3D4