From: Dave Martin <Dave.Martin@arm.com>
To: Will Deacon <will@kernel.org>
Cc: linux-arch@vger.kernel.org, linux-man@vger.kernel.org,
"Michael Kerrisk \(man-pages\)" <mtk.manpages@gmail.com>,
linux-arm-kernel@lists.infradead.org,
Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [PATCH 13/14] prctl.2: Add SVE prctls (arm64)
Date: Tue, 26 May 2020 15:45:25 +0100 [thread overview]
Message-ID: <20200526144524.GR5031@arm.com> (raw)
In-Reply-To: <20200513211153.GB28594@willie-the-truck>
On Wed, May 13, 2020 at 10:11:54PM +0100, Will Deacon wrote:
> On Wed, May 13, 2020 at 03:02:00PM +0100, Dave Martin wrote:
> > On Wed, May 13, 2020 at 01:01:12PM +0200, Michael Kerrisk (man-pages) wrote:
> > > On 5/13/20 12:46 PM, Dave Martin wrote:
> > > > On Wed, May 13, 2020 at 09:43:52AM +0100, Will Deacon wrote:
> > > >> On Tue, May 12, 2020 at 05:36:58PM +0100, Dave Martin wrote:
[...]
> > > >>> +If
> > > >>> +.B PR_SVE_VL_INHERIT
> > > >>> +is also included in
> > > >>> +.IR arg2 ,
> > > >>> +it takes effect
> > > >>> +.I after
> > > >>> +this deferred change.
> > > >>
> > > >> I find this a bit hard to follow, since it's not clear to me whether the
> > > >> INHERIT flag is effectively set before or after the next execve(). In other
> > > >> words, if both PR_SVE_SET_VL_ONEXEC and PR_SVE_VL_INHERIT are specified,
> > > >> is the vector length preserved or reset on the next execve()?
> > > >
> > > > It makes no difference, because the ONEXEC handling takes priority over
> > > > the INHERIT handling. But either way INHERIT is never cleared by execve()
> > > > and will apply at subsequent execs().
> > > >
> > > > Explaining all this properly seems out of scope here. Maybe this should
> > > > be trimmed down rather than elaborated? Or perhaps just explain it in
> > > > terms of what the kernel does instead of futile attempts to make it
> > > > intuitive?
>
> Hmm, if we don't explain it in the man page then we should at least point
> people to somewhere where they can get the gory details, because I think
> they're necessary in order to use the prctl() request correctly. I'm still
> not confident that I understand the semantics of setting both
> PR_SVE_SET_VL_ONEXEC and PR_SVE_VL_INHERIT without reading the code, which
> may change.
On this point, can you review the following wording?
I simply enumerate the possible flag combinations now, rather than tying
myself in knots trying to describe the two flags independently.
Cheers
---Dave
--8<--
PR_SVE_SET_VL (since Linux 4.15, only on arm64)
Configure the thread's SVE vector length, as specified by (int)
arg2. Arguments arg3, arg4 and arg5 are ignored.
The bits of arg2 corresponding to PR_SVE_VL_LEN_MASK must be set
to the desired vector length in bytes. This is interpreted as
an upper bound: the kernel will select the greatest available
vector length that does not exceed the value specified. In par-
ticular, specifying SVE_VL_MAX (defined in <asm/sigcontext.h>)
for the PR_SVE_VL_LEN_MASK bits requests the maximum supported
vector length.
In addition, arg2 may include the following combinations of
flags:
0 Perform the change immediately. At the next execve(2) in
the thread, the vector length will be reset to the value
configured in /proc/sys/abi/sve_default_vector_length.
PR_SVE_VL_INHERIT
Perform the change immediately. Subsequent execve(2)
calls will preserve the new vector length.
PR_SVE_SET_VL_ONEXEC
Defer the change, so that it is performed at the next
execve(2) in the thread. Further execve(2) calls will
reset the vector length to the value configured in
/proc/sys/abi/sve_default_vector_length.
PR_SVE_SET_VL_ONEXEC | PR_SVE_VL_INHERIT
Defer the change, so that it is performed at the next
execve(2) in the thread. Further execve(2) calls will
preserve the new vector length.
In all cases, any previously pending deferred change is can-
celed.
The call fails with error EINVAL if SVE is not supported on the
platform, if arg2 is unrecognized or invalid, or the value in
the bits of arg2 corresponding to PR_SVE_VL_LEN_MASK is outside
the range SVE_VL_MIN..SVE_VL_MAX, or is not a multiple of 16.
On success, a nonnegative value is returned that describes the
selected configuration, which may differ from the current con-
figuration if PR_SVE_SET_VL_ONEXEC was specified. The value is
encoded in the same way as the return value of PR_SVE_GET_VL.
The configuration (including any pending deferred change) is
inherited across fork(2) and clone(2).
For more information, see the kernel source file Documenta-
tion/arm64/sve.rst (or Documentation/arm64/sve.txt before Linux
5.3).
Warning: Because the compiler or run-time environment may be
using SVE, using this call without the PR_SVE_SET_VL_ONEXEC flag
can lead to unpredicable behaviour in the calling process. The
conditions for using it safely are complex and system-dependent.
Don't use it unless you really know what you are doing.
-->8--
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-05-26 14:45 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 16:36 [PATCH 00/14] prctl.2 man page updates for Linux 5.6 Dave Martin
2020-05-12 16:36 ` [PATCH 01/14] prctl.2: tfix clarify that prctl can apply to threads Dave Martin
2020-05-13 8:30 ` Michael Kerrisk (man-pages)
2020-05-12 16:36 ` [PATCH 02/14] prctl.2: Add health warning Dave Martin
2020-05-13 10:10 ` Michael Kerrisk (man-pages)
2020-05-13 11:13 ` Dave Martin
2020-05-13 11:40 ` Michael Kerrisk (man-pages)
2020-05-13 11:41 ` Dave Martin
2020-05-12 16:36 ` [PATCH 03/14] prctl.2: tfix mis-description of thread ID values in procfs Dave Martin
2020-05-13 8:36 ` Michael Kerrisk (man-pages)
2020-05-12 16:36 ` [PATCH 04/14] prctl.2: srcfix add comments for navigation Dave Martin
2020-05-13 10:09 ` Michael Kerrisk (man-pages)
2020-05-13 10:56 ` Dave Martin
2020-05-13 11:03 ` Michael Kerrisk (man-pages)
2020-05-13 11:15 ` Dave Martin
2020-05-13 11:48 ` Michael Kerrisk (man-pages)
2020-05-13 11:51 ` Dave Martin
2020-05-12 16:36 ` [PATCH 05/14] prctl.2: tfix listing order of prctls Dave Martin
2020-05-13 10:10 ` Michael Kerrisk (man-pages)
2020-05-13 11:21 ` Dave Martin
2020-05-13 11:31 ` Michael Kerrisk (man-pages)
2020-05-13 11:45 ` Dave Martin
2020-05-12 16:36 ` [PATCH 06/14] prctl.2: ffix quotation mark tweaks Dave Martin
2020-05-13 10:11 ` Michael Kerrisk (man-pages)
2020-05-13 11:39 ` Dave Martin
2020-05-13 11:46 ` Michael Kerrisk (man-pages)
2020-05-13 11:51 ` Dave Martin
2020-05-12 16:36 ` [PATCH 07/14] prctl.2: Document removal of Intel MPX prctls Dave Martin
2020-05-12 16:41 ` Dave Hansen
2020-05-13 10:11 ` Michael Kerrisk (man-pages)
2020-05-12 16:36 ` [PATCH 08/14] prctl.2: Work around bogus constant "maxsig" in PR_SET_PDEATHSIG Dave Martin
2020-05-13 10:30 ` Michael Kerrisk (man-pages)
2020-05-12 16:36 ` [PATCH 09/14] prctl.2: tfix minor punctuation in SPECULATION_CTRL prctls Dave Martin
2020-05-13 10:31 ` Michael Kerrisk (man-pages)
2020-05-12 16:36 ` [PATCH 10/14] prctl.2: Add PR_SPEC_INDIRECT_BRANCH for " Dave Martin
2020-05-13 11:21 ` Michael Kerrisk (man-pages)
2020-05-13 11:49 ` Dave Martin
2020-05-13 12:06 ` Michael Kerrisk (man-pages)
2020-05-13 13:53 ` Dave Martin
2020-05-12 16:36 ` [PATCH 11/14] prctl.2: Add PR_SPEC_DISABLE_NOEXEC " Dave Martin
2020-05-12 16:36 ` [PATCH 12/14] prctl.2: Clarify the unsupported hardware case of EINVAL Dave Martin
2020-05-13 10:48 ` Michael Kerrisk (man-pages)
2020-05-12 16:36 ` [PATCH 13/14] prctl.2: Add SVE prctls (arm64) Dave Martin
2020-05-13 8:43 ` Will Deacon
2020-05-13 10:46 ` Dave Martin
2020-05-13 11:01 ` Michael Kerrisk (man-pages)
2020-05-13 14:02 ` Dave Martin
2020-05-13 21:11 ` Will Deacon
2020-05-18 16:37 ` Dave Martin
2020-05-26 14:45 ` Dave Martin [this message]
2020-05-12 16:36 ` [PATCH 14/14] prctl.2: Add PR_PAC_RESET_KEYS (arm64) Dave Martin
2020-05-13 7:25 ` Will Deacon
2020-05-13 14:36 ` Dave Martin
2020-05-13 21:00 ` Will Deacon
2020-05-18 16:11 ` Dave Martin
2020-05-18 16:29 ` Will Deacon
2020-05-13 11:28 ` [PATCH 00/14] prctl.2 man page updates for Linux 5.6 Michael Kerrisk (man-pages)
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=20200526144524.GR5031@arm.com \
--to=dave.martin@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--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: 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 NNTP newsgroup(s).