Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752773AbbGQB1N (ORCPT ); Thu, 16 Jul 2015 21:27:13 -0400 Received: from mail-wg0-f66.google.com ([74.125.82.66]:35979 "EHLO mail-wg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbbGQB1L convert rfc822-to-8bit (ORCPT ); Thu, 16 Jul 2015 21:27:11 -0400 MIME-Version: 1.0 In-Reply-To: <1437037461.15828.2.camel@ellerman.id.au> References: <1437037461.15828.2.camel@ellerman.id.au> Date: Fri, 17 Jul 2015 09:27:10 +0800 Message-ID: Subject: Re: BUG: perf error on syscalls for powerpc64. From: Zumeng Chen To: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, romeo.cane.ext@coriant.com, imunsie@au1.ibm.com, paulus@samba.org, benh@kernel.crashing.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3778 Lines: 105 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@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 > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/