public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: "Markus T Metzger" <markus.t.metzger@intel.com>
Cc: <simon.marchi@ericsson.com>,<tim.wiederhake@intel.com>,
	"GDB" <gdb-patches@sourceware.org>
Subject: RE: [PATCH] x86-64: fix ZMM register state tracking
Date: Tue, 25 Sep 2018 07:47:00 -0000	[thread overview]
Message-ID: <5BA9E7EE02000078001EB704@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <A78C989F6D9628469189715575E55B236B35D702@IRSMSX104.ger.corp.intel.com>

>>> On 24.09.18 at 19:19, <markus.t.metzger@intel.com> wrote:
>> --- a/gdb/i387-tdep.c
>> +++ b/gdb/i387-tdep.c
>> @@ -923,7 +923,8 @@ i387_supply_xsave (struct regcache *regc
>>    enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>>    struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
>>    const gdb_byte *regs = (const gdb_byte *) xsave;
>> -  int i;
>> +  int i, zmm_endlo_regnum = I387_ZMM0H_REGNUM (tdep)
>> +			    + std::min (tdep->num_zmm_regs, 16);
> 
> It would be nice to comment on this magic 16 and the min operation.
> It's how XSAVE organizes things but it isn't entirely intuitive.

Okay, I can accept the desire for a (new) comment here, albeit it pretty
much goes along the lines of what I say further down.

>> @@ -1002,7 +1003,8 @@ i387_supply_xsave (struct regcache *regc
>>        return;
>> 
>>      case avx512_zmm_h:
>> -      if ((clear_bv & (X86_XSTATE_ZMM_H | X86_XSTATE_ZMM)))
>> +      if ((clear_bv & (regnum < zmm_endlo_regnum ? X86_XSTATE_ZMM_H
>> +						 : X86_XSTATE_ZMM)))
> 
> A comment that XSAVE stores the lower 16 registers in a different place
> than the higher 16 registers and also guards them by different XCR0 bits
> would be nice.

Such a comment would have been appropriate already prior to my patch.
I have to admit that I'm not inclined to invest time in improving
pre-existing (lack of) commentary, the more that how to exactly word
this might be controversial. If that's really a requirement, then I'd
abandon the patch (perhaps for someone else to pick up), maintaining it
locally until the bug has been fixed upstream by whatever means. This
is even more so that the extra time I'll have to put into playing with
Simon's test case is also nothing I really have time for (but I'll try to
find the time nevertheless).

> We hid the different places behind those XSAVE_AVX512_ZMM_H_ADDR
> macros but there's nothing similar for the guard bits.  Maybe add macros
> for the guard check, as well?

Same here - nothing that this patch really changes.

>> @@ -1135,6 +1135,9 @@ i387_supply_xsave (struct regcache *regc
>>  	    }
>>  	  else
>>  	    {
>> +	      for (i = zmm_endlo_regnum; i < I387_ZMMENDH_REGNUM (tdep); i++)
>> +		regcache->raw_supply (i,
>> +				      XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i));
> 
> This covers the upper halves of zmm16 to zmm31.  Looking at the function it looks
> like the lower halves are covered in separate cases avx512_ymmh_avx512 and
> avx512_xmmh_avx512.  Maybe reflect this in the comment?  It currently suggests
> that it handles the entire upper 16 registers.

Same here - the split among code regions has been there before (also
for e.g. the YMM register lower and upper halves).

Irrespective of my mostly negative responses thanks for your
comments, Jan


  reply	other threads:[~2018-09-25  7:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 13:23 Jan Beulich
2018-09-07 23:13 ` Simon Marchi
2018-09-10  6:25   ` Jan Beulich
2018-09-10 13:01     ` Simon Marchi
2018-09-18 13:38       ` Jan Beulich
2018-09-25  3:29         ` Simon Marchi
2018-09-25 15:04           ` Jan Beulich
2018-10-02 19:20             ` Simon Marchi
2018-10-03 14:30               ` Jan Beulich
2018-10-03 14:41                 ` Simon Marchi
2018-09-11 10:34 ` Pedro Alves
2018-09-11 11:34   ` Jan Beulich
2018-09-24 17:19 ` Metzger, Markus T
2018-09-25  7:47   ` Jan Beulich [this message]
2018-10-10 15:12 ` [PATCH v2] " Jan Beulich
2018-10-29 10:31 ` Ping: " Jan Beulich
2018-10-31 14:00   ` Simon Marchi
2018-11-07  9:07     ` Metzger, Markus T
2018-11-07  9:12       ` Jan Beulich
2018-11-07 13:18         ` Metzger, Markus T
2018-11-07 13:25           ` Jan Beulich
2018-11-07 14:18             ` Simon Marchi
2018-11-08 11:16               ` Jan Beulich
2018-11-08 16:24                 ` Simon Marchi

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=5BA9E7EE02000078001EB704@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    --cc=simon.marchi@ericsson.com \
    --cc=tim.wiederhake@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).