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 19:12:28 +0100	[thread overview]
Message-ID: <6ae65bdc-e418-deef-4b7e-17cca9b1b8d8@gnu.org> (raw)
In-Reply-To: <DM8PR11MB574932521ADFDF103F235A84DE209@DM8PR11MB5749.namprd11.prod.outlook.com>


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.

  reply	other threads:[~2022-01-26 18:12 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
2022-01-26 17:11             ` Metzger, Markus T
2022-01-26 18:12               ` Simon Sobisch [this message]
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=6ae65bdc-e418-deef-4b7e-17cca9b1b8d8@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).