Oops (NULL pointer) with 'perf record' of selftest 'null_syscall'

Christophe Leroy christophe.leroy at csgroup.eu
Wed Jun 16 16:48:59 AEST 2021



Le 16/06/2021 à 08:33, Madhavan Srinivasan a écrit :
> 
> On 6/16/21 11:56 AM, Christophe Leroy wrote:
>>
>>
>> Le 16/06/2021 à 05:40, Athira Rajeev a écrit :
>>>
>>>
>>>> On 16-Jun-2021, at 8:53 AM, Madhavan Srinivasan <maddy at linux.ibm.com> wrote:
>>>>
>>>>
>>>> On 6/15/21 8:35 PM, Christophe Leroy wrote:
>>>>> For your information, I'm getting the following Oops. Detected with 5.13-rc6, it also oopses on 
>>>>> 5.12 and 5.11.
>>>>> Runs ok on 5.10. I'm starting bisecting now.
>>>>
>>>>
>>>> Thanks for reporting, got the issue. What has happened in this case is that, pmu device is not 
>>>> registered
>>>> and trying to access the instruction point which will land in perf_instruction_pointer(). And 
>>>> recently I have added
>>>> a workaround patch for power10 DD1 which has caused this breakage. My bad. We are working on a 
>>>> fix patch
>>>> for the same and will post it out. Sorry again.
>>>>
>>>
>>> Hi Christophe,
>>>
>>> Can you please try with below patch in your environment and test if it works for you.
>>>
>>>  From 55d3afc9369dfbe28a7152c8e9f856c11c7fe43d Mon Sep 17 00:00:00 2001
>>> From: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
>>> Date: Tue, 15 Jun 2021 22:28:11 -0400
>>> Subject: [PATCH] powerpc/perf: Fix crash with 'perf_instruction_pointer' when
>>>   pmu is not set
>>>
>>> On systems without any specific PMU driver support registered, running
>>> perf record causes oops:
>>>
>>> [   38.841073] NIP [c00000000013af54] perf_instruction_pointer+0x24/0x100
>>> [   38.841079] LR [c0000000003c7358] perf_prepare_sample+0x4e8/0x820
>>> [   38.841085] --- interrupt: 300
>>> [   38.841088] [c00000001cf03440] [c0000000003c6ef8] perf_prepare_sample+0x88/0x820 (unreliable)
>>> [   38.841096] [c00000001cf034a0] [c0000000003c76d0] perf_event_output_forward+0x40/0xc0
>>> [   38.841104] [c00000001cf03520] [c0000000003b45e8] __perf_event_overflow+0x88/0x1b0
>>> [   38.841112] [c00000001cf03570] [c0000000003b480c] perf_swevent_hrtimer+0xfc/0x1a0
>>> [   38.841119] [c00000001cf03740] [c0000000002399cc] __hrtimer_run_queues+0x17c/0x380
>>> [   38.841127] [c00000001cf037c0] [c00000000023a5f8] hrtimer_interrupt+0x128/0x2f0
>>> [   38.841135] [c00000001cf03870] [c00000000002962c] timer_interrupt+0x13c/0x370
>>> [   38.841143i] [c00000001cf038d0] [c000000000009ba4] decrementer_common_virt+0x1a4/0x1b0
>>> [   38.841151] --- interrupt: 900 at copypage_power7+0xd4/0x1c0
>>>
>>> During perf record session, perf_instruction_pointer() is called to
>>> capture the sample ip. This function in core-book3s accesses ppmu->flags.
>>> If a platform specific PMU driver is not registered, ppmu is set to NULL
>>> and accessing its members results in a crash. Fix this crash by checking
>>> if ppmu is set.
>>>
>>> Signed-off-by: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
>>> Reported-by: Christophe Leroy <christophe.leroy at csgroup.eu>
>>
>> Fixes: 2ca13a4cc56c ("powerpc/perf: Use regs->nip when SIAR is zero")
>> Cc: stable at vger.kernel.org
>> Tested-by: Christophe Leroy <christophe.leroy at csgroup.eu>
> Thanks, but just wonder what is the system config and processor version in which you got this fail.
> Reason, we do have generic-pmu which should kick-in in absence of a platform specific driver.
> 


It's an mpc8321 (book3s/32)

Christophe


More information about the Linuxppc-dev mailing list