linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug 218865] New: NULL pointer reference if amd_pstate=disabled on a AMD CPU that supports CPPC
@ 2024-05-21  0:15 bugzilla-daemon
  2024-05-21  0:15 ` [Bug 218865] NULL pointer reference if X86_AMD_PSTATE_DEFAULT_MODE=1 " bugzilla-daemon
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bugzilla-daemon @ 2024-05-21  0:15 UTC (permalink / raw)
  To: linux-pm

https://bugzilla.kernel.org/show_bug.cgi?id=218865

            Bug ID: 218865
           Summary: NULL pointer reference if amd_pstate=disabled on a AMD
                    CPU that supports CPPC
           Product: Power Management
           Version: 2.5
          Hardware: AMD
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: cpufreq
          Assignee: linux-pm@vger.kernel.org
          Reporter: matthew4196@gmail.com
        Regression: No

I recently deployed a custom kernel build with X86_AMD_PSTATE_DEFAULT_MODE set
to 1 (Disabled) to a newer AMD system: AMD Ryzen 3 4100 that supports cppc and
got a NULL pointer reference crash so I had to add amd_pstate=active on that
system to get it to boot.  The same kernel boots fine on older AMD systems that
don't support cppc.

The kernel is 6.6.22

This is what I think is happening when no amd_pstate parameter has been
specified although I haven't tested a patch yet:
in function: amd_pstate_init the cppc_state starts as AMD_PSTATE_UNDEFINED.

On older systems that don't support CPPC, !boot_cpu_has(X86_FEATURE_CPPC) tests
true so "driver load is disabled, boot with specific mode to enable this" is
printed and -ENODEV is returned.

On the newer systems that support CPPC , it goes on to "ret =
amd_pstate_set_driver(CONFIG_X86_AMD_PSTATE_DEFAULT_MODE);" .  Then
amd_pstate_set_driver sees AMD_PSTATE_DISABLE , prints "driver is explicitly
disabled" , doesn't assign a driver to current_pstate_driver, but still returns
0.  So then the switch statement in amd_pstate_init breaks and then I suspect
it crashes at "current_pstate_driver->adjust_perf = amd_pstate_adjust_perf;"
just below the switch statement.

If this is the case, maybe adjusting amd_pstate_set_driver to return -ENODEV if
cppc_state == AMD_PSTATE_DISABLE might fix the problem.

Here is some of the crash output (manually typed from a photo):
amd_pstate: driver is explicitly disabled
BUG: kernel NULL pointer deference, address: 0000000000000050
...
? __die+0x1a/0x60
? page_fault_oops+0x17c/0x4a0
? _prb_read_valid+0x263/0x2e0
? exc_page_fault+0x33f/0x610
? prb_read_valid+0x12/0x20
? asm_exc_page_fault+0x22/0x30
? amd_pstate_init+0x90/0x260
? amd_pstate_param+0xb0/0xb0
do_one_initcall+0x82/0x2c0
kernel_init_freeable+0x1af/0x260
? rest_init+0xb0/0xb0
kernel_init+0x11/0x1b0
ret_from_fork+0x2b/0x40
? rest_init+0xb0/0xb0
ret_from_fork_asm+0x11/0x20

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-26 20:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-21  0:15 [Bug 218865] New: NULL pointer reference if amd_pstate=disabled on a AMD CPU that supports CPPC bugzilla-daemon
2024-05-21  0:15 ` [Bug 218865] NULL pointer reference if X86_AMD_PSTATE_DEFAULT_MODE=1 " bugzilla-daemon
2024-05-21  0:41 ` bugzilla-daemon
2024-05-21  7:18 ` bugzilla-daemon
2024-05-21  7:19 ` bugzilla-daemon
2024-05-21  7:28 ` bugzilla-daemon
2024-05-23  1:44 ` bugzilla-daemon
2024-05-23 16:13 ` bugzilla-daemon
2024-05-26 20:36 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).