[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DBL2588APTCA.2XUKQCJ0DW89C@ventanamicro.com>
Date: Fri, 25 Jul 2025 12:18:23 +0200
From: Radim Krčmář <rkrcmar@...tanamicro.com>
To: "Vivian Wang" <wangruikang@...as.ac.cn>, "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>
Cc: "linux-riscv" <linux-riscv-bounces@...ts.infradead.org>
Subject: Re: [PATCH] riscv: Add sysctl to control discard of vstate during
syscall
2025-07-24T05:55:54+08:00, Vivian Wang <wangruikang@...as.ac.cn>:
> 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.
I think your proposal improves the existing code, but if a userspace is
using vectors, it's likely also restoring them after a syscall, so the
state would immediately get dirty, and the next syscall would again
needlessly clobber vector registers.
Preserving the vector state still seems better for userspaces that use
both vectors and syscalls.
Powered by blists - more mailing lists