Re: How to use bts recording?

Simon Sobisch via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
Am 26.01.2022 um 18:11 schrieb Metzger, Markus T:
> Hello Simon,
> 
>>> 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.
> 
> Here's the problem.  AFAIK neither BTS nor PT are virtualized.  This is simply
> missing enabling in hypervisors.  They do properly indicate this by omitting
> the respective cpuid enumeration.  This results in an EOPNOTSUPP when
> GDB tries to enable it, which is printed by GDB.

I see - but something is still not ideal.
At least on this machine GDB 11.1 said:

(gdb) record btrace bts
Could not enable branch tracing for Thread 0x7ffff7fe4740 (LWP 2756): 
**Failed to start recording: Operation not supported**

While the Debian GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git reports

Could not enable branch tracing for Thread 0x7ffff79833c0 (LWP 334): 
**BTS support has been disabled for the target cpu**

That's a clear message, I like that.

Is this a special Debian patch or is because of the target cpu being AMD?
Is there a path that should be taken when the OS reports EOPNOTSUPP?

A message similar to the one above would be useful.

> I'm afraid that's a fairly common problem, these days, but I don't see how
> GDB could check that it is running in a guest OS and that the hypervisor did
> not virtualize PT or BTS.

As you've said: use of virtualized environments is quite common, so it 
may be reasonable to adjust the docs to at least hint at that issue.

I suggest changing

- Hardware-supported instruction recording, supported on Intel processors
+ Hardware-supported instruction recording, supported on Intel 
processors if not running in a virtual machine.

... or something like that.


BTW: rechecked newer RHEL:
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-12.el8 also has the link to 
libipt and so also says
Failed to open /sys/bus/event_source/devices/intel_pt/type

[note: that message possibly could hint at "Intel PT not available"]

Also: not sure if libipt is the one that is checking that directory, but 
possibly GDB could do this _before_ printing
 > Intel Processor Trace support was disabled at compile time.

... because this led me to believe "just reconfigure and possible 
install libipt before and everything will be fine" - but if I had done 
this the only result would have been another error message.
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.