AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/09/20 13:16 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch modifies shmem_init_perf() in the amd-pstate CPU frequency scaling driver (drivers/cpufreq/amd-pstate.c). This code is structurally unreachable in standard virtualized fuzzing environments (QEMU/GCE) because amd-pstate requires physical AMD hardware with ACPI _CPC (Collaborative Processor Performance Control) tables provided by SBIOS (acpi_cpc_valid()), as well as AMD hardware P-state features (X86_FEATURE_HW_PSTATE). In standard QEMU/GCE VMs, these ACPI objects and CPU features are not present or emulated, causing driver initialization to fail early during boot.",
  "WorthFuzzing": false
}

1/1 2026/09/20 13:16 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 59ad515456c6400795bc6711ce3ebcb33084eeda\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Sun Sep 20 13:16:25 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c\nindex d4ff8b228f86f..e163688ac7d9a 100644\n--- a/drivers/cpufreq/amd-pstate.c\n+++ b/drivers/cpufreq/amd-pstate.c\n@@ -524,8 +524,10 @@ static int shmem_init_perf(struct amd_cpudata *cpudata)\n \t\treturn 0;\n \t}\n \n-\tret = cppc_set_auto_sel(cpudata-\u003ecpu,\n-\t\t\t(cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);\n+\tif ((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)\n+\t\treturn 0;\n+\n+\tret = cppc_set_auto_sel(cpudata-\u003ecpu, !auto_sel);\n \n \tif (ret)\n \t\tpr_warn(\"failed to set auto_sel, ret: %d\\n\", ret);\n"
}

2/1 2026/09/20 13:16 agent patch-evaluator
1m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies shmem_init_perf() in the amd-pstate CPU frequency scaling driver (drivers/cpufreq/amd-pstate.c). This code is structurally unreachable in standard virtualized fuzzing environments (QEMU/GCE) because amd-pstate requires physical AMD hardware with ACPI _CPC (Collaborative Processor Performance Control) tables provided by SBIOS (acpi_cpc_valid()), as well as AMD hardware P-state features (X86_FEATURE_HW_PSTATE). In standard QEMU/GCE VMs, these ACPI objects and CPU features are not present or emulated, causing driver initialization to fail early during boot.",
  "WorthFuzzing": false
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 59ad515456c6400795bc6711ce3ebcb33084eeda
Author: syz-cluster <triage@syzkaller.com>
Date:   Sun Sep 20 13:16:25 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index d4ff8b228f86f..e163688ac7d9a 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -524,8 +524,10 @@ static int shmem_init_perf(struct amd_cpudata *cpudata)
 		return 0;
 	}
 
-	ret = cppc_set_auto_sel(cpudata->cpu,
-			(cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);
+	if ((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)
+		return 0;
+
+	ret = cppc_set_auto_sel(cpudata->cpu, !auto_sel);
 
 	if (ret)
 		pr_warn("failed to set auto_sel, ret: %d\n", ret);

3/2 2026/09/20 13:16 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 2939
							output: 40
							thoughts: 361
						

Thoughts:
**Analyzing the AMD-PState Driver Patch**

Alright, let's dive into this. The diff indicates a change within the `drivers/cpufreq/amd-pstate.c` file. Specifically, we're looking at a modification related to the `shmem_init_perf` function. The code seems to be handling the `auto_sel` configuration of the CPPC interface, and the original logic apparently wasn't robust, so it is likely an attempt to fix a bug, or improve performance.

The patch's core looks like it's addressing how the `auto_sel` flag is set within the `cppc_set_auto_sel` function call. The original code directly set `auto_sel` to `(cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1`. My initial thoughts are that if we are currently in "passive" mode the auto selection should be turned off, otherwise turned on.

The new logic introduces a conditional that checks if the state change is necessary. The change now calls `cppc_set_auto_sel` only when the previous value of `auto_sel` does not match the new target state. This is an improvement. The patch now checks if the new target state `(!auto_sel)` is the same as the previous state `((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)`. If the target and the previous states are the same, it returns early.

This is a well-considered optimization; this change removes redundant calls to `cppc_set_auto_sel`, which are likely expensive, and therefore will improve overall performance. Further research on the `cppc_set_auto_sel` function would be beneficial to assess its full impact.



4/2 2026/09/20 13:16 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 500,
  "LineCount": 60
}

Results:
{
  "Contents": " 500:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n 501:\t\tu64 numerator;\n 502:\t\tbool auto_sel;\n 503:\t\n 504:\t\tint ret = cppc_get_perf_caps(cpudata-\u003ecpu, \u0026cppc_perf);\n 505:\t\tif (ret)\n 506:\t\t\treturn ret;\n 507:\t\n 508:\t\tret = amd_get_boost_ratio_numerator(cpudata-\u003ecpu, \u0026numerator);\n 509:\t\tif (ret)\n 510:\t\t\treturn ret;\n 511:\t\n 512:\t\tperf.highest_perf = numerator;\n 513:\t\tperf.max_limit_perf = numerator;\n 514:\t\tperf.min_limit_perf = cppc_perf.lowest_perf;\n 515:\t\tperf.nominal_perf = cppc_perf.nominal_perf;\n 516:\t\tperf.lowest_nonlinear_perf = cppc_perf.lowest_nonlinear_perf;\n 517:\t\tperf.lowest_perf = cppc_perf.lowest_perf;\n 518:\t\tWRITE_ONCE(cpudata-\u003eperf, perf);\n 519:\t\tWRITE_ONCE(cpudata-\u003eprefcore_ranking, cppc_perf.highest_perf);\n 520:\t\n 521:\t\tret = cppc_get_auto_sel(cpudata-\u003ecpu, \u0026auto_sel);\n 522:\t\tif (ret) {\n 523:\t\t\tpr_warn(\"failed to get auto_sel, ret: %d\\n\", ret);\n 524:\t\t\treturn 0;\n 525:\t\t}\n 526:\t\n 527:\t\tif ((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)\n 528:\t\t\treturn 0;\n 529:\t\n 530:\t\tret = cppc_set_auto_sel(cpudata-\u003ecpu, !auto_sel);\n 531:\t\n 532:\t\tif (ret)\n 533:\t\t\tpr_warn(\"failed to set auto_sel, ret: %d\\n\", ret);\n 534:\t\n 535:\t\treturn ret;\n 536:\t}\n 537:\t\n 538:\tDEFINE_STATIC_CALL(amd_pstate_init_perf, msr_init_perf);\n 539:\t\n 540:\tstatic inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)\n 541:\t{\n 542:\t\treturn static_call(amd_pstate_init_perf)(cpudata);\n 543:\t}\n 544:\t\n 545:\tstatic int shmem_update_perf(struct cpufreq_policy *policy, u8 min_perf,\n 546:\t\t\t\t     u8 des_perf, u8 max_perf, u8 epp, bool fast_switch)\n 547:\t{\n 548:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n 549:\t\tstruct cppc_perf_ctrls perf_ctrls;\n 550:\t\tu64 value, prev;\n 551:\t\tint ret;\n 552:\t\n 553:\t\tif (cppc_state == AMD_PSTATE_ACTIVE) {\n 554:\t\t\tint ret = shmem_set_epp(policy, epp);\n 555:\t\n 556:\t\t\tif (ret)\n 557:\t\t\t\treturn ret;\n 558:\t\t}\n 559:\t\n"
}

5/2 2026/09/20 13:16 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 4676
							output: 56
							thoughts: 301
						

Thoughts:
**My Assessment of `amd-pstate` Reachability for Fuzzing**

Okay, let's break this down. My immediate concern is whether I can even *get* to `amd-pstate` within a typical QEMU or GCE fuzzing setup. I need to understand if the environment supports the required hardware or configurations. Specifically, `amd-pstate` is a frequency scaling driver for AMD processors, tied to `X86_AMD_PSTATE`. The question is, does standard QEMU or GCE *actually* emulate or support the AMD P-state hardware and the necessary ACPI CPPC tables for an AMD CPU?

Let's pause and reference Section 2 and Section 3 of that documentation. Ah, right. It mentions "structurally unreachable hardware" like vendor-specific PCIe switches, SmartNICs, GPU drivers (like `amdgpu`, etc.) that need physical ASIC or PCIe cards not simulated in QEMU. That's a red flag. The core principle here is *reachability*. Fuzzing is only effective if the code is actually *executable* in standard virtualized environments. If the code is structurally unreachable, as described in Section 2, it shouldn't be fuzzed, no matter if there are assertions or logic involved.

So, the next logical step is to dive deeper into the `amd-pstate` initialization. How is it initialized? Can I load it, trigger it, or otherwise make it active? I need to examine the `amd_pstate_init` or probe functions within `drivers/cpufreq/amd-pstate.c` to understand the setup and what's required for it to be active. This is crucial for determining if I can even include this area for fuzzing.



6/2 2026/09/20 13:17 tool grepper
0m Args:
{
  "Expression": "module_init|device_initcall|fs_initcall|subsys_initcall|amd_pstate",
  "PathPrefix": "drivers/cpufreq/amd-pstate.c"
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 870 lines.\nUse more precise expression if possible.\n\ndrivers/cpufreq/amd-pstate.c-62-\ndrivers/cpufreq/amd-pstate.c:63:static const char * const amd_pstate_mode_string[] = {\ndrivers/cpufreq/amd-pstate.c-64-\t[AMD_PSTATE_UNDEFINED]   = \"undefined\",\n--\ndrivers/cpufreq/amd-pstate.c-69-};\ndrivers/cpufreq/amd-pstate.c:70:static_assert(ARRAY_SIZE(amd_pstate_mode_string) == AMD_PSTATE_MAX);\ndrivers/cpufreq/amd-pstate.c-71-\ndrivers/cpufreq/amd-pstate.c:72:const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)\ndrivers/cpufreq/amd-pstate.c-73-{\n--\ndrivers/cpufreq/amd-pstate.c-75-\t\tmode = AMD_PSTATE_UNDEFINED;\ndrivers/cpufreq/amd-pstate.c:76:\treturn amd_pstate_mode_string[mode];\ndrivers/cpufreq/amd-pstate.c-77-}\ndrivers/cpufreq/amd-pstate.c:78:EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_get_mode_string);\ndrivers/cpufreq/amd-pstate.c-79-\n--\ndrivers/cpufreq/amd-pstate.c=85=static struct cpufreq_driver *current_pstate_driver;\ndrivers/cpufreq/amd-pstate.c:86:static struct cpufreq_driver amd_pstate_driver;\ndrivers/cpufreq/amd-pstate.c:87:static struct cpufreq_driver amd_pstate_epp_driver;\ndrivers/cpufreq/amd-pstate.c-88-static int cppc_state = AMD_PSTATE_UNDEFINED;\ndrivers/cpufreq/amd-pstate.c:89:static bool amd_pstate_prefcore = true;\ndrivers/cpufreq/amd-pstate.c-90-static struct quirk_entry *quirks;\n--\ndrivers/cpufreq/amd-pstate.c=161=static int __init dmi_matched_7k62_bios_bug(const struct dmi_system_id *dmi)\n--\ndrivers/cpufreq/amd-pstate.c-176-\ndrivers/cpufreq/amd-pstate.c:177:static const struct dmi_system_id amd_pstate_quirks_table[] __initconst = {\ndrivers/cpufreq/amd-pstate.c-178-\t{\n--\ndrivers/cpufreq/amd-pstate.c-188-};\ndrivers/cpufreq/amd-pstate.c:189:MODULE_DEVICE_TABLE(dmi, amd_pstate_quirks_table);\ndrivers/cpufreq/amd-pstate.c-190-\ndrivers/cpufreq/amd-pstate.c=191=static inline int get_mode_idx_from_str(const char *str, size_t size)\n--\ndrivers/cpufreq/amd-pstate.c-195-\tfor (i = 0; i \u003c AMD_PSTATE_MAX; i++) {\ndrivers/cpufreq/amd-pstate.c:196:\t\tif (!strncmp(str, amd_pstate_mode_string[i], size))\ndrivers/cpufreq/amd-pstate.c-197-\t\t\treturn i;\n--\ndrivers/cpufreq/amd-pstate.c-201-\ndrivers/cpufreq/amd-pstate.c:202:static DEFINE_MUTEX(amd_pstate_driver_lock);\ndrivers/cpufreq/amd-pstate.c-203-\ndrivers/cpufreq/amd-pstate.c=204=static int msr_get_epp(struct amd_cpudata *cpudata)\n--\ndrivers/cpufreq/amd-pstate.c-217-\ndrivers/cpufreq/amd-pstate.c:218:DEFINE_STATIC_CALL(amd_pstate_get_epp, msr_get_epp);\ndrivers/cpufreq/amd-pstate.c-219-\ndrivers/cpufreq/amd-pstate.c:220:static inline int amd_pstate_get_epp(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-221-{\ndrivers/cpufreq/amd-pstate.c:222:\treturn static_call(amd_pstate_get_epp)(cpudata);\ndrivers/cpufreq/amd-pstate.c-223-}\n--\ndrivers/cpufreq/amd-pstate.c=239=static int msr_update_perf(struct cpufreq_policy *policy, u8 min_perf,\n--\ndrivers/cpufreq/amd-pstate.c-251-\ndrivers/cpufreq/amd-pstate.c:252:\tif (trace_amd_pstate_epp_perf_enabled()) {\ndrivers/cpufreq/amd-pstate.c-253-\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\ndrivers/cpufreq/amd-pstate.c-254-\ndrivers/cpufreq/amd-pstate.c:255:\t\ttrace_call__amd_pstate_epp_perf(cpudata-\u003ecpu,\ndrivers/cpufreq/amd-pstate.c-256-\t\t\t\t\t  perf.highest_perf,\n--\ndrivers/cpufreq/amd-pstate.c-280-\ndrivers/cpufreq/amd-pstate.c:281:DEFINE_STATIC_CALL(amd_pstate_update_perf, msr_update_perf);\ndrivers/cpufreq/amd-pstate.c-282-\ndrivers/cpufreq/amd-pstate.c:283:static inline int amd_pstate_update_perf(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-284-\t\t\t\t\t  u8 min_perf, u8 des_perf,\n--\ndrivers/cpufreq/amd-pstate.c-287-{\ndrivers/cpufreq/amd-pstate.c:288:\treturn static_call(amd_pstate_update_perf)(policy, min_perf, des_perf,\ndrivers/cpufreq/amd-pstate.c-289-\t\t\t\t\t\t   max_perf, epp, fast_switch);\n--\ndrivers/cpufreq/amd-pstate.c=292=static int msr_set_epp(struct cpufreq_policy *policy, u8 epp)\n--\ndrivers/cpufreq/amd-pstate.c-300-\ndrivers/cpufreq/amd-pstate.c:301:\tif (trace_amd_pstate_epp_perf_enabled()) {\ndrivers/cpufreq/amd-pstate.c-302-\t\tunion perf_cached perf = cpudata-\u003eperf;\ndrivers/cpufreq/amd-pstate.c-303-\ndrivers/cpufreq/amd-pstate.c:304:\t\ttrace_call__amd_pstate_epp_perf(cpudata-\u003ecpu, perf.highest_perf,\ndrivers/cpufreq/amd-pstate.c-305-\t\t\t\t\t  epp,\n--\ndrivers/cpufreq/amd-pstate.c-328-\ndrivers/cpufreq/amd-pstate.c:329:DEFINE_STATIC_CALL(amd_pstate_set_epp, msr_set_epp);\ndrivers/cpufreq/amd-pstate.c-330-\ndrivers/cpufreq/amd-pstate.c:331:static inline int amd_pstate_set_epp(struct cpufreq_policy *policy, u8 epp)\ndrivers/cpufreq/amd-pstate.c-332-{\ndrivers/cpufreq/amd-pstate.c:333:\treturn static_call(amd_pstate_set_epp)(policy, epp);\ndrivers/cpufreq/amd-pstate.c-334-}\ndrivers/cpufreq/amd-pstate.c-335-\ndrivers/cpufreq/amd-pstate.c:336:static int amd_pstate_set_floor_perf(struct cpufreq_policy *policy, u8 perf)\ndrivers/cpufreq/amd-pstate.c-337-{\n--\ndrivers/cpufreq/amd-pstate.c-364-out_trace:\ndrivers/cpufreq/amd-pstate.c:365:\tif (trace_amd_pstate_cppc_req2_enabled())\ndrivers/cpufreq/amd-pstate.c:366:\t\ttrace_call__amd_pstate_cppc_req2(cpudata-\u003ecpu, perf, changed,\ndrivers/cpufreq/amd-pstate.c-367-\t\t\t\t\t\t ret);\n--\ndrivers/cpufreq/amd-pstate.c-370-\ndrivers/cpufreq/amd-pstate.c:371:static int amd_pstate_init_floor_perf(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-372-{\n--\ndrivers/cpufreq/amd-pstate.c-393-\t\tfloor_perf = cpudata-\u003eperf.nominal_perf;\ndrivers/cpufreq/amd-pstate.c:394:\t\tret = amd_pstate_set_floor_perf(policy, floor_perf);\ndrivers/cpufreq/amd-pstate.c-395-\t\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c=406=static int shmem_set_epp(struct cpufreq_policy *policy, u8 epp)\n--\ndrivers/cpufreq/amd-pstate.c-415-\tepp_cached = FIELD_GET(AMD_CPPC_EPP_PERF_MASK, cpudata-\u003ecppc_req_cached);\ndrivers/cpufreq/amd-pstate.c:416:\tif (trace_amd_pstate_epp_perf_enabled()) {\ndrivers/cpufreq/amd-pstate.c-417-\t\tunion perf_cached perf = cpudata-\u003eperf;\ndrivers/cpufreq/amd-pstate.c-418-\ndrivers/cpufreq/amd-pstate.c:419:\t\ttrace_call__amd_pstate_epp_perf(cpudata-\u003ecpu, perf.highest_perf,\ndrivers/cpufreq/amd-pstate.c-420-\t\t\t\t\t  epp,\n--\ndrivers/cpufreq/amd-pstate.c=451=static int shmem_cppc_enable(struct cpufreq_policy *policy)\n--\ndrivers/cpufreq/amd-pstate.c-455-\ndrivers/cpufreq/amd-pstate.c:456:DEFINE_STATIC_CALL(amd_pstate_cppc_enable, msr_cppc_enable);\ndrivers/cpufreq/amd-pstate.c-457-\ndrivers/cpufreq/amd-pstate.c:458:static inline int amd_pstate_cppc_enable(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-459-{\ndrivers/cpufreq/amd-pstate.c:460:\treturn static_call(amd_pstate_cppc_enable)(policy);\ndrivers/cpufreq/amd-pstate.c-461-}\n--\ndrivers/cpufreq/amd-pstate.c=497=static int shmem_init_perf(struct amd_cpudata *cpudata)\n--\ndrivers/cpufreq/amd-pstate.c-537-\ndrivers/cpufreq/amd-pstate.c:538:DEFINE_STATIC_CALL(amd_pstate_init_perf, msr_init_perf);\ndrivers/cpufreq/amd-pstate.c-539-\ndrivers/cpufreq/amd-pstate.c:540:static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-541-{\ndrivers/cpufreq/amd-pstate.c:542:\treturn static_call(amd_pstate_init_perf)(cpudata);\ndrivers/cpufreq/amd-pstate.c-543-}\n--\ndrivers/cpufreq/amd-pstate.c=545=static int shmem_update_perf(struct cpufreq_policy *policy, u8 min_perf,\n--\ndrivers/cpufreq/amd-pstate.c-566-\ndrivers/cpufreq/amd-pstate.c:567:\tif (trace_amd_pstate_epp_perf_enabled()) {\ndrivers/cpufreq/amd-pstate.c-568-\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\ndrivers/cpufreq/amd-pstate.c-569-\ndrivers/cpufreq/amd-pstate.c:570:\t\ttrace_call__amd_pstate_epp_perf(cpudata-\u003ecpu,\ndrivers/cpufreq/amd-pstate.c-571-\t\t\t\t\t  perf.highest_perf,\n--\ndrivers/cpufreq/amd-pstate.c-594-\ndrivers/cpufreq/amd-pstate.c:595:static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-596-{\n--\ndrivers/cpufreq/amd-pstate.c-627-\ndrivers/cpufreq/amd-pstate.c:628:static void amd_pstate_update(struct cpufreq_policy *policy, u8 min_perf,\ndrivers/cpufreq/amd-pstate.c-629-\t\t\t      u8 des_perf, u8 max_perf, bool fast_switch, int gov_flags)\n--\ndrivers/cpufreq/amd-pstate.c-646-\ndrivers/cpufreq/amd-pstate.c:647:\tif (trace_amd_pstate_perf_enabled() \u0026\u0026 amd_pstate_sample(cpudata)) {\ndrivers/cpufreq/amd-pstate.c:648:\t\ttrace_call__amd_pstate_perf(min_perf, des_perf, max_perf, cpudata-\u003efreq,\ndrivers/cpufreq/amd-pstate.c-649-\t\t\tcpudata-\u003ecur.mperf, cpudata-\u003ecur.aperf, cpudata-\u003ecur.tsc,\n--\ndrivers/cpufreq/amd-pstate.c-652-\ndrivers/cpufreq/amd-pstate.c:653:\tamd_pstate_update_perf(policy, min_perf, des_perf, max_perf, 0, fast_switch);\ndrivers/cpufreq/amd-pstate.c-654-}\ndrivers/cpufreq/amd-pstate.c-655-\ndrivers/cpufreq/amd-pstate.c:656:static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)\ndrivers/cpufreq/amd-pstate.c-657-{\n--\ndrivers/cpufreq/amd-pstate.c-686-\ndrivers/cpufreq/amd-pstate.c:687:static void amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-688-{\n--\ndrivers/cpufreq/amd-pstate.c-728-\ndrivers/cpufreq/amd-pstate.c:729:static int amd_pstate_update_freq(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-730-\t\t\t\t  unsigned int target_freq, bool fast_switch)\n--\ndrivers/cpufreq/amd-pstate.c-739-\tif (policy-\u003emin != cpudata-\u003emin_limit_freq || policy-\u003emax != cpudata-\u003emax_limit_freq)\ndrivers/cpufreq/amd-pstate.c:740:\t\tamd_pstate_update_min_max_limit(policy);\ndrivers/cpufreq/amd-pstate.c-741-\n--\ndrivers/cpufreq/amd-pstate.c-757-\ndrivers/cpufreq/amd-pstate.c:758:\tamd_pstate_update(policy, perf.min_limit_perf, des_perf,\ndrivers/cpufreq/amd-pstate.c-759-\t\t\t  perf.max_limit_perf, fast_switch,\n--\ndrivers/cpufreq/amd-pstate.c-767-\ndrivers/cpufreq/amd-pstate.c:768:static int amd_pstate_target(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-769-\t\t\t     unsigned int target_freq,\n--\ndrivers/cpufreq/amd-pstate.c-771-{\ndrivers/cpufreq/amd-pstate.c:772:\treturn amd_pstate_update_freq(policy, target_freq, false);\ndrivers/cpufreq/amd-pstate.c-773-}\ndrivers/cpufreq/amd-pstate.c-774-\ndrivers/cpufreq/amd-pstate.c:775:static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-776-\t\t\t\t  unsigned int target_freq)\ndrivers/cpufreq/amd-pstate.c-777-{\ndrivers/cpufreq/amd-pstate.c:778:\tif (!amd_pstate_update_freq(policy, target_freq, true))\ndrivers/cpufreq/amd-pstate.c-779-\t\treturn target_freq;\n--\ndrivers/cpufreq/amd-pstate.c-782-\ndrivers/cpufreq/amd-pstate.c:783:static void amd_pstate_adjust_perf(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-784-\t\t\t\t   unsigned long _min_perf,\n--\ndrivers/cpufreq/amd-pstate.c-798-\tif (policy-\u003emin != cpudata-\u003emin_limit_freq || policy-\u003emax != cpudata-\u003emax_limit_freq)\ndrivers/cpufreq/amd-pstate.c:799:\t\tamd_pstate_update_min_max_limit(policy);\ndrivers/cpufreq/amd-pstate.c-800-\n--\ndrivers/cpufreq/amd-pstate.c-819-\ndrivers/cpufreq/amd-pstate.c:820:\tamd_pstate_update(policy, min_perf, des_perf, max_perf, true,\ndrivers/cpufreq/amd-pstate.c-821-\t\t\tpolicy-\u003egovernor-\u003eflags);\n--\ndrivers/cpufreq/amd-pstate.c-823-\ndrivers/cpufreq/amd-pstate.c:824:static int amd_pstate_cpu_boost_update(struct cpufreq_policy *policy, bool on)\ndrivers/cpufreq/amd-pstate.c-825-{\n--\ndrivers/cpufreq/amd-pstate.c-845-\ndrivers/cpufreq/amd-pstate.c:846:static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)\ndrivers/cpufreq/amd-pstate.c-847-{\n--\ndrivers/cpufreq/amd-pstate.c-855-\ndrivers/cpufreq/amd-pstate.c:856:\tret = amd_pstate_cpu_boost_update(policy, state);\ndrivers/cpufreq/amd-pstate.c-857-\trefresh_frequency_limits(policy);\n--\ndrivers/cpufreq/amd-pstate.c-861-\ndrivers/cpufreq/amd-pstate.c:862:static int amd_pstate_init_boost_support(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-863-{\n--\ndrivers/cpufreq/amd-pstate.c=894=static void amd_perf_ctl_reset(unsigned int cpu)\n--\ndrivers/cpufreq/amd-pstate.c-900-\ndrivers/cpufreq/amd-pstate.c:901:static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-902-{\ndrivers/cpufreq/amd-pstate.c-903-\t/* user disabled or not detected */\ndrivers/cpufreq/amd-pstate.c:904:\tif (!amd_pstate_prefcore)\ndrivers/cpufreq/amd-pstate.c-905-\t\treturn;\n--\ndrivers/cpufreq/amd-pstate.c-909-\t    IS_ENABLED(CONFIG_AMD_HFI)) {\ndrivers/cpufreq/amd-pstate.c:910:\t\tamd_pstate_prefcore = false;\ndrivers/cpufreq/amd-pstate.c-911-\t\treturn;\n--\ndrivers/cpufreq/amd-pstate.c-919-\ndrivers/cpufreq/amd-pstate.c:920:static void amd_pstate_update_limits(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-921-{\n--\ndrivers/cpufreq/amd-pstate.c-926-\ndrivers/cpufreq/amd-pstate.c:927:\tif (!amd_pstate_prefcore)\ndrivers/cpufreq/amd-pstate.c-928-\t\treturn;\n--\ndrivers/cpufreq/amd-pstate.c-950- */\ndrivers/cpufreq/amd-pstate.c:951:static u32 amd_pstate_get_transition_delay_us(unsigned int cpu)\ndrivers/cpufreq/amd-pstate.c-952-{\n--\ndrivers/cpufreq/amd-pstate.c-969- */\ndrivers/cpufreq/amd-pstate.c:970:static u32 amd_pstate_get_transition_latency(unsigned int cpu)\ndrivers/cpufreq/amd-pstate.c-971-{\n--\ndrivers/cpufreq/amd-pstate.c-981-/*\ndrivers/cpufreq/amd-pstate.c:982: * amd_pstate_init_freq: Initialize the nominal_freq and lowest_nonlinear_freq\ndrivers/cpufreq/amd-pstate.c-983- *\t\t\t for the @cpudata object.\n--\ndrivers/cpufreq/amd-pstate.c-988- */\ndrivers/cpufreq/amd-pstate.c:989:static int amd_pstate_init_freq(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-990-{\n--\ndrivers/cpufreq/amd-pstate.c-1051-\ndrivers/cpufreq/amd-pstate.c:1052:static int amd_pstate_cpu_init(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-1053-{\n--\ndrivers/cpufreq/amd-pstate.c-1073-\ndrivers/cpufreq/amd-pstate.c:1074:\tret = amd_pstate_init_perf(cpudata);\ndrivers/cpufreq/amd-pstate.c-1075-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1077-\ndrivers/cpufreq/amd-pstate.c:1078:\tamd_pstate_init_prefcore(cpudata);\ndrivers/cpufreq/amd-pstate.c-1079-\ndrivers/cpufreq/amd-pstate.c:1080:\tret = amd_pstate_init_freq(cpudata);\ndrivers/cpufreq/amd-pstate.c-1081-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1083-\ndrivers/cpufreq/amd-pstate.c:1084:\tret = amd_pstate_init_boost_support(cpudata);\ndrivers/cpufreq/amd-pstate.c-1085-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1087-\ndrivers/cpufreq/amd-pstate.c:1088:\tpolicy-\u003ecpuinfo.transition_latency = amd_pstate_get_transition_latency(policy-\u003ecpu);\ndrivers/cpufreq/amd-pstate.c:1089:\tpolicy-\u003etransition_delay_us = amd_pstate_get_transition_delay_us(policy-\u003ecpu);\ndrivers/cpufreq/amd-pstate.c-1090-\n--\ndrivers/cpufreq/amd-pstate.c-1097-\tpolicy-\u003edriver_data = cpudata;\ndrivers/cpufreq/amd-pstate.c:1098:\tret = amd_pstate_cppc_enable(policy);\ndrivers/cpufreq/amd-pstate.c-1099-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1109-\ndrivers/cpufreq/amd-pstate.c:1110:\tret = amd_pstate_init_floor_perf(policy);\ndrivers/cpufreq/amd-pstate.c-1111-\tif (ret) {\n--\ndrivers/cpufreq/amd-pstate.c-1131-\tif (!current_pstate_driver-\u003eadjust_perf)\ndrivers/cpufreq/amd-pstate.c:1132:\t\tcurrent_pstate_driver-\u003eadjust_perf = amd_pstate_adjust_perf;\ndrivers/cpufreq/amd-pstate.c-1133-\n--\ndrivers/cpufreq/amd-pstate.c-1144-\ndrivers/cpufreq/amd-pstate.c:1145:static void amd_pstate_cpu_exit(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-1146-{\n--\ndrivers/cpufreq/amd-pstate.c-1150-\t/* Reset CPPC_REQ MSR to the BIOS value */\ndrivers/cpufreq/amd-pstate.c:1151:\tamd_pstate_update_perf(policy, perf.bios_min_perf, 0U, 0U, 0U, false);\ndrivers/cpufreq/amd-pstate.c:1152:\tamd_pstate_set_floor_perf(policy, cpudata-\u003ebios_floor_perf);\ndrivers/cpufreq/amd-pstate.c-1153-\n--\ndrivers/cpufreq/amd-pstate.c-1159-\ndrivers/cpufreq/amd-pstate.c:1160:static int amd_pstate_get_balanced_epp(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-1161-{\n--\ndrivers/cpufreq/amd-pstate.c-1169-\ndrivers/cpufreq/amd-pstate.c:1170:static int amd_pstate_power_supply_notifier(struct notifier_block *nb,\ndrivers/cpufreq/amd-pstate.c-1171-\t\t\t\t\t    unsigned long event, void *data)\n--\ndrivers/cpufreq/amd-pstate.c-1187-\ndrivers/cpufreq/amd-pstate.c:1188:\tepp = amd_pstate_get_balanced_epp(policy);\ndrivers/cpufreq/amd-pstate.c-1189-\ndrivers/cpufreq/amd-pstate.c:1190:\tret = amd_pstate_set_epp(policy, epp);\ndrivers/cpufreq/amd-pstate.c-1191-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1196-\ndrivers/cpufreq/amd-pstate.c:1197:static int amd_pstate_get_epp_from_platform_profile(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-1198-\t\t\t\t\t\t    enum platform_profile_option profile)\n--\ndrivers/cpufreq/amd-pstate.c-1203-\tcase PLATFORM_PROFILE_BALANCED:\ndrivers/cpufreq/amd-pstate.c:1204:\t\treturn amd_pstate_get_balanced_epp(policy);\ndrivers/cpufreq/amd-pstate.c-1205-\tcase PLATFORM_PROFILE_LOW_POWER:\n--\ndrivers/cpufreq/amd-pstate.c-1214-\ndrivers/cpufreq/amd-pstate.c:1215:static int amd_pstate_profile_probe(void *drvdata, unsigned long *choices)\ndrivers/cpufreq/amd-pstate.c-1216-{\n--\ndrivers/cpufreq/amd-pstate.c-1223-\ndrivers/cpufreq/amd-pstate.c:1224:static int amd_pstate_profile_get(struct device *dev,\ndrivers/cpufreq/amd-pstate.c-1225-\t\t\t\t  enum platform_profile_option *profile)\n--\ndrivers/cpufreq/amd-pstate.c-1233-\ndrivers/cpufreq/amd-pstate.c:1234:static int amd_pstate_profile_set(struct device *dev,\ndrivers/cpufreq/amd-pstate.c-1235-\t\t\t\t  enum platform_profile_option profile)\n--\ndrivers/cpufreq/amd-pstate.c-1244-\ndrivers/cpufreq/amd-pstate.c:1245:\tret = amd_pstate_get_epp_from_platform_profile(policy, profile);\ndrivers/cpufreq/amd-pstate.c-1246-\tif (ret \u003c 0)\n--\ndrivers/cpufreq/amd-pstate.c-1249-\tepp = (u8)ret;\ndrivers/cpufreq/amd-pstate.c:1250:\tret = amd_pstate_set_epp(policy, epp);\ndrivers/cpufreq/amd-pstate.c-1251-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1258-\ndrivers/cpufreq/amd-pstate.c:1259:static const struct platform_profile_ops amd_pstate_profile_ops = {\ndrivers/cpufreq/amd-pstate.c:1260:\t.probe = amd_pstate_profile_probe,\ndrivers/cpufreq/amd-pstate.c:1261:\t.profile_set = amd_pstate_profile_set,\ndrivers/cpufreq/amd-pstate.c:1262:\t.profile_get = amd_pstate_profile_get,\ndrivers/cpufreq/amd-pstate.c-1263-};\ndrivers/cpufreq/amd-pstate.c-1264-\ndrivers/cpufreq/amd-pstate.c:1265:void amd_pstate_clear_dynamic_epp(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-1266-{\n--\ndrivers/cpufreq/amd-pstate.c-1277-}\ndrivers/cpufreq/amd-pstate.c:1278:EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_clear_dynamic_epp);\ndrivers/cpufreq/amd-pstate.c-1279-\ndrivers/cpufreq/amd-pstate.c:1280:static int amd_pstate_set_dynamic_epp(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-1281-{\n--\ndrivers/cpufreq/amd-pstate.c-1286-\ndrivers/cpufreq/amd-pstate.c:1287:\tret = amd_pstate_get_epp_from_platform_profile(policy, cpudata-\u003ecurrent_profile);\ndrivers/cpufreq/amd-pstate.c-1288-\tif (ret \u003c 0)\n--\ndrivers/cpufreq/amd-pstate.c-1291-\tepp = (u8)ret;\ndrivers/cpufreq/amd-pstate.c:1292:\tret = amd_pstate_set_epp(policy, epp);\ndrivers/cpufreq/amd-pstate.c-1293-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1302-\t\t\t\t\t\t   policy-\u003edriver_data,\ndrivers/cpufreq/amd-pstate.c:1303:\t\t\t\t\t\t   \u0026amd_pstate_profile_ops);\ndrivers/cpufreq/amd-pstate.c-1304-\tif (IS_ERR(cpudata-\u003eppdev)) {\n--\ndrivers/cpufreq/amd-pstate.c-1310-\tif (cpudata-\u003eepp_default_ac != cpudata-\u003eepp_default_dc) {\ndrivers/cpufreq/amd-pstate.c:1311:\t\tcpudata-\u003epower_nb.notifier_call = amd_pstate_power_supply_notifier;\ndrivers/cpufreq/amd-pstate.c-1312-\t\tret = power_supply_reg_notifier(\u0026cpudata-\u003epower_nb);\n--\ndrivers/cpufreq/amd-pstate.c-1321-cleanup:\ndrivers/cpufreq/amd-pstate.c:1322:\tamd_pstate_clear_dynamic_epp(policy);\ndrivers/cpufreq/amd-pstate.c-1323-\n--\ndrivers/cpufreq/amd-pstate.c-1325-\t/* Restore previous EPP if toggling Dynamic EPP failed. */\ndrivers/cpufreq/amd-pstate.c:1326:\tamd_pstate_set_epp(policy, epp);\ndrivers/cpufreq/amd-pstate.c-1327-\treturn ret;\n--\ndrivers/cpufreq/amd-pstate.c-1336- */\ndrivers/cpufreq/amd-pstate.c:1337:static ssize_t show_amd_pstate_max_freq(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-1338-\t\t\t\t\tchar *buf)\n--\ndrivers/cpufreq/amd-pstate.c-1344-\ndrivers/cpufreq/amd-pstate.c:1345:static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-1346-\t\t\t\t\t\t     char *buf)\n--\ndrivers/cpufreq/amd-pstate.c-1361- */\ndrivers/cpufreq/amd-pstate.c:1362:static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-1363-\t\t\t\t\t    char *buf)\n--\ndrivers/cpufreq/amd-pstate.c-1371-\ndrivers/cpufreq/amd-pstate.c:1372:static ssize_t show_amd_pstate_prefcore_ranking(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-1373-\t\t\t\t\t\tchar *buf)\n--\ndrivers/cpufreq/amd-pstate.c-1382-\ndrivers/cpufreq/amd-pstate.c:1383:static ssize_t show_amd_pstate_hw_prefcore(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-1384-\t\t\t\t\t   char *buf)\n--\ndrivers/cpufreq/amd-pstate.c=1412=ssize_t store_energy_performance_preference(struct cpufreq_policy *policy,\n--\ndrivers/cpufreq/amd-pstate.c-1441-\t\t\tcpudata-\u003ecurrent_profile = PLATFORM_PROFILE_BALANCED;\ndrivers/cpufreq/amd-pstate.c:1442:\t\t\tret = amd_pstate_set_dynamic_epp(policy);\ndrivers/cpufreq/amd-pstate.c-1443-\t\t\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1464-\tif (cpudata-\u003edynamic_epp)\ndrivers/cpufreq/amd-pstate.c:1465:\t\tamd_pstate_clear_dynamic_epp(policy);\ndrivers/cpufreq/amd-pstate.c-1466-\ndrivers/cpufreq/amd-pstate.c:1467:\tret = amd_pstate_set_epp(policy, epp);\ndrivers/cpufreq/amd-pstate.c-1468-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c=1509=EXPORT_SYMBOL_FOR_PSTATE_UT(show_energy_performance_preference);\ndrivers/cpufreq/amd-pstate.c-1510-\ndrivers/cpufreq/amd-pstate.c:1511:ssize_t store_amd_pstate_floor_freq(struct cpufreq_policy *policy, const char *buf, size_t count)\ndrivers/cpufreq/amd-pstate.c-1512-{\n--\ndrivers/cpufreq/amd-pstate.c-1526-\tfloor_perf = freq_to_perf(perf, cpudata-\u003enominal_freq, freq);\ndrivers/cpufreq/amd-pstate.c:1527:\tret = amd_pstate_set_floor_perf(policy, floor_perf);\ndrivers/cpufreq/amd-pstate.c-1528-\n--\ndrivers/cpufreq/amd-pstate.c-1533-}\ndrivers/cpufreq/amd-pstate.c:1534:EXPORT_SYMBOL_FOR_PSTATE_UT(store_amd_pstate_floor_freq);\ndrivers/cpufreq/amd-pstate.c-1535-\ndrivers/cpufreq/amd-pstate.c:1536:ssize_t show_amd_pstate_floor_freq(struct cpufreq_policy *policy, char *buf)\ndrivers/cpufreq/amd-pstate.c-1537-{\n--\ndrivers/cpufreq/amd-pstate.c-1541-}\ndrivers/cpufreq/amd-pstate.c:1542:EXPORT_SYMBOL_FOR_PSTATE_UT(show_amd_pstate_floor_freq);\ndrivers/cpufreq/amd-pstate.c-1543-\ndrivers/cpufreq/amd-pstate.c:1544:static ssize_t show_amd_pstate_floor_count(struct cpufreq_policy *policy, char *buf)\ndrivers/cpufreq/amd-pstate.c-1545-{\n--\ndrivers/cpufreq/amd-pstate.c-1551-\ndrivers/cpufreq/amd-pstate.c:1552:cpufreq_freq_attr_ro(amd_pstate_max_freq);\ndrivers/cpufreq/amd-pstate.c:1553:cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq);\ndrivers/cpufreq/amd-pstate.c-1554-\ndrivers/cpufreq/amd-pstate.c:1555:cpufreq_freq_attr_ro(amd_pstate_highest_perf);\ndrivers/cpufreq/amd-pstate.c:1556:cpufreq_freq_attr_ro(amd_pstate_prefcore_ranking);\ndrivers/cpufreq/amd-pstate.c:1557:cpufreq_freq_attr_ro(amd_pstate_hw_prefcore);\ndrivers/cpufreq/amd-pstate.c-1558-cpufreq_freq_attr_rw(energy_performance_preference);\ndrivers/cpufreq/amd-pstate.c=1559=cpufreq_freq_attr_ro(energy_performance_available_preferences);\ndrivers/cpufreq/amd-pstate.c:1560:cpufreq_freq_attr_rw(amd_pstate_floor_freq);\ndrivers/cpufreq/amd-pstate.c:1561:cpufreq_freq_attr_ro(amd_pstate_floor_count);\ndrivers/cpufreq/amd-pstate.c-1562-\n--\ndrivers/cpufreq/amd-pstate.c=1575=static bool prefcore_visibility(void)\ndrivers/cpufreq/amd-pstate.c-1576-{\ndrivers/cpufreq/amd-pstate.c:1577:\treturn amd_pstate_prefcore;\ndrivers/cpufreq/amd-pstate.c-1578-}\n--\ndrivers/cpufreq/amd-pstate.c=1581=static bool epp_visibility(void)\n--\ndrivers/cpufreq/amd-pstate.c-1585-\ndrivers/cpufreq/amd-pstate.c:1586:/* Determines whether amd_pstate_floor_freq related attributes should be visible */\ndrivers/cpufreq/amd-pstate.c-1587-static bool floor_freq_visibility(void)\n--\ndrivers/cpufreq/amd-pstate.c-1591-\ndrivers/cpufreq/amd-pstate.c:1592:static struct freq_attr_visibility amd_pstate_attr_visibility[] = {\ndrivers/cpufreq/amd-pstate.c:1593:\t{\u0026amd_pstate_max_freq, always_visible},\ndrivers/cpufreq/amd-pstate.c:1594:\t{\u0026amd_pstate_lowest_nonlinear_freq, always_visible},\ndrivers/cpufreq/amd-pstate.c:1595:\t{\u0026amd_pstate_highest_perf, always_visible},\ndrivers/cpufreq/amd-pstate.c:1596:\t{\u0026amd_pstate_prefcore_ranking, prefcore_visibility},\ndrivers/cpufreq/amd-pstate.c:1597:\t{\u0026amd_pstate_hw_prefcore, prefcore_visibility},\ndrivers/cpufreq/amd-pstate.c-1598-\t{\u0026energy_performance_preference, epp_visibility},\ndrivers/cpufreq/amd-pstate.c-1599-\t{\u0026energy_performance_available_preferences, epp_visibility},\ndrivers/cpufreq/amd-pstate.c:1600:\t{\u0026amd_pstate_floor_freq, floor_freq_visibility},\ndrivers/cpufreq/amd-pstate.c:1601:\t{\u0026amd_pstate_floor_count, floor_freq_visibility},\ndrivers/cpufreq/amd-pstate.c-1602-};\ndrivers/cpufreq/amd-pstate.c-1603-\ndrivers/cpufreq/amd-pstate.c:1604:struct freq_attr **amd_pstate_get_current_attrs(void)\ndrivers/cpufreq/amd-pstate.c-1605-{\n--\ndrivers/cpufreq/amd-pstate.c-1609-}\ndrivers/cpufreq/amd-pstate.c:1610:EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_get_current_attrs);\ndrivers/cpufreq/amd-pstate.c-1611-\ndrivers/cpufreq/amd-pstate.c=1612=static struct freq_attr **get_freq_attrs(void)\ndrivers/cpufreq/amd-pstate.c-1613-{\ndrivers/cpufreq/amd-pstate.c:1614:\tbool attr_visible[ARRAY_SIZE(amd_pstate_attr_visibility)];\ndrivers/cpufreq/amd-pstate.c-1615-\tstruct freq_attr **attrs;\n--\ndrivers/cpufreq/amd-pstate.c-1617-\ndrivers/cpufreq/amd-pstate.c:1618:\tfor (i = 0, count = 0; i \u003c ARRAY_SIZE(amd_pstate_attr_visibility); i++) {\ndrivers/cpufreq/amd-pstate.c:1619:\t\tstruct freq_attr_visibility *v = \u0026amd_pstate_attr_visibility[i];\ndrivers/cpufreq/amd-pstate.c-1620-\n--\ndrivers/cpufreq/amd-pstate.c-1625-\ndrivers/cpufreq/amd-pstate.c:1626:\t/* amd_pstate_{max_freq, lowest_nonlinear_freq, highest_perf} should always be visible */\ndrivers/cpufreq/amd-pstate.c-1627-\tBUG_ON(!count);\n--\ndrivers/cpufreq/amd-pstate.c-1632-\ndrivers/cpufreq/amd-pstate.c:1633:\tfor (i = 0, j = 0; i \u003c ARRAY_SIZE(amd_pstate_attr_visibility); i++) {\ndrivers/cpufreq/amd-pstate.c-1634-\t\tif (!attr_visible[i])\n--\ndrivers/cpufreq/amd-pstate.c-1636-\ndrivers/cpufreq/amd-pstate.c:1637:\t\tattrs[j++] = amd_pstate_attr_visibility[i].attr;\ndrivers/cpufreq/amd-pstate.c-1638-\t}\n--\n\n"
}

7/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 17217
							output: 42
							thoughts: 28
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Diving into AMD P-State Initialization**

Okay, so I need to understand how the AMD P-State driver is getting its hooks into the system. My first instinct is always to check the `amd-pstate.c` file, specifically around where the driver's initialization occurs. I'm thinking the `module_init` macro is the obvious place to start, or perhaps it's using a `device_initcall`. That'll tell me what's loaded up during the driver load or device probe. I need to figure out exactly when and how the core functionalities are established. That likely will be the entry point to understanding how everything is put together. Knowing the initialization sequence is fundamental.



8/2 2026/09/20 13:17 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 1850,
  "LineCount": 100
}

Results:
{
  "Contents": "1850:\t};\n1851:\t\n1852:\tstatic const struct attribute_group amd_pstate_global_attr_group = {\n1853:\t\t.name = \"amd_pstate\",\n1854:\t\t.attrs = pstate_global_attributes,\n1855:\t};\n1856:\t\n1857:\tstatic bool amd_pstate_acpi_pm_profile_server(void)\n1858:\t{\n1859:\t\tswitch (acpi_gbl_FADT.preferred_profile) {\n1860:\t\tcase PM_ENTERPRISE_SERVER:\n1861:\t\tcase PM_SOHO_SERVER:\n1862:\t\tcase PM_PERFORMANCE_SERVER:\n1863:\t\t\treturn true;\n1864:\t\t}\n1865:\t\treturn false;\n1866:\t}\n1867:\t\n1868:\tstatic bool amd_pstate_acpi_pm_profile_undefined(void)\n1869:\t{\n1870:\t\tif (acpi_gbl_FADT.preferred_profile == PM_UNSPECIFIED)\n1871:\t\t\treturn true;\n1872:\t\tif (acpi_gbl_FADT.preferred_profile \u003e= NR_PM_PROFILES)\n1873:\t\t\treturn true;\n1874:\t\treturn false;\n1875:\t}\n1876:\t\n1877:\tstatic int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)\n1878:\t{\n1879:\t\tstruct amd_cpudata *cpudata;\n1880:\t\tunion perf_cached perf;\n1881:\t\tstruct device *dev;\n1882:\t\tint default_epp;\n1883:\t\tint ret;\n1884:\t\n1885:\t\t/*\n1886:\t\t * Resetting PERF_CTL_MSR will put the CPU in P0 frequency,\n1887:\t\t * which is ideal for initialization process.\n1888:\t\t */\n1889:\t\tamd_perf_ctl_reset(policy-\u003ecpu);\n1890:\t\tdev = get_cpu_device(policy-\u003ecpu);\n1891:\t\tif (!dev)\n1892:\t\t\treturn -ENODEV;\n1893:\t\n1894:\t\tcpudata = kzalloc_obj(*cpudata);\n1895:\t\tif (!cpudata)\n1896:\t\t\treturn -ENOMEM;\n1897:\t\n1898:\t\tcpudata-\u003ecpu = policy-\u003ecpu;\n1899:\t\n1900:\t\tret = amd_pstate_init_perf(cpudata);\n1901:\t\tif (ret)\n1902:\t\t\tgoto free_cpudata1;\n1903:\t\n1904:\t\tamd_pstate_init_prefcore(cpudata);\n1905:\t\n1906:\t\tret = amd_pstate_init_freq(cpudata);\n1907:\t\tif (ret)\n1908:\t\t\tgoto free_cpudata1;\n1909:\t\n1910:\t\tret = amd_pstate_init_boost_support(cpudata);\n1911:\t\tif (ret)\n1912:\t\t\tgoto free_cpudata1;\n1913:\t\n1914:\t\tperf = READ_ONCE(cpudata-\u003eperf);\n1915:\t\n1916:\t\tpolicy-\u003ecpuinfo.min_freq = perf_to_freq(perf, cpudata-\u003enominal_freq,\n1917:\t\t\t\t\t\t\tperf.lowest_perf);\n1918:\t\tpolicy-\u003ecpuinfo.max_freq = cpudata-\u003emax_freq;\n1919:\t\tpolicy-\u003edriver_data = cpudata;\n1920:\t\n1921:\t\tret = amd_pstate_cppc_enable(policy);\n1922:\t\tif (ret)\n1923:\t\t\tgoto free_cpudata1;\n1924:\t\n1925:\t\t/* It will be updated by governor */\n1926:\t\tpolicy-\u003ecur = policy-\u003ecpuinfo.min_freq;\n1927:\t\n1928:\t\n1929:\t\tpolicy-\u003eboost_supported = READ_ONCE(cpudata-\u003eboost_supported);\n1930:\t\n1931:\t\t/* Cache the firmware programmed EPP */\n1932:\t\tdefault_epp = amd_pstate_get_epp(cpudata);\n1933:\t\tif (default_epp \u003c 0) {\n1934:\t\t\tret = default_epp;\n1935:\t\t\tgoto free_cpudata1;\n1936:\t\t}\n1937:\t\tFIELD_MODIFY(AMD_CPPC_EPP_PERF_MASK, \u0026cpudata-\u003ecppc_req_cached, default_epp);\n1938:\t\n1939:\t\t/*\n1940:\t\t * Set the policy to provide a valid fallback value in case\n1941:\t\t * the default cpufreq governor is neither powersave nor performance.\n1942:\t\t */\n1943:\t\tif (amd_pstate_acpi_pm_profile_server() ||\n1944:\t\t    amd_pstate_acpi_pm_profile_undefined()) {\n1945:\t\t\tpolicy-\u003epolicy = CPUFREQ_POLICY_PERFORMANCE;\n1946:\t\t\tcpudata-\u003eepp_default_ac = cpudata-\u003eepp_default_dc = default_epp;\n1947:\t\t\tcpudata-\u003ecurrent_profile = PLATFORM_PROFILE_PERFORMANCE;\n1948:\t\t} else {\n1949:\t\t\tpolicy-\u003epolicy = CPUFREQ_POLICY_POWERSAVE;\n"
}

9/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 18953
							output: 42
							thoughts: 22
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Analyzing File Structure for Potential Issue Location**

Okay, so I need to zero in on a specific region within this file. Given my expertise, I suspect the issue I'm tracking might be located around line 1950 to 2050. That range often indicates a segment relating to a specific function or configuration that I'm interested in. I'm going to quickly jump to that section to perform my preliminary analysis. This initial skim will either confirm my suspicion or help me refine my search parameters, perhaps leading me to adjacent code blocks. I'm expecting to find either a clear cause or at least some meaningful clues.



10/2 2026/09/20 13:17 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 1950,
  "LineCount": 100
}

Results:
{
  "Contents": "1950:\t\t\tcpudata-\u003eepp_default_ac = AMD_CPPC_EPP_PERFORMANCE;\n1951:\t\t\tcpudata-\u003eepp_default_dc = AMD_CPPC_EPP_BALANCE_PERFORMANCE;\n1952:\t\t\tcpudata-\u003ecurrent_profile = PLATFORM_PROFILE_BALANCED;\n1953:\t\t}\n1954:\t\n1955:\t\tret = amd_pstate_set_epp(policy, cpudata-\u003eepp_default_dc);\n1956:\t\tif (ret)\n1957:\t\t\tgoto free_cpudata1;\n1958:\t\n1959:\t\tret = amd_pstate_init_floor_perf(policy);\n1960:\t\tif (ret) {\n1961:\t\t\tdev_err(dev, \"Failed to initialize Floor Perf (%d)\\n\", ret);\n1962:\t\t\tgoto free_cpudata1;\n1963:\t\t}\n1964:\t\n1965:\t\tcurrent_pstate_driver-\u003eadjust_perf = NULL;\n1966:\t\n1967:\t\treturn 0;\n1968:\t\n1969:\tfree_cpudata1:\n1970:\t\tpr_warn(\"Failed to initialize CPU %d: %d\\n\", policy-\u003ecpu, ret);\n1971:\t\tkfree(cpudata);\n1972:\t\tpolicy-\u003edriver_data = NULL;\n1973:\t\treturn ret;\n1974:\t}\n1975:\t\n1976:\tstatic void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)\n1977:\t{\n1978:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n1979:\t\n1980:\t\tif (cpudata) {\n1981:\t\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n1982:\t\n1983:\t\t\tif (cpudata-\u003edynamic_epp)\n1984:\t\t\t\tamd_pstate_clear_dynamic_epp(policy);\n1985:\t\n1986:\t\t\t/* Reset CPPC_REQ MSR to the BIOS value */\n1987:\t\t\tamd_pstate_update_perf(policy, perf.bios_min_perf, 0U, 0U, 0U, false);\n1988:\t\t\tamd_pstate_set_floor_perf(policy, cpudata-\u003ebios_floor_perf);\n1989:\t\n1990:\t\t\tkfree(cpudata);\n1991:\t\t\tpolicy-\u003edriver_data = NULL;\n1992:\t\t}\n1993:\t\n1994:\t\tpr_debug(\"CPU %d exiting\\n\", policy-\u003ecpu);\n1995:\t}\n1996:\t\n1997:\tstatic int amd_pstate_epp_update_limit(struct cpufreq_policy *policy, bool policy_change)\n1998:\t{\n1999:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2000:\t\tunion perf_cached perf;\n2001:\t\tu8 epp;\n2002:\t\n2003:\t\tif (policy_change ||\n2004:\t\t    policy-\u003emin != cpudata-\u003emin_limit_freq ||\n2005:\t\t    policy-\u003emax != cpudata-\u003emax_limit_freq)\n2006:\t\t\tamd_pstate_update_min_max_limit(policy);\n2007:\t\n2008:\t\tif (cpudata-\u003epolicy == CPUFREQ_POLICY_PERFORMANCE)\n2009:\t\t\tepp = 0;\n2010:\t\telse\n2011:\t\t\tepp = FIELD_GET(AMD_CPPC_EPP_PERF_MASK, cpudata-\u003ecppc_req_cached);\n2012:\t\n2013:\t\tperf = READ_ONCE(cpudata-\u003eperf);\n2014:\t\n2015:\t\treturn amd_pstate_update_perf(policy, perf.min_limit_perf, 0U,\n2016:\t\t\t\t\t      perf.max_limit_perf, epp, false);\n2017:\t}\n2018:\t\n2019:\tstatic int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)\n2020:\t{\n2021:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2022:\t\tint ret;\n2023:\t\n2024:\t\tif (!policy-\u003ecpuinfo.max_freq)\n2025:\t\t\treturn -ENODEV;\n2026:\t\n2027:\t\t/* Must be a switch between PERFORMANCE and POWERSAVE */\n2028:\t\tif (cpudata-\u003epolicy != policy-\u003epolicy) {\n2029:\t\t\t/*\n2030:\t\t\t * Disable dynamic_epp when switching\n2031:\t\t\t * out of CPUFREQ_POLICY_POWERSAVE.\n2032:\t\t\t */\n2033:\t\t\tif (cpudata-\u003edynamic_epp) {\n2034:\t\t\t\tWARN_ON_ONCE(cpudata-\u003epolicy != CPUFREQ_POLICY_POWERSAVE);\n2035:\t\t\t\tamd_pstate_clear_dynamic_epp(policy);\n2036:\t\t\t}\n2037:\t\t}\n2038:\t\n2039:\t\tcpudata-\u003epolicy = policy-\u003epolicy;\n2040:\t\n2041:\t\tret = amd_pstate_epp_update_limit(policy, true);\n2042:\t\tif (ret)\n2043:\t\t\treturn ret;\n2044:\t\n2045:\t\t/*\n2046:\t\t * policy-\u003ecur is never updated with the amd_pstate_epp driver, but it\n2047:\t\t * is used as a stale frequency value. So, keep it within limits.\n2048:\t\t */\n2049:\t\tpolicy-\u003ecur = policy-\u003emin;\n"
}

11/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 20738
							output: 42
							thoughts: 11
						

Thoughts:
Okay, let's dive in. Here's my take on those initial thoughts, framed as my own:

**Initial Assessment of the Driver Registration and Initialization**

Alright, time to get my hands dirty. My immediate thought is, "Let's crack open the code and see how this driver is being registered and initialized." I want to understand the foundational setup. Specifically, I'm thinking about how the system hooks into the kernel, what registration mechanisms are being employed (are we talking static registration, a module interface, or something more dynamic?), and how the driver's core structures are being populated. I'm keen to trace the execution path from the point where the driver is loaded or started right through to its readiness to interact with the hardware. Initialization is key here; I want to understand what the driver does to get ready, allocate any resources it needs, and establish its operational state. I'm looking for potential areas of concern for concurrency, memory management, and overall robustness. This initial step sets the stage for everything else.



12/2 2026/09/20 13:17 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 2050,
  "LineCount": 100
}

Results:
{
  "Contents": "2050:\t\n2051:\t\treturn 0;\n2052:\t}\n2053:\t\n2054:\tstatic int amd_pstate_cpu_online(struct cpufreq_policy *policy)\n2055:\t{\n2056:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2057:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2058:\t\tu8 cached_floor_perf;\n2059:\t\tint ret;\n2060:\t\n2061:\t\tret = amd_pstate_cppc_enable(policy);\n2062:\t\tif (ret)\n2063:\t\t\treturn ret;\n2064:\t\n2065:\t\tcached_floor_perf = freq_to_perf(perf, cpudata-\u003enominal_freq, cpudata-\u003efloor_freq);\n2066:\t\treturn amd_pstate_set_floor_perf(policy, cached_floor_perf);\n2067:\t}\n2068:\t\n2069:\tstatic int amd_pstate_cpu_offline(struct cpufreq_policy *policy)\n2070:\t{\n2071:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2072:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2073:\t\tint ret;\n2074:\t\n2075:\t\t/*\n2076:\t\t * Reset CPPC_REQ MSR to the BIOS value, this will allow us to retain the BIOS specified\n2077:\t\t * min_perf value across kexec reboots. If this CPU is just onlined normally after this, the\n2078:\t\t * limits, epp and desired perf will get reset to the cached values in cpudata struct\n2079:\t\t */\n2080:\t\tret = amd_pstate_update_perf(policy, perf.bios_min_perf,\n2081:\t\t\t\t\t     FIELD_GET(AMD_CPPC_DES_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2082:\t\t\t\t\t     FIELD_GET(AMD_CPPC_MAX_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2083:\t\t\t\t\t     FIELD_GET(AMD_CPPC_EPP_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2084:\t\t\t\t\t     false);\n2085:\t\tif (ret)\n2086:\t\t\treturn ret;\n2087:\t\n2088:\t\treturn amd_pstate_set_floor_perf(policy, cpudata-\u003ebios_floor_perf);\n2089:\t}\n2090:\t\n2091:\tstatic int amd_pstate_suspend(struct cpufreq_policy *policy)\n2092:\t{\n2093:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2094:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2095:\t\tint ret;\n2096:\t\n2097:\t\t/*\n2098:\t\t * Reset CPPC_REQ MSR to the BIOS value, this will allow us to retain the BIOS specified\n2099:\t\t * min_perf value across kexec reboots. If this CPU is just resumed back without kexec,\n2100:\t\t * the limits, epp and desired perf will get reset to the cached values in cpudata struct\n2101:\t\t */\n2102:\t\tret = amd_pstate_update_perf(policy, perf.bios_min_perf,\n2103:\t\t\t\t\t     FIELD_GET(AMD_CPPC_DES_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2104:\t\t\t\t\t     FIELD_GET(AMD_CPPC_MAX_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2105:\t\t\t\t\t     FIELD_GET(AMD_CPPC_EPP_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2106:\t\t\t\t\t     false);\n2107:\t\tif (ret)\n2108:\t\t\treturn ret;\n2109:\t\n2110:\t\tret = amd_pstate_set_floor_perf(policy, cpudata-\u003ebios_floor_perf);\n2111:\t\tif (ret)\n2112:\t\t\treturn ret;\n2113:\t\n2114:\t\t/* set this flag to avoid setting core offline*/\n2115:\t\tcpudata-\u003esuspended = true;\n2116:\t\n2117:\t\treturn 0;\n2118:\t}\n2119:\t\n2120:\tstatic int amd_pstate_resume(struct cpufreq_policy *policy)\n2121:\t{\n2122:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2123:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2124:\t\tint cur_perf = freq_to_perf(perf, cpudata-\u003enominal_freq, policy-\u003ecur);\n2125:\t\tu8 cached_floor_perf;\n2126:\t\tint ret;\n2127:\t\n2128:\t\t/* Set CPPC_REQ to last sane value until the governor updates it */\n2129:\t\tret = amd_pstate_update_perf(policy, perf.min_limit_perf, cur_perf, perf.max_limit_perf,\n2130:\t\t\t\t\t     0U, false);\n2131:\t\tif (ret)\n2132:\t\t\treturn ret;\n2133:\t\n2134:\t\tcached_floor_perf = freq_to_perf(perf, cpudata-\u003enominal_freq, cpudata-\u003efloor_freq);\n2135:\t\treturn amd_pstate_set_floor_perf(policy, cached_floor_perf);\n2136:\t}\n2137:\t\n2138:\tstatic int amd_pstate_epp_resume(struct cpufreq_policy *policy)\n2139:\t{\n2140:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2141:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2142:\t\tu8 cached_floor_perf;\n2143:\t\n2144:\t\tif (cpudata-\u003esuspended) {\n2145:\t\t\tint ret;\n2146:\t\n2147:\t\t\t/* enable amd pstate from suspend state*/\n2148:\t\t\tret = amd_pstate_epp_update_limit(policy, false);\n2149:\t\t\tif (ret)\n"
}

13/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 22731
							output: 42
							thoughts: 22
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience and written in the first person:

**Navigating the AMD pstate Initialization Sequence**

Okay, let's dive into this `amd_pstate` code. I'm specifically interested in how the initialization sequence unfolds, the core of how this driver gets off the ground. My immediate goal is to locate where the `amd_pstate_init` function, or, for that matter, any module initialization function, is defined. That's the logical starting point for understanding the overall control flow. From there I'll be able to better understand what this driver is doing.



14/2 2026/09/20 13:17 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 2200,
  "LineCount": 100
}

Results:
{
  "Contents": "2200:\t\tif (!cpu_feature_enabled(X86_FEATURE_HW_PSTATE)) {\n2201:\t\t\tpr_debug_once(\"frequency scaling is not supported by the processor\\n\");\n2202:\t\t\treturn false;\n2203:\t\t}\n2204:\t\n2205:\t\tif ((boot_cpu_data.x86 == 0x17) \u0026\u0026 (boot_cpu_data.x86_model \u003c 0x30)) {\n2206:\t\t\tpr_debug_once(\"CPPC feature is not supported by the processor\\n\");\n2207:\t\t\treturn false;\n2208:\t\t}\n2209:\t\n2210:\t\t/*\n2211:\t\t * If the CPPC feature is disabled in the BIOS for processors\n2212:\t\t * that support MSR-based CPPC, the AMD Pstate driver may not\n2213:\t\t * function correctly.\n2214:\t\t *\n2215:\t\t * For such processors, check the CPPC flag and display a\n2216:\t\t * warning message if the platform supports CPPC.\n2217:\t\t *\n2218:\t\t * Note: The code check below will not abort the driver\n2219:\t\t * registration process because of the code is added for\n2220:\t\t * debugging purposes. Besides, it may still be possible for\n2221:\t\t * the driver to work using the shared-memory mechanism.\n2222:\t\t */\n2223:\t\tif (!cpu_feature_enabled(X86_FEATURE_CPPC)) {\n2224:\t\t\tif (cpu_feature_enabled(X86_FEATURE_ZEN2)) {\n2225:\t\t\t\tswitch (c-\u003ex86_model) {\n2226:\t\t\t\tcase 0x60 ... 0x6F:\n2227:\t\t\t\tcase 0x80 ... 0xAF:\n2228:\t\t\t\t\twarn = true;\n2229:\t\t\t\t\tbreak;\n2230:\t\t\t\t}\n2231:\t\t\t} else if (cpu_feature_enabled(X86_FEATURE_ZEN3) ||\n2232:\t\t\t\t   cpu_feature_enabled(X86_FEATURE_ZEN4)) {\n2233:\t\t\t\tswitch (c-\u003ex86_model) {\n2234:\t\t\t\tcase 0x10 ... 0x1F:\n2235:\t\t\t\tcase 0x40 ... 0xAF:\n2236:\t\t\t\t\twarn = true;\n2237:\t\t\t\t\tbreak;\n2238:\t\t\t\t}\n2239:\t\t\t} else if (cpu_feature_enabled(X86_FEATURE_ZEN5)) {\n2240:\t\t\t\twarn = true;\n2241:\t\t\t}\n2242:\t\t}\n2243:\t\n2244:\t\tif (warn)\n2245:\t\t\tpr_warn_once(\"The CPPC feature is supported but currently disabled by the BIOS.\\n\"\n2246:\t\t\t\t\t\t\"Please enable it if your BIOS has the CPPC option.\\n\");\n2247:\t\treturn true;\n2248:\t}\n2249:\t\n2250:\tstatic int __init amd_pstate_init(void)\n2251:\t{\n2252:\t\tstruct device *dev_root;\n2253:\t\tint ret;\n2254:\t\n2255:\t\tif (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)\n2256:\t\t\treturn -ENODEV;\n2257:\t\n2258:\t\t/* show debug message only if CPPC is not supported */\n2259:\t\tif (!amd_cppc_supported())\n2260:\t\t\treturn -EOPNOTSUPP;\n2261:\t\n2262:\t\t/* show warning message when BIOS broken or ACPI disabled */\n2263:\t\tif (!acpi_cpc_valid()) {\n2264:\t\t\tpr_warn_once(\"the _CPC object is not present in SBIOS or ACPI disabled\\n\");\n2265:\t\t\treturn -ENODEV;\n2266:\t\t}\n2267:\t\n2268:\t\t/* don't keep reloading if cpufreq_driver exists */\n2269:\t\tif (cpufreq_get_current_driver())\n2270:\t\t\treturn -EEXIST;\n2271:\t\n2272:\t\tquirks = NULL;\n2273:\t\n2274:\t\t/* check if this machine need CPPC quirks */\n2275:\t\tdmi_check_system(amd_pstate_quirks_table);\n2276:\t\n2277:\t\t/*\n2278:\t\t* determine the driver mode from the command line or kernel config.\n2279:\t\t* If no command line input is provided, cppc_state will be AMD_PSTATE_UNDEFINED.\n2280:\t\t* command line options will override the kernel config settings.\n2281:\t\t*/\n2282:\t\n2283:\t\tif (cppc_state == AMD_PSTATE_UNDEFINED) {\n2284:\t\t\t/* Disable on the following configs by default:\n2285:\t\t\t * 1. Undefined platforms\n2286:\t\t\t * 2. Server platforms with CPUs older than Family 0x1A.\n2287:\t\t\t */\n2288:\t\t\tif (amd_pstate_acpi_pm_profile_undefined() ||\n2289:\t\t\t    (amd_pstate_acpi_pm_profile_server() \u0026\u0026 boot_cpu_data.x86 \u003c 0x1A)) {\n2290:\t\t\t\tpr_info(\"driver load is disabled, boot with specific mode to enable this\\n\");\n2291:\t\t\t\treturn -ENODEV;\n2292:\t\t\t}\n2293:\t\t\t/* get driver mode from kernel config option [1:4] */\n2294:\t\t\tcppc_state = CONFIG_X86_AMD_PSTATE_DEFAULT_MODE;\n2295:\t\t}\n2296:\t\n2297:\t\tif (cppc_state == AMD_PSTATE_DISABLE) {\n2298:\t\t\tpr_info(\"driver load is disabled, boot with specific mode to enable this\\n\");\n2299:\t\t\treturn -ENODEV;\n"
}

15/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 24531
							output: 38
							thoughts: 192
						

Thoughts:
**Initial AMD P-State Module Inspection**

Okay, let's dive into this `amd_pstate_init(void)` function. First, it checks if we're even on an AMD system. Makes sense, that's a quick check to avoid wasting time. Then, it verifies that CPPC is supported. If CPPC isn't there, it won't do anything because this is the primary functionality of the module. Finally, it flags issues with a broken BIOS or if ACPI is disabled. Seems reasonable to gracefully exit if the underlying hardware or system configuration isn't in a good state to support the functionality of this module. A warning is shown only if there is a potential underlying problem.

Now, wait a second...What about this `shmem_init_perf` function? I wonder where that's used. Let's trace this function and see when it is referenced. I need to understand the relationship between this and the AMD P-State module I've just glanced at.



16/2 2026/09/20 13:17 tool grepper
0m Args:
{
  "Expression": "shmem_init_perf",
  "PathPrefix": "drivers/cpufreq/amd-pstate.c"
}

Results:
{
  "Output": "drivers/cpufreq/amd-pstate.c=463=static int msr_init_perf(struct amd_cpudata *cpudata)\n--\ndrivers/cpufreq/amd-pstate.c-496-\ndrivers/cpufreq/amd-pstate.c:497:static int shmem_init_perf(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-498-{\n--\ndrivers/cpufreq/amd-pstate.c=2250=static int __init amd_pstate_init(void)\n--\ndrivers/cpufreq/amd-pstate.c-2307-\t\tstatic_call_update(amd_pstate_cppc_enable, shmem_cppc_enable);\ndrivers/cpufreq/amd-pstate.c:2308:\t\tstatic_call_update(amd_pstate_init_perf, shmem_init_perf);\ndrivers/cpufreq/amd-pstate.c-2309-\t\tstatic_call_update(amd_pstate_update_perf, shmem_update_perf);\n"
}

17/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 25263
							output: 41
							thoughts: 30
						

Thoughts:
Here's a summary of my thought process, as requested:

**Diving into AMD P-State Driver Code**

Alright, time to get my hands dirty. I need to refresh my memory on a specific section of the AMD P-State driver. Let's zero in on the `drivers/cpufreq/amd-pstate.c` file, specifically lines 2300 through 2350. This is likely where I'll find the core logic I'm after, depending on what I was last working on. I'm assuming that block holds the logic I need, otherwise I would have written that I knew what I was looking for. Now the real fun begins: understanding the nuances of how the code handles the frequency scaling or power management calculations there. Time to dig in and re-familiarize myself with the relevant code. Let's see what gems are hidden there!



18/2 2026/09/20 13:17 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 2300,
  "LineCount": 50
}

Results:
{
  "Contents": "2300:\t\t}\n2301:\t\n2302:\t\t/* capability check */\n2303:\t\tif (cpu_feature_enabled(X86_FEATURE_CPPC)) {\n2304:\t\t\tpr_debug(\"AMD CPPC MSR based functionality is supported\\n\");\n2305:\t\t} else {\n2306:\t\t\tpr_debug(\"AMD CPPC shared memory based functionality is supported\\n\");\n2307:\t\t\tstatic_call_update(amd_pstate_cppc_enable, shmem_cppc_enable);\n2308:\t\t\tstatic_call_update(amd_pstate_init_perf, shmem_init_perf);\n2309:\t\t\tstatic_call_update(amd_pstate_update_perf, shmem_update_perf);\n2310:\t\t\tstatic_call_update(amd_pstate_get_epp, shmem_get_epp);\n2311:\t\t\tstatic_call_update(amd_pstate_set_epp, shmem_set_epp);\n2312:\t\t}\n2313:\t\n2314:\t\tif (amd_pstate_prefcore) {\n2315:\t\t\tret = amd_detect_prefcore(\u0026amd_pstate_prefcore);\n2316:\t\t\tif (ret)\n2317:\t\t\t\treturn ret;\n2318:\t\t}\n2319:\t\n2320:\t\tret = amd_pstate_register_driver(cppc_state);\n2321:\t\tif (ret) {\n2322:\t\t\tpr_err(\"failed to register with return %d\\n\", ret);\n2323:\t\t\treturn ret;\n2324:\t\t}\n2325:\t\n2326:\t\tdev_root = bus_get_dev_root(\u0026cpu_subsys);\n2327:\t\tif (dev_root) {\n2328:\t\t\tret = sysfs_create_group(\u0026dev_root-\u003ekobj, \u0026amd_pstate_global_attr_group);\n2329:\t\t\tput_device(dev_root);\n2330:\t\t\tif (ret) {\n2331:\t\t\t\tpr_err(\"sysfs attribute export failed with error %d.\\n\", ret);\n2332:\t\t\t\tgoto global_attr_free;\n2333:\t\t\t}\n2334:\t\t}\n2335:\t\n2336:\t\treturn ret;\n2337:\t\n2338:\tglobal_attr_free:\n2339:\t\tamd_pstate_unregister_driver(0);\n2340:\t\treturn ret;\n2341:\t}\n2342:\tdevice_initcall(amd_pstate_init);\n2343:\t\n2344:\tstatic int __init amd_pstate_param(char *str)\n2345:\t{\n2346:\t\tsize_t size;\n2347:\t\tint mode_idx;\n2348:\t\n2349:\t\tif (!str)\n"
}

19/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 26297
							output: 21
							thoughts: 490
						

Thoughts:
**My Assessment of AMD CPPC Support**

Okay, let's break this down. First, the check `boot_cpu_data.x86_vendor != X86_VENDOR_AMD` is a pretty clear gatekeeper; if it's not an AMD CPU, we're out with `-ENODEV`. That's standard practice, I get it.

Now, that `amd_cppc_supported()` function is key. I see it checks the vendor, but also needs `HW_PSTATE` enabled.  No surprises there. The processor model check for `0x17` with model less than `0x30` is interesting – presumably, that's a known incompatibility or limitation of a specific CPU. Good to see that level of detail.

The ACPI `_CPC` check is the real clincher: `!acpi_cpc_valid()`.  That looks like a hard requirement, which triggers an `-ENODEV` if absent. This is where things get interesting, because I can start to see a potential problem.

Here's the problem: I need to consider QEMU and GCE, since syzkaller is often run in these environments.  Do they *actually* support AMD CPPC? Does QEMU even *emulate* AMD CPPC?  I know from experience that the ACPI tables that get generated in QEMU (using SeaBIOS or EDK2) usually *don't* include the `_CPC` object for AMD CPUs. If that's the case, we're likely going to hit that `-ENODEV` every time, even when the underlying hardware might support it. That's a huge potential issue for testing.

So, I need to check `acpi_cpc_valid()`. I need to figure out how it determines whether or not the ACPI `_CPC` object is present and what it does if it is absent. I'll need to figure out where that function is defined so I can understand the logic and then use my expertise to figure out if it can be modified. I'll use `grepper` to track that down, so I can see what it's really doing under the hood. This whole thing makes me think this is going to be a potential area of concern for testing in virtualized environments, which I'll need to remember.



20/2 2026/09/20 13:17 tool grepper
0m Args:
{
  "Expression": "acpi_cpc_valid"
}

Results:
{
  "Output": "Documentation/admin-guide/pm/amd-pstate.rst=190=The ``amd-pstate`` initialization will fail if the ``_CPC`` entry in the ACPI\nDocumentation/admin-guide/pm/amd-pstate.rst:191:SBIOS does not exist in the detected processor. It uses ``acpi_cpc_valid``\nDocumentation/admin-guide/pm/amd-pstate.rst-192-to check the existence of ``_CPC``. All Zen based processors support the legacy\n--\nDocumentation/admin-guide/pm/amd-pstate.rst=629=Unit Tests for amd-pstate\n--\nDocumentation/admin-guide/pm/amd-pstate.rst-648-        +=========+================================+====================================================================================+\nDocumentation/admin-guide/pm/amd-pstate.rst:649:        | 1       | amd_pstate_ut_acpi_cpc_valid   || Check whether the _CPC object is present in SBIOS.                                |\nDocumentation/admin-guide/pm/amd-pstate.rst-650-        |         |                                ||                                                                                   |\n--\nDocumentation/admin-guide/pm/amd-pstate.rst-742-          $ dmesg | grep \"amd_pstate_ut\" | tee log.txt\nDocumentation/admin-guide/pm/amd-pstate.rst:743:          [12977.570663] amd_pstate_ut: 1    amd_pstate_ut_acpi_cpc_valid  success!\nDocumentation/admin-guide/pm/amd-pstate.rst-744-          [12977.570673] amd_pstate_ut: 2    amd_pstate_ut_check_enabled   success!\n--\ndrivers/acpi/cppc_acpi.c=468=static int acpi_get_psd(struct cpc_desc *cpc_ptr, acpi_handle handle)\n--\ndrivers/acpi/cppc_acpi.c-525-\ndrivers/acpi/cppc_acpi.c:526:bool acpi_cpc_valid(void)\ndrivers/acpi/cppc_acpi.c-527-{\n--\ndrivers/acpi/cppc_acpi.c-541-}\ndrivers/acpi/cppc_acpi.c:542:EXPORT_SYMBOL_GPL(acpi_cpc_valid);\ndrivers/acpi/cppc_acpi.c-543-\n--\ndrivers/base/arch_topology.c=327=static inline void topology_init_cpu_capacity_cppc(void)\n--\ndrivers/base/arch_topology.c-332-\ndrivers/base/arch_topology.c:333:\tif (likely(!acpi_cpc_valid()))\ndrivers/base/arch_topology.c-334-\t\treturn;\n--\ndrivers/cpufreq/amd-pstate-ut.c=47=struct amd_pstate_ut_struct {\n--\ndrivers/cpufreq/amd-pstate-ut.c-54- */\ndrivers/cpufreq/amd-pstate-ut.c:55:static int amd_pstate_ut_acpi_cpc_valid(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c-56-static int amd_pstate_ut_check_enabled(u32 index);\n--\ndrivers/cpufreq/amd-pstate-ut.c=64=static struct amd_pstate_ut_struct amd_pstate_ut_cases[] = {\ndrivers/cpufreq/amd-pstate-ut.c:65:\t{\"amd_pstate_ut_acpi_cpc_valid\",    amd_pstate_ut_acpi_cpc_valid   },\ndrivers/cpufreq/amd-pstate-ut.c-66-\t{\"amd_pstate_ut_check_enabled\",     amd_pstate_ut_check_enabled    },\n--\ndrivers/cpufreq/amd-pstate-ut.c=94=static bool get_shared_mem(void)\n--\ndrivers/cpufreq/amd-pstate-ut.c-106- */\ndrivers/cpufreq/amd-pstate-ut.c:107:static int amd_pstate_ut_acpi_cpc_valid(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-108-{\ndrivers/cpufreq/amd-pstate-ut.c:109:\tif (!acpi_cpc_valid()) {\ndrivers/cpufreq/amd-pstate-ut.c-110-\t\tpr_err(\"%s the _CPC object is not present in SBIOS!\\n\", __func__);\n--\ndrivers/cpufreq/amd-pstate.c=2250=static int __init amd_pstate_init(void)\n--\ndrivers/cpufreq/amd-pstate.c-2262-\t/* show warning message when BIOS broken or ACPI disabled */\ndrivers/cpufreq/amd-pstate.c:2263:\tif (!acpi_cpc_valid()) {\ndrivers/cpufreq/amd-pstate.c-2264-\t\tpr_warn_once(\"the _CPC object is not present in SBIOS or ACPI disabled\\n\");\n--\ndrivers/cpufreq/cppc_cpufreq.c=1055=static int __init cppc_cpufreq_init(void)\n--\ndrivers/cpufreq/cppc_cpufreq.c-1058-\ndrivers/cpufreq/cppc_cpufreq.c:1059:\tif (!acpi_cpc_valid())\ndrivers/cpufreq/cppc_cpufreq.c-1060-\t\treturn -ENODEV;\n--\ninclude/acpi/cppc_acpi.h=174=extern unsigned int cppc_khz_to_perf(struct cppc_perf_caps *caps, unsigned int freq);\ninclude/acpi/cppc_acpi.h:175:extern bool acpi_cpc_valid(void);\ninclude/acpi/cppc_acpi.h-176-bool cppc_allow_fast_switch(const struct cpumask *cpus);\n--\ninclude/acpi/cppc_acpi.h=234=static inline bool cppc_perf_ctrs_in_pcc(void)\n--\ninclude/acpi/cppc_acpi.h-237-}\ninclude/acpi/cppc_acpi.h:238:static inline bool acpi_cpc_valid(void)\ninclude/acpi/cppc_acpi.h-239-{\n"
}

21/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 28981
							output: 40
							thoughts: 29
						

Thoughts:
Here's my summary, as though I'm thinking through this process:

**Diving into the ACPI/CPPC Landscape**

Alright, let's zero in on this `acpi_cpc_valid` function. I remember seeing that one in `drivers/acpi/cppc_acpi.c`. Always a good starting point when dealing with ACPI-based power management. Time to refresh my memory and understand what role this function plays in the whole CPPC initialization and validation process. Gotta make sure the ACPI tables are sane before we start pushing frequency settings around. This is a critical step, obviously. I'll need to remember all the edge cases it handles, especially error scenarios, to ensure robustness in the driver.



22/2 2026/09/20 13:17 tool read-file
0m Args:
{
  "File": "drivers/acpi/cppc_acpi.c",
  "FirstLine": 520,
  "LineCount": 30
}

Results:
{
  "Contents": " 520:\t\tresult = 0;\n 521:\tend:\n 522:\t\tkfree(buffer.pointer);\n 523:\t\treturn result;\n 524:\t}\n 525:\t\n 526:\tbool acpi_cpc_valid(void)\n 527:\t{\n 528:\t\tstruct cpc_desc *cpc_ptr;\n 529:\t\tint cpu;\n 530:\t\n 531:\t\tif (acpi_disabled)\n 532:\t\t\treturn false;\n 533:\t\n 534:\t\tfor_each_online_cpu(cpu) {\n 535:\t\t\tcpc_ptr = per_cpu(cpc_desc_ptr, cpu);\n 536:\t\t\tif (!cpc_ptr)\n 537:\t\t\t\treturn false;\n 538:\t\t}\n 539:\t\n 540:\t\treturn true;\n 541:\t}\n 542:\tEXPORT_SYMBOL_GPL(acpi_cpc_valid);\n 543:\t\n 544:\tbool cppc_allow_fast_switch(const struct cpumask *cpus)\n 545:\t{\n 546:\t\tstruct cpc_register_resource *desired_reg, *min_reg, *max_reg;\n 547:\t\tstruct cpc_desc *cpc_ptr;\n 548:\t\tint cpu;\n 549:\t\n"
}

23/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 29599
							output: 40
							thoughts: 155
						

Thoughts:
**My Line of Inquiry Regarding CPC and ACPI**

Okay, so I'm trying to figure out how this `cpc_desc_ptr` is getting populated. It looks like it's happening during the parsing of `_CPC` within `acpi_cppc_processor_probe`. The next logical question is, are standard QEMU or GCE configurations even *supposed* to provide these `_CPC` ACPI objects?

Hold on... I'm pretty sure not. This `_CPC`, the Continuous Performance Control objects, that's something that typically comes from the hardware's ACPI BIOS, specifically on physical AMD, ARM, or Intel servers and laptops *with* CPPC support. QEMU's ACPI implementation isn't set up to provide `_CPC` objects on x86, as far as I know.

Hang on... wait, let me double-check something. There's something nagging at the back of my mind. Let me look at `amd_pstate-ut.c`. Hmm, what *is* `amd-pstate-ut.c`, I need to check that file and understand what it is. Okay, let's dive into it.



24/2 2026/09/20 13:17 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate-ut.c",
  "FirstLine": 1,
  "LineCount": 80
}

Results:
{
  "Contents": "   1:\t// SPDX-License-Identifier: GPL-2.0-or-later\n   2:\t/*\n   3:\t * AMD Processor P-state Frequency Driver Unit Test\n   4:\t *\n   5:\t * Copyright (C) 2022 Advanced Micro Devices, Inc. All Rights Reserved.\n   6:\t *\n   7:\t * Author: Meng Li \u003cli.meng@amd.com\u003e\n   8:\t *\n   9:\t * The AMD P-State Unit Test is a test module for testing the amd-pstate\n  10:\t * driver. 1) It can help all users to verify their processor support\n  11:\t * (SBIOS/Firmware or Hardware). 2) Kernel can have a basic function\n  12:\t * test to avoid the kernel regression during the update. 3) We can\n  13:\t * introduce more functional or performance tests to align the result\n  14:\t * together, it will benefit power and performance scale optimization.\n  15:\t *\n  16:\t * This driver implements basic framework with plans to enhance it with\n  17:\t * additional test cases to improve the depth and coverage of the test.\n  18:\t *\n  19:\t * See Documentation/admin-guide/pm/amd-pstate.rst Unit Tests for\n  20:\t * amd-pstate to get more detail.\n  21:\t */\n  22:\t\n  23:\t#define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n  24:\t\n  25:\t#include \u003clinux/bitfield.h\u003e\n  26:\t#include \u003clinux/cpufeature.h\u003e\n  27:\t#include \u003clinux/cpufreq.h\u003e\n  28:\t#include \u003clinux/kernel.h\u003e\n  29:\t#include \u003clinux/module.h\u003e\n  30:\t#include \u003clinux/moduleparam.h\u003e\n  31:\t#include \u003clinux/mm.h\u003e\n  32:\t#include \u003clinux/fs.h\u003e\n  33:\t#include \u003clinux/cleanup.h\u003e\n  34:\t\n  35:\t#include \u003cacpi/cppc_acpi.h\u003e\n  36:\t\n  37:\t#include \u003casm/msr.h\u003e\n  38:\t\n  39:\t#include \"amd-pstate.h\"\n  40:\t\n  41:\tstatic char *test_list;\n  42:\tmodule_param(test_list, charp, 0444);\n  43:\tMODULE_PARM_DESC(test_list,\n  44:\t\t\"Comma-delimited list of tests to run (empty means run all tests)\");\n  45:\tDEFINE_FREE(cleanup_page, void *, if (_T) free_page((unsigned long)_T))\n  46:\t\n  47:\tstruct amd_pstate_ut_struct {\n  48:\t\tconst char *name;\n  49:\t\tint (*func)(u32 index);\n  50:\t};\n  51:\t\n  52:\t/*\n  53:\t * Kernel module for testing the AMD P-State unit test\n  54:\t */\n  55:\tstatic int amd_pstate_ut_acpi_cpc_valid(u32 index);\n  56:\tstatic int amd_pstate_ut_check_enabled(u32 index);\n  57:\tstatic int amd_pstate_ut_check_perf(u32 index);\n  58:\tstatic int amd_pstate_ut_check_freq(u32 index);\n  59:\tstatic int amd_pstate_ut_epp(u32 index);\n  60:\tstatic int amd_pstate_ut_check_driver(u32 index);\n  61:\tstatic int amd_pstate_ut_check_freq_attrs(u32 index);\n  62:\tstatic int amd_pstate_ut_check_floor_freq(u32 index);\n  63:\t\n  64:\tstatic struct amd_pstate_ut_struct amd_pstate_ut_cases[] = {\n  65:\t\t{\"amd_pstate_ut_acpi_cpc_valid\",    amd_pstate_ut_acpi_cpc_valid   },\n  66:\t\t{\"amd_pstate_ut_check_enabled\",     amd_pstate_ut_check_enabled    },\n  67:\t\t{\"amd_pstate_ut_check_perf\",        amd_pstate_ut_check_perf       },\n  68:\t\t{\"amd_pstate_ut_check_freq\",        amd_pstate_ut_check_freq       },\n  69:\t\t{\"amd_pstate_ut_epp\",               amd_pstate_ut_epp              },\n  70:\t\t{\"amd_pstate_ut_check_driver\",      amd_pstate_ut_check_driver     },\n  71:\t\t{\"amd_pstate_ut_check_freq_attrs\",  amd_pstate_ut_check_freq_attrs },\n  72:\t\t{\"amd_pstate_ut_check_floor_freq\",  amd_pstate_ut_check_floor_freq },\n  73:\t};\n  74:\t\n  75:\tstatic bool test_in_list(const char *list, const char *name)\n  76:\t{\n  77:\t\tsize_t name_len = strlen(name);\n  78:\t\tconst char *p = list;\n  79:\t\n  80:\t\twhile (*p) {\n"
}

25/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 31429
							output: 40
							thoughts: 1530
						

Thoughts:
**Analysis of `amd-pstate-ut.c` and Reachability in Virtualized Environments**

Okay, so I'm looking at `amd-pstate-ut.c` and its relationship to `shmem_init_perf`. The core of my question is whether this unit test exercises the modified code in `shmem_init_perf`. The patch itself modifies how `shmem_init_perf` initializes the "auto_sel" setting. However, my immediate concern is whether this code is even *reachable* in a typical fuzzing environment, like QEMU.

First, I need to understand when `shmem_init_perf` is called. It seems to be conditionally called within `amd_pstate_init()`.  The key checks are:

1.  `boot_cpu_data.x86_vendor != X86_VENDOR_AMD` – If it's not an AMD CPU, it exits early with `-ENODEV`.  Definitely a problem in any non-AMD simulated environment.
2.  `amd_cppc_supported()` – This checks for AMD CPPC support, but crucially, it checks for both AMD and HYGON vendors, and then checks for `X86_FEATURE_HW_PSTATE`. This also exits if we're not running on AMD or if the specific hardware feature isn't present.
3.  `acpi_cpc_valid()` – This is a *major* red flag for virtualized environments. It checks for the existence of ACPI `_CPC` descriptors. My experience tells me that QEMU's ACPI tables *never* include `_CPC` objects. They are generated by `hw/i386/acpi-build.c`, and I know from past experience, that code doesn't generate them! Therefore, this will *always* return `-ENODEV` in QEMU.
4.  `static_call_update(amd_pstate_init_perf, shmem_init_perf)` – This line is only reached if `!cpu_feature_enabled(X86_FEATURE_CPPC)`. Which means shared memory based CPPC is used, so older AMD CPUs that don't directly support CPPC.
5.  Following that, `amd_pstate_register_driver()` is called.
6.  `amd_pstate_init_perf()` then calls `shmem_init_perf()` inside `amd_pstate_cpu_init` and `amd_pstate_epp_cpu_init` as part of CPU frequency initialization.

Now, my triage philosophy hinges on reachability. Section 1 and 2 say: code must be executable in standard virtualized environments.  This is about whether the modified code can *execute* in GCE or QEMU, using emulated devices.

The question then, is, can `amd-pstate` run in QEMU? Even on an AMD host, will KVM/QEMU pass through the AMD CPPC shared memory or the relevant MSRs (Model Specific Registers)? The answer is likely NO. We know QEMU doesn't populate the necessary ACPI tables and that is where the whole thing starts.

Given that `amd_pstate_init` returns early if not on AMD hardware, doesn't support CPPC, or doesn't have valid ACPI CPC objects, and that QEMU doesn't have those CPC objects, I'm concluding that `shmem_init_perf` (and therefore, the modified code) is *unreachable* in a standard QEMU environment. The CPPC shared memory support provided by `shmem_init_perf` would only be used on older AMD processors. Also, `amd_pstate` is a *platform* driver, and not a virtual or software emulated device.

My next step is to confirm where `shmem_init_perf` is called with a grep.



26/2 2026/09/20 13:17 tool grepper
0m Args:
{
  "Expression": "amd_pstate_init_perf",
  "PathPrefix": "drivers/cpufreq/amd-pstate.c"
}

Results:
{
  "Output": "drivers/cpufreq/amd-pstate.c=497=static int shmem_init_perf(struct amd_cpudata *cpudata)\n--\ndrivers/cpufreq/amd-pstate.c-537-\ndrivers/cpufreq/amd-pstate.c:538:DEFINE_STATIC_CALL(amd_pstate_init_perf, msr_init_perf);\ndrivers/cpufreq/amd-pstate.c-539-\ndrivers/cpufreq/amd-pstate.c:540:static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-541-{\ndrivers/cpufreq/amd-pstate.c:542:\treturn static_call(amd_pstate_init_perf)(cpudata);\ndrivers/cpufreq/amd-pstate.c-543-}\n--\ndrivers/cpufreq/amd-pstate.c=1052=static int amd_pstate_cpu_init(struct cpufreq_policy *policy)\n--\ndrivers/cpufreq/amd-pstate.c-1073-\ndrivers/cpufreq/amd-pstate.c:1074:\tret = amd_pstate_init_perf(cpudata);\ndrivers/cpufreq/amd-pstate.c-1075-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c=1877=static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)\n--\ndrivers/cpufreq/amd-pstate.c-1899-\ndrivers/cpufreq/amd-pstate.c:1900:\tret = amd_pstate_init_perf(cpudata);\ndrivers/cpufreq/amd-pstate.c-1901-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c=2250=static int __init amd_pstate_init(void)\n--\ndrivers/cpufreq/amd-pstate.c-2307-\t\tstatic_call_update(amd_pstate_cppc_enable, shmem_cppc_enable);\ndrivers/cpufreq/amd-pstate.c:2308:\t\tstatic_call_update(amd_pstate_init_perf, shmem_init_perf);\ndrivers/cpufreq/amd-pstate.c-2309-\t\tstatic_call_update(amd_pstate_update_perf, shmem_update_perf);\n"
}

27/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 34501
							output: 49
							thoughts: 177
						

Thoughts:
**My Initial Thoughts on AMD P-State Initialization**

Okay, so `amd_pstate_init_perf`... I need to track down exactly when *that* gets called. Right, it's only called in `amd_pstate_cpu_init` and `amd_pstate_epp_cpu_init`. Okay, makes sense. But when *are* those called? Ah, right! They are the `.init` callbacks of the `cpufreq_driver` structures, `amd_pstate_driver` and `amd_pstate_epp_driver`. Elementary, my dear Watson.

So, where are *those* drivers registered? I believe it's during `amd_pstate_init(void)`, which I know is a `device_initcall`. However, there’s a nagging thought... could the driver be loaded or switched *after* boot via sysfs? I vaguely remember something about `/sys/devices/system/cpu/amd_pstate/status` and other related sysfs files... I should probably check that. Yeah, I better look into the `amd_pstate_global_attr_group` and the sysfs handlers in `drivers/cpufreq/amd-pstate.c` just to be sure. I need to be absolutely certain of the initialization flow and any potential dynamic changes.



28/2 2026/09/20 13:17 tool grepper
0m Args:
{
  "Expression": "amd_pstate_global_attr_group|pstate_global_attributes",
  "PathPrefix": "drivers/cpufreq/amd-pstate.c"
}

Results:
{
  "Output": "drivers/cpufreq/amd-pstate.c=1844=static DEVICE_ATTR_RO(prefcore);\ndrivers/cpufreq/amd-pstate.c-1845-\ndrivers/cpufreq/amd-pstate.c:1846:static struct attribute *pstate_global_attributes[] = {\ndrivers/cpufreq/amd-pstate.c-1847-\t\u0026dev_attr_status.attr,\n--\ndrivers/cpufreq/amd-pstate.c-1851-\ndrivers/cpufreq/amd-pstate.c:1852:static const struct attribute_group amd_pstate_global_attr_group = {\ndrivers/cpufreq/amd-pstate.c-1853-\t.name = \"amd_pstate\",\ndrivers/cpufreq/amd-pstate.c:1854:\t.attrs = pstate_global_attributes,\ndrivers/cpufreq/amd-pstate.c-1855-};\n--\ndrivers/cpufreq/amd-pstate.c=2250=static int __init amd_pstate_init(void)\n--\ndrivers/cpufreq/amd-pstate.c-2327-\tif (dev_root) {\ndrivers/cpufreq/amd-pstate.c:2328:\t\tret = sysfs_create_group(\u0026dev_root-\u003ekobj, \u0026amd_pstate_global_attr_group);\ndrivers/cpufreq/amd-pstate.c-2329-\t\tput_device(dev_root);\n"
}

29/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 35413
							output: 41
							thoughts: 230
						

Thoughts:
**Analyzing the AMD P-State Driver Initialization**

Okay, so I'm digging into this code, specifically line 2328 where `sysfs_create_group` is called. That line, `sysfs_create_group(&dev_root->kobj, &amd_pstate_global_attr_group)`, only gets executed if `amd_pstate_init` returns a success. My first thought is to understand the conditions that cause `amd_pstate_init` to *fail* and short-circuit. Let's see... it returns `-ENODEV` or `-EOPNOTSUPP` early if a few key criteria aren't met.

First, if the CPU isn't an AMD CPU, specifically `boot_cpu_data.x86_vendor != X86_VENDOR_AMD`, it bails. Makes sense. Then, it checks `amd_cppc_supported()`, which hinges on the `X86_FEATURE_HW_PSTATE` feature being present. And finally, it demands that `acpi_cpc_valid()` return true. That one requires valid ACPI `_CPC` objects on all CPUs.

Now, wait a minute...none of those conditions are typically met in a QEMU or Google Compute Engine (GCE) virtual machine environment! It's highly unlikely that AMD P-state would initialize at all in those cases. So, what's going on with these tests? Could the unit test, `amd_pstate_ut`, somehow be invoking something like `shmem_init_perf`? I'd better take a look at the unit test itself. I'll need to check `drivers/cpufreq/amd-pstate-ut.c` to see what tests exist in that code. I need to get to the bottom of this.



30/2 2026/09/20 13:17 tool grepper
0m Args:
{
  "Expression": "amd_pstate_ut_",
  "PathPrefix": "drivers/cpufreq/amd-pstate-ut.c"
}

Results:
{
  "Output": "drivers/cpufreq/amd-pstate-ut.c=45=DEFINE_FREE(cleanup_page, void *, if (_T) free_page((unsigned long)_T))\ndrivers/cpufreq/amd-pstate-ut.c-46-\ndrivers/cpufreq/amd-pstate-ut.c:47:struct amd_pstate_ut_struct {\ndrivers/cpufreq/amd-pstate-ut.c-48-\tconst char *name;\n--\ndrivers/cpufreq/amd-pstate-ut.c-54- */\ndrivers/cpufreq/amd-pstate-ut.c:55:static int amd_pstate_ut_acpi_cpc_valid(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:56:static int amd_pstate_ut_check_enabled(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:57:static int amd_pstate_ut_check_perf(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:58:static int amd_pstate_ut_check_freq(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:59:static int amd_pstate_ut_epp(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:60:static int amd_pstate_ut_check_driver(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:61:static int amd_pstate_ut_check_freq_attrs(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:62:static int amd_pstate_ut_check_floor_freq(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c-63-\ndrivers/cpufreq/amd-pstate-ut.c:64:static struct amd_pstate_ut_struct amd_pstate_ut_cases[] = {\ndrivers/cpufreq/amd-pstate-ut.c:65:\t{\"amd_pstate_ut_acpi_cpc_valid\",    amd_pstate_ut_acpi_cpc_valid   },\ndrivers/cpufreq/amd-pstate-ut.c:66:\t{\"amd_pstate_ut_check_enabled\",     amd_pstate_ut_check_enabled    },\ndrivers/cpufreq/amd-pstate-ut.c:67:\t{\"amd_pstate_ut_check_perf\",        amd_pstate_ut_check_perf       },\ndrivers/cpufreq/amd-pstate-ut.c:68:\t{\"amd_pstate_ut_check_freq\",        amd_pstate_ut_check_freq       },\ndrivers/cpufreq/amd-pstate-ut.c:69:\t{\"amd_pstate_ut_epp\",               amd_pstate_ut_epp              },\ndrivers/cpufreq/amd-pstate-ut.c:70:\t{\"amd_pstate_ut_check_driver\",      amd_pstate_ut_check_driver     },\ndrivers/cpufreq/amd-pstate-ut.c:71:\t{\"amd_pstate_ut_check_freq_attrs\",  amd_pstate_ut_check_freq_attrs },\ndrivers/cpufreq/amd-pstate-ut.c:72:\t{\"amd_pstate_ut_check_floor_freq\",  amd_pstate_ut_check_floor_freq },\ndrivers/cpufreq/amd-pstate-ut.c-73-};\n--\ndrivers/cpufreq/amd-pstate-ut.c=94=static bool get_shared_mem(void)\n--\ndrivers/cpufreq/amd-pstate-ut.c-106- */\ndrivers/cpufreq/amd-pstate-ut.c:107:static int amd_pstate_ut_acpi_cpc_valid(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-108-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-119- */\ndrivers/cpufreq/amd-pstate-ut.c:120:static int amd_pstate_ut_check_enabled(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-121-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-145- */\ndrivers/cpufreq/amd-pstate-ut.c:146:static int amd_pstate_ut_check_perf(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-147-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-221- */\ndrivers/cpufreq/amd-pstate-ut.c:222:static int amd_pstate_ut_check_freq(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-223-{\n--\ndrivers/cpufreq/amd-pstate-ut.c=268=static int amd_pstate_set_mode(enum amd_pstate_mode mode)\n--\ndrivers/cpufreq/amd-pstate-ut.c-276-\ndrivers/cpufreq/amd-pstate-ut.c:277:static int amd_pstate_ut_epp(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-278-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-410-\ndrivers/cpufreq/amd-pstate-ut.c:411:static int amd_pstate_ut_check_driver(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-412-{\n--\ndrivers/cpufreq/amd-pstate-ut.c=462=static bool attr_in_driver(struct freq_attr **driver_attrs, const char *name)\n--\ndrivers/cpufreq/amd-pstate-ut.c-478- */\ndrivers/cpufreq/amd-pstate-ut.c:479:static int amd_pstate_ut_check_freq_attrs(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-480-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-564-\ndrivers/cpufreq/amd-pstate-ut.c:565:static int amd_pstate_ut_check_floor_freq(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-566-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-638-\ndrivers/cpufreq/amd-pstate-ut.c:639:static int __init amd_pstate_ut_init(void)\ndrivers/cpufreq/amd-pstate-ut.c-640-{\ndrivers/cpufreq/amd-pstate-ut.c:641:\tu32 i = 0, arr_size = ARRAY_SIZE(amd_pstate_ut_cases);\ndrivers/cpufreq/amd-pstate-ut.c-642-\tenum amd_pstate_mode mode = amd_pstate_get_status();\n--\ndrivers/cpufreq/amd-pstate-ut.c-651-\t\tif (test_list \u0026\u0026 *test_list \u0026\u0026\ndrivers/cpufreq/amd-pstate-ut.c:652:\t\t    !test_in_list(test_list, amd_pstate_ut_cases[i].name))\ndrivers/cpufreq/amd-pstate-ut.c-653-\t\t\tcontinue;\ndrivers/cpufreq/amd-pstate-ut.c-654-\ndrivers/cpufreq/amd-pstate-ut.c:655:\t\tret = amd_pstate_ut_cases[i].func(i);\ndrivers/cpufreq/amd-pstate-ut.c-656-\n--\ndrivers/cpufreq/amd-pstate-ut.c-659-\t\t\tif (ret == -EOPNOTSUPP) {\ndrivers/cpufreq/amd-pstate-ut.c:660:\t\t\t\tpr_err(\"%-4d %-20s\\t skipped!\\n\", i+1, amd_pstate_ut_cases[i].name);\ndrivers/cpufreq/amd-pstate-ut.c-661-\t\t\t\tcontinue;\ndrivers/cpufreq/amd-pstate-ut.c-662-\t\t\t}\ndrivers/cpufreq/amd-pstate-ut.c:663:\t\t\tpr_err(\"%-4d %-20s\\t fail: %d!\\n\", i+1, amd_pstate_ut_cases[i].name, ret);\ndrivers/cpufreq/amd-pstate-ut.c-664-\t\t} else {\ndrivers/cpufreq/amd-pstate-ut.c:665:\t\t\tpr_info(\"%-4d %-20s\\t success!\\n\", i+1, amd_pstate_ut_cases[i].name);\ndrivers/cpufreq/amd-pstate-ut.c-666-\t\t}\n--\ndrivers/cpufreq/amd-pstate-ut.c-671-\ndrivers/cpufreq/amd-pstate-ut.c:672:static void __exit amd_pstate_ut_exit(void)\ndrivers/cpufreq/amd-pstate-ut.c-673-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-675-\ndrivers/cpufreq/amd-pstate-ut.c:676:module_init(amd_pstate_ut_init);\ndrivers/cpufreq/amd-pstate-ut.c:677:module_exit(amd_pstate_ut_exit);\ndrivers/cpufreq/amd-pstate-ut.c-678-\n"
}

31/2 2026/09/20 13:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 38578
							output: 35
							thoughts: 613
						

Thoughts:
**My Assessment of the `shmem_init_perf` Reachability for Fuzzing**

Okay, so I'm looking at this `shmem_init_perf` function, which is, unfortunately, static inside `drivers/cpufreq/amd-pstate.c`. That right there is a problem; it's not exported, meaning I can't directly call it from something like `amd-pstate-ut.c`. This is compounded by the fact that it only gets executed under very specific, and quite frankly, physically demanding circumstances.

Essentially, `shmem_init_perf` is a fallback that's *only* reached when `amd_pstate_init` runs successfully on an AMD machine. The catch? It has to be an older AMD CPU *without* MSR CPPC support (`!cpu_feature_enabled(X86_FEATURE_CPPC)`), but it *must* have `X86_FEATURE_HW_PSTATE`, be from the AMD vendor, and have a valid ACPI CPPC table `_CPC`.

The reality is these physical hardware prerequisites are simply not going to happen in standard QEMU or GCE virtual environments. My quick check of the "WHEN TO RETURN WorthFuzzing=false" section reinforces this:  it's explicitly stated that vendor-specific hardware like this falls into the category of "structurally unreachable" in standard emulated environments.

Specifically, `amd-pstate.c` is all about CPU frequency management for *physical* AMD CPUs with ACPI CPPC.  `shmem_init_perf()` is the initialization function specifically for older AMD CPUs lacking MSR-based CPPC, relying on ACPI `_CPC` tables from the physical SBIOS and the AMD HW_PSTATE CPU features.

I already see that, during kernel boot, `amd_pstate_init()` will fail pretty early on due to those specific requirements being unmet. The code clearly checks for the AMD vendor, whether CPPC is supported, and if there's a valid ACPI `_CPC` table.  Since these conditions will never be true in QEMU or GCE, the driver won't initialize, meaning this code is structurally unreachable from a fuzzing standpoint.  It's a no-go.

Now, I'm going to quickly check the Kconfig file for `amd-pstate` in `drivers/cpufreq/Kconfig.x86` just to be absolutely sure there isn't some obscure config option or mock that *could* make it reachable. But based on what I've seen so far, I'm not optimistic.



32/2 2026/09/20 13:18 tool grepper
0m Args:
{
  "Expression": "config X86_AMD_PSTATE",
  "PathPrefix": "drivers/cpufreq/"
}

Results:
{
  "Output": "drivers/cpufreq/Kconfig.x86=22=config X86_PCC_CPUFREQ\n--\ndrivers/cpufreq/Kconfig.x86-35-\ndrivers/cpufreq/Kconfig.x86:36:config X86_AMD_PSTATE\ndrivers/cpufreq/Kconfig.x86-37-\tbool \"AMD Processor P-State driver\"\n--\ndrivers/cpufreq/Kconfig.x86-54-\ndrivers/cpufreq/Kconfig.x86:55:config X86_AMD_PSTATE_DEFAULT_MODE\ndrivers/cpufreq/Kconfig.x86-56-\tint \"AMD Processor P-State default mode\"\n--\ndrivers/cpufreq/Kconfig.x86-71-\ndrivers/cpufreq/Kconfig.x86:72:config X86_AMD_PSTATE_UT\ndrivers/cpufreq/Kconfig.x86-73-\ttristate \"selftest for AMD Processor P-State driver\"\n"
}

33/2 2026/09/20 13:18 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 40057
							output: 39
							thoughts: 24
						

Thoughts:
Here's my summary, as though I'm reading and thinking about the Kconfig file:

**Navigating the CPUFreq Configuration**

Okay, let's dive into the `drivers/cpufreq/Kconfig.x86` file. Specifically, I want to get a sense of how things are structured around line 36. I need to refresh my memory on what options are presented for frequency scaling on x86 systems. I anticipate this section deals with the core configurations – perhaps the overall `cpufreq` driver enablement and the fundamental frequency scaling governors like `ondemand` or `powersave`. I'm curious to see if there are any architecture-specific options in this area that I need to be aware of, perhaps related to newer hardware features. I'll be looking for dependencies, default settings, and maybe any conditional logic related to other kernel features. Let's get to it.



34/2 2026/09/20 13:18 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/Kconfig.x86",
  "FirstLine": 35,
  "LineCount": 40
}

Results:
{
  "Contents": "  35:\t\n  36:\tconfig X86_AMD_PSTATE\n  37:\t\tbool \"AMD Processor P-State driver\"\n  38:\t\tdepends on ACPI\n  39:\t\tselect ACPI_PROCESSOR\n  40:\t\tselect ACPI_CPPC_LIB if X86_64\n  41:\t\tselect CPU_FREQ_GOV_SCHEDUTIL if SMP\n  42:\t\tselect ACPI_PLATFORM_PROFILE\n  43:\t\tselect POWER_SUPPLY\n  44:\t\thelp\n  45:\t\t  This driver adds a CPUFreq driver which utilizes a fine grain\n  46:\t\t  processor performance frequency control range instead of legacy\n  47:\t\t  performance levels. _CPC needs to be present in the ACPI tables\n  48:\t\t  of the system.\n  49:\t\n  50:\t\t  For details, take a look at:\n  51:\t\t  \u003cfile:Documentation/admin-guide/pm/amd-pstate.rst\u003e.\n  52:\t\n  53:\t\t  If in doubt, say N.\n  54:\t\n  55:\tconfig X86_AMD_PSTATE_DEFAULT_MODE\n  56:\t\tint \"AMD Processor P-State default mode\"\n  57:\t\tdepends on X86_AMD_PSTATE\n  58:\t\tdefault 3 if X86_AMD_PSTATE\n  59:\t\trange 1 4\n  60:\t\thelp\n  61:\t\t  Select the default mode the amd-pstate driver will use on\n  62:\t\t  supported hardware.\n  63:\t\t  The value set has the following meanings:\n  64:\t\t\t1 -\u003e Disabled\n  65:\t\t\t2 -\u003e Passive\n  66:\t\t\t3 -\u003e Active (EPP)\n  67:\t\t\t4 -\u003e Guided\n  68:\t\n  69:\t\t  For details, take a look at:\n  70:\t\t  \u003cfile:Documentation/admin-guide/pm/amd-pstate.rst\u003e.\n  71:\t\n  72:\tconfig X86_AMD_PSTATE_UT\n  73:\t\ttristate \"selftest for AMD Processor P-State driver\"\n  74:\t\tdepends on ACPI_PROCESSOR\n"
}

35/2 2026/09/20 13:18 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 40866
							output: 174
							thoughts: 373
						

Thoughts:
**My Assessment: Unfuzzable Target**

Okay, the documentation is crystal clear: the presence of `_CPC` in the ACPI tables is a hard requirement. Since I know these tables are typically absent or inadequately emulated in standard QEMU or GCE environments – and this is confirmed by the subsequent details - then `WorthFuzzing` has to be `false`. There's no way around it.

Let me just quickly review the required fields for `set-results` to make sure I'm dotting all the i's and crossing all the t's. `WorthFuzzing` is definitely `false`. I need to provide a concise `Reasoning` explaining the structural unreachability. The focus symbols will be an empty array, and the enable configurations will be empty too.

Right, let’s dig into the details to be absolutely sure. The patch affects `shmem_init_perf()` within `drivers/cpufreq/amd-pstate.c`. It's all about initializing performance controls using the CPPC shared-memory mode specifically for AMD processors. The function demands: an actual AMD processor, hardware P-state support, valid ACPI CPPC `_CPC` entries (confirmed by `acpi_cpc_valid()`), and crucially, it must be the shared memory mode (non-MSR CPPC).

In a standard virtualized setup, like QEMU or GCE, the ACPI `_CPC` objects and the AMD CPPC hardware features aren’t emulated or supported. That's a given. This absence leads to the `amd_pstate_init()` failing during driver probing, probably returning either `-ENODEV` or `-EOPNOTSUPP`. The target code is simply unreachable, blocked by the lack of the prerequisites.

Okay, everything checks out. The reasoning is solid, and the unreachability is well-established. Time to call `set-results`.



36/2 2026/09/20 13:18 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch modifies shmem_init_perf() in the amd-pstate CPU frequency scaling driver (drivers/cpufreq/amd-pstate.c). This code is structurally unreachable in standard virtualized fuzzing environments (QEMU/GCE) because amd-pstate requires physical AMD hardware with ACPI _CPC (Collaborative Processor Performance Control) tables provided by SBIOS (acpi_cpc_valid()), as well as AMD hardware P-state features (X86_FEATURE_HW_PSTATE). In standard QEMU/GCE VMs, these ACPI objects and CPU features are not present or emulated, causing driver initialization to fail early during boot.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies shmem_init_perf() in the amd-pstate CPU frequency scaling driver (drivers/cpufreq/amd-pstate.c). This code is structurally unreachable in standard virtualized fuzzing environments (QEMU/GCE) because amd-pstate requires physical AMD hardware with ACPI _CPC (Collaborative Processor Performance Control) tables provided by SBIOS (acpi_cpc_valid()), as well as AMD hardware P-state features (X86_FEATURE_HW_PSTATE). In standard QEMU/GCE VMs, these ACPI objects and CPU features are not present or emulated, causing driver initialization to fail early during boot.",
  "WorthFuzzing": false
}

37/1 2026/09/20 13:18 action If
0m Args:
{
  "WorthFuzzing": false
}

Results:
null

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)