Re: [PATCH] RISC-V: KVM: Use raw_spinlock for VMID update critical section

From: Sebastian Andrzej Siewior

Date: Fri Jul 17 2026 - 02:55:19 EST


On 2026-07-16 14:40:11 [+0800], yhchen312@xxxxxxxxx wrote:
> From: "Yuhang.chen" <yhchen312@xxxxxxxxx>
>
> The VMID update critical section performs an IPI broadcast via
> on_each_cpu_mask() on VMID version rollover, which must not be preempted
> under PREEMPT_RT.

Here you state _why_ it must not be preempted. What would be the worst
that could happen.

> Convert vmid_lock to raw_spinlock_t and use plain
That part starting with "Convert" belongs into into a new line.

> raw_spin_lock()/raw_spin_unlock() (interrupts stay enabled, since
> on_each_cpu_mask() requires it).
>
> Assisted-by: YuanSheng:deepseek-v4-pro
> Co-developed-by: Quan Zhou <zhouquan@xxxxxxxxxxx>
> Signed-off-by: Quan Zhou <zhouquan@xxxxxxxxxxx>
> Signed-off-by: Yuhang.chen <yhchen312@xxxxxxxxx>

Sebastian