From: Mark Brown <broonie@kernel.org> To: Dave Martin <Dave.Martin@arm.com> Cc: Will Deacon <will@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Oleg Nesterov <oleg@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Doug Anderson <dianders@chromium.org> Subject: Re: [PATCH] arm64/sve: Lower the maximum allocation for the SVE ptrace regset Date: Mon, 5 Feb 2024 17:41:47 +0000 [thread overview] Message-ID: <ZcEd2zU/JpeIwn5f@finisterre.sirena.org.uk> (raw) In-Reply-To: <ZcEW3y0IlEctOYBA@e133380.arm.com> [-- Attachment #1.1: Type: text/plain, Size: 2070 bytes --] On Mon, Feb 05, 2024 at 05:11:59PM +0000, Dave Martin wrote: > On Sat, Feb 03, 2024 at 12:16:49PM +0000, Mark Brown wrote: > > We could also teach the ptrace core about runtime discoverable regset sizes > > but that would be a more invasive change and this is being observed in > > practical systems. > This is not hard at all: see > 27e64b4be4b8 ("regset: Add support for dynamically sized regsets") > But since this is precisely what was ripped out, I guess adding it back > may be controversial (?) Also just that people might want to backport and while it's not super *hard* I tend to prefer to do something as minimal as possible as a fix, the less we do the less the chances that we mess up. > > We should probably also use the actual architectural limit for the > > bitmasks we use in the VL enumeration code, though that's both a little > > bit more involved and less immediately a problem. > Since these masks are 64 bytes each and rarely accessed, it seemed > pointless complexity to make them resizeable... I was suggesting making them use the architectural maximum rather than making them dynamic. > > +#define ARCH_SVE_VQ_MAX 16 > > #define SME_VQ_MAX 16 > Ack, though part of the reason for not doing this was to discourage > people from allocating statically sized buffers in general. I was going to do a patch adding a comment to the header noting that this is not actually the architectural maximum since at present it's a bit of a landmine, people who have some idea of the architecture likely have a rough idea what sort of allocation size is needed for the maximum SVE state and are likely to not double check the value provided (I think that's what happened with the refactoring to remove the dynamic sizing). A comment in the header is still very missable but it'd be something. > If the kernel is now juggling two #defines for the maximum vector size, > this feels like it may seed bitrot... Ideally we'd just not have the existing define externally but it's there and it's been used. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org> To: Dave Martin <Dave.Martin@arm.com> Cc: Will Deacon <will@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Oleg Nesterov <oleg@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Doug Anderson <dianders@chromium.org> Subject: Re: [PATCH] arm64/sve: Lower the maximum allocation for the SVE ptrace regset Date: Mon, 5 Feb 2024 17:41:47 +0000 [thread overview] Message-ID: <ZcEd2zU/JpeIwn5f@finisterre.sirena.org.uk> (raw) In-Reply-To: <ZcEW3y0IlEctOYBA@e133380.arm.com> [-- Attachment #1: Type: text/plain, Size: 2070 bytes --] On Mon, Feb 05, 2024 at 05:11:59PM +0000, Dave Martin wrote: > On Sat, Feb 03, 2024 at 12:16:49PM +0000, Mark Brown wrote: > > We could also teach the ptrace core about runtime discoverable regset sizes > > but that would be a more invasive change and this is being observed in > > practical systems. > This is not hard at all: see > 27e64b4be4b8 ("regset: Add support for dynamically sized regsets") > But since this is precisely what was ripped out, I guess adding it back > may be controversial (?) Also just that people might want to backport and while it's not super *hard* I tend to prefer to do something as minimal as possible as a fix, the less we do the less the chances that we mess up. > > We should probably also use the actual architectural limit for the > > bitmasks we use in the VL enumeration code, though that's both a little > > bit more involved and less immediately a problem. > Since these masks are 64 bytes each and rarely accessed, it seemed > pointless complexity to make them resizeable... I was suggesting making them use the architectural maximum rather than making them dynamic. > > +#define ARCH_SVE_VQ_MAX 16 > > #define SME_VQ_MAX 16 > Ack, though part of the reason for not doing this was to discourage > people from allocating statically sized buffers in general. I was going to do a patch adding a comment to the header noting that this is not actually the architectural maximum since at present it's a bit of a landmine, people who have some idea of the architecture likely have a rough idea what sort of allocation size is needed for the maximum SVE state and are likely to not double check the value provided (I think that's what happened with the refactoring to remove the dynamic sizing). A comment in the header is still very missable but it'd be something. > If the kernel is now juggling two #defines for the maximum vector size, > this feels like it may seed bitrot... Ideally we'd just not have the existing define externally but it's there and it's been used. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-02-05 17:42 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-03 12:16 [PATCH] arm64/sve: Lower the maximum allocation for the SVE ptrace regset Mark Brown 2024-02-03 12:16 ` Mark Brown 2024-02-05 17:02 ` Doug Anderson 2024-02-05 17:02 ` Doug Anderson 2024-02-09 17:11 ` Will Deacon 2024-02-09 17:11 ` Will Deacon 2024-02-09 17:40 ` Mark Brown 2024-02-09 17:40 ` Mark Brown 2024-02-05 17:11 ` Dave Martin 2024-02-05 17:11 ` Dave Martin 2024-02-05 17:41 ` Mark Brown [this message] 2024-02-05 17:41 ` Mark Brown 2024-02-07 12:23 ` Dave Martin 2024-02-07 12:23 ` Dave Martin 2024-02-07 13:09 ` Mark Brown 2024-02-07 13:09 ` Mark Brown 2024-02-07 13:51 ` Dave Martin 2024-02-07 13:51 ` Dave Martin 2024-02-07 15:07 ` Mark Brown 2024-02-07 15:07 ` Mark Brown 2024-02-12 16:50 ` Dave Martin 2024-02-12 16:50 ` Dave Martin 2024-02-12 17:09 ` Mark Brown 2024-02-12 17:09 ` Mark Brown
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=ZcEd2zU/JpeIwn5f@finisterre.sirena.org.uk \ --to=broonie@kernel.org \ --cc=Dave.Martin@arm.com \ --cc=catalin.marinas@arm.com \ --cc=dianders@chromium.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=oleg@redhat.com \ --cc=viro@zeniv.linux.org.uk \ --cc=will@kernel.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.