BUG: perf error on syscalls for powerpc64.

Zumeng Chen zumeng.chen at gmail.com
Fri Jul 17 11:27:10 AEST 2015


On 2015年07月16日 17:04, Michael Ellerman wrote:
> On Thu, 2015-07-16 at 13:57 +0800, Zumeng Chen wrote:
>> Hi All,
>>
>> 1028ccf5 did a change for sys_call_table from a pointer to an array of
>> unsigned long, I think it's not proper, here is my reason:
>>
>> sys_call_table defined as a label in assembler should be pointer array
>> rather than an array as described in 1028ccf5. If we defined it as an
>> array, then arch_syscall_addr will return the address of sys_call_table[],
>> actually the content of sys_call_table[] is demanded by arch_syscall_addr.
>> so 'perf list' will ignore all syscalls since find_syscall_meta will
>> return null
>> in init_ftrace_syscalls because of the wrong arch_syscall_addr.
>>
>> Did I miss something, or Gcc compiler has done something newer ?
> Hi Zumeng,
>
> It works for me with the code as it is in mainline.
>
> I don't quite follow your explanation, so if you're seeing a bug please send
> some information about what you're actually seeing. And include the disassembly
> of arch_syscall_addr() and your compiler version etc.

Hi Michael,

Yeah, it seems it was not a good explanation, I'll explain more this time:

1. Whatever we exclaim sys_call_table in C level, actually it is a pointer
     to sys_call_table rather than sys_call_table self in assemble level.

     arch/powerpc/kernel/systbl.S
     47 .globl sys_call_table   <--- see here
     48 sys_call_table:

     So if you want to exclaim sys_call_table as array, then I think
it's very
     clear what we'll get when we do sys_call_table[i].

2. Disassemble codes difference of arch_syscall_addr with or without
1028ccf5
================================================

     *) With 1028ccf5
       ---------------------
Dump of assembler code for function arch_syscall_addr:
522    {
523        return (unsigned long)sys_call_table[nr];
    0xc000000000df53d4 <+0>:    addis   r10,r2,-13
    0xc000000000df53d8 <+4>:    addi    r9,r10,3488
    0xc000000000df53dc <+8>:    rldicr  r3,r3,3,60
524    }
    0xc000000000df53e0 <+12>:    ldx     r3,r9,r3
    0xc000000000df53e4 <+16>:    blr


     *) Without 1028ccf5
     ---------------------------
Dump of assembler code for function arch_syscall_addr:
522    {
523        return (unsigned long)sys_call_table[nr];
    0xc000000000df53d0 <+0>:    addis   r10,r2,-13
    0xc000000000df53d4 <+4>:    addi    r9,r10,3488
    0xc000000000df53d8 <+8>:    rldicr  r3,r3,3,60
    0xc000000000df53dc <+12>:    ld      r9,0(r9) <------only this is
different
524    }
    0xc000000000df53e0 <+16>:    ldx     r3,r9,r3
    0xc000000000df53e4 <+20>:    blr
End of assembler dump.

3. What I have seen in 3.14.x kernel,
======================
And so far, no more difference to 4.x kernel from me about this part if
I'm right.

*) With 1028ccf5

perf list|grep -i syscall got me nothing.


*) Without 1028ccf5
root at localhost:~# perf list|grep -i syscall
   syscalls:sys_enter_socket                          [Tracepoint event]
   syscalls:sys_exit_socket                           [Tracepoint event]
   syscalls:sys_enter_socketpair                      [Tracepoint event]
   syscalls:sys_exit_socketpair                       [Tracepoint event]
   syscalls:sys_enter_bind                            [Tracepoint event]
   syscalls:sys_exit_bind                             [Tracepoint event]
   syscalls:sys_enter_listen                          [Tracepoint event]
   syscalls:sys_exit_listen                           [Tracepoint event]
   ... ...

Cheers,
Zumeng

>
> cheers
>
>


More information about the Linuxppc-dev mailing list