From: czm <zumeng.chen@windriver.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Zumeng Chen <zumeng.chen@gmail.com>,
<linux-kernel@vger.kernel.org>, <paulus@samba.org>,
<imunsie@au1.ibm.com>, <linuxppc-dev@lists.ozlabs.org>,
<romeo.cane.ext@coriant.com>, Anton Blanchard <anton@samba.org>
Subject: Re: BUG: perf error on syscalls for powerpc64.
Date: Wed, 22 Jul 2015 07:00:19 +0800 [thread overview]
Message-ID: <55AECF03.80407@windriver.com> (raw)
In-Reply-To: <1437460821.30722.11.camel@ellerman.id.au>
在 2015年07月21日 14:40, Michael Ellerman 写道:
> On Fri, 2015-07-17 at 13:28 +0800, Zumeng Chen wrote:
>> On 2015年07月17日 12:07, Michael Ellerman wrote:
>>> On Fri, 2015-07-17 at 09:27 +0800, Zumeng Chen wrote:
>>>> 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,
>>> Hi Zumeng,
>>>
>>>> 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.
>>> No it's not a pointer.
>> Then what is the second one in the following:
> It's a function descriptor.
>
>> zchen@pek-yocto-build2:$ cat System.map |grep sys_call_table
>> c000000000009590 T .sys_call_table <-----this is a real sys_call_table.
>> c0000000014e1b48 D sys_call_table <-----this should be referred by
>> arch_syscall_addr
>>
>> The c0000000014e1b48[0] = c000000000009590
> That is from 3.14 isn't it?
>
> In 3.14 we had in systbl.S:
>
> 46 _GLOBAL(sys_call_table)
> 47 #include <asm/systbl.h>
>
> And _GLOBAL was:
>
> 46 #define _GLOBAL(name) \
> 47 .type name,@function; \
> 48 .globl name; \
> 49 name:
>
>
> Which means sys_call_table was being declared as a function, which is
> completely wrong.
>
> On big endian when you declare a function "foo" you get two symbols, ".foo" at
> the address you declare the symbol and "foo" which is somewhere else and
> contains three pointers, the first of which is to ".foo".
>
> So at address "foo" you have a pointer to ".foo", which happens to be what
> you'd expect if "foo" was a pointer to ".foo".
>
> Anton fixed this in 3.16:
>
> https://git.kernel.org/torvalds/c/c857c43b34ec
>
>
> But that had the side-effect of breaking the usage of sys_call_table in C.
Yeah, good to know, thanks Michael again.
Cheers,
Zumeng
>
> cheers
>
>
prev parent reply other threads:[~2015-07-21 23:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-16 5:57 BUG: perf error on syscalls for powerpc64 Zumeng Chen
2015-07-16 9:04 ` Michael Ellerman
2015-07-17 1:27 ` Zumeng Chen
2015-07-17 1:51 ` Sukadev Bhattiprolu
2015-07-17 1:59 ` Ian Munsie
2015-07-18 2:00 ` Zumeng Chen
2015-07-17 5:33 ` Zumeng Chen
2015-07-17 4:07 ` Michael Ellerman
2015-07-17 5:28 ` Zumeng Chen
2015-07-21 6:40 ` Michael Ellerman
2015-07-21 23:00 ` czm [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55AECF03.80407@windriver.com \
--to=zumeng.chen@windriver.com \
--cc=anton@samba.org \
--cc=imunsie@au1.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=romeo.cane.ext@coriant.com \
--cc=zumeng.chen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).