* [PATCH] powerpc/sysrq: Fix oops whem ppmu is not registered
@ 2017-09-19 6:17 Ravi Bangoria
2017-09-19 10:00 ` Michael Ellerman
2017-09-21 1:46 ` Michael Ellerman
0 siblings, 2 replies; 4+ messages in thread
From: Ravi Bangoria @ 2017-09-19 6:17 UTC (permalink / raw)
To: mpe, linuxppc-dev
Cc: benh, paulus, maddy, tglx, mingo, kan.liang, linux-kernel,
Ravi Bangoria
Kernel crashes if power pmu is not registered and user tries to dump
regs with 'echo p > /proc/sysrq-trigger'. Sample log:
Unable to handle kernel paging request for data at address 0x00000008
Faulting instruction address: 0xc0000000000d52f0
NIP [c0000000000d52f0] perf_event_print_debug+0x10/0x230
LR [c00000000058a938] sysrq_handle_showregs+0x38/0x50
Call Trace:
printk+0x38/0x4c (unreliable)
__handle_sysrq+0xe4/0x270
write_sysrq_trigger+0x64/0x80
proc_reg_write+0x80/0xd0
__vfs_write+0x40/0x200
vfs_write+0xc8/0x240
SyS_write+0x60/0x110
system_call+0x58/0x6c
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
---
arch/powerpc/perf/core-book3s.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 2e3eb74..9e3da16 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -793,6 +793,11 @@ void perf_event_print_debug(void)
u32 pmcs[MAX_HWEVENTS];
int i;
+ if (!ppmu) {
+ pr_info("Performance monitor hardware not registered.\n");
+ return;
+ }
+
if (!ppmu->n_counter)
return;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/sysrq: Fix oops whem ppmu is not registered
2017-09-19 6:17 [PATCH] powerpc/sysrq: Fix oops whem ppmu is not registered Ravi Bangoria
@ 2017-09-19 10:00 ` Michael Ellerman
2017-09-19 10:04 ` Madhavan Srinivasan
2017-09-21 1:46 ` Michael Ellerman
1 sibling, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2017-09-19 10:00 UTC (permalink / raw)
To: Ravi Bangoria, linuxppc-dev
Cc: benh, paulus, maddy, tglx, mingo, kan.liang, linux-kernel,
Ravi Bangoria
Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> writes:
> Kernel crashes if power pmu is not registered and user tries to dump
> regs with 'echo p > /proc/sysrq-trigger'. Sample log:
>
> Unable to handle kernel paging request for data at address 0x00000008
> Faulting instruction address: 0xc0000000000d52f0
>
> NIP [c0000000000d52f0] perf_event_print_debug+0x10/0x230
> LR [c00000000058a938] sysrq_handle_showregs+0x38/0x50
> Call Trace:
> printk+0x38/0x4c (unreliable)
> __handle_sysrq+0xe4/0x270
> write_sysrq_trigger+0x64/0x80
> proc_reg_write+0x80/0xd0
> __vfs_write+0x40/0x200
> vfs_write+0xc8/0x240
> SyS_write+0x60/0x110
> system_call+0x58/0x6c
Thanks.
I added:
Fixes: 5f6d0380c640 ("powerpc/perf: Define perf_event_print_debug() to print PMU register values")
But I don't think I'll Cc stable, I can't think why we'd ever *not* have
a ppmu registered. How did you hit it?
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/sysrq: Fix oops whem ppmu is not registered
2017-09-19 10:00 ` Michael Ellerman
@ 2017-09-19 10:04 ` Madhavan Srinivasan
0 siblings, 0 replies; 4+ messages in thread
From: Madhavan Srinivasan @ 2017-09-19 10:04 UTC (permalink / raw)
To: Michael Ellerman, Ravi Bangoria, linuxppc-dev
Cc: benh, paulus, tglx, mingo, kan.liang, linux-kernel
On Tuesday 19 September 2017 03:30 PM, Michael Ellerman wrote:
> Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> writes:
>
>> Kernel crashes if power pmu is not registered and user tries to dump
>> regs with 'echo p > /proc/sysrq-trigger'. Sample log:
>>
>> Unable to handle kernel paging request for data at address 0x00000008
>> Faulting instruction address: 0xc0000000000d52f0
>>
>> NIP [c0000000000d52f0] perf_event_print_debug+0x10/0x230
>> LR [c00000000058a938] sysrq_handle_showregs+0x38/0x50
>> Call Trace:
>> printk+0x38/0x4c (unreliable)
>> __handle_sysrq+0xe4/0x270
>> write_sysrq_trigger+0x64/0x80
>> proc_reg_write+0x80/0xd0
>> __vfs_write+0x40/0x200
>> vfs_write+0xc8/0x240
>> SyS_write+0x60/0x110
>> system_call+0x58/0x6c
> Thanks.
>
> I added:
>
> Fixes: 5f6d0380c640 ("powerpc/perf: Define perf_event_print_debug() to print PMU register values")
>
> But I don't think I'll Cc stable, I can't think why we'd ever *not* have
> a ppmu registered. How did you hit it?
mpe,
We hit this in a compact mode setup where the distro kernel did not have
the
pmu support for the base pvr.
Maddy
> cheers
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: powerpc/sysrq: Fix oops whem ppmu is not registered
2017-09-19 6:17 [PATCH] powerpc/sysrq: Fix oops whem ppmu is not registered Ravi Bangoria
2017-09-19 10:00 ` Michael Ellerman
@ 2017-09-21 1:46 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-09-21 1:46 UTC (permalink / raw)
To: Ravi Bangoria, linuxppc-dev
Cc: maddy, linux-kernel, Ravi Bangoria, paulus, kan.liang, tglx,
mingo
On Tue, 2017-09-19 at 06:17:06 UTC, Ravi Bangoria wrote:
> Kernel crashes if power pmu is not registered and user tries to dump
> regs with 'echo p > /proc/sysrq-trigger'. Sample log:
>
> Unable to handle kernel paging request for data at address 0x00000008
> Faulting instruction address: 0xc0000000000d52f0
>
> NIP [c0000000000d52f0] perf_event_print_debug+0x10/0x230
> LR [c00000000058a938] sysrq_handle_showregs+0x38/0x50
> Call Trace:
> printk+0x38/0x4c (unreliable)
> __handle_sysrq+0xe4/0x270
> write_sysrq_trigger+0x64/0x80
> proc_reg_write+0x80/0xd0
> __vfs_write+0x40/0x200
> vfs_write+0xc8/0x240
> SyS_write+0x60/0x110
> system_call+0x58/0x6c
>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
> Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/4917fcb58cc73f6b81455e3c5f9601
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-21 1:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19 6:17 [PATCH] powerpc/sysrq: Fix oops whem ppmu is not registered Ravi Bangoria
2017-09-19 10:00 ` Michael Ellerman
2017-09-19 10:04 ` Madhavan Srinivasan
2017-09-21 1:46 ` Michael Ellerman
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).