Re: [PING 2][PATCH 0/8] Add SVE support for Aarch64 GDB

Alan Hayward
2018-05-29T14:35:31Z

> On 29 May 2018, at 14:06, Omair Javaid <omair.javaid@linaro.org> wrote:
>
> Hi Alan,
>
> I would like to help you review and get these patches accepted upstream.
>

Thanks!

> https://developer.arm.com/docs/ddi0584/latest/arm-architecture-reference-manual-supplement-the-scalable-vector-extension-sve-for-armv8-a
>
> Do you think above link has the latest documents on SVE?

Yes, that’ll give you the latest docs for SVE.

At the last GNU cauldron I gave a summary of SVE, including the
latest status on Linux, and the changes required for gdb:
https://slideslive.com/38902367/supporting-variable-register-sizes-for-the-arm-scalable-vector-extension-sve-in-gdb
The regcache slide is out of date - it’s an early plan for
detached_regcache/readable_regcache etc. Not sure if the video
is ok, as I dare not watch it :)

Also, there is also a nice delve into some simple programming
using SVE here:
http://developer.arm.com/hpc/a-sneak-peek-into-sve-and-vla-programming

Binutils fully supports SVE already.

(I should have put all this in the patch summary).

>
> Also can we test these patches with QEMU or any other virtualization model?

SVE support for QEMU is being worked on by Linaro. The changelog for
the latest release (2.12) says preliminary SVE support. I can look into
this a little more if you want - but I suspect it won’t be good enough yet.
(You’ll need to emulate a full linux kernel - otherwise qemu will fail
when it hits ptrace).

I’ve been using Arm’s Fast Models, but that’s a paid for product and sadly
not something I can easily give you access to.

What happens with other ports to obscure architectures for which most people
/ reviewers don't have access too?
At a minimum, the existing buildbot setup will confirm that nothing is
broken for normal aarch64.

>
> What is the status of corresponding ptrace changes in kernel? Are they
> already accepted which kernel versions will have that code?

SVE support went into Linux 4.15 in a single batch patches.

Easiest way to check is to look for NT_ARM_SVE in elf.h:
https://github.com/torvalds/linux/blob/v4.15/include/uapi/linux/elf.h

>
> I will go forward the say more on your patches in coming days.

Note, because this patch set doesn’t support gdbserver, it makes the last
two patches a little strange. I now have gdbserver support working too
(it’s just a few small changes). When I get to V2 of the set, I’ll
probably add in the gdbserver changes.

Thanks,
Alan.

>
> Thanks!
>
> On 29 May 2018 at 13:59, Alan Hayward <Alan.Hayward@arm.com> wrote:
>> Ping ping.
>>
>> Thanks,
>> Alan.
>>
>>> On 22 May 2018, at 09:34, Alan Hayward <Alan.Hayward@arm.com> wrote:
>>>
>>> Ping.
>>>
>>>
>>> Thanks,
>>> Alan.
>>>
>>>> On 11 May 2018, at 11:52, Alan Hayward <Alan.Hayward@arm.com> wrote:
>>>>
>>>> This set of patches adds gdb support for SVE on AArch64.
>>>>
>>>> SVE is the new vector extension for Aarch64. SVE is different in that the
>>>> length of a vector register is not fixed - it is can vary for different
>>>> hardware implementors. All code compiled for SVE is vector length agnostic.
>>>> The Linux kernel can then further restrict the vector length up to the
>>>> supported maximum for the hardware. Potentially different process and
>>>> threads can have different vector lengths, and they could change at any
>>>> time. However, in practice, we expect the vector length to remain constant
>>>> across the lifetime of a process.
>>>> This set of patches assumes the vector length will not change and either
>>>> warns once (when reading registers) or errors (when writing registers) if the
>>>> vector length has changed. A future set of patches will offer full support.
>>>>
>>>> This series does not support gdbserver. However, where it makes sense I have
>>>> commonised as much code as possible and have added the groundwork in
>>>> gdbserver. Enabling gdbserver should be a small set of additional patches.
>>>>
>>>> Core files and watchpoints are not yet supported.
>>>>
>>>> The vector length is read from ptrace and is required to create the target
>>>> description for the running process. There is no hardcoded SVE XML.
>>>>
>>>> The patches require recent linux header files for all the SVE ptrace macros.
>>>> To allow builds for older headers, I've added all required macros and
>>>> structures within ifdef checks. I'm not sure if this is the ideal solution.
>>>> When including kernel header code, I've not performed any reformatting (ie
>>>> they are not in GNU style).
>>>>
>>>> One of the later patches adds functions to gdbserver regcache so that I can
>>>> add common functionality that works on gdb and gdbserver.
>>>>
>>>> Given there are no working SVE systems available today, this was manually
>>>> tested on an Aarch64 SVE emulator running Ubuntu. In addition I've run make
>>>> check on X86 and Aarch64 builds for both unix and native-gdbserver.
>>>>
>>>>
>>>> Alan.
>>>>
>>>> Alan Hayward (8):
>>>> Add Aarch64 SVE target description
>>>> Function for reading the Aarch64 SVE vector length.
>>>> Add SVE register defines
>>>> Enable SVE for GDB
>>>> Add aarch64 psuedo help functions
>>>> Aarch64 SVE pseudo register support
>>>> Add methods to gdbserver regcache and raw_compare
>>>> Ptrace support for Aarch64 SVE
>>>>
>>>> gdb/Makefile.in | 1 +
>>>> gdb/aarch64-linux-nat.c | 60 +++++-
>>>> gdb/aarch64-linux-tdep.c | 5 +-
>>>> gdb/aarch64-tdep.c | 402 +++++++++++++++++++++++-------------
>>>> gdb/aarch64-tdep.h | 12 +-
>>>> gdb/arch/aarch64.c | 12 +-
>>>> gdb/arch/aarch64.h | 37 +++-
>>>> gdb/configure.nat | 2 +-
>>>> gdb/doc/gdb.texinfo | 4 +
>>>> gdb/features/aarch64-sve.c | 158 ++++++++++++++
>>>> gdb/gdbserver/Makefile.in | 1 +
>>>> gdb/gdbserver/configure.srv | 1 +
>>>> gdb/gdbserver/linux-aarch64-tdesc.c | 3 +-
>>>> gdb/gdbserver/regcache.c | 55 ++++-
>>>> gdb/gdbserver/regcache.h | 8 +
>>>> gdb/nat/aarch64-sve-linux-ptrace.c | 315 ++++++++++++++++++++++++++++
>>>> gdb/nat/aarch64-sve-linux-ptrace.h | 193 +++++++++++++++++
>>>> gdb/regcache.c | 17 ++
>>>> gdb/regcache.h | 2 +
>>>> 19 files changed, 1122 insertions(+), 166 deletions(-)
>>>> create mode 100644 gdb/features/aarch64-sve.c
>>>> create mode 100644 gdb/nat/aarch64-sve-linux-ptrace.c
>>>> create mode 100644 gdb/nat/aarch64-sve-linux-ptrace.h
>>>>
>>>> --
>>>> 2.15.1 (Apple Git-101)
>>>>
>>>
>>