public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: Luis Machado <luis.machado@arm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/8] gdb, gdbserver/aarch64-linux: Allow aarch64_sve_get_vq to return error
Date: Sat, 26 Nov 2022 01:42:10 +0000	[thread overview]
Message-ID: <87y1ry8pal.fsf@linaro.org> (raw)
In-Reply-To: <6b12308f-d54a-129c-b8d9-5d34d09bb5bb@arm.com>


Luis Machado <luis.machado@arm.com> writes:

> On 9/8/22 07:41, Thiago Jung Bauermann via Gdb-patches wrote:
>> If ptrace fails, aarch64_sve_get_vq assumes that SVE isn't supported.
>> Because in a subsequent change this function will need to be called from
>> low_new_thread (which can be called whe the inferior thread isn't stopped),
>> it will need to distinguish between ptrace errors due to SVE not being
>> supported from ptrace errors due to the inferior thread not being stopped.
>
> My understanding is that we will always be able to validate supported
> features when we start/attach to a process. So if, say, we detect SVE
> support through HWCAP's in the beginning of the debugging session,
> that will still hold for any thread that is spawned. What may change
> later on is the VL (still, very unlikely).

I ended up dropping this patch when I implemented your idea of leaving
the process' target description in place and using a thread target
description only for the cases where it is needed (i.e., when the
inferior supports SVE). It simplified the code a lot (thanks!), and it's
not necessary any more to change low_new_thread so this patch became
unnecessary.

As an aside, we don't check for SVE support using HWCAP, just by getting
the NT_ARM_SVE regset via ptrace.

> When a thread is spawned, it will inherit SVE settings from its
> parent. From the Linux Kernel SVE documentation:
>
>   In particular, on return from a fork() or clone(), the parent and new child
>   process or thread share identical SVE configuration, matching that of the
>   parent before the call.
>
> Is that something we can use here? I suppose there may be corner cases
> where the parent spawned a thread and changed its VL size etc.

It is, and for a while I had changes in my local branch which in the
event of a clone or fork event copied the original thread's target
description to the new one.

After a while I noticed that in practice it was redundant, because when
the new thread stops gdbserver calls aarch64_target::arch_update_tdesc
which also sets up the thread's target description so I removed the
changes for the clone and fork events.

> If we can't and a thread is running, we won't be able to tell the VL,
> but we have a state that is meant to indicate "unknown VL", don't we?
> Maybe I'm misremembering, but -1 used to indicate that.

We used -1 in struct gdbarch_info's id field, but it became unused in
commit “Fix thread's gdbarch when SVE vector length changes” and was
removed. We don't have an “unknown VL” state anymore. And with v2 of
these patches, we can always use ptrace to get the VL so it's not
needed.

-- 
Thiago

  reply	other threads:[~2022-11-26  1:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  6:41 [PATCH 0/8] gdbserver improvements for AArch64 SVE support Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 1/8] gdbserver: Add asserts in register_size and register_data functions Thiago Jung Bauermann
2022-09-20  7:36   ` Luis Machado
2022-11-26  1:36     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 2/8] gdbserver: Add thread parameter to linux_get_auxv and linux_get_hwcap Thiago Jung Bauermann
2022-09-20  7:43   ` Luis Machado
2022-11-26  1:37     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 3/8] gdb, gdbserver/aarch64-linux: Allow aarch64_sve_get_vq to return error Thiago Jung Bauermann
2022-09-20  8:07   ` Luis Machado
2022-11-26  1:42     ` Thiago Jung Bauermann [this message]
2022-09-08  6:41 ` [PATCH 4/8] gdbserver/linux-aarch64: Factor out function to get aarch64_features Thiago Jung Bauermann
2022-09-20  8:08   ` Luis Machado
2022-11-26  1:44     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 5/8] gdbserver: Move target description from being per-process to being per-thread Thiago Jung Bauermann
2022-09-20 11:21   ` Luis Machado
2022-11-26  1:47     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 6/8] gdbserver/linux-aarch64: When inferior stops, update its target description Thiago Jung Bauermann
2022-09-20  8:48   ` Luis Machado
2022-11-26  1:49     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 7/8] gdb/aarch64: Factor out most of the thread_architecture method Thiago Jung Bauermann
2022-09-20  8:52   ` Luis Machado
2022-11-26  1:49     ` Thiago Jung Bauermann
2022-09-08  6:41 ` [PATCH 8/8] gdb/aarch64: When remote debugging detect changes in the target description Thiago Jung Bauermann
2022-09-20  8:59   ` Luis Machado
2022-11-26  1:50     ` Thiago Jung Bauermann

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=87y1ry8pal.fsf@linaro.org \
    --to=thiago.bauermann@linaro.org \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.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).