public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Simon Sobisch <simonsobisch@gnu.org>
To: "Metzger, Markus T" <markus.t.metzger@intel.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: How to use bts recording?
Date: Wed, 26 Jan 2022 17:40:34 +0100	[thread overview]
Message-ID: <c0198a57-2ab3-d0a5-f1fe-622927037a0c@gnu.org> (raw)
In-Reply-To: <DM8PR11MB5749FBF8A35A9719B42F3AC4DE209@DM8PR11MB5749.namprd11.prod.outlook.com>


Am 26.01.2022 um 13:41 schrieb Metzger, Markus T:
> Hello Simon,
> 
>> PT has the downside of GDB having to be configured for that - which I
>> guess isn't common in distro versions - and somehow a manual build n the
>> 4.x kernel where libipt was available also did not pick it up (will try
>> to force it with a GDB 11.2 build soon, thanks for pointing out the
>> configure flags; I've looked in the tarball in the ./configure file but
>> that was in gdb/configure).
> 
> Let's work on that, then.  Fedora configures GDB with PT support and I thought RHEL would too.  Not sure at which version they started.  The Debian GDB maintainer promised to enable it but I have not checked, since.

I've just rechecked current Debian, the gdb binary, which shows as
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
has a link to /usr/lib/x86_64-linux-gnu/libipt.so.2, so I guess it is in 
there.

Running there actually does show a different message

(gdb) record btrace
Could not enable branch tracing for Thread 0x7ffff79833c0 (LWP 334): BTS 
support has been disabled for the target cpu.
(gdb) record btrace pt
Could not enable branch tracing for Thread 0x7ffff79833c0 (LWP 334): 
Failed to open /sys/bus/event_source/devices/intel_pt/type: No such file 
or directory.

But this machine is an AMD one...

Both messages are very clear - it would be nice to get those with GDB 
11.x, too (not sure if they are produced by a Debian patch or by a 
different code path).


>>>> 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').
>>
>> That may be the reason that it wasn't picked up; those aren't in there:
>>
>> flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
>> mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb
>> rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable
>> nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic
>> movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor
>> lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb
>> stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid avx512f avx512dq
>> rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt
>> xsavec xsaves arat pku ospke flush_l1d arch_capabilities
>> bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf
>>
>> flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
>> mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm
>> constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid
>> sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c
>> rdrand hypervisor lahf_lm abm 3dnowprefetch arat fsgsbase bmi1 hle avx2
>> smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt
> 
> Are you maybe using virtualization?

Rechecked with the server team: yes, the old RHEL kernel runs on Redhat 
Virtualization Manager; the newer one on VMware vSphere.

If someone knows how to enable Intel PT and/or BTS there I'd take a 
pointer and pass it to the server team.

> [...]
> 
> 
>> Thanks for trying to get this working, ideally we have some hints the
>> next time someone looks out for this and can add a better error message
>> for bts to GDB.
> 
> If this turns out to be something that GDB can check with reasonable effort,
> diagnosing this would certainly help.  Like we do for perf_event_paranoid.

I totally agree. The "only" missing parts are:

* How could GDB check this?
* Who applies this change, possibly directly after the bts error is 
recognized?

I'm available for testing a patched GDB 11.2 on both kernels :-)

> Regards,
> Markus.
> Intel Deutschland GmbH

Thanks again,
Simon

  reply	other threads:[~2022-01-26 16:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 15:18 Simon Sobisch
     [not found] ` <DM8PR11MB57499C939B8E0B461F7489ECDE5E9@DM8PR11MB5749.namprd11.prod.outlook.com>
     [not found]   ` <eabf7025-9866-fcb9-507e-a0e29c0970e9@gnu.org>
2022-01-24  9:27     ` Metzger, Markus T
2022-01-24  9:58       ` Simon Sobisch
2022-01-26 12:41         ` Metzger, Markus T
2022-01-26 16:40           ` Simon Sobisch [this message]
2022-01-26 17:11             ` Metzger, Markus T
2022-01-26 18:12               ` Simon Sobisch
2022-01-27 10:45                 ` Metzger, Markus T

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=c0198a57-2ab3-d0a5-f1fe-622927037a0c@gnu.org \
    --to=simonsobisch@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=markus.t.metzger@intel.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 read-only IMAP folder(s) and NNTP newsgroup(s).