[PATCH v4 7/8] arm64/sve: Leave SVE enabled on syscall if we don't context switch

Mark Brown broonie at kernel.org
Mon Nov 14 03:25:22 PST 2022


On Mon, Nov 14, 2022 at 10:31:17AM +0000, Catalin Marinas wrote:
> On Sat, Oct 22, 2022 at 12:03:20AM +0100, Mark Brown wrote:

> > The syscall ABI says that the SVE register state not shared with FPSIMD
> > may not be preserved on syscall, and this is the only mechanism we have
> > in the ABI to stop tracking the extra SVE state for a process. Currently
> > we do this unconditionally by means of disabling SVE for the process on
> > syscall, causing userspace to take a trap to EL1 if it uses SVE again.
> > These extra traps result in a noticeable overhead for using SVE instead
> > of FPSIMD in some workloads, especially for simple syscalls where we can
> > return directly to userspace and would not otherwise need to update the
> > floating point registers. Tests with fp-pidbench show an approximately
> > 70% overhead on a range of implementations when SVE is in use - while
> > this is an extreme and entirely artificial benchmark it is clear that
> > there is some useful room for improvement here.

> If SVE is no longer in use, does the explicit SVE regs flushing cause
> any noticeable overhead? I guess even if there's a small overhead, it's
> only temporary until a context switch clears TIF_SVE again.

The overhead of the flushes is measurable, IIRC it was about 2-3%
on fp-pidbench for vector lengths 256 bit and above which have
additional overhead due to needing to flush the V/Z registers.
OTOH that's an entirely artificial benchmark and as you say soon
as the task gets context switched it'll stop incurring that
overhead.  Given that the improvement we get in the case where
the task is continuing to use SVE is more than an order of
magnitude greater it seems like a sensible tradeoff.

> Reviewed-by: Catalin Marinas <catalin.marinas at arm.com>

Thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20221114/591ebbc6/attachment.sig>


More information about the linux-arm-kernel mailing list