Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1434243 > unrolled thread
| Started by | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| First post | 2016-06-30 08:30 +0200 |
| Last post | 2016-07-08 07:00 +0200 |
| Articles | 6 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v3 3/4] perf annotate: add powerpc support Michael Ellerman <mpe@ellerman.id.au> - 2016-06-30 08:30 +0200
Re: [PATCH v3 3/4] perf annotate: add powerpc support Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> - 2016-07-01 10:50 +0200
Re: [PATCH v3 3/4] perf annotate: add powerpc support Balbir Singh <bsingharora@gmail.com> - 2016-07-01 14:50 +0200
Re: [PATCH v3 3/4] perf annotate: add powerpc support Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> - 2016-07-01 15:40 +0200
Re: [PATCH v3 3/4] perf annotate: add powerpc support Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> - 2016-07-05 03:30 +0200
Re: [PATCH v3 3/4] perf annotate: add powerpc support Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> - 2016-07-08 07:00 +0200
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Date | 2016-06-30 08:30 +0200 |
| Subject | Re: [PATCH v3 3/4] perf annotate: add powerpc support |
| Message-ID | <rPDE5-67b-5@gated-at.bofh.it> |
On Thu, 2016-06-30 at 11:44 +0530, Ravi Bangoria wrote:
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 36a5825..b87eac7 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -476,6 +481,125 @@ static int ins__cmp(const void *a, const void *b)
...
> +
> +static struct ins *ins__find_powerpc(const char *name)
> +{
> + int i;
> + struct ins *ins;
> + struct ins_ops *ops;
> + static struct instructions_powerpc head;
> + static bool list_initialized;
> +
> + /*
> + * - Interested only if instruction starts with 'b'.
> + * - Few start with 'b', but aren't branch instructions.
> + * - Let's also ignore instructions involving 'ctr' and
> + * 'tar' since target branch addresses for those can't
> + * be determined statically.
> + */
> + if (name[0] != 'b' ||
> + !strncmp(name, "bcd", 3) ||
> + !strncmp(name, "brinc", 5) ||
> + !strncmp(name, "bper", 4) ||
> + strstr(name, "ctr") ||
> + strstr(name, "tar"))
> + return NULL;
It would be good if 'bctr' was at least recognised as a branch, even if we
can't determine the target. They are very common.
It doesn't look like we have the opcode handy here? Could we get it somehow?
That would make this a *lot* more robust.
cheers
[toc] | [next] | [standalone]
| From | Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-01 10:50 +0200 |
| Message-ID | <rQ2j8-4pm-21@gated-at.bofh.it> |
| In reply to | #1434243 |
Thanks Michael for your suggestion.
On Thursday 30 June 2016 11:51 AM, Michael Ellerman wrote:
> On Thu, 2016-06-30 at 11:44 +0530, Ravi Bangoria wrote:
>> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
>> index 36a5825..b87eac7 100644
>> --- a/tools/perf/util/annotate.c
>> +++ b/tools/perf/util/annotate.c
>> @@ -476,6 +481,125 @@ static int ins__cmp(const void *a, const void *b)
> ...
>> +
>> +static struct ins *ins__find_powerpc(const char *name)
>> +{
>> + int i;
>> + struct ins *ins;
>> + struct ins_ops *ops;
>> + static struct instructions_powerpc head;
>> + static bool list_initialized;
>> +
>> + /*
>> + * - Interested only if instruction starts with 'b'.
>> + * - Few start with 'b', but aren't branch instructions.
>> + * - Let's also ignore instructions involving 'ctr' and
>> + * 'tar' since target branch addresses for those can't
>> + * be determined statically.
>> + */
>> + if (name[0] != 'b' ||
>> + !strncmp(name, "bcd", 3) ||
>> + !strncmp(name, "brinc", 5) ||
>> + !strncmp(name, "bper", 4) ||
>> + strstr(name, "ctr") ||
>> + strstr(name, "tar"))
>> + return NULL;
> It would be good if 'bctr' was at least recognised as a branch, even if we
> can't determine the target. They are very common.
We can not show arrow for this since we don't know the target location.
can you please suggest how you intends perf to display bctr?
bctr can be classified into two variants -- 'bctr' and 'bctrl'.
'bctr' will be considered as jump instruction but jump__parse() won't
be able to find any target location and hence it will set target to
UINT64_MAX which transform 'bctr' to 'bctr UINT64_MAX'. This
looks misleading.
bctrl will be considered as call instruction but call_parse() won't
be able to find any target function and hence it won't show any
navigation arrow for this instruction. Which is same as filter it
beforehand.
> It doesn't look like we have the opcode handy here? Could we get it somehow?
> That would make this a *lot* more robust.
objdump prints machine code, but I don't know how difficult that would
be to parse to get opcode.
-Ravi
> cheers
>
[toc] | [prev] | [next] | [standalone]
| From | Balbir Singh <bsingharora@gmail.com> |
|---|---|
| Date | 2016-07-01 14:50 +0200 |
| Message-ID | <rQ63n-6GX-1@gated-at.bofh.it> |
| In reply to | #1435166 |
On Fri, 2016-07-01 at 14:13 +0530, Ravi Bangoria wrote:
> Thanks Michael for your suggestion.
>
> On Thursday 30 June 2016 11:51 AM, Michael Ellerman wrote:
> >
> > On Thu, 2016-06-30 at 11:44 +0530, Ravi Bangoria wrote:
> > >
> > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> > > index 36a5825..b87eac7 100644
> > > --- a/tools/perf/util/annotate.c
> > > +++ b/tools/perf/util/annotate.c
> > > @@ -476,6 +481,125 @@ static int ins__cmp(const void *a, const void *b)
> > ...
> > >
> > > +
> > > +static struct ins *ins__find_powerpc(const char *name)
> > > +{
> > > + int i;
> > > + struct ins *ins;
> > > + struct ins_ops *ops;
> > > + static struct instructions_powerpc head;
> > > + static bool list_initialized;
> > > +
> > > + /*
> > > + * - Interested only if instruction starts with 'b'.
> > > + * - Few start with 'b', but aren't branch instructions.
> > > + * - Let's also ignore instructions involving 'ctr' and
> > > + * 'tar' since target branch addresses for those can't
> > > + * be determined statically.
> > > + */
> > > + if (name[0] != 'b' ||
> > > + !strncmp(name, "bcd", 3) ||
> > > + !strncmp(name, "brinc", 5) ||
> > > + !strncmp(name, "bper", 4) ||
> > > + strstr(name, "ctr") ||
> > > + strstr(name, "tar"))
> > > + return NULL;
> > It would be good if 'bctr' was at least recognised as a branch, even if we
> > can't determine the target. They are very common.
> We can not show arrow for this since we don't know the target location.
> can you please suggest how you intends perf to display bctr?
>
> bctr can be classified into two variants -- 'bctr' and 'bctrl'.
>
> 'bctr' will be considered as jump instruction but jump__parse() won't
> be able to find any target location and hence it will set target to
> UINT64_MAX which transform 'bctr' to 'bctr UINT64_MAX'. This
> looks misleading.
>
> bctrl will be considered as call instruction but call_parse() won't
> be able to find any target function and hence it won't show any
> navigation arrow for this instruction. Which is same as filter it
> beforehand.
>
The target location and function are in the counter. Can't we add
this to instruction ops? Is it a major change to add it?
Balbir Singh.
[toc] | [prev] | [next] | [standalone]
| From | Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-01 15:40 +0200 |
| Message-ID | <rQ6PM-7cN-7@gated-at.bofh.it> |
| In reply to | #1435295 |
Hi Balbir,
On Friday 01 July 2016 06:18 PM, Balbir Singh wrote:
> On Fri, 2016-07-01 at 14:13 +0530, Ravi Bangoria wrote:
>> Thanks Michael for your suggestion.
>>
>> On Thursday 30 June 2016 11:51 AM, Michael Ellerman wrote:
>>>
>>> On Thu, 2016-06-30 at 11:44 +0530, Ravi Bangoria wrote:
>>>>
>>>> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
>>>> index 36a5825..b87eac7 100644
>>>> --- a/tools/perf/util/annotate.c
>>>> +++ b/tools/perf/util/annotate.c
>>>> @@ -476,6 +481,125 @@ static int ins__cmp(const void *a, const void *b)
>>> ...
>>>>
>>>> +
>>>> +static struct ins *ins__find_powerpc(const char *name)
>>>> +{
>>>> + int i;
>>>> + struct ins *ins;
>>>> + struct ins_ops *ops;
>>>> + static struct instructions_powerpc head;
>>>> + static bool list_initialized;
>>>> +
>>>> + /*
>>>> + * - Interested only if instruction starts with 'b'.
>>>> + * - Few start with 'b', but aren't branch instructions.
>>>> + * - Let's also ignore instructions involving 'ctr' and
>>>> + * 'tar' since target branch addresses for those can't
>>>> + * be determined statically.
>>>> + */
>>>> + if (name[0] != 'b' ||
>>>> + !strncmp(name, "bcd", 3) ||
>>>> + !strncmp(name, "brinc", 5) ||
>>>> + !strncmp(name, "bper", 4) ||
>>>> + strstr(name, "ctr") ||
>>>> + strstr(name, "tar"))
>>>> + return NULL;
>>> It would be good if 'bctr' was at least recognised as a branch, even if we
>>> can't determine the target. They are very common.
>> We can not show arrow for this since we don't know the target location.
>> can you please suggest how you intends perf to display bctr?
>>
>> bctr can be classified into two variants -- 'bctr' and 'bctrl'.
>>
>> 'bctr' will be considered as jump instruction but jump__parse() won't
>> be able to find any target location and hence it will set target to
>> UINT64_MAX which transform 'bctr' to 'bctr UINT64_MAX'. This
>> looks misleading.
>>
>> bctrl will be considered as call instruction but call_parse() won't
>> be able to find any target function and hence it won't show any
>> navigation arrow for this instruction. Which is same as filter it
>> beforehand.
>>
> The target location and function are in the counter. Can't we add
> this to instruction ops? Is it a major change to add it?
Of course we can add it.
What I mean is we can not determine target location statically by parsing
objdump output. For example, consider snippet:
objdump output:
c000000000143848: lwarx r8,0,r10
c00000000014384c: addic r8,r8,1
c000000000143850: stwcx. r8,0,r10
c000000000143854: bne- c000000000143848 <.rcu_idle_exit+0x58>
corresponding perf annotate output:
58: lwarx r8,0,r10
addic r8,r8,1
stwcx. r8,0,r10
bne- 58
tui will show up arrow before 'bne- 58' instruction, that indicate it as
a jump instruction. When we focus on 'bne- 58' instruction, arrow will
span from that instruction to instruction with 58th offset( lwarx ).
By pressing Enter, it will jump focus to the target.
In case of 'bctr', we can not determine target location statically
and hence we can not provide any navigation options. Same for
'bctrl' as well.
Please correct me if I misunderstood anything.
-Ravi
>
> Balbir Singh.
>
[toc] | [prev] | [next] | [standalone]
| From | Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-05 03:30 +0200 |
| Message-ID | <rRnlv-4AT-1@gated-at.bofh.it> |
| In reply to | #1435166 |
Hi Michael,
On Friday 01 July 2016 02:13 PM, Ravi Bangoria wrote:
> Thanks Michael for your suggestion.
>
> On Thursday 30 June 2016 11:51 AM, Michael Ellerman wrote:
>> On Thu, 2016-06-30 at 11:44 +0530, Ravi Bangoria wrote:
>>> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
>>> index 36a5825..b87eac7 100644
>>> --- a/tools/perf/util/annotate.c
>>> +++ b/tools/perf/util/annotate.c
>>> @@ -476,6 +481,125 @@ static int ins__cmp(const void *a, const void *b)
>> ...
>>> +
>>> +static struct ins *ins__find_powerpc(const char *name)
>>> +{
>>> + int i;
>>> + struct ins *ins;
>>> + struct ins_ops *ops;
>>> + static struct instructions_powerpc head;
>>> + static bool list_initialized;
>>> +
>>> + /*
>>> + * - Interested only if instruction starts with 'b'.
>>> + * - Few start with 'b', but aren't branch instructions.
>>> + * - Let's also ignore instructions involving 'ctr' and
>>> + * 'tar' since target branch addresses for those can't
>>> + * be determined statically.
>>> + */
>>> + if (name[0] != 'b' ||
>>> + !strncmp(name, "bcd", 3) ||
>>> + !strncmp(name, "brinc", 5) ||
>>> + !strncmp(name, "bper", 4) ||
>>> + strstr(name, "ctr") ||
>>> + strstr(name, "tar"))
>>> + return NULL;
>> It would be good if 'bctr' was at least recognised as a branch, even
>> if we
>> can't determine the target. They are very common.
>
> We can not show arrow for this since we don't know the target location.
> can you please suggest how you intends perf to display bctr?
>
> bctr can be classified into two variants -- 'bctr' and 'bctrl'.
>
> 'bctr' will be considered as jump instruction but jump__parse() won't
> be able to find any target location and hence it will set target to
> UINT64_MAX which transform 'bctr' to 'bctr UINT64_MAX'. This
> looks misleading.
>
> bctrl will be considered as call instruction but call_parse() won't
> be able to find any target function and hence it won't show any
> navigation arrow for this instruction. Which is same as filter it
> beforehand.
>
>> It doesn't look like we have the opcode handy here? Could we get it
>> somehow?
>> That would make this a *lot* more robust.
>
> objdump prints machine code, but I don't know how difficult that would
> be to parse to get opcode.
Perf uses --no-show-raw with objdump and hence objdump output does not
show opcodes. So change in current objdump output may requires changes
in current parsing logic. Additionally I need to change tui as well to show
opcodes. This looks quite more work.
And this patchset is about enabling annotate for cross arch. So if you
really
need opcode with perf anotate, can we do it separately?
Please let me know your thoughts.
-Ravi
>
> -Ravi
>
>> cheers
>>
>
[toc] | [prev] | [next] | [standalone]
| From | Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-08 07:00 +0200 |
| Message-ID | <rSw3n-8s6-3@gated-at.bofh.it> |
| In reply to | #1435166 |
Hi Michael,
On Wednesday 06 July 2016 03:38 PM, Michael Ellerman wrote:
> Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> writes:
>
>> On Thursday 30 June 2016 11:51 AM, Michael Ellerman wrote:
>>> On Thu, 2016-06-30 at 11:44 +0530, Ravi Bangoria wrote:
>>>> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
>>>> index 36a5825..b87eac7 100644
>>>> --- a/tools/perf/util/annotate.c
>>>> +++ b/tools/perf/util/annotate.c
>>>> @@ -476,6 +481,125 @@ static int ins__cmp(const void *a, const void *b)
>>> ...
>>>> +
>>>> +static struct ins *ins__find_powerpc(const char *name)
>>>> +{
>>>> + int i;
>>>> + struct ins *ins;
>>>> + struct ins_ops *ops;
>>>> + static struct instructions_powerpc head;
>>>> + static bool list_initialized;
>>>> +
>>>> + /*
>>>> + * - Interested only if instruction starts with 'b'.
>>>> + * - Few start with 'b', but aren't branch instructions.
>>>> + * - Let's also ignore instructions involving 'ctr' and
>>>> + * 'tar' since target branch addresses for those can't
>>>> + * be determined statically.
>>>> + */
>>>> + if (name[0] != 'b' ||
>>>> + !strncmp(name, "bcd", 3) ||
>>>> + !strncmp(name, "brinc", 5) ||
>>>> + !strncmp(name, "bper", 4) ||
>>>> + strstr(name, "ctr") ||
>>>> + strstr(name, "tar"))
>>>> + return NULL;
>>> It would be good if 'bctr' was at least recognised as a branch, even if we
>>> can't determine the target. They are very common.
>> We can not show arrow for this since we don't know the target location.
>> can you please suggest how you intends perf to display bctr?
> Yeah I understand you can't show an arrow.
>
> I guess it could just be an unterminated arrow? But I'm not sure if
> that's easy to do with the way the UI is constructed. eg. something
> like:
>
> ld r12,0(r12)
> mtctr r12
> bctrl ------------------>
> ld r3,-32704(r2)
>
> But that's just an idea.
I've sent v4 which enables annotate for bctr' instructions.
for 'bctr', it will show down arrow(indicate jump) and 'bctrl' will show
right arrow(indicate call). But no navigation options will be provided.
By pressing Enter key on that, message will be shown that like
"Invalid target"
Please review it.
>> bctr can be classified into two variants -- 'bctr' and 'bctrl'.
>>
>> 'bctr' will be considered as jump instruction but jump__parse() won't
>> be able to find any target location and hence it will set target to
>> UINT64_MAX which transform 'bctr' to 'bctr UINT64_MAX'. This
>> looks misleading.
> Agreed.
>
>> bctrl will be considered as call instruction but call_parse() won't
>> be able to find any target function and hence it won't show any
>> navigation arrow for this instruction. Which is same as filter it
>> beforehand.
> OK.
>
> Maybe what I'm asking for is an enhancement and can be done later.
>
>>> It doesn't look like we have the opcode handy here? Could we get it somehow?
>>> That would make this a *lot* more robust.
>> objdump prints machine code, but I don't know how difficult that would
>> be to parse to get opcode.
> Normal objdump -d output includes the opcode, eg:
>
> c00000000000886c: 2c 2c 00 00 cmpdi r12,0
> ^^^^^^^^^^^
>
> The only thing you need to know is the endian and you can reconstruct
> the raw instruction.
>
> Then you can just decode the opcode, see how we do it in the kernel with
> eg. instr_is_relative_branch().
I'm sorry. I was thinking that you wants to show opcodes with perf
annotate. But you were asking to use opcode instead of parsing
instructions.
This looks like rewrite parsing code. I don't know whether there is any
library already available for this which we can directly use. I'm thinking
about this.
- Ravi
> cheers
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web