RE: How to use bts recording?

"Metzger, Markus T via Gdb" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <DM8PR11MB5749DF60DCDA68CA80E7E0C7DE5E9@DM8PR11MB5749.namprd11.prod.outlook.com>
[re-adding gdb, which got removed accidentally]

Hello Simon,

>using Intel(R) Xeon(R) Gold 6136 CPU on 4.18.0-80.el8.x86_64
>   and Intel(R) Xeon(R) E5-2697 v4    on 3.10.0-514.16.1.el7.x86_64

Both kernels should support BTS and both processors should support BTS as well as PT.  Given the choice, I'd always go with PT as the recording overhead is significantly lower and the trace format is much more compact giving you a significantly longer history.


>How can I check for BTS support?

Hardware support is enumerated by cpuid and published by the kernel in /proc/cpuinfo under flags (look for 'bts').  Same for PT (look for 'intel_pt').

Kernel support for BTS would be checked by trying to enable it via perf_event_open as GDB does.  I'm not aware of some kernel feature enumeration that one could use, instead.

For PT, kernel support could be checked by looking at /sys/bus/event_source/devices/intel_pt/type, which gives the perf event type to be used for PT.  BTS does not need that as it is using a fixed type.


>I've temporarily adjusted /proc/sys/kernel/perf_event_paranoid but even
>-1 makes no difference.

This is one common pitfall and that's why GDB is checking it and giving instructions how to fix it.  The ' No such file or directory ' error you listed below may be a result of GDB trying to access that file and not finding it.

One common reason for BTS not working is that someone on the system (including yourself) is using PT.  The kernel does not allow them to be used at the same time, even by different processes.

For PT, I'd ask you to try 'perf record -e intel_pt//u -- true' so see if PT is working in general on your system for your user.  For BTS, I don't know of another tool we could try.

The error message should come from diagnose_perf_event_open_fail(), which means that the perf_event_open syscall failed.  Could you check if perf is working at all on your system for your user?

Regards,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.