lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc82c938-def3-4df6-9fc9-fc321af7d54a@iscas.ac.cn>
Date: Thu, 24 Jul 2025 05:55:54 +0800
From: Vivian Wang <wangruikang@...as.ac.cn>
To: Drew Fustini <fustini@...nel.org>, Palmer Dabbelt <palmer@...belt.com>,
 Björn Töpel <bjorn@...osinc.com>,
 Alexandre Ghiti <alex@...ti.fr>, Paul Walmsley <paul.walmsley@...ive.com>,
 Samuel Holland <samuel.holland@...ive.com>,
 Drew Fustini <dfustini@...storrent.com>, Andy Chiu <andybnac@...il.com>,
 Conor Dooley <conor.dooley@...rochip.com>, linux-riscv@...ts.infradead.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] riscv: Add sysctl to control discard of vstate during
 syscall

On 7/19/25 11:39, Drew Fustini wrote:

> From: Drew Fustini <dfustini@...storrent.com>
>
> Clobbering the vector registers can significantly increase system call
> latency for some implementations. To mitigate this performance impact, a
> policy mechanism is provided to administrators, distro maintainers, and
> developers to control vector state discard in the form of a sysctl knob:

So I had an idea: Is it possible to avoid repeatedly discarding the
state on every syscall by setting VS to Initial after discarding, and
avoiding discarding when VS is Initial? So:

if (VS == Clean || VS == Dirty) {
    clobber;
    VS = Initial;
}

This would avoid this problem with syscall-heavy user programs while
adding minimum overhead for everything else.

Note that I haven't checked closely on how VS = Initial is currently
used in Linux. This might require changes to vector init make the really
first-time initial state and the after-syscall initial state the same.
Or maybe I misunderstood entirely.

Vivian "dramforever" Wang

> /proc/sys/abi/riscv_v_vstate_discard
>
> Valid values are:
>
> 0: Do not discard vector state during syscall
> 1: Discard vector state during syscall
>
> The initial state is controlled by CONFIG_RISCV_ISA_V_VSTATE_DISCARD.
>
> Fixes: 9657e9b7d253 ("riscv: Discard vector state on syscalls")
> Signed-off-by: Drew Fustini <dfustini@...storrent.com>
> ---
>  Documentation/arch/riscv/vector.rst | 15 +++++++++++++++
>  arch/riscv/Kconfig                  | 10 ++++++++++
>  arch/riscv/include/asm/vector.h     |  4 ++++
>  arch/riscv/kernel/vector.c          | 16 +++++++++++++++-
>  4 files changed, 44 insertions(+), 1 deletion(-)
>
> [...]


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ