From: Charlie Jenkins <charlie@rivosinc.com>
To: Alejandro Colomar <alx@kernel.org>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>, linux-man@vger.kernel.org
Subject: Re: [PATCH v2] prctl.2: Add PR_RISCV_SET_ICACHE_FLUSH_CTX
Date: Tue, 20 Feb 2024 18:23:58 -0800 [thread overview]
Message-ID: <ZdVevjnZVqNHaIqW@ghost> (raw)
In-Reply-To: <ZdFaStMt83D-i8yH@debian>
On Sun, Feb 18, 2024 at 02:15:53AM +0100, Alejandro Colomar wrote:
> Hi Charlie,
>
> On Mon, Feb 12, 2024 at 09:19:21PM -0500, Charlie Jenkins wrote:
> > I have proposed and documented the PR_RISCV_SET_ICACHE_FLUSH_CTX flag
> > for prctl(2) to LKML. It has been reviewed and is expected to land
> > during the Linux version 6.9 merge window. This adds the relevant
> > documentation from that patch.
> >
> > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> > ---
> > I have proposed and documented the PR_RISCV_SET_ICACHE_FLUSH_CTX
> > flag for prctl(2) to LKML. It has been reviewed and is expected to land
> > during the Linux version 6.9 merge window.
>
> Can you please ping when that happens? The below LGTM.
Sure thing. Thank you!
>
> Have a lovely night!
> Alex
>
> > ---
> > Changes in v2:
> > - Update formatting (Alejandro)
> > - Link to v1: https://lore.kernel.org/r/20240124-fencei_prctl-v1-1-0bddafcef331@rivosinc.com
> > ---
> > man2/prctl.2 | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 59 insertions(+)
> >
> > diff --git a/man2/prctl.2 b/man2/prctl.2
> > index f1604a7cb..32ce8474f 100644
> > --- a/man2/prctl.2
> > +++ b/man2/prctl.2
> > @@ -1147,6 +1147,65 @@ For further information, see the kernel source file
> > (or
> > .I Documentation/security/Yama.txt
> > before Linux 4.13).
> > +.\" prctl PR_RISCV_SET_ICACHE_FLUSH_CTX
> > +.TP
> > +.BR PR_RISCV_SET_ICACHE_FLUSH_CTX " (since Linux 6.9, RISC-V only)"
> > +Enable/disable icache flushing instructions in userspace.
> > +The context and the scope can be provided using
> > +.I arg2
> > +and
> > +.I arg3
> > +respectively.
> > +When scope is set to
> > +.B PR_RISCV_SCOPE_PER_PROCESS
> > +all threads in the process are permitted to emit icache flushing instructions.
> > +Whenever any thread in the process is migrated, the corresponding hart's
> > +icache will be guaranteed to be consistent with instruction storage.
> > +This does not enforce any guarantees outside of migration.
> > +If a thread modifies an instruction that another thread may attempt to
> > +execute, the other thread must still emit an icache flushing instruction
> > +before attempting to execute the potentially modified instruction.
> > +This must be performed by the user-space program.
> > +.IP
> > +In per-thread context (eg. scope is set to
> > +.BR PR_RISCV_SCOPE_PER_THREAD )
> > +only the thread calling this function is permitted to emit icache flushing
> > +instructions.
> > +When the thread is migrated, the corresponding hart's icache will be
> > +guaranteed to be consistent with instruction storage.
> > +.IP
> > +On kernels configured without SMP, this function is a nop as migrations across
> > +harts will not occur.
> > +.IP
> > +The following values for
> > +.I arg2
> > +can be specified:
> > +.RS
> > +.TP
> > +.BR PR_RISCV_CTX_SW_FENCEI_ON " (since Linux 6.9)"
> > +Allow fence.i in user space.
> > +.TP
> > +.BR PR_RISCV_CTX_SW_FENCEI_OFF " (since Linux 6.9)"
> > +Disallow fence.i in user space.
> > +All threads in a process will be affected when scope is set to
> > +.BR PR_RISCV_SCOPE_PER_PROCESS .
> > +Therefore, caution must be taken; use this flag only when you can guarantee
> > +that no thread in the process will emit fence.i from this point onward.
> > +.RE
> > +.IP
> > +The following values for
> > +.I arg3
> > +can be specified:
> > +.RS
> > +.TP
> > +.BR PR_RISCV_SCOPE_PER_PROCESS " (since Linux 6.9)"
> > +Ensure the icache of any thread in this process is coherent with instruction
> > +storage upon migration.
> > +.TP
> > +.BR PR_RISCV_SCOPE_PER_THREAD " (since Linux 6.9)"
> > +Ensure the icache of the current thread is coherent with instruction storage
> > +upon migration.
> > +.RE
> > .\" prctl PR_SET_SECCOMP
> > .TP
> > .BR PR_SET_SECCOMP " (since Linux 2.6.23)"
> >
> > ---
> > base-commit: a81e893f2b9316869e6098c3a079c30a48158092
> > change-id: 20240124-fencei_prctl-c24da2643379
> >
> > Best regards,
> > --
> > Charlie Jenkins <charlie@rivosinc.com>
> >
>
> --
> <https://www.alejandro-colomar.es/>
> Looking for a remote C programming job at the moment.
next prev parent reply other threads:[~2024-02-21 2:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 2:19 [PATCH v2] prctl.2: Add PR_RISCV_SET_ICACHE_FLUSH_CTX Charlie Jenkins
2024-02-18 1:15 ` Alejandro Colomar
2024-02-21 2:23 ` Charlie Jenkins [this message]
2024-06-26 21:24 ` Charlie Jenkins
2024-06-28 11:23 ` Alejandro Colomar
2024-06-29 2:37 ` Charlie Jenkins
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=ZdVevjnZVqNHaIqW@ghost \
--to=charlie@rivosinc.com \
--cc=alexghiti@rivosinc.com \
--cc=alx@kernel.org \
--cc=linux-man@vger.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 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.