[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aKUQXDh4u9xJx+jS@x1>
Date: Tue, 19 Aug 2025 17:01:32 -0700
From: Drew Fustini <fustini@...nel.org>
To: Andrew Jones <ajones@...tanamicro.com>
Cc: Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Alexandre Ghiti <alex@...ti.fr>,
Samuel Holland <samuel.holland@...ive.com>,
Björn Töpel <bjorn@...osinc.com>,
Andy Chiu <andybnac@...il.com>,
Conor Dooley <conor.dooley@...rochip.com>,
Darius Rad <darius@...espec.com>,
Vivian Wang <wangruikang@...as.ac.cn>,
Florian Weimer <fweimer@...hat.com>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
Drew Fustini <dfustini@...storrent.com>
Subject: Re: [PATCH v3] riscv: Add sysctl to control discard of vstate on
syscall entry
On Tue, Aug 19, 2025 at 12:16:02PM -0500, Andrew Jones wrote:
> On Tue, Aug 19, 2025 at 02:40:21AM -0700, Drew Fustini wrote:
> > From: Drew Fustini <dfustini@...storrent.com>
> >
> > Vector registers are always clobbered in the syscall entry path to
> > enforce the documented ABI that vector state is not preserved across
> > syscalls. However, this operation can be slow on some RISC-V cores.
> > To mitigate this performance impact, add a sysctl knob to control
> > whether vector state is discarded in the syscall entry path:
> >
> > /proc/sys/abi/riscv_v_vstate_discard
> >
> > Valid values are:
> >
> > 0: Vector state is not intentionally clobbered when entering a syscall
> > 1: Vector state is always clobbered when entering a syscall
> >
> > The initial state is controlled by CONFIG_RISCV_ISA_V_VSTATE_DISCARD.
>
> I'm in favor of the clobbering being off by default and creating a knob
> to enable it for debug purposes, but I'm not sure we need the config. I
> think it's reasonable for systems that need the discard behavior to add
> a sysctl toggle to their early init. The config may complicate the
> documentation needed for user recommendations and potentially generate
> confusion when moving from one system to another since defaults could
> be flipped.
If I dropped CONFIG_RISCV_ISA_V_VSTATE_DISCARD, then are you thinking
that riscv_v_vstate_discard_ctl would be initialized to 0 instead?
I would be okay with that as it defaults to the clobbering being off.
Hopefully, Palmer will chime in on whether setting the sysctl in an
init script would be acceptable. He told me that he does want to retain
the strict clobbering behavior on his tester machine.
Thanks,
Drew
Powered by blists - more mailing lists