Re: [PATCH 2/4] KVM: selftests: Increase UCALL_MAX_ARGS to 7

2022-06-20 Thread Andrew Jones
On Wed, Jun 15, 2022 at 07:31:14PM +, Colton Lewis wrote: > Increase UCALL_MAX_ARGS to 7 to allow GUEST_ASSERT_4 to pass 3 builtin > ucall arguments specified in guest_assert_builtin_args plus 4 > user-specified arguments. > > Signed-off-by: Colton Lewis > --- > tools/testing/selftests/kvm/i

Re: [PATCH 2/4] KVM: selftests: Increase UCALL_MAX_ARGS to 7

2022-06-20 Thread Andrew Jones
On Mon, Jun 20, 2022 at 09:21:11AM +0200, Andrew Jones wrote: > On Sat, Jun 18, 2022 at 12:09:11AM +, Sean Christopherson wrote: > > On Fri, Jun 17, 2022, Colton Lewis wrote: > > > On Thu, Jun 16, 2022 at 02:10:06PM +0200, Andrew Jones wrote: > > > > We probably want to ensure all architectures

[PATCH v2 7/7] arm64/sve: Don't zero non-FPSIMD register state on syscall by default

2022-06-20 Thread Mark Brown
The documented syscall ABI specifies that the SVE state not shared with FPSIMD is undefined after a syscall. Currently we implement this by always flushing this register state to zero, ensuring consistent behaviour but introducing some overhead in the case where we can return directly to userspace

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

2022-06-20 Thread Mark Brown
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, c

[PATCH v2 5/7] arm64/fpsimd: Load FP state based on recorded data type

2022-06-20 Thread Mark Brown
Now that we are recording the type of floating point register state we are saving when we save it we can use that information when we load to decide which register state is required and bring the TIF_SVE state into sync with the loaded register state. The SME state detauls are already recorded dir

[PATCH v2 4/7] arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM

2022-06-20 Thread Mark Brown
Now that we are explicitly telling the host FP code which register state it needs to save we can remove the manipulation of TIF_SVE from the KVM code, simplifying it and allowing us to optimise our handling of normal tasks. Remove the manipulation of TIF_SVE from KVM and instead rely on to_save to

[PATCH v2 3/7] arm64/fpsimd: Have KVM explicitly say which FP registers to save

2022-06-20 Thread Mark Brown
In order to avoid needlessly saving and restoring the guest registers KVM relies on the host FPSMID code to save the guest registers when we context switch away from the guest. This is done by binding the KVM guest state to the CPU on top of the task state that was originally there, then carefully

[PATCH v2 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE

2022-06-20 Thread Mark Brown
When we save the state for the floating point registers this can be done in the form visible through either the FPSIMD V registers or the SVE Z and P registers. At present we track which format is currently used based on TIF_SVE and the SME streaming mode state but particularly in the SVE case this

[PATCH v2 1/7] KVM: arm64: Discard any SVE state when entering KVM guests

2022-06-20 Thread Mark Brown
Since 8383741ab2e773a99 (KVM: arm64: Get rid of host SVE tracking/saving) KVM has not tracked the host SVE state, relying on the fact that we currently disable SVE whenever we perform a syscall. This may not be true in future since performance optimisation may result in us keeping SVE enabled in or

[PATCH v2 0/7] arm64/sve: Clean up KVM integration and optimise syscalls

2022-06-20 Thread Mark Brown
This patch series attempts to clarify the tracking of which set of floating point registers we save on systems supporting SVE, particularly with reference to KVM, and then uses the results of this clarification to improve the performance of simple syscalls where we return directly to userspace in c

Re: [PATCH 4/4] KVM: selftests: Fix filename reporting in guest asserts

2022-06-20 Thread Paolo Bonzini
On 6/16/22 14:45, Andrew Jones wrote: +#define __GUEST_ASSERT(_condition, _condstr, _nargs, _args...) do {\ + if (!(_condition)) \ + ucall(UCALL_ABORT, GUEST_ASSERT_BUILTIN_NARGS + _nargs, \ +

Re: [PATCH 0/3] KVM: selftests: Consolidate ucall code

2022-06-20 Thread Paolo Bonzini
On 6/18/22 02:16, Sean Christopherson wrote: Consolidate the code for making and getting ucalls. All architectures pass the ucall struct via memory, so filling and copying the struct is 100% generic. The only per-arch code is sending and receiving the address of said struct. Tested on x86 and

Re: [PATCH 2/4] KVM: selftests: Increase UCALL_MAX_ARGS to 7

2022-06-20 Thread Anup Patel
On Mon, Jun 20, 2022 at 12:51 PM Andrew Jones wrote: > > On Sat, Jun 18, 2022 at 12:09:11AM +, Sean Christopherson wrote: > > On Fri, Jun 17, 2022, Colton Lewis wrote: > > > On Thu, Jun 16, 2022 at 02:10:06PM +0200, Andrew Jones wrote: > > > > We probably want to ensure all architectures are g

Re: [PATCH 1/3] KVM: selftests: Consolidate common code for popuplating ucall struct

2022-06-20 Thread Christian Borntraeger
Am 18.06.22 um 02:16 schrieb Sean Christopherson: Make ucall() a common helper that populates struct ucall, and only calls into arch code to make the actually call out to userspace. Rename all arch-specific helpers to make it clear they're arch-specific, and to avoid collisions with common he

Re: [PATCH 0/3] KVM: selftests: Consolidate ucall code

2022-06-20 Thread Andrew Jones
On Sat, Jun 18, 2022 at 12:16:15AM +, Sean Christopherson wrote: > Consolidate the code for making and getting ucalls. All architectures pass > the ucall struct via memory, so filling and copying the struct is 100% > generic. The only per-arch code is sending and receiving the address of > sa

Re: [PATCH 2/4] KVM: selftests: Increase UCALL_MAX_ARGS to 7

2022-06-20 Thread Andrew Jones
On Sat, Jun 18, 2022 at 12:09:11AM +, Sean Christopherson wrote: > On Fri, Jun 17, 2022, Colton Lewis wrote: > > On Thu, Jun 16, 2022 at 02:10:06PM +0200, Andrew Jones wrote: > > > We probably want to ensure all architectures are good with this. afaict, > > > riscv only expects 6 args and uses