* [PATCH v1 1/1] perf/x86/amd/power: do not load amd power module in intel platform
@ 2018-01-22 6:12 Xiao Liang
2018-01-24 12:04 ` [tip:x86/urgent] perf/x86/amd/power: Do not load AMD power module on !AMD platforms tip-bot for Xiao Liang
0 siblings, 1 reply; 2+ messages in thread
From: Xiao Liang @ 2018-01-22 6:12 UTC (permalink / raw)
To: tglx, mingo, hpa; +Cc: linux-kernel, x86, Xiao Liang
"power" module can be loaded if it is not amd processor.
And user cannot unload it after loaded it. The following call trace generated
when tried to unload it.
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: __list_del_entry_valid+0x29/0x90
PGD 0 P4D 0
Oops: 0000 [#1] SMP PTI
CPU: 1 PID: 26046 Comm: modprobe Not tainted 4.14.13-300.fc27.x86_64 #1
Hardware name: Xen HVM domU, BIOS 4.9.1 12/12/2017
task: ffff9a138f8dddc0 task.stack: ffffb0ec41cbc000
RIP: 0010:__list_del_entry_valid+0x29/0x90
Call Trace:
perf_pmu_unregister+0x25/0xf0
amd_power_pmu_exit+0x1c/0xd23 [power]
SyS_delete_module+0x1a8/0x2b0
? exit_to_usermode_loop+0x8f/0xb0
entry_SYSCALL_64_fastpath+0x20/0x83
RIP: 0033:0x7fb67d78e5c7
Signed-off-by: Xiao Liang <xiliang@redhat.com>
---
arch/x86/events/amd/power.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c
index a6eee5ac4f58..2aefacf5c5b2 100644
--- a/arch/x86/events/amd/power.c
+++ b/arch/x86/events/amd/power.c
@@ -277,7 +277,7 @@ static int __init amd_power_pmu_init(void)
int ret;
if (!x86_match_cpu(cpu_match))
- return 0;
+ return -ENODEV;
if (!boot_cpu_has(X86_FEATURE_ACC_POWER))
return -ENODEV;
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip:x86/urgent] perf/x86/amd/power: Do not load AMD power module on !AMD platforms
2018-01-22 6:12 [PATCH v1 1/1] perf/x86/amd/power: do not load amd power module in intel platform Xiao Liang
@ 2018-01-24 12:04 ` tip-bot for Xiao Liang
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Xiao Liang @ 2018-01-24 12:04 UTC (permalink / raw)
To: linux-tip-commits; +Cc: tglx, mingo, xiliang, linux-kernel, hpa
Commit-ID: 40d4071ce2d20840d224b4a77b5dc6f752c9ab15
Gitweb: https://git.kernel.org/tip/40d4071ce2d20840d224b4a77b5dc6f752c9ab15
Author: Xiao Liang <xiliang@redhat.com>
AuthorDate: Mon, 22 Jan 2018 14:12:52 +0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 24 Jan 2018 13:00:35 +0100
perf/x86/amd/power: Do not load AMD power module on !AMD platforms
The AMD power module can be loaded on non AMD platforms, but unload fails
with the following Oops:
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: __list_del_entry_valid+0x29/0x90
Call Trace:
perf_pmu_unregister+0x25/0xf0
amd_power_pmu_exit+0x1c/0xd23 [power]
SyS_delete_module+0x1a8/0x2b0
? exit_to_usermode_loop+0x8f/0xb0
entry_SYSCALL_64_fastpath+0x20/0x83
Return -ENODEV instead of 0 from the module init function if the CPU does
not match.
Fixes: c7ab62bfbe0e ("perf/x86/amd/power: Add AMD accumulated power reporting mechanism")
Signed-off-by: Xiao Liang <xiliang@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20180122061252.6394-1-xiliang@redhat.com
---
arch/x86/events/amd/power.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c
index a6eee5a..2aefacf 100644
--- a/arch/x86/events/amd/power.c
+++ b/arch/x86/events/amd/power.c
@@ -277,7 +277,7 @@ static int __init amd_power_pmu_init(void)
int ret;
if (!x86_match_cpu(cpu_match))
- return 0;
+ return -ENODEV;
if (!boot_cpu_has(X86_FEATURE_ACC_POWER))
return -ENODEV;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-24 12:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 6:12 [PATCH v1 1/1] perf/x86/amd/power: do not load amd power module in intel platform Xiao Liang
2018-01-24 12:04 ` [tip:x86/urgent] perf/x86/amd/power: Do not load AMD power module on !AMD platforms tip-bot for Xiao Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox