Re: [PATCH v2 2/3] RISC-V: KVM: Batch user accesses when updating steal time

From: Andrew Jones

Date: Sun Nov 22 2026 - 06:58:57 EST


On Sun, Nov 22, 2026 at 02:35:25AM +0900, Koichiro Den wrote:
> Updating the SBI STA shared structure performs 2x get_user() + 3x
> put_user() calls, each of which toggles sstatus.SUM.
>
> Keep SUM enabled across all five accesses to the shared structure.
>
> Signed-off-by: Koichiro Den <den@xxxxxxxxxxxxx>
> ---
> Changes since v1:
> - Drop might_fault(). (Andrew)
> - Use scoped_user_rw_access(). (Andrew)
> - Use le32_add_cpu() and le64_add_cpu() to avoid the extra temporaries.
>
> Note:
> - I haven't carried over Andrew's Reviewed-by since the scoped_
> conversion reworks the fault paths. Would appreciate another look.
> - As in v1, I kept WARN_ON() for uaccess failures.
>
> v1: https://lore.kernel.org/r/20261118062242.2914385-2-den@xxxxxxxxxxxxx/
>
> arch/riscv/kvm/vcpu_sbi_sta.c | 60 +++++++++++++++++------------------
> 1 file changed, 30 insertions(+), 30 deletions(-)
>

Reviewed-by: Andrew Jones <andrew.jones@xxxxxxxxx>