Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500018 > unrolled thread

Intel PT: Address filtering not working. (cc me)

Started byMuhammad Usman Nadeem <usmanone@gmail.com>
First post2016-10-13 06:10 +0200
Last post2016-10-18 01:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Intel PT: Address filtering not working. (cc me) Muhammad Usman Nadeem <usmanone@gmail.com> - 2016-10-13 06:10 +0200
    Re: Intel PT: Address filtering not working. (cc me) Adrian Hunter <adrian.hunter@intel.com> - 2016-10-17 09:00 +0200
      Re: Intel PT: Address filtering not working. (cc me) Muhammad Usman Nadeem <usmanone@gmail.com> - 2016-10-18 01:20 +0200

#1500018 — Intel PT: Address filtering not working. (cc me)

FromMuhammad Usman Nadeem <usmanone@gmail.com>
Date2016-10-13 06:10 +0200
SubjectIntel PT: Address filtering not working. (cc me)
Message-ID<srFvb-6Bm-1@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Usage: sudo perf record -e intel_pt//u --filter='filter 0x400000 /
0x1000 @./a.out' ./a.out 123

a.out is my program (for loop, call using function pointer and use of
longjump) and 123 is the argument.

Output: [ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.171 MB perf.data ]


Output contains mostly MTC packets and no TNT or TIP packets.

I am on the latest mainline version of kernel (b67be92) and perf
version perf version 4.8.gb67be9.

What could be the problem?
I am using it wrong?

Thanks

[toc] | [next] | [standalone]


#1501635

FromAdrian Hunter <adrian.hunter@intel.com>
Date2016-10-17 09:00 +0200
Message-ID<sta3U-8rr-15@gated-at.bofh.it>
In reply to#1500018
On 13/10/16 04:11, Muhammad Usman Nadeem wrote:
> Usage: sudo perf record -e intel_pt//u --filter='filter 0x400000 /
> 0x1000 @./a.out' ./a.out 123
> 
> a.out is my program (for loop, call using function pointer and use of
> longjump) and 123 is the argument.
> 
> Output: [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 1.171 MB perf.data ]
> 
> 
> Output contains mostly MTC packets and no TNT or TIP packets.
> 
> I am on the latest mainline version of kernel (b67be92) and perf
> version perf version 4.8.gb67be9.
> 
> What could be the problem?
> I am using it wrong?

Yes.  The perf-record documentation says: "<file name> is the name of the
object file, <start> is the offset to the code to trace in that file"

So 0x400000 is well off the end of the file.  Try:

	 --filter='filter 0 / 0x1000 @./a.out'

Also note:

"The kernel may not be able to configure a trace region if it is not
within a single mapping.  MMAP events (or /proc/<pid>/maps) can be
examined to determine if that is a possibility."

You can see mmap events in using perf script with the --show-mmap-events option.

> 
> Thanks
> 
> 
> test.c
> 
> 
> #include <iostream>
> #include <setjmp.h>
> jmp_buf go;
> int foo()
> {
>     return 5;
> }
> int bar()
> {
> 	longjmp(go,1);
>     return 6;
> }
> 
> int main(int argc, char* argv[])
> {
> 	bool jumped = false;
> 	int (*ptr) ();
> 	// if arg then long jump
>     if (argc != 2) 
>     {
>     	ptr = foo;
>     } else {
> 	    ptr = bar;
>     }
> 
>     for (int i = 0; i < 50000000; ++i)
>     {
>         ++i;
>         --i;
>     }
>     setjmp(go);
> 
>     if (!jumped)
>     {
>     	jumped = true;
> 	    ptr();
>     } else {
> 	    std::cout <<  "AFTER long jump." << std::endl; 
>     }
>     return 0;
> }
> 

[toc] | [prev] | [next] | [standalone]


#1502578

FromMuhammad Usman Nadeem <usmanone@gmail.com>
Date2016-10-18 01:20 +0200
Message-ID<stpmh-25m-1@gated-at.bofh.it>
In reply to#1501635
I was providing it the Virtual Memory Address instead of offset in the
file. It is working now.

Thanks.


On Mon, Oct 17, 2016 at 2:50 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 13/10/16 04:11, Muhammad Usman Nadeem wrote:
>> Usage: sudo perf record -e intel_pt//u --filter='filter 0x400000 /
>> 0x1000 @./a.out' ./a.out 123
>>
>> a.out is my program (for loop, call using function pointer and use of
>> longjump) and 123 is the argument.
>>
>> Output: [ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 1.171 MB perf.data ]
>>
>>
>> Output contains mostly MTC packets and no TNT or TIP packets.
>>
>> I am on the latest mainline version of kernel (b67be92) and perf
>> version perf version 4.8.gb67be9.
>>
>> What could be the problem?
>> I am using it wrong?
>
> Yes.  The perf-record documentation says: "<file name> is the name of the
> object file, <start> is the offset to the code to trace in that file"
>
> So 0x400000 is well off the end of the file.  Try:
>
>          --filter='filter 0 / 0x1000 @./a.out'
>
> Also note:
>
> "The kernel may not be able to configure a trace region if it is not
> within a single mapping.  MMAP events (or /proc/<pid>/maps) can be
> examined to determine if that is a possibility."
>
> You can see mmap events in using perf script with the --show-mmap-events option.
>
>>
>> Thanks
>>
>>
>> test.c
>>
>>
>> #include <iostream>
>> #include <setjmp.h>
>> jmp_buf go;
>> int foo()
>> {
>>     return 5;
>> }
>> int bar()
>> {
>>       longjmp(go,1);
>>     return 6;
>> }
>>
>> int main(int argc, char* argv[])
>> {
>>       bool jumped = false;
>>       int (*ptr) ();
>>       // if arg then long jump
>>     if (argc != 2)
>>     {
>>       ptr = foo;
>>     } else {
>>           ptr = bar;
>>     }
>>
>>     for (int i = 0; i < 50000000; ++i)
>>     {
>>         ++i;
>>         --i;
>>     }
>>     setjmp(go);
>>
>>     if (!jumped)
>>     {
>>       jumped = true;
>>           ptr();
>>     } else {
>>           std::cout <<  "AFTER long jump." << std::endl;
>>     }
>>     return 0;
>> }
>>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web