public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Schimpe, Christina" <christina.schimpe@intel.com>
To: "Willgerodt, Felix" <felix.willgerodt@intel.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "eliz@gnu.org" <eliz@gnu.org>
Subject: RE: [PATCH v2 2/2] gdb, gdbserver, python, testsuite: Remove MPX.
Date: Mon, 24 Jun 2024 14:55:55 +0000	[thread overview]
Message-ID: <SN7PR11MB76387B009FB1CE2179E55AA9F9D42@SN7PR11MB7638.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MN2PR11MB456640129088DD4F8E62209F8ECF2@MN2PR11MB4566.namprd11.prod.outlook.com>

> > diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index
> > 675ee8d2e81..634a9a7ab85 100644
> > --- a/gdb/i387-tdep.c
> > +++ b/gdb/i387-tdep.c
> > @@ -818,30 +818,6 @@ static int xsave_xmm_avx512_offset[] =
> >    (xsave + (tdep)->xsave_layout.zmm_offset				\
> >     + xsave_xmm_avx512_offset[regnum - I387_XMM16_REGNUM (tdep)])
> >
> > -/* At xsave_bndregs_offset[REGNUM] you'll find the relative offset
> > -   within the BNDREGS region of the XSAVE extended state where the GDB
> > -   register BND0R + REGNUM is stored.  */
> > -
> > -static int xsave_bndregs_offset[] = {
> > -  0 * 16,			/* bnd0r...bnd3r registers.  */
> > -  1 * 16,
> > -  2 * 16,
> > -  3 * 16
> > -};
> > -
> > -#define XSAVE_BNDREGS_ADDR(tdep, xsave, regnum)
> > 	\
> > -  (xsave + (tdep)->xsave_layout.bndregs_offset
> 	\
> > -   + xsave_bndregs_offset[regnum - I387_BND0R_REGNUM (tdep)])
> > -
> > -static int xsave_bndcfg_offset[] = {
> > -  0 * 8,			/* bndcfg ... bndstatus.  */
> > -  1 * 8,
> > -};
> > -
> > -#define XSAVE_BNDCFG_ADDR(tdep, xsave, regnum)			\
> > -  (xsave + (tdep)->xsave_layout.bndcfg_offset			\
> > -   + xsave_bndcfg_offset[regnum - I387_BNDCFGU_REGNUM (tdep)])
> > -
> >  /* At xsave_avx512_k_offset[REGNUM] you'll find the relative offset
> >     within the K region of the XSAVE extended state where the AVX512
> >     opmask register K0 + REGNUM is stored.  */ @@ -944,8 +920,8 @@
> > i387_guess_xsave_layout (uint64_t xcr0, size_t xsave_size,
> >      {
> >        /* Intel CPUs supporting PKRU.  */
> >        layout.avx_offset = 576;
> > -      layout.bndregs_offset = 960;
> > -      layout.bndcfg_offset = 1024;
> > +      /* APX will take up the space left behind by the deprecated MPX
> > +	 registers.  */
> >        layout.k_offset = 1088;
> >        layout.zmm_h_offset = 1152;
> >        layout.zmm_offset = 1664;
> > @@ -964,19 +940,12 @@ i387_guess_xsave_layout (uint64_t xcr0, size_t
> > xsave_size,
> >      {
> >        /* Intel CPUs supporting AVX512.  */
> >        layout.avx_offset = 576;
> > -      layout.bndregs_offset = 960;
> > -      layout.bndcfg_offset = 1024;
> > +      /* APX will take up the space left behind by the deprecated MPX
> > +	 registers.  */
> >        layout.k_offset = 1088;
> >        layout.zmm_h_offset = 1152;
> >        layout.zmm_offset = 1664;
> >      }
> > -  else if (HAS_MPX (xcr0) && xsave_size == 1088)
> > -    {
> > -      /* Intel CPUs supporting MPX.  */
> > -      layout.avx_offset = 576;
> > -      layout.bndregs_offset = 960;
> > -      layout.bndcfg_offset = 1024;
> > -    }
> 
> Mhm, I wonder if that doesn't unnecessarily make reading corefiles from old
> CPUs worse than before. If the CPU has MPX as the highest supported
> feature and xsave_size is 1088, we now will return 0, and will therefore create
> some generic target description with the SSE mask, and therefore we will no
> longer be able to read the AVX registers (If I followed the code correctly).
> I wonder if keeping HAS_MPX and this if statement (minus the bnd
> stuff) here wouldn't be better. That way, we at least keep AVX support in
> corefiles for those older CPUs.

I agree there could be problems for HW supporting MPX as highest supported feature.
I wonder if it's not enough just to add "|| (xsave_size == 1088)" to the latest else if: 

~~~
  else if (HAS_AVX (xcr0) && (xsave_size == 832 || xsave_size == 1088))
     {
      /* Intel and AMD CPUs supporting AVX.  */
      layout.avx_offset = 576;
    }
~~~

But I'd also be ok with keeping HAS_MPX.

Christina
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  reply	other threads:[~2024-06-24 14:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 14:31 [PATCH v2 0/2] " Schimpe, Christina
2024-06-18 14:31 ` [PATCH v2 1/2] gdb, testsuite, python: Add missing imports Schimpe, Christina
2024-06-18 14:32 ` [PATCH v2 2/2] gdb, gdbserver, python, testsuite: Remove MPX Schimpe, Christina
2024-06-18 14:47   ` Eli Zaretskii
2024-06-19  9:24   ` Willgerodt, Felix
2024-06-24 14:55     ` Schimpe, Christina [this message]
2024-06-25  7:25       ` Willgerodt, Felix
2024-06-27  8:37         ` Schimpe, Christina

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=SN7PR11MB76387B009FB1CE2179E55AA9F9D42@SN7PR11MB7638.namprd11.prod.outlook.com \
    --to=christina.schimpe@intel.com \
    --cc=eliz@gnu.org \
    --cc=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.org \
    /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).