public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30818] New: GDB + GDBserver doesn't set AVX512 registers properly
@ 2023-09-01 14:39 simon.marchi at polymtl dot ca
  2023-09-02  2:14 ` [Bug gdb/30818] " cvs-commit at gcc dot gnu.org
  2023-09-02  2:15 ` simark at simark dot ca
  0 siblings, 2 replies; 3+ messages in thread
From: simon.marchi at polymtl dot ca @ 2023-09-01 14:39 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30818

            Bug ID: 30818
           Summary: GDB + GDBserver doesn't set AVX512 registers properly
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at polymtl dot ca
  Target Milestone: ---

On a machine with AVX512 support (AMD EPYC 9634), I see:

$ make check TESTS="gdb.arch/i386-avx512.exp"
RUNTESTFLAGS="--target_board=native-gdbserver"
...
FAIL: gdb.arch/i386-avx512.exp: check contents of zmm_data[16] after writing
ZMM regs
...

I can reproduce more simply with (after connecting to gdbserver):

(gdb) print $zmm16.v8_int64 
$1 = {0, 0, 0, 0, 0, 0, 0, 0}
(gdb) print $zmm16.v8_int64 = {11,22,33,44,55,66,77,88}
$2 = {11, 22, 33, 44, 55, 66, 77, 88}
(gdb) print $zmm16.v8_int64
$3 = {11, 22, 33, 44, 55, 66, 77, 88}
(gdb) step
5               ++x;
(gdb) print $zmm16.v8_int64
$4 = {11, 22, 77, 88, 0, 0, 0, 0}

It looks like writing to the local regcache in GDB worked fine, but the
writeback to gdbserver didn't work fine.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug gdb/30818] GDB + GDBserver doesn't set AVX512 registers properly
  2023-09-01 14:39 [Bug gdb/30818] New: GDB + GDBserver doesn't set AVX512 registers properly simon.marchi at polymtl dot ca
@ 2023-09-02  2:14 ` cvs-commit at gcc dot gnu.org
  2023-09-02  2:15 ` simark at simark dot ca
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-02  2:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30818

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Marchi <simark@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=41770089162edd23ea7ae33b7952585316accde5

commit 41770089162edd23ea7ae33b7952585316accde5
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Fri Sep 1 14:12:07 2023 -0400

    gdbserver: i387_cache_to_xsave: fix copy dest of zmm registers

    On a machine with AVX512 support (AMD EPYC 9634), I see these failures:

        $ make check TESTS="gdb.arch/i386-avx512.exp"
RUNTESTFLAGS="--target_board=native-gdbserver"
        ...
        FAIL: gdb.arch/i386-avx512.exp: check contents of zmm_data[16] after
writing ZMM regs
        FAIL: gdb.arch/i386-avx512.exp: check contents of zmm_data[17] after
writing ZMM regs
        FAIL: gdb.arch/i386-avx512.exp: check contents of zmm_data[18] after
writing ZMM regs
        ...

    The problem can be reduced to:

        (gdb) print $zmm16.v8_int64
        $1 = {0, 0, 0, 0, 0, 0, 0, 0}
        (gdb) print $zmm16.v8_int64 = {11,22,33,44,55,66,77,88}
        $2 = {11, 22, 33, 44, 55, 66, 77, 88}
        (gdb) print $zmm16.v8_int64
        $3 = {11, 22, 33, 44, 55, 66, 77, 88}
        (gdb) step
        5               ++x;
        (gdb) print $zmm16.v8_int64
        $4 = {11, 22, 77, 88, 0, 0, 0, 0}

    Writing to the local regcache in GDB works fine, but the writeback to
    gdbserver (which happens when resuming / stepping) doesn't work (the
    code being stepped doesn't touch AVX registers, so we don't expect the
    value of zmm16 to change when stepping).

    The problem is on the gdbserver side, the zmmh and ymmh portions of the
    zmm register are not memcpied at the right place in the xsave buffer.  Fix
    that.  Note now how the two modified memcpy calls match the memcmp calls
    just above them.

    With this patch, gdb.arch/i386-avx512.exp passes completely for me.

    Change-Id: I22c417e0f5e88d4bc635a0f08f8817a031c76433
    Reviewed-by: John Baldwin <jhb@FreeBSD.org>
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30818

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug gdb/30818] GDB + GDBserver doesn't set AVX512 registers properly
  2023-09-01 14:39 [Bug gdb/30818] New: GDB + GDBserver doesn't set AVX512 registers properly simon.marchi at polymtl dot ca
  2023-09-02  2:14 ` [Bug gdb/30818] " cvs-commit at gcc dot gnu.org
@ 2023-09-02  2:15 ` simark at simark dot ca
  1 sibling, 0 replies; 3+ messages in thread
From: simark at simark dot ca @ 2023-09-02  2:15 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30818

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |simark at simark dot ca

--- Comment #2 from Simon Marchi <simark at simark dot ca> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-02  2:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-01 14:39 [Bug gdb/30818] New: GDB + GDBserver doesn't set AVX512 registers properly simon.marchi at polymtl dot ca
2023-09-02  2:14 ` [Bug gdb/30818] " cvs-commit at gcc dot gnu.org
2023-09-02  2:15 ` simark at simark dot ca

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).