From: sashiko-bot@kernel.org
To: "Joshua Horne" <hornejd@etsu.edu>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 4/4] drm/amd/pm: stop disabling overdrive on Carrizo and Stoney
Date: Sun, 06 Dec 2026 05:13:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-252160@kernel.org> (raw)
In-Reply-To: <20261205-smu8-overdrive-v3-4-46890aa116e7@etsu.edu>
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 <hornejd@etsu.edu>
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 &= ~PP_GFXOFF_MASK;
> - hwmgr->od_enabled = false;
> hwmgr->smumgr_funcs = &smu8_smu_funcs;
> hwmgr->feature_mask &= ~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 = 0; i < (int)table->count; i++) {
if (clock <= table->entries[i].clk)
break;
}
break;
case PPSMC_MSG_SetSclkSoftMax:
case PPSMC_MSG_SetSclkHardMax:
for (i = table->count - 1; i >= 0; i--) {
if (clock >= 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 = 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 >= table->entries[od->num_of_pl].clk with -EINVAL.
If disabled trailing VBIOS slots (i >= od->num_of_pl) contain zero or
non-increasing clocks, smu8_od_commit_sclk_table() will reject every
commit, including after a reset.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205-smu8-overdrive-v3-0-46890aa116e7@etsu.edu?part=4
prev parent reply other threads:[~2026-12-06 5:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 4:52 [PATCH v3 0/4] drm/amd/pm: overdrive support for smu8 (Carrizo/Stoney) Joshua Horne
2026-12-06 4:52 ` Joshua Horne via B4 Relay
2026-12-06 4:52 ` [PATCH v3 1/4] drm/amd/pm: move smu8_populate_umdpstate_clocks() up Joshua Horne
2026-12-06 4:52 ` Joshua Horne via B4 Relay
2026-12-06 4:52 ` [PATCH v3 2/4] drm/amd/pm: show the smu8 overdrive sclk table Joshua Horne
2026-12-06 4:52 ` Joshua Horne via B4 Relay
2026-12-06 5:14 ` sashiko-bot
2026-12-06 4:52 ` [PATCH v3 3/4] drm/amd/pm: allow editing " Joshua Horne
2026-12-06 4:52 ` Joshua Horne via B4 Relay
2026-12-06 5:15 ` sashiko-bot
2026-12-06 4:52 ` [PATCH v3 4/4] drm/amd/pm: stop disabling overdrive on Carrizo and Stoney Joshua Horne
2026-12-06 4:52 ` Joshua Horne via B4 Relay
2026-12-06 5:13 ` 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-252160@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hornejd@etsu.edu \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.