Skip to content

AMD Venice CPPC(FAST) support for VeLinux 6.6 kernel - #126

Closed
mohanasv2 wants to merge 188 commits into
openvelinux:6.6-velinuxfrom
mohanasv2:Venice_CPPC_patches
Closed

mohanasv2 wants to merge 188 commits into
openvelinux:6.6-velinuxfrom
mohanasv2:Venice_CPPC_patches

Conversation

@mohanasv2

@mohanasv2 mohanasv2 commented Jun 4, 2026

Copy link
Copy Markdown

AMD Venice CPPC (FAST) support for VeLinux 6.6 kernel

Patch List:

  • cpufreq: amd-pstate: Update amd-pstate preferred core ranking dynamically
  • cpufreq: amd-pstate: Document limit fields in struct amd_cpudata
  • cpufreq: amd-pstate: Document the units for freq variables in amd_cpudata
  • cpufreq: amd-pstate: Unify computation of {max,min,nominal,lowest_nonlinear}_freq
  • cpufreq: amd-pstate: Remove amd_get_{min,max,nominal,lowest_nonlinear}_freq()
  • cpufreq: amd-pstate: Bail out if min/max/nominal_freq is 0
  • cpufreq: amd-pstate: get transition delay and latency value from ACPI tables
  • cpufreq: amd-pstate: Add quirk for the pstate CPPC capabilities missing
  • cpufreq: amd-pstate: fix code format problems
  • cpufreq: amd-pstate: remove unused variable lowest_nonlinear_freq
  • cpufreq: amd-pstate: remove global header file
  • cpufreq: amd-pstate: Allow users to write 'default' EPP string
  • cpufreq: amd-pstate: optimize the initial frequency values verification
  • cpufreq: amd-pstate: remove unused variable nominal_freq
  • cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported
  • cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS
  • cpufreq: amd-pstate: switch boot_cpu_has() to cpu_feature_enabled()
  • cpufreq: amd-pstate: enable shared memory type CPPC by default
  • cpufreq: amd-pstate: auto-load pstate driver by default
  • cpufreq/amd-pstate: fix setting policy current frequency value
  • cpufreq: amd-pstate: Don't create attributes when registration fails
  • cpufreq: amd-pstate: Fix the inconsistency in max frequency units
  • cpufreq: acpi: move MSR_K7_HWCR_CPB_DIS_BIT into msr-index.h
  • cpufreq: amd-pstate: initialize core precision boost state
  • cpufreq: amd-pstate: Cap the CPPC.max_perf to nominal_perf if CPB is off
  • cpufreq: pcc: Remove empty exit() callback
  • cpufreq/amd-pstate-ut: Convert nominal_freq to khz during comparisons
  • cpufreq: Make cpufreq_driver->exit() return void
  • cpufreq: amd-pstate: Fix uninitialized variable in amd_pstate_cpu_boost_update()
  • cpufreq/amd-pstate: Use topology_logical_package_id() instead of logical_die_id()
  • cpufreq/amd-pstate-ut: Don't check for highest perf matching on prefcore
  • cpufreq/amd-pstate: Remove warning for X86_FEATURE_CPPC on certain Zen models
  • cpufreq/amd-pstate: Add the missing cpufreq_cpu_put()
  • cpufreq/amd-pstate: Catch failures for amd_pstate_epp_update_limit()
  • x86/CPU/AMD: Always inline amd_clear_divider()
  • x86/amd: Move amd_get_highest_perf() from amd.c to cppc.c
  • ACPI: CPPC: Adjust return code for inline functions in !CONFIG_ACPI_CPPC_LIB
  • x86/amd: Rename amd_get_highest_perf() to amd_get_boost_ratio_numerator()
  • x86/amd: Move amd_get_highest_perf() out of amd-pstate
  • x86/amd: Detect preferred cores in amd_get_boost_ratio_numerator()
  • cpufreq: amd-pstate: Merge amd_pstate_highest_perf_set() into amd_get_boost_ratio_numerator()
  • cpufreq: amd-pstate: Optimize amd_pstate_update_limits()
  • cpufreq/amd-pstate: Export symbols for changing modes
  • cpufreq/amd-pstate-ut: Add test case for mode switches
  • cpufreq/amd-pstate-ut: Fix an "Uninitialized variables" issue
  • cpufreq/amd-pstate: Use nominal perf for limits when boost is disabled
  • cpufreq/amd-pstate: Rename MSR and shared memory specific functions
  • cpufreq/amd-pstate: Fix non kerneldoc comment
  • cpufreq/amd-pstate: Don't update CPPC request in amd_pstate_cpu_boost_update()
  • cpufreq/amd-pstate: Use amd_pstate_update_min_max_limit() for EPP limits
  • cpufreq/amd-pstate: Drop needless EPP initialization
  • cpufreq/amd-pstate: Remove the redundant verify() function
  • cpufreq/amd-pstate: Set the initial min_freq to lowest_nonlinear_freq
  • cpufreq/amd-pstate: Call amd_pstate_register() in amd_pstate_init()
  • cpufreq/amd-pstate: Call amd_pstate_set_driver() in amd_pstate_register_driver()
  • cpufreq/amd-pstate: Remove the switch case in amd_pstate_init()
  • cpufreq/amd-pstate: Remove the redundant amd_pstate_set_driver() call
  • amd-pstate: Switch to amd-pstate by default on some Server platforms
  • cpufreq/amd-pstate-ut: Add fix for min freq unit test
  • cpufreq/amd-pstate: Rename functions that enable CPPC
  • cpufreq/amd-pstate: Do not attempt to clear MSR_AMD_CPPC_ENABLE
  • cpufreq/amd-pstate: Call cppc_set_epp_perf in the reenable function
  • cpufreq/amd-pstate: Align offline flow of shared memory and MSR based systems
  • cpufreq/amd-pstate: Push adjust_perf vfunc init into cpu_init
  • cpufreq/amd-pstate: Move registration after static function call update
  • cpufreq/amd-pstate: Detect preferred core support before driver registration
  • cpufreq: amd-pstate: Add documentation for amd_pstate_hw_prefcore
  • amd-pstate: Add missing documentation for amd_pstate_prefcore_ranking
  • cpufreq/amd-pstate: Store the boost numerator as highest perf again
  • cpufreq/amd-pstate: Use boost numerator for upper bound of frequencies
  • cpufreq/amd-pstate: Convert the amd_pstate_get/set_epp() to static calls
  • cpufreq/amd-pstate: Move the invocation of amd_pstate_update_perf()
  • cpufreq/amd-pstate: Refactor amd_pstate_epp_reenable() and amd_pstate_epp_offline()
  • cpufreq/amd-pstate: Remove the cppc_state check in offline/online functions
  • cpufreq/amd-pstate: Merge amd_pstate_epp_cpu_offline() and amd_pstate_epp_offline()
  • cpufreq/amd-pstate: Add trace event for EPP perf updates
  • cpufreq/amd-pstate: convert mutex use to guard()
  • cpufreq/amd-pstate: Drop cached epp_policy variable
  • cpufreq/amd-pstate: Use FIELD_PREP and FIELD_GET macros
  • cpufreq/amd-pstate: Only update the cached value in msr_set_epp() on success
  • cpufreq/amd-pstate: store all values in cpudata struct in khz
  • cpufreq/amd-pstate: Change amd_pstate_update_perf() to return an int
  • cpufreq/amd-pstate: Move limit updating code
  • cpufreq/amd-pstate: Cache EPP value and use that everywhere
  • cpufreq/amd-pstate: Always write EPP value when updating perf
  • cpufreq/amd-pstate: Drop ret variable from amd_pstate_set_energy_pref_index()
  • cpufreq/amd-pstate: Set different default EPP policy for Epyc and Ryzen
  • cpufreq/amd-pstate: Drop boost_state variable
  • cpufreq/amd-pstate: Fix prefcore rankings
  • cpufreq/amd-pstate: Refactor max frequency calculation
  • cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
  • cpufreq/amd-pstate: Remove the goto label in amd_pstate_update_limits
  • cpufreq/amd-pstate: Fix max_perf updation with schedutil
  • cpufreq/amd-pstate: Fix cpufreq_policy ref counting
  • cpufreq: amd-pstate: Remove unnecessary driver_lock in set_boost
  • cpufreq: amd: Set policy->boost_supported
  • cpufreq/amd-pstate: Modify the min_perf calculation in adjust_perf callback
  • cpufreq/amd-pstate: Remove the redundant des_perf clamping in adjust_perf
  • cpufreq/amd-pstate: Pass min/max_limit_perf as min/max_perf to amd_pstate_update
  • cpufreq/amd-pstate: Convert all perf values to u8
  • cpufreq/amd-pstate: Modularize perf<->freq conversion
  • cpufreq/amd-pstate: Remove the unnecessary cpufreq_update_policy call
  • cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
  • cpufreq/amd-pstate: Use scope based cleanup for cpufreq_policy refs
  • cpufreq/amd-pstate: Remove the unncecessary driver_lock in amd_pstate_update_limits
  • cpufreq/amd-pstate: Fix the clamping of perf values
  • cpufreq/amd-pstate: Invalidate cppc_req_cached during suspend
  • cpufreq/amd-pstate: Show a warning when a CPU fails to setup
  • cpufreq/amd-pstate: Drop min and max cached frequencies
  • cpufreq/amd-pstate: Move perf values into a union
  • cpufreq/amd-pstate: Overhaul locking
  • cpufreq/amd-pstate: Drop cppc_cap1_cached
  • cpufreq/amd-pstate-ut: Use _free macro to free put policy
  • cpufreq/amd-pstate-ut: Allow lowest nonlinear and lowest to be the same
  • cpufreq/amd-pstate-ut: Drop SUCCESS and FAIL enums
  • cpufreq/amd-pstate-ut: Run on all of the correct CPUs
  • cpufreq/amd-pstate-ut: Adjust variable scope
  • cpufreq/amd-pstate: Replace all AMD_CPPC_* macros with masks
  • cpufreq/amd-pstate: Cache CPPC request in shared mem case too
  • cpufreq/amd-pstate: Move all EPP tracing into *_update_perf and *_set_epp functions
  • cpufreq/amd-pstate: Update cppc_req_cached for shared mem EPP writes
  • cpufreq/amd-pstate: Drop debug statements for policy setting
  • cpufreq/amd-pstate: Rework CPPC enabling
  • cpufreq/amd-pstate: Stop caching EPP
  • cpufreq/amd-pstate: Drop actions in amd_pstate_epp_cpu_offline()
  • cpufreq/amd-pstate: Fix min_limit perf and freq updation for performance governor
  • cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems
  • x86/sched: Add basic support for CPU capacity scaling
  • cpufreq: Consolidate some code in cpufreq_online()
  • cpufreq: Split cpufreq_online()
  • cpufreq: Add and use cpufreq policy locking guards
  • cpufreq: intel_pstate: Rearrange max frequency updates handling code
  • cpufreq: Pass policy pointer to ->update_limits()
  • cpufreq/amd-pstate: Enable ITMT support after initializing core rankings
  • sched/topology: Introduce sched_update_asym_prefer_cpu()
  • cpufreq/amd-pstate: Update asym_prefer_cpu when core rankings change
  • cpufreq/amd-pstate: Move max_perf limiting in amd_pstate_update
  • cpufreq/amd-pstate: Add offline, online and suspend callbacks for amd_pstate_driver
  • cpufreq/amd-pstate: Add support for the "Requested CPU Min frequency" BIOS option
  • amd-pstate-ut: Reset amd-pstate driver mode after running selftests
  • cpufreq/amd-pstate: Avoid shadowing ret in amd_pstate_ut_check_driver()
  • x86/cpufeatures: Add X86_FEATURE_AMD_WORKLOAD_CLASS feature bit
  • cpufreq/amd-pstate: Disable preferred cores on designs with workload classification
  • amd-pstate: Fix memory leak in amd_pstate_epp_cpu_init()
  • amd-pstate: Update cppc_req_cached in fast_switch case
  • amd-pstate: Make certain freq_attrs conditionally visible
  • x86/cpufeatures: Add AMD CPPC Performance Priority feature.
  • bitfield: Add FIELD_MODIFY() helper
  • amd-pstate: Add support for CPPC_REQ2 and FLOOR_PERF
  • cpufreq/amd-pstate: Fix a regression leading to EPP 0 after resume
  • cpufreq/amd-pstate: Fix a regression leading to EPP 0 after hibernate
  • amd-pstate: Add sysfs support for floor_freq and floor_count
  • amd-pstate: Introduce a tracepoint trace_amd_pstate_cppc_req2()
  • amd-pstate-ut: Add module parameter to select testcases
  • amd-pstate-ut: Add a testcase to validate the visibility of driver attributes
  • Documentation/amd-pstate: List amd_pstate_hw_prefcore sysfs file
  • Documentation/amd-pstate: List amd_pstate_prefcore_ranking sysfs file
  • Documentation/amd-pstate: Add documentation for amd_pstate_floor_{freq,count}
  • cpufreq/amd-pstate: Cache the max frequency in cpudata
  • Documentation: amd-pstate: fix dead links in the reference section
  • cpufreq/amd-pstate: Use sysfs_match_string() for epp
  • cpufreq/amd-pstate: Add dynamic energy performance preference
  • Documentation: amd-pstate: introduce amd-pstate preferred core
  • Documentation: introduce amd-pstate preferrd core mode kernel command line options
  • cpufreq/amd-pstate: add kernel command line to override dynamic epp
  • cpufreq: Pass the policy to cpufreq_driver->adjust_perf()
  • cpufreq/amd-pstate: Pass the policy to amd_pstate_update()
  • cpufreq/amd-pstate: Add static asserts for EPP indices
  • cpufreq/amd-pstate: Add support for raw EPP writes
  • cpufreq/amd-pstate-ut: Add a unit test for raw EPP
  • MAINTAINERS: amd-pstate: Step down as maintainer, add Prateek as reviewer
  • cpufreq: intel_pstate: Clear hybrid_max_perf_cpu before driver registration
  • ACPI: processor: Move arch_init_invariance_cppc() call later
  • cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially
  • cpufreq: intel_pstate: Rearrange locking in hybrid_init_cpu_capacity_scaling()
  • cpufreq/amd-pstate: Fix setting of CPPC.min_perf in active mode for performance governor
  • ACPI: CPPC: Detect preferred core availability on online CPUs
  • cpufreq: intel_pstate: Enable asym capacity only when CPU SMT is not possible
  • cpufreq: intel_pstate: Rearrange variable declaration involving __free()
  • cpufreq: intel_pstate: Fix crash during turbo disable
  • cpufreq/amd-pstate: Add POWER_SUPPLY select for dynamic EPP
  • cpufreq/amd-pstate: Grab "amd_pstate_driver_lock" when toggling dynamic_epp
  • cpufreq/amd-pstate: Allow writes to dynamic_epp when state isn't modified
  • cpufreq/amd-pstate: Reorder notifier unregistration and floor perf reset
  • cpufreq/amd-pstate: Use "epp_default_dc" as default when dynamic_epp is disabled
  • cpufreq/amd-pstate-ut: Drop policy reference before driver switch
  • cpufreq/amd-pstate-ut: Disable dynamic_epp after the mode switch
  • cpufreq/amd-pstate: drop stale @epp_cached kdoc

Patch Series Overview:

This patch series consists of 188 upstream commits backporting AMD P-state and CPPC (Collaborative Processor Performance Control) enhancements into the veLinux 6.6-velinux kernel, on branch Venice_CPPC_patches. The changes span the core amd-pstate driver, the amd-pstate-ut unit test framework, x86 CPU feature and scheduler-topology infrastructure, the cpufreq core, ACPI CPPC preferred-core detection, and documentation.

Key Bug Fixes:

  • EPP 0 regression after resume: Fixed a regression where the Energy Performance Preference was incorrectly reset to 0 on the system suspend/resume path.
  • EPP 0 regression after hibernate: Fixed the same EPP-0 regression on the hibernate cycle, restoring the intended EPP on wake.
  • Memory leak in amd_pstate_epp_cpu_init(): Fixed a memory leak where allocated CPPC data was not freed on the error path during EPP CPU initialisation.
  • Fix the clamping of perf values: Corrected clamping logic where performance values were clamped against stale bounds, leading to suboptimal frequency selection.
  • min_limit perf and freq for performance governor: Fixed min_limit_perf and the corresponding frequency not being updated correctly when the performance governor is active.
  • CPPC.min_perf in active mode (performance governor): Fixed setting of CPPC.min_perf in active mode under the performance governor.
  • cpufreq_policy ref counting: Fixed improper policy reference counting that could result in use-after-free or premature policy teardown; added the missing cpufreq_cpu_put().
  • max_perf updation with schedutil: Fixed max_perf not being updated correctly under the schedutil governor, holding the frequency ceiling below the hardware maximum.
  • Per-policy boost flag on failure: Fixed policy->boost_enabled being left incorrect when the boost update path failed partway through.
  • prefcore rankings: Fixed incorrect preferred core ranking calculations causing wrong core prioritisation on asymmetric systems.
  • msr_set_epp() cached value on failure: Only update the cached EPP value on a successful MSR write, preventing stale cached values from masking failures.
  • max frequency unit inconsistency: Fixed a unit mismatch where max_perf was compared against a frequency in different units, causing incorrect frequency caps.
  • Bail out on zero frequencies: Added an early exit when CPPC-reported frequencies are zero, preventing division-by-zero and nonsensical policy values on firmware-buggy platforms.
  • Cap CPPC.max_perf when CPB is off: Prevented CPPC.max_perf from exceeding nominal performance when Core Performance Boost is disabled.
  • Uninitialized variable in boost update: Fixed use of an uninitialized return value in the boost update path on shared-memory systems.
  • Don't create attributes on registration failure: Prevented sysfs attributes being created when driver registration subsequently failed, avoiding orphaned entries.
  • intel_pstate turbo-disable crash: Backported the fix for a kernel crash during turbo disable.
  • amd-pstate-ut driver-check fix: Avoided shadowing ret in amd_pstate_ut_check_driver().

Feature Additions:

  • CPPC_REQ2 and FLOOR_PERF support: Added support for the extended CPPC request register and its FLOOR_PERF field, enabling a minimum performance floor. Includes the trace_amd_pstate_cppc_req2() tracepoint and floor_freq / floor_count sysfs attributes.
  • AMD CPPC Performance Priority feature bit: Added the X86_FEATURE bit (CPUID 0x80000007:EDX[16]) that gates FLOOR_PERF availability.
  • Raw EPP writes: Added support for writing raw numeric EPP values directly, bypassing string-to-index translation for precise EPP control.
  • Dynamic EPP: Added dynamic-EPP mode for automatic EPP adjustment based on workload classification, with an amd_pstate_epp= kernel command-line override.
  • "Requested CPU Min frequency" BIOS option: Added reading of the BIOS-configured minimum CPU frequency from CPPC and applying it as the driver floor frequency.
  • Offline, online and suspend callbacks: Added explicit callbacks to correctly manage CPPC hardware state across CPU hotplug and suspend/resume.
  • policy->boost_supported flag: Introduced a per-policy boost_supported flag in the cpufreq core for per-CPU boost capability advertisement.
  • ITMT support: Enabled asymmetric scheduling (ITMT) after preferred core rankings are initialised.
  • sched_update_asym_prefer_cpu(): Added a scheduler-topology helper to update the asymmetric CPU preference when core rankings change at runtime.
  • CPU capacity scaling for x86: Added basic CPU capacity scaling support as a prerequisite for asymmetric scheduling on heterogeneous AMD platforms.
  • amd-pstate default on server platforms: Enabled amd-pstate as the default cpufreq driver on select AMD EPYC server platforms.
  • auto-load and shared-memory CPPC by default: Made amd-pstate auto-load and enabled shared-memory CPPC by default.
  • Dynamic preferred core ranking: Added runtime update of preferred core rankings with propagation to scheduler topology, without a driver restart.
  • Different default EPP for EPYC and Ryzen: Applied platform-appropriate default EPP profiles for server (EPYC) and desktop/laptop (Ryzen) targets.
  • Workload-classification handling: Added the X86_FEATURE_AMD_WORKLOAD_CLASS bit and disabled preferred cores on designs with workload classification.
  • ACPI CPPC preferred-core detection: Detect preferred core availability on online CPUs.

Logic & Performance Improvements:

  • Locking overhaul: Replaced ad-hoc driver_lock uses with guard(mutex)/scoped cleanup, removed unnecessary locks in set_boost and update_limits, and converted policy reference handling to scope-based cleanup.
  • Perf values in a union: Moved all performance limit fields into a struct/union within amd_cpudata, improving cache locality and making value relationships explicit.
  • All perf values as u8: Converted all CPPC performance register values from u32 to u8, matching the hardware register width.
  • All freq values in kHz: Standardised all frequency values in amd_cpudata to kHz, eliminating mixed Hz/kHz confusion.
  • Perf<->freq modularisation: Extracted perf-to-frequency and frequency-to-perf conversion into dedicated helpers, removing duplication.
  • Replace AMD_CPPC_ macros with masks:* Replaced legacy bit-shift macros with FIELD_PREP()/FIELD_GET() using proper bitmask definitions; added FIELD_MODIFY() helper.
  • CPPC request caching unified: Unified cppc_req_cached handling across MSR and shared-memory paths, with correct invalidation on suspend and updates in the fast_switch case.
  • Stop caching EPP separately: Eliminated the redundant epp_cached variable, relying on cppc_req_cached for EPP state.
  • EPP get/set as static calls: Converted EPP accessors to static calls, eliminating indirect dispatch overhead on MSR-based systems.
  • Rework CPPC enabling: Refactored the CPPC hardware enable/disable path with correct ordering of boost_supported relative to the enable call.
  • amd_get_boost_ratio_numerator(): Consolidated amd_get_highest_perf() into a single function in cppc.c, moving it out of the driver into shared x86 AMD code.
  • cpufreq core improvements: Passed policy to adjust_perf() and update_limits(), split and consolidated cpufreq_online(), added locking guards, and made exit() return void.
  • Boot/init hardening: Moved arch_init_invariance_cppc() later, cleared hybrid_max_perf_cpu before driver registration, and rearranged intel_pstate asym-capacity locking / declarations.

Unit Test Framework (amd-pstate-ut):

  • Module parameter for testcase selection: Added a module parameter to select individual test cases at load time.
  • Driver mode reset after selftests: Added automatic reset of driver mode after running selftests.
  • Mode switch testcase: Added a test case exercising driver mode transitions.
  • Visibility attribute test: Added a test case validating per-CPU sysfs attribute visibility under each driver mode.
  • Raw EPP test: Added a unit test for raw EPP writes.
  • Prefcore highest-perf exemption: Skip the highest-perf matching check on preferred core systems.
  • Various test fixes: Variable scoping, CPU selection, enum simplification (dropped SUCCESS/FAIL), _free-based policy cleanup, min-freq unit conversion, and dynamic_epp/policy-reference handling around mode switches.

Documentation:

  • amd-pstate preferred core: Documentation for the preferred core feature, kernel command-line options, and amd_pstate_prefcore_ranking / amd_pstate_hw_prefcore sysfs files.
  • floor_freq and floor_count: Documentation for the new amd_pstate_floor_freq and amd_pstate_floor_count sysfs attributes.
  • amd_cpudata field units: Inline documentation clarifying the units for frequency and performance fields in struct amd_cpudata.
  • Dead link fixes: Corrected broken reference links in the amd-pstate documentation.

Unit Test:

1. Mode gate:

cat /proc/cmdline | tr ' ' '\n' | grep amd_pstate
cat /sys/devices/system/cpu/amd_pstate/status
cat $P/scaling_driver
amd_pstate=active
active
amd-pstate-epp

2. DUT facts:

uname -r
lscpu | grep -E 'Model name|Socket|Core|Thread'
cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list
nproc
cat $P/cpuinfo_min_freq $P/amd_pstate_lowest_nonlinear_freq $P/cpuinfo_max_freq $P/amd_pstate_max_freq
cat $P/amd_pstate_floor_freq $P/amd_pstate_floor_count
6.6.122-cppc-reduced-latest-head
Model name:                              AMD Eng Sample: 100-000001051-02
Thread(s) per core:                      2
Core(s) per socket:                      256
Socket(s):                               1
0,256
512
1213794
1806897
3517242
3517242
2000000
2

3. Driver bring-up + crash scan:

cat $P/scaling_driver; cat /sys/devices/system/cpu/amd_pstate/status
sudo dmesg | grep -iE 'kernel panic|Oops|Call Trace|kernel BUG at|\bBUG:' | grep -viE 'nf_tables|debugfs'; echo "grep_rc=$?"
amd-pstate-epp
active
grep_rc=1

4. CPPC frequency calculation:

cat $P/cpuinfo_min_freq $P/amd_pstate_lowest_nonlinear_freq $P/cpuinfo_max_freq $P/amd_pstate_max_freq
1213794
1806897
3517242
3517242

5. CPPC MSR decode:

sudo rdmsr -p 0 0xc00102b0
sudo rdmsr -p 0 0xc00102b3
sudo rdmsr -p 0 0xc00102b5
2ff918358
91ff
91

6. Governor / EPP availability:

cat $P/scaling_available_governors
cat $P/scaling_governor
cat /sys/devices/system/cpu/amd_pstate/dynamic_epp
performance powersave
performance
disabled

7. EPP → MSR_AMD_CPPC_REQ[31:24] mapping:

echo powersave > $P/scaling_governor
cat $P/energy_performance_available_preferences
for e in performance balance_performance balance_power power default; do
    echo $e > $P/energy_performance_preference
    printf "%-20s REQ[31:24]=0x%02x\n" "$e" $(( ($(sudo rdmsr -p 0 -d 0xc00102b3) >> 24) & 0xff ))
done
echo 0x80 > $P/energy_performance_preference
printf "raw 0x80 REQ[31:24]=0x%02x\n" $(( ($(sudo rdmsr -p 0 -d 0xc00102b3) >> 24) & 0xff ))
echo performance > $P/energy_performance_preference
echo performance > $P/scaling_governor
default performance balance_performance balance_power power custom
performance          REQ[31:24]=0x00
balance_performance  REQ[31:24]=0x80
balance_power        REQ[31:24]=0xbf
power                REQ[31:24]=0xff
default              REQ[31:24]=0x00
raw 0x80 REQ[31:24]=0x80

8. Frequency response under load:

echo performance > $P/scaling_governor
ratio(){ a1=$(sudo rdmsr -p 0 -d 0xe8); m1=$(sudo rdmsr -p 0 -d 0xe7); sleep 1; \
         a2=$(sudo rdmsr -p 0 -d 0xe8); m2=$(sudo rdmsr -p 0 -d 0xe7); \
         awk -v da=$((a2-a1)) -v dm=$((m2-m1)) 'BEGIN{printf "%.3f", da/dm}'; }
echo "IDLE ratio = $(ratio)"
taskset -c 0 stress-ng --cpu 1 --timeout 8s >/dev/null 2>&1 &
sleep 2
echo "LOAD ratio = $(ratio)"; wait
IDLE aperf/mperf ratio = 1.481
LOAD aperf/mperf ratio = 1.762
highest/nominal = 255/145 = 1.759

9. FLOOR_PERF feature gate:

sudo cpuid -r -1 -l 0x80000007 | head -2
sudo rdmsr -p 0 0xc00102b5
ls /sys/devices/system/cpu/cpufreq/policy*/amd_pstate_floor_freq | wc -l
ls -d /sys/devices/system/cpu/cpufreq/policy* | wc -l
cat $P/amd_pstate_floor_freq $P/amd_pstate_floor_count
CPU:
   0x80000007 0x00: eax=0x00000000 ebx=0x0000003b ecx=0x00000000 edx=0x00016799
91
512
512
2000000
2

10. floor_freq range validation:

MINF=$(cat $P/cpuinfo_min_freq); MAXF=$(cat $P/scaling_max_freq); echo "min=$MINF max=$MAXF"
echo $((MINF-1000)) > $P/amd_pstate_floor_freq; echo "min-1000 rc=$?"
echo $((MAXF+1000)) > $P/amd_pstate_floor_freq; echo "max+1000 rc=$?"
echo $MINF > $P/amd_pstate_floor_freq; echo "min rc=$? floor_freq=$(cat $P/amd_pstate_floor_freq)"
min=1213794 max=3517242
bash: echo: write error: Invalid argument
min-1000 rc=1
bash: echo: write error: Invalid argument
max+1000 rc=1
min rc=0  floor_freq=1213794

11. Floor latches in HW (control plane):

T=/sys/kernel/debug/tracing
echo 1 > $T/events/amd_cpu/amd_pstate_cppc_req2/enable
echo > $T/trace
echo "BEFORE REQ2=0x$(sudo rdmsr -p 0 0xc00102b5)"
echo $(cat $P/scaling_max_freq) > $P/amd_pstate_floor_freq
echo "AFTER  REQ2=0x$(sudo rdmsr -p 0 0xc00102b5)"
cat $T/trace | grep amd_pstate_cppc_req2 | tail -1
sudo wrmsr -p 0 0xc00102b5 0x000000ff
echo "clean wrmsr 0xff -> REQ2=0x$(sudo rdmsr -p 0 0xc00102b5)"
BEFORE REQ2=0x59
AFTER  REQ2=0xff
            bash-63017   [328] ..... 64078.045193: amd_pstate_cppc_req2: cpu0: floor_perf=255, changed=1 (error = 0)
clean wrmsr 0xff -> REQ2=0xff

12. HIGH/LOW floor sweep — reduced-patch impact check:

for pair in LOW:$(cat $P/cpuinfo_min_freq) LNL:$(cat $P/amd_pstate_lowest_nonlinear_freq) \
            MID:2000000 HIGH:$(cat $P/scaling_max_freq); do
    lbl=${pair%%:*}; f=${pair##*:}
    echo $f > $P/amd_pstate_floor_freq
    raw=$(sudo rdmsr -p 0 0xc00102b5)
    printf "%-6s floor_freq=%-8s REQ2=0x%-4s floor_perf=%-3d reserved=0x%x\n" \
        $lbl $(cat $P/amd_pstate_floor_freq) $raw $((0x$raw & 0xff)) $((0x$raw >> 8))
done
echo 2000000 > $P/amd_pstate_floor_freq
LOW    floor_freq=1213794  REQ2=0x59   floor_perf=89  reserved=0x0
LNL    floor_freq=1806897  REQ2=0x84   floor_perf=132 reserved=0x0
MID    floor_freq=2000000  REQ2=0x91   floor_perf=145 reserved=0x0
HIGH   floor_freq=3517242  REQ2=0xff   floor_perf=255 reserved=0x0
restored floor_freq=2000000

13. Persistence across offline/online:

c=9; PP=/sys/devices/system/cpu/cpufreq/policy$c
echo $(cat $PP/scaling_max_freq) > $PP/amd_pstate_floor_freq
echo "set floor=$(cat $PP/amd_pstate_floor_freq) REQ2=0x$(sudo rdmsr -p $c 0xc00102b5)"
echo 0 > /sys/devices/system/cpu/cpu$c/online; echo "offline: $(cat /sys/devices/system/cpu/cpu$c/online)"
echo 1 > /sys/devices/system/cpu/cpu$c/online; sleep 1; echo "online: $(cat /sys/devices/system/cpu/cpu$c/online)"
echo "AFTER floor=$(cat $PP/amd_pstate_floor_freq) REQ2=0x$(sudo rdmsr -p $c 0xc00102b5)"
echo 2000000 > $PP/amd_pstate_floor_freq
set floor=3517242 REQ2=0xff
offline: 0
online: 1
AFTER floor=3517242 REQ2=0xff

14: amd-pstate-ut (safe subset):

sudo modprobe amd-pstate-ut \
  test_list="amd_pstate_ut_acpi_cpc_valid,amd_pstate_ut_check_enabled,amd_pstate_ut_check_perf,amd_pstate_ut_check_freq"
dmesg | grep -i amd_pstate_ut
sudo rmmod amd_pstate_ut && echo "module unloaded cleanly"
[64079.179613] amd_pstate_ut: 1    amd_pstate_ut_acpi_cpc_valid	 success!
[64079.179621] amd_pstate_ut: 2    amd_pstate_ut_check_enabled	 success!
[64079.188097] amd_pstate_ut: 3    amd_pstate_ut_check_perf	 success!
[64079.188116] amd_pstate_ut: 4    amd_pstate_ut_check_freq	 success!
module unloaded cleanly

@kchuyizhou

Copy link
Copy Markdown

• Thanks for the detailed MR description and the current unit test output.

I see that the test section covers amd_pstate=active bring-up, CPPC-derived
frequency calculation, and basic CPPC MSR decoding. However, I don't see a
validation case for the CPPC Performance Priority / FLOOR_PERF feature.

In particular, this series lists CPPC_REQ2/FLOOR_PERF and the
amd_pstate_floor_freq / amd_pstate_floor_count sysfs files as feature additions,
but the current MSR test output shows:

REQ2 0xc00102b5 = rdmsr: CPU 0 cannot read MSR 0xc00102b5

So the current test log does not demonstrate that CPPC Performance Priority is
supported or exercised on the tested system.

Could you please add Venice-specific validation details for this feature? I am
mainly looking for a copy-pasteable example that shows:

  1. How to confirm CPPC Performance Priority support on Venice, e.g. CPUID
    0x80000007 EDX[16] / X86_FEATURE_CPPC_PERF_PRIO, successful access to
    MSR_AMD_CPPC_REQ2, and visibility of:
    /sys/devices/system/cpu/cpufreq/policy*/amd_pstate_floor_freq
    /sys/devices/system/cpu/cpufreq/policy*/amd_pstate_floor_count

  2. What exact values should be written to amd_pstate_floor_freq, and how those
    values should be chosen relative to cpuinfo_min_freq, scaling_max_freq, and
    SMT sibling CPUs.

  3. What workload should be used to make the priority behavior observable. For
    example, should we run pinned stress-ng workloads on different CPU groups, and
    does the system need to be under package power or thermal constraint before
    the floor priority takes effect?

  4. What behavior is expected on Venice after assigning different floor_freq
    values to different CPU/core groups. For example, should the higher-floor
    group maintain a higher effective frequency or be throttled later than the
    lower-floor group? What should count as pass/fail?

  5. What observability should be used: trace_amd_pstate_cppc_req2, turbostat,
    aperf/mperf, cpupower, perf stat, dmesg, or direct MSR_AMD_CPPC_REQ2 reads.
    A sample before/after output would be very helpful.

In summary, could you please provide a deterministic Venice validation
procedure for the CPPC Performance Priority feature, including the exact sysfs
writes, workload, expected observable behavior, and pass/fail criteria? That
would allow us to independently reproduce the test on Venice systems and
confirm that the new amd_pstate_floor_freq / amd_pstate_floor_count support is
working as intended, rather than only confirming general amd-pstate or CPPC
bring-up.

@mohanasv2
mohanasv2 force-pushed the Venice_CPPC_patches branch from 2e4337d to 2d90382 Compare June 12, 2026 10:42
@mohanasv2

mohanasv2 commented Jun 12, 2026

Copy link
Copy Markdown
Author

• Thanks for the detailed MR description and the current unit test output.

I see that the test section covers amd_pstate=active bring-up, CPPC-derived frequency calculation, and basic CPPC MSR decoding. However, I don't see a validation case for the CPPC Performance Priority / FLOOR_PERF feature.

In particular, this series lists CPPC_REQ2/FLOOR_PERF and the amd_pstate_floor_freq / amd_pstate_floor_count sysfs files as feature additions, but the current MSR test output shows:

REQ2 0xc00102b5 = rdmsr: CPU 0 cannot read MSR 0xc00102b5

So the current test log does not demonstrate that CPPC Performance Priority is supported or exercised on the tested system.

Could you please add Venice-specific validation details for this feature? I am mainly looking for a copy-pasteable example that shows:

  1. How to confirm CPPC Performance Priority support on Venice, e.g. CPUID
    0x80000007 EDX[16] / X86_FEATURE_CPPC_PERF_PRIO, successful access to
    MSR_AMD_CPPC_REQ2, and visibility of:
    /sys/devices/system/cpu/cpufreq/policy*/amd_pstate_floor_freq
    /sys/devices/system/cpu/cpufreq/policy*/amd_pstate_floor_count
  2. What exact values should be written to amd_pstate_floor_freq, and how those
    values should be chosen relative to cpuinfo_min_freq, scaling_max_freq, and
    SMT sibling CPUs.
  3. What workload should be used to make the priority behavior observable. For
    example, should we run pinned stress-ng workloads on different CPU groups, and
    does the system need to be under package power or thermal constraint before
    the floor priority takes effect?
  4. What behavior is expected on Venice after assigning different floor_freq
    values to different CPU/core groups. For example, should the higher-floor
    group maintain a higher effective frequency or be throttled later than the
    lower-floor group? What should count as pass/fail?
  5. What observability should be used: trace_amd_pstate_cppc_req2, turbostat,
    aperf/mperf, cpupower, perf stat, dmesg, or direct MSR_AMD_CPPC_REQ2 reads.
    A sample before/after output would be very helpful.

In summary, could you please provide a deterministic Venice validation procedure for the CPPC Performance Priority feature, including the exact sysfs writes, workload, expected observable behavior, and pass/fail criteria? That would allow us to independently reproduce the test on Venice systems and confirm that the new amd_pstate_floor_freq / amd_pstate_floor_count support is working as intended, rather than only confirming general amd-pstate or CPPC bring-up.

Thanks for the detailed review. Please find the details below:

1. Confirm feature support:

# X86_FEATURE_CPPC_PERF_PRIO -> CPUID 0x80000007 EDX[16]
cpuid -1 -l 0x80000007 | grep -i edx
# Floor sysfs present on every policy:
ls /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_floor_freq \
   /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_floor_count
# REQ2 readable as root:
sudo rdmsr -p0 0xc00102b5

Result:

CPUID 0x80000007 EDX[16]=1 (CPPC_PERF_PRIO set), both sysfs files present on all policy*, rdmsr 0xc00102b5 = 80001491 (readable). PASS — feature present and exercised.

2. Decode REQ2 and choose floor values:

MSR_AMD_CPPC_REQ2 (0xc00102b5) low byte [7:0] = FLOOR_PERF. At boot: 0x...91 = 145 = nominal_perf.
Keep floor within the perf scale: lowest(88) <= floor <= nominal(145) <= highest(255).
amd_pstate_floor_freq takes kHz; the driver maps freq→perf. To target perf 255 (highest) write scaling_max_freq; for a mid floor write a value between cpuinfo_min_freq and scaling_max_freq.
For SMT pairs, set the floor on both sibling policies (each logical CPU has its own REQ2).

3 & 4. Workload, expected behavior, pass/fail:

# group A (high floor) vs group B (low floor)
echo 3517242 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_floor_freq   # ~max
echo 1800000 | sudo tee /sys/devices/system/cpu/cpufreq/policy64/amd_pstate_floor_freq  # low
# pin load on both, then constrain package power so the floor arbitrates:
stress-ng --cpu 1 --taskset 0 &
stress-ng --cpu 1 --taskset 64 &
Expected: under a package-power/thermal constraint (floor priority only matters when not all cores can run at max), the high-floor core holds a higher effective Bzy_MHz and is throttled later than the low-floor core. Unconstrained/idle, both float at the governor's choice and the floor is not observable.
PASS: high-floor core's Bzy_MHz >= low-floor core's under constraint, and >= the requested floor.
FAIL: floor core drops below its requested floor while power headroom exists.

5. Observability — before/after:

Use direct REQ2 read + amd_pstate_cppc_req2 tracepoint for the write, and turbostat for the effect:

T=/sys/kernel/debug/tracing
P=/sys/devices/system/cpu/cpufreq/policy0
echo 1 > $T/events/amd_cpu/amd_pstate_cppc_req2/enable
rdmsr -p0 0xc00102b5                       # BEFORE
echo 3517242 > $P/amd_pstate_floor_freq
rdmsr -p0 0xc00102b5                       # AFTER
cat $T/trace | grep cpu0: | tail -1
sudo turbostat --quiet --interval 1 --show CPU,Bzy_MHz,Avg_MHz,PkgWatt sleep 5
Actual result:
BEFORE: 0091              (floor_perf = 0x91 = 145)
AFTER : 00ff              (floor_perf = 0xff = 255)
trace : amd_pstate_cppc_req2: cpu0: floor_perf=255, changed=1 (error = 0)

The REQ2 low byte moves from 0x91→0xff, the tracepoint confirms the write (changed=1, error=0), and turbostat shows the busy frequency held at the floor on an otherwise-idle core. PASS — floor write latches and is observable.

Please let me know if you need any further information.

Thanks.

@kchuyizhou

Copy link
Copy Markdown

I did one more retest for the CPPC priority / amd_pstate_floor_freq behavior
and would like to confirm the expected semantics.

Test environment:

  • AMD Venice platform, 1 socket, 144 cores / 288 threads
  • CPU family/model: 26/80
  • cpufreq driver: amd-pstate-epp
  • governor: performance
  • amd_pstate_floor_count = 2
  • cpuinfo_min_freq = 1212599 kHz
  • scaling_max_freq = 4015749 kHz
  • package power limit was applied through HSMP

Test setup:

  • LOW floor: 1800000 kHz
  • HIGH floor: 3500000 kHz
  • package power cap: 450000 mW
  • workload: stress-ng matrixprod on all 288 CPUs
  • HIGH group used complete physical cores, i.e. both SMT siblings were put into
    the same group.

Observed result:

  • With 18 high-floor cores, the high group was still clearly protected compared
    with the low group, but it did not stay at the requested 3500 MHz floor.
  • At the same time, the low group did not drop all the way down to 1800 MHz.

Example results:

  • HIGH cores on cpu0-17,cpu144-161:
    • low avg: 1963 MHz
    • high avg: 3054 MHz
  • Repeated with the same placement:
    • low avg: 1945 MHz
    • high avg: 3089 MHz
  • HIGH cores moved to cpu72-89,cpu216-233:
    • low avg: 1918 MHz
    • high avg: 3164 MHz

So the priority effect is visible because the high-floor group keeps a much
higher effective frequency than the low-floor group. However, the behavior is
not a strict ordering where all low-priority CPUs are reduced to their LOW floor
before any high-priority CPU drops below its HIGH floor.

Could you help confirm whether this is the expected hardware/SMU behavior?
In other words, should amd_pstate_floor_freq be interpreted as a relative
priority/protection hint under power or thermal constraints, rather than a hard
minimum frequency guarantee? Also, is it expected that topology/local power or
thermal limits can cause the high-floor group to be reduced while the low-floor
group is still above its requested floor?

@mohanasv2

Copy link
Copy Markdown
Author

I did one more retest for the CPPC priority / amd_pstate_floor_freq behavior and would like to confirm the expected semantics.

Test environment:

  • AMD Venice platform, 1 socket, 144 cores / 288 threads
  • CPU family/model: 26/80
  • cpufreq driver: amd-pstate-epp
  • governor: performance
  • amd_pstate_floor_count = 2
  • cpuinfo_min_freq = 1212599 kHz
  • scaling_max_freq = 4015749 kHz
  • package power limit was applied through HSMP

Test setup:

  • LOW floor: 1800000 kHz
  • HIGH floor: 3500000 kHz
  • package power cap: 450000 mW
  • workload: stress-ng matrixprod on all 288 CPUs
  • HIGH group used complete physical cores, i.e. both SMT siblings were put into
    the same group.

Observed result:

  • With 18 high-floor cores, the high group was still clearly protected compared
    with the low group, but it did not stay at the requested 3500 MHz floor.
  • At the same time, the low group did not drop all the way down to 1800 MHz.

Example results:

  • HIGH cores on cpu0-17,cpu144-161:

    • low avg: 1963 MHz
    • high avg: 3054 MHz
  • Repeated with the same placement:

    • low avg: 1945 MHz
    • high avg: 3089 MHz
  • HIGH cores moved to cpu72-89,cpu216-233:

    • low avg: 1918 MHz
    • high avg: 3164 MHz

So the priority effect is visible because the high-floor group keeps a much higher effective frequency than the low-floor group. However, the behavior is not a strict ordering where all low-priority CPUs are reduced to their LOW floor before any high-priority CPU drops below its HIGH floor.

Could you help confirm whether this is the expected hardware/SMU behavior? In other words, should amd_pstate_floor_freq be interpreted as a relative priority/protection hint under power or thermal constraints, rather than a hard minimum frequency guarantee? Also, is it expected that topology/local power or thermal limits can cause the high-floor group to be reduced while the low-floor group is still above its requested floor?

Hi,

Thanks for sharing the test details. Please find the explanation for the results.

In summary:
###########
Under full-system load with a package power cap, the observed behavior is expected: amd_pstate_floor_freq acts as a relative prioritization hint rather than a hard minimum guarantee, meaning the SMU distributes available power and frequency across all cores to optimize overall efficiency while favoring higher-priority CPUs. As a result, high-floor cores maintain consistently higher effective frequencies but may still drop below their configured floor when constrained, while low-floor cores are not strictly forced down to their minimum if residual power is available. Additionally, variations due to core placement reflect normal topology- and locality-aware power management.

Details:
########
We retested on a Venice ES (family 0x1A, 256C/512T, amd-pstate-epp, performance governor, amd_pstate_floor_count=2) and reproduce the same pattern you describe.

Setup: HIGH floor ~3500 MHz (FLOOR_PERF 254) on 18 complete physical cores (both SMT siblings in the same group), LOW floor ~1800 MHz (FLOOR_PERF 131) on the rest. Workload: stress-ng --matrix 0 --matrix-method prod on all CPUs. An all-core matrixprod load drives the package to its stock PPT (~521 W), which supplies the constraint.
Results (two placements, for repeatability):
HIGH group placement pkgW HIGH avg Bzy LOW avg Bzy separation
cpu0-17 + siblings 521 2679 MHz 1735 MHz 944 MHz
cpu72-89 + siblings 523 2684 MHz 1756 MHz 928 MHz

Same as your finding: the high-floor group is clearly protected (~940 MHz higher), but it does not hold the requested 3500 MHz floor, and the low group is not pinned at exactly 1800 MHz.

To your questions:
Yes — amd_pstate_floor_freq is a relative priority/protection hint, not a hard minimum-frequency guarantee. It maps to CPPC FLOOR_PERF in MSR_AMD_CPPC_REQ2, a request to the SMU. The minimum is honored only when power/thermal headroom exists; under a package constraint it becomes a weighting for how the limited budget is distributed.

Yes — topology and local power/thermal limits can reduce a high-floor core while a low-floor core stays above its floor. The package budget is arbitrated globally by the SMU, but per-core V/F curves and per-CCD current (EDC/TDC)/thermal limits are local, so strict cross-core ordering ("all low cores at LOW floor before any high core drops below HIGH floor") is not something the feature provides or intends.

Why HIGH lands below 3500 and LOW above 1800: at the cap, the high group's aggregate demand exceeds the budget, so the SMU protects it relatively but scales it down to stay within power; the low floor is a minimum target, not a setpoint, so low cores float wherever budget allows. Tightening the cap pushes the low group toward 1800 first.

Thanks.

@kchuyizhou

Copy link
Copy Markdown

Hello, here is a another issue I met:
I ran an additional dynamic HIGH floor test on the Venice system to better
understand the cppc priority behavior.

Test environment:

  • 1 socket, 144 cores / 288 CPUs
  • amd-pstate-epp
  • governor: performance
  • amd_pstate_floor_count: 2
  • HSMP socket power limit kept at platform max: 500 W
  • No explicit power cap was applied
  • Workload: stress-ng --cpu 144 --cpu-load 50
  • Sampling: turbostat --interval 1 --num_iterations 60 --show CPU,Bzy_MHz,Busy%,PkgWatt
  • LOW floor fixed at 1800000 kHz
  • HIGH group: 18 full cores, tested with both A0 and B72 placements

I changed only the HIGH floor while keeping the same workload running:

A0 result:

  • HIGH=3500000: PkgWatt 437.99 W, HIGH 3552 MHz, LOW 2631 MHz, delta +921 MHz
  • HIGH=2500000: PkgWatt 459.69 W, HIGH 3577 MHz, LOW 2882 MHz, delta +695 MHz
  • HIGH=1800000: PkgWatt 500.01 W, HIGH 3511 MHz, LOW 3516 MHz, delta -5 MHz
  • HIGH=4015749: PkgWatt 462.75 W, HIGH 3671 MHz, LOW 2524 MHz, delta +1147 MHz

So the relative HIGH/LOW split tracks the configured HIGH floor:

  • reducing HIGH floor reduces the delta;
  • setting HIGH equal to LOW removes the split;
  • setting HIGH to scaling_max_freq increases the split.

The part I would like to clarify is the expected behavior when there still
appears to be package power headroom.

When all CPUs use the same floor value, the same workload can run around
3.5 GHz across the machine and reaches around 500 W. However, once we configure
different floor values, for example LOW=1800000 and HIGH=3500000, package power
is only around 438-439 W, but the LOW group is already reduced to around
2.6 GHz while the HIGH group stays around 3.5 GHz.

Is this expected firmware/SMU behavior for CPPC Performance Priority?

In other words, should different FLOOR_PERF values be interpreted not only as a
throttling preference under an already saturated package power/thermal limit,
but also as an internal priority signal that can redistribute performance
between HIGH and LOW groups even before the package reaches the external socket
power limit?

@mohanasv2

Copy link
Copy Markdown
Author

Hello, here is a another issue I met: I ran an additional dynamic HIGH floor test on the Venice system to better understand the cppc priority behavior.

Test environment:

  • 1 socket, 144 cores / 288 CPUs
  • amd-pstate-epp
  • governor: performance
  • amd_pstate_floor_count: 2
  • HSMP socket power limit kept at platform max: 500 W
  • No explicit power cap was applied
  • Workload: stress-ng --cpu 144 --cpu-load 50
  • Sampling: turbostat --interval 1 --num_iterations 60 --show CPU,Bzy_MHz,Busy%,PkgWatt
  • LOW floor fixed at 1800000 kHz
  • HIGH group: 18 full cores, tested with both A0 and B72 placements

I changed only the HIGH floor while keeping the same workload running:

A0 result:

  • HIGH=3500000: PkgWatt 437.99 W, HIGH 3552 MHz, LOW 2631 MHz, delta +921 MHz
  • HIGH=2500000: PkgWatt 459.69 W, HIGH 3577 MHz, LOW 2882 MHz, delta +695 MHz
  • HIGH=1800000: PkgWatt 500.01 W, HIGH 3511 MHz, LOW 3516 MHz, delta -5 MHz
  • HIGH=4015749: PkgWatt 462.75 W, HIGH 3671 MHz, LOW 2524 MHz, delta +1147 MHz

So the relative HIGH/LOW split tracks the configured HIGH floor:

  • reducing HIGH floor reduces the delta;
  • setting HIGH equal to LOW removes the split;
  • setting HIGH to scaling_max_freq increases the split.

The part I would like to clarify is the expected behavior when there still appears to be package power headroom.

When all CPUs use the same floor value, the same workload can run around 3.5 GHz across the machine and reaches around 500 W. However, once we configure different floor values, for example LOW=1800000 and HIGH=3500000, package power is only around 438-439 W, but the LOW group is already reduced to around 2.6 GHz while the HIGH group stays around 3.5 GHz.

Is this expected firmware/SMU behavior for CPPC Performance Priority?

In other words, should different FLOOR_PERF values be interpreted not only as a throttling preference under an already saturated package power/thermal limit, but also as an internal priority signal that can redistribute performance between HIGH and LOW groups even before the package reaches the external socket power limit?

Hi,

CPPC Performance Priority — redistribution below the external power limit:

Yes — this is expected firmware/SMU behavior, and your interpretation is correct:
FLOOR_PERF is a genuine internal priority signal that can redistribute
performance between groups before the package reaches the external socket power
limit — not only a throttling order that activates once that limit is
saturated.

Why redistribution happens below the 500 W cap:

The HSMP socket power limit is only one of several limiters the SMU enforces
simultaneously. The active constraint is whichever binds first, and with a floor
differential that is usually an internal one well below the socket cap:

  • fast/slow package power tracking (PPT)
  • electrical limits — EDC (design current) and TDC (thermal-design current) on the shared rail
  • thermal (Tjmax / hotspot), di/dt, VRM telemetry
  • the SMU's internal boost-budget allocation, which actually consumes the CPPC desired / min(FLOOR) / max hints

With LOW=1800 and HIGH=3500, FLOOR_PERF tells the SMU to commit the shared
boost/voltage/current budget preferentially to the HIGH cores. Holding the HIGH
group near 3.5 GHz raises shared-rail voltage and consumes EDC/TDC and boost
budget, so the SMU pulls the LOW group down to stay within those internal limits
— even though externally-reported socket power is still ~438 W < 500 W. The
438 W simply means socket power was not the active limiter in that
configuration; an internal limit (and the priority allocation itself) was.

Why split-config power (438 W) is lower than uniform 3.5 GHz (500 W):

Dropping the LOW group to ~2.6 GHz lowers its voltage and power substantially
(P ≈ f·V², and V scales with f), so total package power falls even with the HIGH
group held at 3.5 GHz. The SMU is not trying to "fill" the socket to 500 W — it
honors the priority distribution subject to internal V/F and current limits.

In summary:

FLOOR_PERF should be read as both: a throttling preference under a saturated
external power/thermal limit, and an internal priority signal that
redistributes performance between HIGH and LOW groups before the package reaches
the external socket power limit — because internal electrical/thermal/boost-budget
limits, not the socket cap, are typically the active constraint.

Thanks.

@guixiongwei

Copy link
Copy Markdown
Collaborator

Hello, here is a another issue I met: I ran an additional dynamic HIGH floor test on the Venice system to better understand the cppc priority behavior.
Test environment:

  • 1 socket, 144 cores / 288 CPUs
  • amd-pstate-epp
  • governor: performance
  • amd_pstate_floor_count: 2
  • HSMP socket power limit kept at platform max: 500 W
  • No explicit power cap was applied
  • Workload: stress-ng --cpu 144 --cpu-load 50
  • Sampling: turbostat --interval 1 --num_iterations 60 --show CPU,Bzy_MHz,Busy%,PkgWatt
  • LOW floor fixed at 1800000 kHz
  • HIGH group: 18 full cores, tested with both A0 and B72 placements

I changed only the HIGH floor while keeping the same workload running:
A0 result:

  • HIGH=3500000: PkgWatt 437.99 W, HIGH 3552 MHz, LOW 2631 MHz, delta +921 MHz
  • HIGH=2500000: PkgWatt 459.69 W, HIGH 3577 MHz, LOW 2882 MHz, delta +695 MHz
  • HIGH=1800000: PkgWatt 500.01 W, HIGH 3511 MHz, LOW 3516 MHz, delta -5 MHz
  • HIGH=4015749: PkgWatt 462.75 W, HIGH 3671 MHz, LOW 2524 MHz, delta +1147 MHz

So the relative HIGH/LOW split tracks the configured HIGH floor:

  • reducing HIGH floor reduces the delta;
  • setting HIGH equal to LOW removes the split;
  • setting HIGH to scaling_max_freq increases the split.

The part I would like to clarify is the expected behavior when there still appears to be package power headroom.
When all CPUs use the same floor value, the same workload can run around 3.5 GHz across the machine and reaches around 500 W. However, once we configure different floor values, for example LOW=1800000 and HIGH=3500000, package power is only around 438-439 W, but the LOW group is already reduced to around 2.6 GHz while the HIGH group stays around 3.5 GHz.
Is this expected firmware/SMU behavior for CPPC Performance Priority?
In other words, should different FLOOR_PERF values be interpreted not only as a throttling preference under an already saturated package power/thermal limit, but also as an internal priority signal that can redistribute performance between HIGH and LOW groups even before the package reaches the external socket power limit?

Hi,

CPPC Performance Priority — redistribution below the external power limit:

Yes — this is expected firmware/SMU behavior, and your interpretation is correct: FLOOR_PERF is a genuine internal priority signal that can redistribute performance between groups before the package reaches the external socket power limit — not only a throttling order that activates once that limit is saturated.

Why redistribution happens below the 500 W cap:

The HSMP socket power limit is only one of several limiters the SMU enforces simultaneously. The active constraint is whichever binds first, and with a floor differential that is usually an internal one well below the socket cap:

  • fast/slow package power tracking (PPT)
  • electrical limits — EDC (design current) and TDC (thermal-design current) on the shared rail
  • thermal (Tjmax / hotspot), di/dt, VRM telemetry
  • the SMU's internal boost-budget allocation, which actually consumes the CPPC desired / min(FLOOR) / max hints

With LOW=1800 and HIGH=3500, FLOOR_PERF tells the SMU to commit the shared boost/voltage/current budget preferentially to the HIGH cores. Holding the HIGH group near 3.5 GHz raises shared-rail voltage and consumes EDC/TDC and boost budget, so the SMU pulls the LOW group down to stay within those internal limits — even though externally-reported socket power is still ~438 W < 500 W. The 438 W simply means socket power was not the active limiter in that configuration; an internal limit (and the priority allocation itself) was.

Why split-config power (438 W) is lower than uniform 3.5 GHz (500 W):

Dropping the LOW group to ~2.6 GHz lowers its voltage and power substantially (P ≈ f·V², and V scales with f), so total package power falls even with the HIGH group held at 3.5 GHz. The SMU is not trying to "fill" the socket to 500 W — it honors the priority distribution subject to internal V/F and current limits.

In summary:

FLOOR_PERF should be read as both: a throttling preference under a saturated external power/thermal limit, and an internal priority signal that redistributes performance between HIGH and LOW groups before the package reaches the external socket power limit — because internal electrical/thermal/boost-budget limits, not the socket cap, are typically the active constraint.

Thanks.

Thanks for your reply, that explanation is helpful. One concern I still have is about the
work-conservation aspect.

In this test, the workload is unchanged. With a uniform floor, the whole socket can
run around 3.5 GHz and package power reaches around 500 W. With split floors
(LOW=1800, HIGH=3500), the HIGH group is still around 3.5 GHz, but the LOW group
drops to around 2.6 GHz and package power drops to around 438 W.

So the HIGH group does not appear to gain additional frequency compared with the
uniform case, while the LOW group loses frequency. For a throughput-oriented
workload, this likely means lower aggregate performance.

Is this intended behavior? In other words, is CPPC Performance Priority expected
to be non-work-conserving, where different FloorPerf values can reserve/steer
internal boost budget for HIGH cores even if the HIGH group does not consume all
available package power headroom? Or should the SMU allow the LOW group to use
remaining headroom once the HIGH group is already satisfied?

I understand that FloorPerf is a priority hint and not a fixed frequency request.
I just want to clarify whether the expected policy is:

  1. protect HIGH first and allow LOW to use remaining headroom, or
  2. enforce a stronger HIGH/LOW split even if that reduces total socket power and
    aggregate throughput under the same workload.

@kchuyizhou

Copy link
Copy Markdown

Hello

CI reports missing upstream fix patches for this branch.

The fix-patch scan checked 227 commits and found several missing fixes. Some of
them are directly related to amd-pstate / CPPC / dynamic EPP / floor perf, so
they should be either backported into this MR/branch or explicitly marked as not
applicable with justification.

Missing fixes reported by CI:

  • 5629eec1a282 cpufreq/amd-pstate: Fix setting EPP in performance mode
  • 3cd07ee35a66 cpufreq/amd-pstate: drop stale @epp_cached kdoc
  • f9f16835d4dc cpufreq/amd-pstate-ut: Drop policy reference before driver switch
  • caa822d312be cpufreq/amd-pstate: Use "epp_default_dc" as default when dynamic_epp is disabled
  • f3acf7ff1130 cpufreq/amd-pstate: Reorder notifier unregistration and floor perf reset
  • c5eed6ddc757 cpufreq/amd-pstate: Allow writes to dynamic_epp when state isn't modified
  • 87d2a8dec0f0 cpufreq/amd-pstate: Return -ENOMEM on failure to allocate profile_name
  • 9228169d2ae0 cpufreq/amd-pstate: Grab "amd_pstate_driver_lock" when toggling dynamic_epp
  • 679343977588 cpufreq/amd-pstate: Add POWER_SUPPLY select for dynamic EPP
  • 4fe5934db4a7 ACPI: CPPC: Detect preferred core availability on online CPUs
  • 220abf77e7c2 cpufreq/amd-pstate: Fix setting of CPPC.min_perf in active mode for performance governor
  • b79276d ACPI: processor: Move arch_init_invariance_cppc() call later
  • df488cac6140 cpufreq/amd-pstate-ut: Disable dynamic_epp after the mode switch

There are also several non-amd-pstate fixes reported by the same scan:

  • 6b050482ec40 cpufreq: intel_pstate: Fix crash during turbo disable
  • 1fedbb589448 cpufreq: intel_pstate: Enable asym capacity only when CPU SMT is not possible
  • 1a1030d cpufreq: intel_pstate: Rearrange locking in hybrid_init_cpu_capacity_scaling()
  • 92447aa cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially
  • 4490fe973669 platform/x86/amd: pmf: Fix missing hidden options for Smart PC
  • b3e127dacad6 platform/x86: thinkpad_acpi: Fix registration of tpacpi platform driver

@mohanasv2

Copy link
Copy Markdown
Author

Hello, here is a another issue I met: I ran an additional dynamic HIGH floor test on the Venice system to better understand the cppc priority behavior.
Test environment:

  • 1 socket, 144 cores / 288 CPUs
  • amd-pstate-epp
  • governor: performance
  • amd_pstate_floor_count: 2
  • HSMP socket power limit kept at platform max: 500 W
  • No explicit power cap was applied
  • Workload: stress-ng --cpu 144 --cpu-load 50
  • Sampling: turbostat --interval 1 --num_iterations 60 --show CPU,Bzy_MHz,Busy%,PkgWatt
  • LOW floor fixed at 1800000 kHz
  • HIGH group: 18 full cores, tested with both A0 and B72 placements

I changed only the HIGH floor while keeping the same workload running:
A0 result:

  • HIGH=3500000: PkgWatt 437.99 W, HIGH 3552 MHz, LOW 2631 MHz, delta +921 MHz
  • HIGH=2500000: PkgWatt 459.69 W, HIGH 3577 MHz, LOW 2882 MHz, delta +695 MHz
  • HIGH=1800000: PkgWatt 500.01 W, HIGH 3511 MHz, LOW 3516 MHz, delta -5 MHz
  • HIGH=4015749: PkgWatt 462.75 W, HIGH 3671 MHz, LOW 2524 MHz, delta +1147 MHz

So the relative HIGH/LOW split tracks the configured HIGH floor:

  • reducing HIGH floor reduces the delta;
  • setting HIGH equal to LOW removes the split;
  • setting HIGH to scaling_max_freq increases the split.

The part I would like to clarify is the expected behavior when there still appears to be package power headroom.
When all CPUs use the same floor value, the same workload can run around 3.5 GHz across the machine and reaches around 500 W. However, once we configure different floor values, for example LOW=1800000 and HIGH=3500000, package power is only around 438-439 W, but the LOW group is already reduced to around 2.6 GHz while the HIGH group stays around 3.5 GHz.
Is this expected firmware/SMU behavior for CPPC Performance Priority?
In other words, should different FLOOR_PERF values be interpreted not only as a throttling preference under an already saturated package power/thermal limit, but also as an internal priority signal that can redistribute performance between HIGH and LOW groups even before the package reaches the external socket power limit?

Hi,
CPPC Performance Priority — redistribution below the external power limit:
Yes — this is expected firmware/SMU behavior, and your interpretation is correct: FLOOR_PERF is a genuine internal priority signal that can redistribute performance between groups before the package reaches the external socket power limit — not only a throttling order that activates once that limit is saturated.
Why redistribution happens below the 500 W cap:
The HSMP socket power limit is only one of several limiters the SMU enforces simultaneously. The active constraint is whichever binds first, and with a floor differential that is usually an internal one well below the socket cap:

  • fast/slow package power tracking (PPT)
  • electrical limits — EDC (design current) and TDC (thermal-design current) on the shared rail
  • thermal (Tjmax / hotspot), di/dt, VRM telemetry
  • the SMU's internal boost-budget allocation, which actually consumes the CPPC desired / min(FLOOR) / max hints

With LOW=1800 and HIGH=3500, FLOOR_PERF tells the SMU to commit the shared boost/voltage/current budget preferentially to the HIGH cores. Holding the HIGH group near 3.5 GHz raises shared-rail voltage and consumes EDC/TDC and boost budget, so the SMU pulls the LOW group down to stay within those internal limits — even though externally-reported socket power is still ~438 W < 500 W. The 438 W simply means socket power was not the active limiter in that configuration; an internal limit (and the priority allocation itself) was.
Why split-config power (438 W) is lower than uniform 3.5 GHz (500 W):
Dropping the LOW group to ~2.6 GHz lowers its voltage and power substantially (P ≈ f·V², and V scales with f), so total package power falls even with the HIGH group held at 3.5 GHz. The SMU is not trying to "fill" the socket to 500 W — it honors the priority distribution subject to internal V/F and current limits.
In summary:
FLOOR_PERF should be read as both: a throttling preference under a saturated external power/thermal limit, and an internal priority signal that redistributes performance between HIGH and LOW groups before the package reaches the external socket power limit — because internal electrical/thermal/boost-budget limits, not the socket cap, are typically the active constraint.
Thanks.

Thanks for your reply, that explanation is helpful. One concern I still have is about the work-conservation aspect.

In this test, the workload is unchanged. With a uniform floor, the whole socket can run around 3.5 GHz and package power reaches around 500 W. With split floors (LOW=1800, HIGH=3500), the HIGH group is still around 3.5 GHz, but the LOW group drops to around 2.6 GHz and package power drops to around 438 W.

So the HIGH group does not appear to gain additional frequency compared with the uniform case, while the LOW group loses frequency. For a throughput-oriented workload, this likely means lower aggregate performance.

Is this intended behavior? In other words, is CPPC Performance Priority expected to be non-work-conserving, where different FloorPerf values can reserve/steer internal boost budget for HIGH cores even if the HIGH group does not consume all available package power headroom? Or should the SMU allow the LOW group to use remaining headroom once the HIGH group is already satisfied?

I understand that FloorPerf is a priority hint and not a fixed frequency request. I just want to clarify whether the expected policy is:

  1. protect HIGH first and allow LOW to use remaining headroom, or
  2. enforce a stronger HIGH/LOW split even if that reduces total socket power and
    aggregate throughput under the same workload.

Hi Kchuyizhou,

Thank you for the detailed test data and the very clear write-up — the four-point HIGH-floor sweep with turbostat sampling made the behavior easy to reproduce and reason about on our side.

Short answer: Yes, what you are observing is expected firmware/SMU behavior, not a defect or a misreport of available power. Different per-core MinPerf (FLOOR_PERF) values are interpreted as more than a throttling-order preference under a saturated power/thermal cap — they act as guaranteed minimum active-frequency targets that the SMU's DPM arbitration satisfies first, which effectively makes them an internal performance-priority signal. That priority can redistribute performance between your HIGH and LOW groups even before the package reaches the 500 W socket limit.

Why the numbers look the way they do:
• Equal floors (1.8 / 1.8 GHz): The autonomous DPM controller boosts every core uniformly toward the workload's natural operating point until it hits the 500 W ceiling. Here, package power is the binding constraint, so all cores converge to ~3.5 GHz at ~500 W with essentially no split (Δ ≈ −5 MHz).
• Divergent floors (e.g. 1.8 / 3.5 GHz): The SMU first honors the high floor on the 18 HIGH cores as a guaranteed minimum it must try to satisfy. With less DPM freedom remaining after meeting those minimums, it does not opportunistically spend the leftover budget pushing the LOW group higher. The LOW cores therefore settle lower (~2.6 GHz), the HIGH cores stay pinned near their floor (~3.5 GHz), and the binding constraint shifts from package power to your per-group floor configuration. This is exactly why total power lands at ~438 W instead of the full 500 W — the ~62 W of "headroom" is not throttled-away budget; it is simply unused because the floor configuration, not power, is now the limiter.

This also explains the clean monotonic trend you captured:

HIGH floor PkgWatt HIGH MHz LOW MHz Δ
1.8 GHz (= LOW) 500 W 3511 3516 −5
2.5 GHz 460 W 3577 2882 +695
3.5 GHz 438 W 3552 2631 +921
4.0 GHz (= scaling_max) 463 W 3671 2524 +1147

As you noted: reducing the HIGH floor reduces the split; setting HIGH = LOW removes it; setting HIGH = scaling_max_freq maximizes it. That is consistent with MinPerf being honored as a priority/guaranteed-minimum input to the arbitration rather than a pure power-cap throttle.

The platform is intended to support core-priority — allowing the SMU to prioritize frequency allocation (and throttling) by core rather than treating all cores uniformly. Using divergent MinPerf floors is effectively a way to express that priority.

• If the goal is to fully utilize package power while still favoring the HIGH cores, raising the LOW-group floor (rather than lowering it) will pull more of the available budget back into the LOW group and push package power back toward 500 W, while the HIGH floor continues to guarantee the priority cores.

Sample run output:
#############################################################
platform: NCPU=512 offset=256 highest_perf=255
cpuinfo_min=1213794kHz scaling_max=3517242kHz cpuinfo_max=3517242kHz
config : HIGH=3500MHz(0xfe, hw≈3503MHz) HIGH cores=18 from cpu0 SECS=60
sweep : LOW = 1800 2500 3000 (MHz)

================ RESULTS (Bzy_MHz; D = HIGH-LOW separation) ================
--- LOW=1800MHz(0x82): HW read-back -> HIGH=3503MHz LOW=1793MHz ---
LOW=1800 saturated pkgW=523.5 HIGH=2614 LOW=1687 Δ(H-L)=927 PASS

--- LOW=2500MHz(0xb5): HW read-back -> HIGH=3503MHz LOW=2497MHz ---
LOW=2500 saturated pkgW=535.2 HIGH=2352 LOW=1860 Δ(H-L)=492 PASS

--- LOW=3000MHz(0xd9): HW read-back -> HIGH=3503MHz LOW=2993MHz ---
LOW=3000 saturated pkgW=554.2 HIGH=2168 LOW=1963 Δ(H-L)=205 PASS
#############################################################

• If the goal is strict prioritization of the 18 HIGH cores, the current configuration is working as intended — the unused power is expected, not lost throughput that should have been reclaimed.

Please let us know if you need any further information.

Thanks.

@mohanasv2

Copy link
Copy Markdown
Author

Hello

CI reports missing upstream fix patches for this branch.

The fix-patch scan checked 227 commits and found several missing fixes. Some of them are directly related to amd-pstate / CPPC / dynamic EPP / floor perf, so they should be either backported into this MR/branch or explicitly marked as not applicable with justification.

Missing fixes reported by CI:

  • 5629eec1a282 cpufreq/amd-pstate: Fix setting EPP in performance mode
  • 3cd07ee35a66 cpufreq/amd-pstate: drop stale @epp_cached kdoc
  • f9f16835d4dc cpufreq/amd-pstate-ut: Drop policy reference before driver switch
  • caa822d312be cpufreq/amd-pstate: Use "epp_default_dc" as default when dynamic_epp is disabled
  • f3acf7ff1130 cpufreq/amd-pstate: Reorder notifier unregistration and floor perf reset
  • c5eed6ddc757 cpufreq/amd-pstate: Allow writes to dynamic_epp when state isn't modified
  • 87d2a8dec0f0 cpufreq/amd-pstate: Return -ENOMEM on failure to allocate profile_name
  • 9228169d2ae0 cpufreq/amd-pstate: Grab "amd_pstate_driver_lock" when toggling dynamic_epp
  • 679343977588 cpufreq/amd-pstate: Add POWER_SUPPLY select for dynamic EPP
  • 4fe5934db4a7 ACPI: CPPC: Detect preferred core availability on online CPUs
  • 220abf77e7c2 cpufreq/amd-pstate: Fix setting of CPPC.min_perf in active mode for performance governor
  • b79276d ACPI: processor: Move arch_init_invariance_cppc() call later
  • df488cac6140 cpufreq/amd-pstate-ut: Disable dynamic_epp after the mode switch

There are also several non-amd-pstate fixes reported by the same scan:

  • 6b050482ec40 cpufreq: intel_pstate: Fix crash during turbo disable
  • 1fedbb589448 cpufreq: intel_pstate: Enable asym capacity only when CPU SMT is not possible
  • 1a1030d cpufreq: intel_pstate: Rearrange locking in hybrid_init_cpu_capacity_scaling()
  • 92447aa cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially
  • 4490fe973669 platform/x86/amd: pmf: Fix missing hidden options for Smart PC
  • b3e127dacad6 platform/x86: thinkpad_acpi: Fix registration of tpacpi platform driver

Hi Kchuyizhou,

Some of these patches identified in the scan were not originally scoped for this backport, as they had not been upstreamed at that time. They have now been recently upstreamed as part of version 7.1. We will analyze and backport the remaining fix patches and submit them for review. Kindly advise whether these patches should be included in the current PR or submitted as a new PR.

Thanks.

@kchuyizhou

Copy link
Copy Markdown

Hello
CI reports missing upstream fix patches for this branch.
The fix-patch scan checked 227 commits and found several missing fixes. Some of them are directly related to amd-pstate / CPPC / dynamic EPP / floor perf, so they should be either backported into this MR/branch or explicitly marked as not applicable with justification.
Missing fixes reported by CI:

  • 5629eec1a282 cpufreq/amd-pstate: Fix setting EPP in performance mode
  • 3cd07ee35a66 cpufreq/amd-pstate: drop stale @epp_cached kdoc
  • f9f16835d4dc cpufreq/amd-pstate-ut: Drop policy reference before driver switch
  • caa822d312be cpufreq/amd-pstate: Use "epp_default_dc" as default when dynamic_epp is disabled
  • f3acf7ff1130 cpufreq/amd-pstate: Reorder notifier unregistration and floor perf reset
  • c5eed6ddc757 cpufreq/amd-pstate: Allow writes to dynamic_epp when state isn't modified
  • 87d2a8dec0f0 cpufreq/amd-pstate: Return -ENOMEM on failure to allocate profile_name
  • 9228169d2ae0 cpufreq/amd-pstate: Grab "amd_pstate_driver_lock" when toggling dynamic_epp
  • 679343977588 cpufreq/amd-pstate: Add POWER_SUPPLY select for dynamic EPP
  • 4fe5934db4a7 ACPI: CPPC: Detect preferred core availability on online CPUs
  • 220abf77e7c2 cpufreq/amd-pstate: Fix setting of CPPC.min_perf in active mode for performance governor
  • b79276d ACPI: processor: Move arch_init_invariance_cppc() call later
  • df488cac6140 cpufreq/amd-pstate-ut: Disable dynamic_epp after the mode switch

There are also several non-amd-pstate fixes reported by the same scan:

  • 6b050482ec40 cpufreq: intel_pstate: Fix crash during turbo disable
  • 1fedbb589448 cpufreq: intel_pstate: Enable asym capacity only when CPU SMT is not possible
  • 1a1030d cpufreq: intel_pstate: Rearrange locking in hybrid_init_cpu_capacity_scaling()
  • 92447aa cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially
  • 4490fe973669 platform/x86/amd: pmf: Fix missing hidden options for Smart PC
  • b3e127dacad6 platform/x86: thinkpad_acpi: Fix registration of tpacpi platform driver

Hi Kchuyizhou,

Some of these patches identified in the scan were not originally scoped for this backport, as they had not been upstreamed at that time. They have now been recently upstreamed as part of version 7.1. We will analyze and backport the remaining fix patches and submit them for review. Kindly advise whether these patches should be included in the current PR or submitted as a new PR.

Thanks.

Hi,

Thanks for the update.

Since the CI scan is based on the commits included in this MR, the reported
missing fixes should correspond to patches whose original commits are already in
the current MR.

For the fixes that are related to amd-pstate / ACPI CPPC / dynamic EPP /
floor perf and are needed for the CPPC priority backport, please include the
missing fix patches in this MR.

For any reported fix whose original patch is not really related to the CPPC
priority / amd_pstate_floor_freq feature scope, I think it's also ok to drop that original patch
from this MR.

@mohanasv2

Copy link
Copy Markdown
Author

Hello
CI reports missing upstream fix patches for this branch.
The fix-patch scan checked 227 commits and found several missing fixes. Some of them are directly related to amd-pstate / CPPC / dynamic EPP / floor perf, so they should be either backported into this MR/branch or explicitly marked as not applicable with justification.
Missing fixes reported by CI:

  • 5629eec1a282 cpufreq/amd-pstate: Fix setting EPP in performance mode
  • 3cd07ee35a66 cpufreq/amd-pstate: drop stale @epp_cached kdoc
  • f9f16835d4dc cpufreq/amd-pstate-ut: Drop policy reference before driver switch
  • caa822d312be cpufreq/amd-pstate: Use "epp_default_dc" as default when dynamic_epp is disabled
  • f3acf7ff1130 cpufreq/amd-pstate: Reorder notifier unregistration and floor perf reset
  • c5eed6ddc757 cpufreq/amd-pstate: Allow writes to dynamic_epp when state isn't modified
  • 87d2a8dec0f0 cpufreq/amd-pstate: Return -ENOMEM on failure to allocate profile_name
  • 9228169d2ae0 cpufreq/amd-pstate: Grab "amd_pstate_driver_lock" when toggling dynamic_epp
  • 679343977588 cpufreq/amd-pstate: Add POWER_SUPPLY select for dynamic EPP
  • 4fe5934db4a7 ACPI: CPPC: Detect preferred core availability on online CPUs
  • 220abf77e7c2 cpufreq/amd-pstate: Fix setting of CPPC.min_perf in active mode for performance governor
  • b79276d ACPI: processor: Move arch_init_invariance_cppc() call later
  • df488cac6140 cpufreq/amd-pstate-ut: Disable dynamic_epp after the mode switch

There are also several non-amd-pstate fixes reported by the same scan:

  • 6b050482ec40 cpufreq: intel_pstate: Fix crash during turbo disable
  • 1fedbb589448 cpufreq: intel_pstate: Enable asym capacity only when CPU SMT is not possible
  • 1a1030d cpufreq: intel_pstate: Rearrange locking in hybrid_init_cpu_capacity_scaling()
  • 92447aa cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially
  • 4490fe973669 platform/x86/amd: pmf: Fix missing hidden options for Smart PC
  • b3e127dacad6 platform/x86: thinkpad_acpi: Fix registration of tpacpi platform driver

Hi Kchuyizhou,
Some of these patches identified in the scan were not originally scoped for this backport, as they had not been upstreamed at that time. They have now been recently upstreamed as part of version 7.1. We will analyze and backport the remaining fix patches and submit them for review. Kindly advise whether these patches should be included in the current PR or submitted as a new PR.
Thanks.

Hi,

Thanks for the update.

Since the CI scan is based on the commits included in this MR, the reported missing fixes should correspond to patches whose original commits are already in the current MR.

For the fixes that are related to amd-pstate / ACPI CPPC / dynamic EPP / floor perf and are needed for the CPPC priority backport, please include the missing fix patches in this MR.

For any reported fix whose original patch is not really related to the CPPC priority / amd_pstate_floor_freq feature scope, I think it's also ok to drop that original patch from this MR.

Hi,

All fix patches identified by the fix‑patch scan have been backported, tested, and included in this PR, except the following:

4490fe973669platform/x86/amd: pmf: Fix missing hidden options for Smart PC
Not backported, as it depends on the complete Smart PC / PMF‑TA / policy‑binary feature stack (~60+ patches), which is unrelated to amd‑pstate.

Test Results (Fix Patches)

Results before and after backport (also included in the PR summary under unit test results):

# Test Before Backport After Backport
1 acpi_cpc_valid success success
2 check_enabled success success
3 check_perf success success
4 check_freq success success
5 check_epp HANG (D-state >122s) success
6 check_driver never reached success
7 check_freq_attrs never reached success

Please help with the review.

Thanks.

@kchuyizhou

Copy link
Copy Markdown

4490fe973669platform/x86/amd: pmf: Fix missing hidden options for Smart PC

Could you completely drop the following two patches from the current MR?
platform/x86/amd: pmf: Add balanced-performance to hidden choices
platform/x86/amd: pmf: Add 'quiet' to hidden choices

Because as long as these two patches remain in the current branch, our CI will definitely require
4490fe973669 – platform/x86/amd: pmf: Fix missing hidden options for Smart PC to be merged,
since it is a fix for the two patches mentioned above.

@mohanasv2

Copy link
Copy Markdown
Author

4490fe973669platform/x86/amd: pmf: Fix missing hidden options for Smart PC

Could you completely drop the following two patches from the current MR? platform/x86/amd: pmf: Add balanced-performance to hidden choices platform/x86/amd: pmf: Add 'quiet' to hidden choices

Because as long as these two patches remain in the current branch, our CI will definitely require 4490fe973669 – platform/x86/amd: pmf: Fix missing hidden options for Smart PC to be merged, since it is a fix for the two patches mentioned above.

Hi,
Those two patches are fix patches for "ACPI: platform_profile: Allow multiple handlers", which is a base patch for the platform profiler. Removing them will cause CI fix patch failures for that patch.
Could you please confirm if it is acceptable to remove these two patches despite the known fix patch issue?

Commit: 688834743d672b - ACPI: platform_profile: Allow multiple handlers
FAIL -> new bugfix needed
* 9a43102daf64dd platform/x86/amd: pmf: Add balanced-performance to hidden choices
* 44e94fece5170e platform/x86/amd: pmf: Add 'quiet' to hidden choices

Thanks.

@kchuyizhou

Copy link
Copy Markdown

Hi,
Those two patches are fix patches for "ACPI: platform_profile: Allow multiple handlers", which is a base patch for the platform profiler. Removing them will cause CI fix patch failures for that patch.
Could you please confirm if it is acceptable to remove these two patches despite the known fix patch issue?

I see....

So could we further drop the following patch or its related patches? Is this feasible?
ACPI: platform_profile: Allow multiple handlers

@mohanasv2

Copy link
Copy Markdown
Author

Hi,
Those two patches are fix patches for "ACPI: platform_profile: Allow multiple handlers", which is a base patch for the platform profiler. Removing them will cause CI fix patch failures for that patch.
Could you please confirm if it is acceptable to remove these two patches despite the known fix patch issue?

I see....

So could we further drop the following patch or its related patches? Is this feasible? ACPI: platform_profile: Allow multiple handlers

The following patch is a base ACPI patch that introduces support for multiple handlers and cannot be removed. Removing it will lead to platform profiler functionality failures.
Patch: ACPI: platform_profile: Allow multiple handlers

@kchuyizhou

Copy link
Copy Markdown

Hi,
cpufreq/amd-pstate: Use topology_logical_package_id() instead of logical_die_id() is a follow-up fix for x86/cpu/topology: Add support for the AMD 0x80000026 leaf. However, the latter is neither included in the current MR nor present in the branch’s commit history, which will cause CI failures.
There are two possible ways to address this:
Backport x86/cpu/topology: Add support for the AMD 0x80000026 leaf before cpufreq/amd-pstate: Use topology_logical_package_id() instead of logical_die_id(). However, it may depend on fixes in several other subsystems, which might also need to be backported.

Simply consider dropping cpufreq/amd-pstate: Use topology_logical_package_id() instead of logical_die_id(), since the issue it is intended to fix does not exist in the current branch.

@mohanasv2

Copy link
Copy Markdown
Author

Hi, cpufreq/amd-pstate: Use topology_logical_package_id() instead of logical_die_id() is a follow-up fix for x86/cpu/topology: Add support for the AMD 0x80000026 leaf. However, the latter is neither included in the current MR nor present in the branch’s commit history, which will cause CI failures. There are two possible ways to address this: Backport x86/cpu/topology: Add support for the AMD 0x80000026 leaf before cpufreq/amd-pstate: Use topology_logical_package_id() instead of logical_die_id(). However, it may depend on fixes in several other subsystems, which might also need to be backported.

Simply consider dropping cpufreq/amd-pstate: Use topology_logical_package_id() instead of logical_die_id(), since the issue it is intended to fix does not exist in the current branch.

Hi,
Thanks for the review feedback.
The patch "cpufreq/amd-pstate: Use topology_logical_package_id() instead of logical_die_id()" was backported as a dependency for "cpufreq/amd-pstate: Rework CPPC enabling". However, its prerequisite topology commit was inadvertently omitted, which is causing the CI failure.
To address this, we have now backported "x86/cpu/topology: Add support for the AMD 0x80000026 leaf", which does not have any additional dependencies. Since it was merged automatically, the patch was added at the end of the series.

Kindly review & let us know your feedback.

Thanks.

@mohanasv2
mohanasv2 force-pushed the Venice_CPPC_patches branch 2 times, most recently from d0952ee to 25345f1 Compare July 28, 2026 06:04
Meng Li and others added 9 commits July 28, 2026 11:40
…ally

commit e571a5e upstream.

Preferred core rankings can be changed dynamically by the
platform based on the workload and platform conditions and
accounting for thermals and aging.
When this occurs, cpu priority need to be set.

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Wyes Karny <wyes.karny@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Meng Li <li.meng@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit b37ef72 upstream.

The four fields of struct cpudata namely min_limit_perf,
max_limit_perf, min_limit_freq, max_limit_freq introduced in the
commit febab20("cpufreq/amd-pstate: Fix scaling_min_freq and
scaling_max_freq update") are currently undocumented

Add comments describing these fields

Acked-by: Huang Rui <ray.huang@amd.com>
Fixes: febab20("cpufreq/amd-pstate: Fix scaling_min_freq and scaling_max_freq update")
Reviewed-by: Li Meng <li.meng@amd.com>
Tested-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…data

commit 4fcfd19 upstream.

The min_limit_freq, max_limit_freq, min_freq, max_freq, nominal_freq
and the lowest_nominal_freq members of struct cpudata store the
frequency value in khz to be consistent with the cpufreq
core. Update the comment to document this.

Reviewed-by: Li Meng <li.meng@amd.com>
Tested-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…linear}_freq

commit 5547c0e upstream.

Currently the amd_get_{min, max, nominal, lowest_nonlinear}_freq()
helpers computes the values of min_freq, max_freq, nominal_freq and
lowest_nominal_freq respectively afresh from
cppc_get_perf_caps(). This is not necessary as there are fields in
cpudata to cache these values.

To simplify this, add a single helper function named
amd_pstate_init_freq() which computes all these frequencies at once, and
caches it in cpudata.

Use the cached values everywhere else in the code.

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Li Meng <li.meng@amd.com>
Tested-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Co-developed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…}_freq()

commit 3cbbe88 upstream.

amd_get_{min,max,nominal,lowest_nonlinear}_freq() functions merely
return cpudata->{min,max,nominal,lowest_nonlinear}_freq values.

There is no loss in readability in replacing their invocations by
accesses to the corresponding members of cpudata.

Do so and remove these helper functions.

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Li Meng <li.meng@amd.com>
Tested-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 2ddb8a3 upstream.

The amd-pstate driver cannot work when the min_freq, nominal_freq or
the max_freq is zero. When this happens it is prudent to error out
early on rather than waiting failing at the time of the governor
initialization.

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Tested-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
… tables

commit 069a2bb upstream.

Make pstate driver initially retrieve the P-state transition delay and
latency values from the BIOS ACPI tables which has more reasonable
delay and latency values according to the platform design and
requirements.

Previously there values were hardcoded at specific value which may
have conflicted with platform and it might not reflect the most
accurate or optimized setting for the processor.

[054h 0084   8]                Preserve Mask : FFFFFFFF00000000
[05Ch 0092   8]                   Write Mask : 0000000000000001
[064h 0100   4]              Command Latency : 00000FA0
[068h 0104   4]          Maximum Access Rate : 0000EA60
[06Ch 0108   2]      Minimum Turnaround Time : 0000

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit eb8b6c3 upstream.

Add quirks table to get CPPC capabilities issue fixed by providing
correct perf or frequency values while driver loading.

If CPPC capabilities are not defined in the ACPI tables or wrongly
defined by platform firmware, it needs to use quick to get those
issues fixed with correct workaround values to make pstate driver
can be loaded even though there are CPPC capabilities errors.

The workaround will match the broken BIOS which lack of CPPC capabilities
nominal_freq and lowest_freq definition in the ACPI table.

$ cat /sys/devices/system/cpu/cpu0/acpi_cppc/lowest_freq
0
$ cat /sys/devices/system/cpu/cpu0/acpi_cppc/nominal_freq
0

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Tested-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 5131a3c upstream.

get some code format problems fixed in the amd-pstate driver.

Changes Made:

- Fixed incorrect comment format in the functions.

- Removed unnecessary blank line.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404271148.HK9yHBlB-lkp@intel.com/
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Abhishek Rajput <Abhishek.Rajput@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
Meng Li and others added 25 commits July 28, 2026 11:40
… line options

commit dfddf34 upstream.

amd-pstate driver support enable/disable preferred core.
Default enabled on platforms supporting amd-pstate preferred core.
Disable amd-pstate preferred core with
"amd_prefcore=disable" added to the kernel command line.

Signed-off-by: Meng Li <li.meng@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Wyes Karny <wyes.karny@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Perry Yuan <perry.yuan@amd.com>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: chaithanyaLagisetty <LagisettyVenkata.NagaChaitanya@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit da8afb1c666a4a966f0ab91dc336df4c855bc7b2 upstream.

Add `amd_dynamic_epp=enable` and `amd_dynamic_epp=disable` to override
the kernel configuration option `CONFIG_X86_AMD_PSTATE_DYNAMIC_EPP`
locally.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: chaithanyaLagisetty <LagisettyVenkata.NagaChaitanya@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit c03791085adcd61fa9b766ab303c7d0941d7378d upstream.

cpufreq_cpu_get() can sleep on PREEMPT_RT in presence of concurrent
writer(s), however amd-pstate depends on fetching the cpudata via the
policy's driver data which necessitates grabbing the reference.

Since schedutil governor can call "cpufreq_driver->update_perf()"
during sched_tick/enqueue/dequeue with rq_lock held and IRQs disabled,
fetching the policy object using the cpufreq_cpu_get() helper in the
scheduler fast-path leads to "BUG: scheduling while atomic" on
PREEMPT_RT [1].

Pass the cached cpufreq policy object in sg_policy to the update_perf()
instead of just the CPU. The CPU can be inferred using "policy->cpu".

The lifetime of cpufreq_policy object outlasts that of the governor and
the cpufreq driver (allocated when the CPU is onlined and only reclaimed
when the CPU is offlined / the CPU device is removed) which makes it
safe to be referenced throughout the governor's lifetime.

Closes:https://lore.kernel.org/all/20250731092316.3191-1-spasswolf@web.de/ [1]

[Backport Changes]
Upstream changes to rust/kernel/cpufreq.rs were excluded. The Rust
cpufreq abstraction does not yet exist in the Anolis 6.6 kernel tree;
only the C cpufreq core (drivers/cpufreq/cpufreq.c, intel_pstate.c,
amd-pstate.c), the cpufreq schedutil governor, and include/linux/cpufreq.h
hunks are applied.

Fixes: 1d215f0 ("cpufreq: amd-pstate: Add fast switch function for AMD P-State")
Reported-by: Bert Karwatzki <spasswolf@web.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Acked-by: Gary Guo <gary@garyguo.net> # Rust
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260316081849.19368-3-kprateek.nayak@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 86d71f1d7686cecebbafb371ad58c6ad7f80a93a upstream.

All callers of amd_pstate_update() already have a reference to the
cpufreq_policy object.

Pass the entire policy object and grab the cpudata using
"policy->driver_data" instead of passing the cpudata and unnecessarily
grabbing another read-side reference to the cpufreq policy object when
it is already available in the caller.

No functional changes intended.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Link: https://lore.kernel.org/r/20260316081849.19368-2-kprateek.nayak@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 077f23573d29d063a950e90aa77c8e1f79580147 upstream.

In case a new index is introduced add a static assert to make sure
that strings and values are updated.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 6927f21852f38db2975b5d5539cbe5241c25a99b upstream.

The energy performance preference field of the CPPC request MSR
supports values from 0 to 255, but the strings only offer 4 values.

The other values are useful for tuning the performance of some
workloads.

Add support for writing the raw energy performance preference value
to the sysfs file.  If the last value written was an integer then
an integer will be returned.  If the last value written was a string
then a string will be returned.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 7e173bc310d2b1df018edc66334a5304305889a2 upstream.

Ensure that all supported raw EPP values work properly.

Export the driver helpers used by the test module so the test can drive
raw EPP writes and temporarily disable dynamic EPP while it runs.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…ewer

commit 9487e2a00e7b3c6f258c5c99953f470eba6fb61d upstream.

Mario Limonciello has led amd-pstate maintenance in recent years and
has done excellent work. The amd-pstate driver is in good hands with
him. I am stepping down as co-maintainer as I move on to other things.

Add K Prateek Nayak as a reviewer. He has been actively contributing
to the driver including preferred-core and ITMT improvements, and has
been helping review amd-pstate patches for a while now.

[Backport Changes]
The MAINTAINERS entry for the AMD PSTATE DRIVER in this tree does not contain
the line "M:	Gautham R. Shenoy <gautham.shenoy@amd.com>", so the hunk that
removes it was dropped. Only the upstream change that adds the new reviewer
was applied.

Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Acked-by: K Prateek Nayak <kprateek.nayak@amd.com>
Acked-by: Mario Limonciello (AMD) <superm1@kernel.org>
Link: https://lore.kernel.org/r/20260402102611.16519-1-gautham.shenoy@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…ration

commit a97e293 upstream.

Modify intel_pstate_register_driver() to clear hybrid_max_perf_cpu
before calling cpufreq_register_driver(), so that asymmetric CPU
capacity scaling is not updated until hybrid_init_cpu_capacity_scaling()
runs down the road.  This is done in preparation for a subsequent
change adding asymmetric CPU capacity computation to the CPU init path
to handle CPUs that are initially offline.

The information on whether or not hybrid_max_perf_cpu was NULL before
it has been cleared is passed to hybrid_init_cpu_capacity_scaling(),
so full initialization of CPU capacity scaling can be skipped if it
has been carried out already.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/4616631.LvFx2qVVIh@rjwysocki.net
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit b79276d upstream.

arch_init_invariance_cppc() is called at the end of
acpi_cppc_processor_probe() in order to configure frequency invariance
based upon the values from _CPC.

This however doesn't work on AMD CPPC shared memory designs that have
AMD preferred cores enabled because _CPC needs to be analyzed from all
cores to judge if preferred cores are enabled.

This issue manifests to users as a warning since commit 21fb59a
("ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn"):
```
Could not retrieve highest performance (-19)
```

However the warning isn't the cause of this, it was actually
commit 279f838 ("x86/amd: Detect preferred cores in
amd_get_boost_ratio_numerator()") which exposed the issue.

To fix this problem, change arch_init_invariance_cppc() into a new weak
symbol that is called at the end of acpi_processor_driver_init().
Each architecture that supports it can declare the symbol to override
the weak one.

Define it for x86, in arch/x86/kernel/acpi/cppc.c, and for all of the
architectures using the generic arch_topology.c code.

Fixes: 279f838 ("x86/amd: Detect preferred cores in amd_get_boost_ratio_numerator()")
Reported-by: Ivan Shapovalov <intelfx@intelfx.name>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219431
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20241104222855.3959267-1-superm1@kernel.org
[ rjw: Changelog edit ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…e initially

commit 92447aa upstream.

Commit 929ebc9 ("cpufreq: intel_pstate: Set asymmetric CPU
capacity on hybrid systems") overlooked a corner case in which some
CPUs may be offline to start with and brought back online later,
after the intel_pstate driver has been registered, so their asymmetric
capacity will not be set.

Address this by calling hybrid_update_capacity() in the CPU
initialization path that is executed instead of the online path
for those CPUs.

Note that this asymmetric capacity update will be skipped during
driver initialization and mode switches because hybrid_max_perf_cpu
is NULL in those cases.

Fixes: 929ebc9 ("cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/1913414.tdWV9SEqCh@rjwysocki.net
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…scaling()

commit 1a1030d upstream.

Notice that hybrid_init_cpu_capacity_scaling() only needs to hold
hybrid_capacity_lock around __hybrid_init_cpu_capacity_scaling()
calls, so introduce a "locked" wrapper around the latter and call
it from the former.  This allows to drop a local variable and a
label that are not needed any more.

Also, rename __hybrid_init_cpu_capacity_scaling() to
__hybrid_refresh_cpu_capacity_scaling() for consistency.

Interestingly enough, this fixes a locking issue introduced by commit
929ebc9 ("cpufreq: intel_pstate: Set asymmetric CPU capacity on
hybrid systems") that put an arch_enable_hybrid_capacity_scale() call
under hybrid_capacity_lock, which was a mistake because the latter is
acquired in CPU hotplug paths and so it cannot be held around
cpus_read_lock() calls.

Link: https://lore.kernel.org/linux-pm/SJ1PR11MB6129EDBF22F8A90FC3A3EDC8B9582@SJ1PR11MB6129.namprd11.prod.outlook.com/
Fixes: 929ebc9 ("cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reported-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
Link: https://patch.msgid.link/12554508.O9o76ZdvQC@rjwysocki.net
[ rjw: Changelog update ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…erformance governor

commit 220abf77e7c2835cc63ea8cd7158cf83952640af upstream.

In the "active" mode of the amd-pstate driver with performance
governor, the CPPC.min_perf is expected to be the nominal_perf.

However after commit a9b9b4c2a4cd ("cpufreq/amd-pstate: Drop min and
max cached frequencies"), this is not the case when the governor is
switched from performance to powersave and back to performance, and
the CPPC.min_perf will be equal to the scaling_min_freq that was set
for the powersave governor.

This is because prior to commit a9b9b4c2a4cd ("cpufreq/amd-pstate:
Drop min and max cached frequencies"), amd_pstate_epp_update_limit()
would unconditionally call amd_pstate_update_min_max_limit() and the
latter function would enforce the CPPC.min_perf constraint when the
governor is performance.

However, after the aforementioned commit,
amd_pstate_update_min_max_limit() is called by
amd_pstate_epp_update_limit() only when either the
scaling_{min/max}_freq is different from the cached value of
cpudata->{min/max}_limit_freq, which wouldn't have changed on a
governor transition from powersave to performance, thus missing out on
enforcing the CPPC.min_perf constraint for the performance governor.

Fix this by invoking amd_pstate_epp_udpate_limit() not only when the
{min/max} limits have changed from the cached values, but also when
the policy itself has changed.

Fixes: a9b9b4c2a4cd ("cpufreq/amd-pstate: Drop min and max cached frequencies")
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20250821042638.356-1-gautham.shenoy@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 4fe5934db4a7187d358f1af1b3ef9b6dd59bce58 upstream.

Commit 279f838 ("x86/amd: Detect preferred cores in
amd_get_boost_ratio_numerator()") introduced the ability to detect the
preferred core on AMD platforms by checking if there at least two
distinct highest_perf values.

However, it uses for_each_present_cpu() to iterate through all the
CPUs in the platform, which is problematic when the kernel is booted
with "nosmt=force" commandline option.

Hence limit the search to only the online CPUs.

Fixes: 279f838 ("x86/amd: Detect preferred cores in amd_get_boost_ratio_numerator()")
Reported-by: Christopher Harris <chris.harris79@gmail.com>
Closes: https://lore.kernel.org/lkml/CAM+eXpdDT7KjLV0AxEwOLkSJ2QtrsvGvjA2cCHvt1d0k2_C4Cw@mail.gmail.com/
Reviewed-by: "Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>
Tested-by: Chrisopher Harris <chris.harris79@gmail.com>
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Link: https://patch.msgid.link/20251107074145.2340-2-gautham.shenoy@amd.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…possible

commit 1fedbb589448bee9f20bb2ed9c850d1d2cf9963c upstream.

According to the description in the intel_pstate.rst documentation,
Capacity-Aware Scheduling and Energy-Aware Scheduling are only
supported on a hybrid processor without SMT. Previously, the system
used sched_smt_active() for judgment, which is not a strict condition
because users can switch it on or off via /sys at any time.

This could lead to incorrect driver settings in certain scenarios.
For example, on a CPU that supports SMT, a user can disable SMT
via the nosmt parameter to enable asym capacity, and then re-enable
SMT via /sys. In such cases, some settings in the driver would no
longer be correct.

To address this issue, replace sched_smt_active() with cpu_smt_possible(),
and only enable asym capacity when CPU SMT is not possible.

Fixes: 929ebc9 ("cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems")
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
[ rjw: Subject and changelog edits ]
Link: https://patch.msgid.link/20260203024852.301066-1-tianyaxiong@kylinos.cn
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 5f2ec3536d7933a804d28d2541e4e918ba32587b upstream.

Follow cleanup.h recommendations and define and assign a variable
in one statement when __free() is used.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Zihuan Zhang <zhangzihuan@kylinos.cn>
Link: https://patch.msgid.link/2251447.irdbgypaU6@rafael.j.wysocki
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 6b050482ec40569429d963ac52afa878691b04c9 upstream.

When the system is booted with kernel command line argument "nosmt" or
"maxcpus" to limit the number of CPUs, disabling turbo via:

 echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo

results in a crash:

 PF: supervisor read access in kernel mode
 PF: error_code(0x0000) - not-present page
 PGD 0 P4D 0
 Oops: Oops: 0000 [#1] SMP PTI
 ...
 RIP: 0010:store_no_turbo+0x100/0x1f0
 ...

This occurs because for_each_possible_cpu() returns CPUs even if they
are not online. For those CPUs, all_cpu_data[] will be NULL. Since
commit 973207ae3d7c ("cpufreq: intel_pstate: Rearrange max frequency
updates handling code"), all_cpu_data[] is dereferenced even for CPUs
which are not online, causing the NULL pointer dereference.

To fix that, pass CPU number to intel_pstate_update_max_freq() and use
all_cpu_data[] for those CPUs for which there is a valid cpufreq policy.

Fixes: 973207ae3d7c ("cpufreq: intel_pstate: Rearrange max frequency updates handling code")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221068
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: 6.16+ <stable@vger.kernel.org> # 6.16+
Link: https://patch.msgid.link/20260225001752.890164-1-srinivas.pandruvada@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 679343977588781bd3effba79e9644aee4ee046c upstream.

The dynamic EPP feature uses power_supply_reg_notifier() and
power_supply_unreg_notifier() but doesn't declare a dependency on
POWER_SUPPLY, causing linker errors when POWER_SUPPLY is not enabled.

Add POWER_SUPPLY to the selects.

Suggested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Fixes: e30ca6dd5345 ("cpufreq/amd-pstate: Add dynamic energy performance preference")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202604040742.ySEdkuAa-lkp@intel.com/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20260407194949.310114-1-mario.limonciello@amd.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…ic_epp

commit 9228169d2ae055ed09a163887fc59a710a5eb73b upstream.

Concurrently changing driver mode and dynamic_epp with:

    echo passive > /sys/devices/system/cpu/amd_pstate/status&
    echo disable > /sys/devices/system/cpu/amd_pstate/dynamic_epp&

hits the WARN_ON_ONCE() in static_key_disable_cpuslocked() and hangs the
system since both sysfs writes are trying to do
amd_pstate_change_driver_mode() without any synchronization.

Grab the "amd_pstate_driver_lock" mutex when modifying "dynamic_epp" to
prevent the two paths from racing with each other. Add a lockdep
assertion for "amd_pstate_driver_lock" in
amd_pstate_change_driver_mode() to formalize the dependency.

Since "cppc_mode" is stable under "amd_pstate_driver_lock", only reload
the driver when in "AMD_PSTATE_ACTIVE" mode and reject all writes when
in passive or guided mode, or if the driver is not loaded, since only
active mode operates on EPP.

Fixes: e30ca6dd5345 ("cpufreq/amd-pstate: Add dynamic energy performance preference")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/r/20260508051748.10484-2-kprateek.nayak@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…fied

commit c5eed6ddc757e477f52b3d99bfde9e59975c72ca upstream.

Writing the current "dynamic_epp" state to sysfs fails with -EINVAL even
though the desired result was achieved. Allow writes to "dynamic_epp"
that does not modify the state.

Fixes: e30ca6dd5345 ("cpufreq/amd-pstate: Add dynamic energy performance preference")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/r/20260508051748.10484-4-kprateek.nayak@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit f3acf7ff113007557538b278ccb0e4ab7ae513ea upstream.

An active power supply notifier can race with amd_pstate_epp_cpu_exit()
trying to reset the floor perf and can overwrite the floor perf set in
MSR_AMD_CPPC_REQ.

Unregister the notifier before setting the floor perf to prevent the
rare race.

Fixes: e30ca6dd5345 ("cpufreq/amd-pstate: Add dynamic energy performance preference")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/r/20260508051748.10484-5-kprateek.nayak@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
…is disabled

commit caa822d312be54e3fe1a3b52c887e0888e149c12 upstream.

If "dynamic_epp" is disabled, the driver initialization and the default
EPP selection from sysfs currently sets the EPP based on the power
supply state of the system at that time but there is no power supply
callbacks registered to toggle it when the power supply state changes.

This can lead to faster battery drain on platforms that start off while
being plugged to the wall but later move to battery power since the EPP
stays at AMD_CPPC_EPP_PERFORMANCE.

Use "epp_default_dc" as the default EPP selection when dynamic_epp is
disabled, restoring older behavior. On servers, this defaults to
AMD_CPPC_EPP_PERFORMANCE and on other platforms, it defaults to
AMD_CPPC_EPP_BALANCE_PERFORMANCE.

Fixes: e30ca6dd5345 ("cpufreq/amd-pstate: Add dynamic energy performance preference")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/r/20260508051748.10484-6-kprateek.nayak@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit f9f16835d4dc46113c0a72625ffbf61f1aa95e5c upstream.

Recent changes to the EPP unit test tries to perform a driver switch
with a cpufreq_policy reference held when the driver is loaded into
anything but the active mode which leads to a circular dependency and
the unit test hanging indefinitely.

Drop the reference before driver switch and grab it back once the driver
mode is stabilized for the test.

The EPP writes are only possible with CPUFREQ_POLICY_POWERSAVE policy.
Temporarily switch the cpudata->policy (while holding the write end of
the policy->rwsem) to CPUFREQ_POLICY_POWERSAVE and restore the original
policy once tests are done. To ensure the final EPP is correct in case
the driver started with CPUFREQ_POLICY_PERFORMANCE, EPP performance is
tested last.

The __free() based cleanup for cpufreq_policy is lost in the process.

Reported-by: Kalpana Shetty <kalpana.shetty@amd.com>
Fixes: 7e173bc310d2b ("cpufreq/amd-pstate-ut: Add a unit test for raw EPP")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/r/20260508051748.10484-7-kprateek.nayak@amd.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit df488cac6140aa04ae52af9b4507d8f99a3762be upstream.

Dan reported a possible NULL pointer dereference in amd-pstate-ut.c from
static analysis and sure enough, running amd-pstate-ut in active mode
with amd_dynamic_epp=enable results in a crash as a reult of the policy
reference being set to NULL early, before disabling dynamic EPP.

Kalpana also reported seeing amd-pstate-ut error out with -EBUSY for
"amd_pstate_ut_epp" test when starting from the passive mode and
amd_dynamic_epp=enable in the command line. The reason for the failure
is that the command line enables dynamic_epp by default after the mode
switch and the modifications to EPP values are blocked when running in
dynamic EPP mode.

Solution to both problems is to toggle off dynamic_epp *after* the mode
switch when the driver grabs the policy reference again since the unit
test is in full control of the policy after that point.

The final restoration step will reset the dynamic_epp state via mode
switch based on the initial conditions of the system.

Reported-by: Kalpana Shetty <kalpana.shetty@amd.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/linux-pm/ahEq0CvdBX0T7_cO@stanley.mountain/
Fixes: f9f16835d4dc ("cpufreq/amd-pstate-ut: Drop policy reference before driver switch")
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://patch.msgid.link/20260523055503.7651-1-kprateek.nayak@amd.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
commit 3cd07ee35a66038fd1a643632bfc057645e07c9a upstream.

Commit 4e16c1175238 ("cpufreq/amd-pstate: Stop caching EPP") removed
the epp_cached field from struct amd_cpudata in favour of always
reading from cppc_req_cached, but the kdoc above the struct still
documents @epp_cached.

Drop the now-stale @epp_cached entry.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Fixes: 4e16c1175238 ("cpufreq/amd-pstate: Stop caching EPP")
Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
Link: https://lore.kernel.org/r/20260526022131.1302373-1-zhanxusheng@xiaomi.com
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Hemanth Selam <Hemanth.Selam@amd.com>
Signed-off-by: mohanasv2 <mohanasv@amd.com>
@mohanasv2
mohanasv2 force-pushed the Venice_CPPC_patches branch from 25345f1 to b7d53f5 Compare July 28, 2026 06:11
@mohanasv2

Copy link
Copy Markdown
Author

The PR has been updated with the proposed reduced patch set (188 patches total). Please help with the review.
Note: Patch "cpufreq: Introduce policy->boost_supported flag" from the original list of 189 patches has been excluded, as it has already been merged.

guojinhui-liam pushed a commit that referenced this pull request Sep 14, 2026
[ Upstream commit acd7df8d955480a6f6e5bb809da67b1500cc3cf4 ]

tipc_sk_enqueue() runs with sk->sk_lock.slock held while the socket is
owned by user context. The spinlock protects the backlog queue in this
path, but it does not serialize against the socket owner consuming or
purging sk_receive_queue.

KASAN reported:

  CPU: 14 UID: 0 PID: 1050 Comm: tipc3 Not tainted 7.1.0-rc6+ #126 PREEMPT(lazy)
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
  Call Trace:
    <TASK>
    dump_stack_lvl+0x76/0xa0 lib/dump_stack.c:123
    print_report+0xce/0x5b0 mm/kasan/report.c:482
    kasan_report+0xc6/0x100 mm/kasan/report.c:597
    __asan_report_load4_noabort+0x14/0x30 mm/kasan/report_generic.c:380
    tipc_skb_dump+0x1327/0x16f0 net/tipc/trace.c:73
    tipc_list_dump+0x208/0x2e0 net/tipc/trace.c:187
    tipc_sk_dump+0xaf6/0xd60 net/tipc/socket.c:3996
    trace_event_raw_event_tipc_sk_class+0x312/0x5a0 net/tipc/trace.h:188
    tipc_sk_rcv+0xb1d/0x1d50 net/tipc/socket.c:2497
    tipc_node_xmit+0x1c3/0x1440 net/tipc/node.c:1689
    __tipc_sendmsg+0x97a/0x1440 net/tipc/socket.c:1512
    tipc_sendmsg+0x52/0x80 net/tipc/socket.c:1400
    sock_sendmsg+0x2f6/0x3e0 net/socket.c:825
    splice_to_socket+0x7f9/0x1010 fs/splice.c:884
    do_splice+0xe21/0x2330 fs/splice.c:936
    __do_splice+0x153/0x260 fs/splice.c:1431
    __x64_sys_splice+0x150/0x230 fs/splice.c:1616
    x64_sys_call+0xeb5/0x2790 arch/x86/entry/syscall_64.c:41
    do_syscall_64+0xf3/0x620 arch/x86/entry/syscall_64.c:63
    entry_SYSCALL_64_after_hwframe+0x76/0x7e arch/x86/entry/entry_64.S:130
  RIP: 0033:0x71624e8aafe2
  Code: 08 0f 85 71 3a ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 66 2e 0f 1f 84 00 00 00 00 00 66 2e 0f 1f 84 00 00 00 00 00 66
  RSP: 002b:0000716157ffed68 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
  RAX: ffffffffffffffda RBX: 0000716157fff6c0 RCX: 000071624e8aafe2
  RDX: 000000000000005f RSI: 0000000000000000 RDI: 0000000000000066
  RBP: 0000716157ffed90 R08: 0000000000008000 R09: 0000000000000001
  R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffff00
  R13: 0000000000000021 R14: 0000000000000000 R15: 00007fff89799c40
    </TASK>

The TIPC_DUMP_ALL tracepoints in tipc_sk_enqueue() also dump
sk_receive_queue and can therefore dereference skbs that the socket
owner has already dequeued or freed. Restrict these dumps to
TIPC_DUMP_SK_BKLGQ, which matches the queue protected by the held
spinlock.

Keep the change limited to the enqueue path, where the unsafe queue dump
is reachable while the socket is owned by user context.

Fixes: 01e661e ("tipc: add trace_events for tipc socket")
Cc: stable@vger.kernel.org
Signed-off-by: Li Xiasong <lixiasong1@huawei.com>
Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Link: https://patch.msgid.link/20260611135647.3666727-1-lixiasong1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
@guixiongwei

Copy link
Copy Markdown
Collaborator

Thanks for your work, this PR has merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.