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

Andrew Jones andrew.jones at linux.dev
Sun Nov 22 03:58:10 PST 2026


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 at valinux.co.jp>
> ---
> 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@valinux.co.jp/
> 
>  arch/riscv/kvm/vcpu_sbi_sta.c | 60 +++++++++++++++++------------------
>  1 file changed, 30 insertions(+), 30 deletions(-)
>

Reviewed-by: Andrew Jones <andrew.jones at linux.dev>



More information about the kvm-riscv mailing list