From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [209.51.188.92]) by sourceware.org (Postfix) with ESMTPS id EAF7C385EC42 for ; Wed, 26 Jan 2022 18:12:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EAF7C385EC42 Received: from [2001:470:142:3::e] (port=38662 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCmmV-00032K-E5; Wed, 26 Jan 2022 13:12:32 -0500 Received: from ip5f5a8abe.dynamic.kabel-deutschland.de ([95.90.138.190]:51776 helo=[192.168.111.41]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nCmmV-0006Fa-5D; Wed, 26 Jan 2022 13:12:31 -0500 Message-ID: <6ae65bdc-e418-deef-4b7e-17cca9b1b8d8@gnu.org> Date: Wed, 26 Jan 2022 19:12:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US To: "Metzger, Markus T" Cc: "gdb@sourceware.org" References: <40aebee9-d4ed-3a94-2341-cc17beeb6431@gnu.org> <290cd354-3de0-9c0a-5bd7-48cc2ba9173e@gnu.org> From: Simon Sobisch Subject: Re: How to use bts recording? In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2022 18:12:34 -0000 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.