From: bugzilla-daemon@kernel.org
To: linux-pm@vger.kernel.org
Subject: [Bug 218865] New: NULL pointer reference if amd_pstate=disabled on a AMD CPU that supports CPPC
Date: Tue, 21 May 2024 00:15:02 +0000 [thread overview]
Message-ID: <bug-218865-137361@https.bugzilla.kernel.org/> (raw)
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.
next reply other threads:[~2024-05-21 0:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 0:15 bugzilla-daemon [this message]
2024-05-21 0:15 ` [Bug 218865] NULL pointer reference if X86_AMD_PSTATE_DEFAULT_MODE=1 on a AMD CPU that supports CPPC 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-218865-137361@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@kernel.org \
--cc=linux-pm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox