Message ID | 20221021121308.294059-1-markus.t.metzger@intel.com |
---|---|
State | Committed |
Commit | d9757bcd43534875d2003962944d3d130289f82c |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 70DCF385E001 for <patchwork@sourceware.org>; Fri, 21 Oct 2022 13:17:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70DCF385E001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666358251; bh=S4brZd1NfW5wjlhe6hv/BR4pDnLOlLSpotjARfsKmfQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tDSAF7XPg5gk85gwGEUJFSWYvOFnf6bS1OwiP9ZaalD2DReNRajrz3yC1NLXCmzzP 5x8fo5ZK7DtWax4xoT72ZZh9bFH2tiu8ZTQgZ0ysq4eg5PFq4+ZxbB0YvFsnnTVPTh p4XjtRrTAwUkvw8rSWDQ+giYxcCdy9aIHlrnZRcI= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by sourceware.org (Postfix) with ESMTPS id F1B863856DC0 for <gdb-patches@sourceware.org>; Fri, 21 Oct 2022 13:17:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F1B863856DC0 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="393301096" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="393301096" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 06:17:05 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="755796109" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="755796109" Received: from labpc2407.iul.intel.com (HELO localhost) ([172.28.48.175]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 06:17:04 -0700 To: gdb-patches@sourceware.org Subject: [PATCH] gdb, btrace: fix family and model computation Date: Fri, 21 Oct 2022 14:13:08 +0200 Message-Id: <20221021121308.294059-1-markus.t.metzger@intel.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Markus Metzger via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Markus Metzger <markus.t.metzger@intel.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
gdb, btrace: fix family and model computation
|
|
Commit Message
Metzger, Markus T
Oct. 21, 2022, 12:13 p.m. UTC
In gdb/nat/linux-btrace.c:btrace_this_cpu() we initialize the cpu structure given to the libipt btrace decoder. We only consider the extended model field for family 0x6 and forget about family 0xf and we don't consider the extended family field. Fix it. --- gdb/nat/linux-btrace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Comments
>>>>> "Markus" == Markus Metzger via Gdb-patches <gdb-patches@sourceware.org> writes:
Markus> In gdb/nat/linux-btrace.c:btrace_this_cpu() we initialize the cpu
Markus> structure given to the libipt btrace decoder.
Markus> We only consider the extended model field for family 0x6 and forget about
Markus> family 0xf and we don't consider the extended family field. Fix it.
You should probably just self-approve this.
Markus> cpu.family = (cpuid >> 8) & 0xf;
Markus> - cpu.model = (cpuid >> 4) & 0xf;
Markus> + if (cpu.family == 0xf)
Markus> + cpu.family += (cpuid >> 20) & 0xff;
Markus> - if (cpu.family == 0x6)
Markus> + cpu.model = (cpuid >> 4) & 0xf;
Markus> + if ((cpu.family == 0x6) || ((cpu.family & 0xf) == 0xf))
Markus> cpu.model += (cpuid >> 12) & 0xf0;
I wonder if these magic numbers have #defines anywhere we could use.
Tom
Hello Tom, >Markus> cpu.family = (cpuid >> 8) & 0xf; >Markus> - cpu.model = (cpuid >> 4) & 0xf; >Markus> + if (cpu.family == 0xf) >Markus> + cpu.family += (cpuid >> 20) & 0xff; > >Markus> - if (cpu.family == 0x6) >Markus> + cpu.model = (cpuid >> 4) & 0xf; >Markus> + if ((cpu.family == 0x6) || ((cpu.family & 0xf) == 0xf)) >Markus> cpu.model += (cpuid >> 12) & 0xf0; > >I wonder if these magic numbers have #defines anywhere we could use. In fact, bb368aad297 gprofng: a new GNU profiler added the same functionality, so now we have two versions of it. I tried to unify them (attached) but wasn't able to pass gprofng tests on my box. They already fail without my changes. I could replace this patch with the attached two. What do you think? 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
> In fact, > bb368aad297 gprofng: a new GNU profiler > added the same functionality, so now we have two versions of it. I tried > to unify them (attached) but wasn't able to pass gprofng tests on my box. > They already fail without my changes. > I could replace this patch with the attached two. What do you think? I wouldn't hold up your patch for this, but if you wanted to coordinate with the gprofng folks and get this new patch in, it does seem better to consolidate the code. Tom
Thanks, Tom, >> In fact, >> bb368aad297 gprofng: a new GNU profiler >> added the same functionality, so now we have two versions of it. I tried >> to unify them (attached) but wasn't able to pass gprofng tests on my box. >> They already fail without my changes. > >> I could replace this patch with the attached two. What do you think? > >I wouldn't hold up your patch for this, but if you wanted to coordinate >with the gprofng folks and get this new patch in, it does seem better to >consolidate the code. I'll push this patch, then, so we get the fix. Then, I'll send out the other two to consolidate if there is interest from gprofng. 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
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c index 4911630ba5c..a951f3b56aa 100644 --- a/gdb/nat/linux-btrace.c +++ b/gdb/nat/linux-btrace.c @@ -84,9 +84,11 @@ btrace_this_cpu (void) cpu.vendor = CV_INTEL; cpu.family = (cpuid >> 8) & 0xf; - cpu.model = (cpuid >> 4) & 0xf; + if (cpu.family == 0xf) + cpu.family += (cpuid >> 20) & 0xff; - if (cpu.family == 0x6) + cpu.model = (cpuid >> 4) & 0xf; + if ((cpu.family == 0x6) || ((cpu.family & 0xf) == 0xf)) cpu.model += (cpuid >> 12) & 0xf0; } }