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

Sebastian Andrzej Siewior bigeasy at linutronix.de
Thu Jul 16 23:51:37 PDT 2026


On 2026-07-16 14:40:11 [+0800], yhchen312 at gmail.com wrote:
> From: "Yuhang.chen" <yhchen312 at gmail.com>
> 
> 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 at iscas.ac.cn>
> Signed-off-by: Quan Zhou <zhouquan at iscas.ac.cn>
> Signed-off-by: Yuhang.chen <yhchen312 at gmail.com>

Sebastian



More information about the linux-riscv mailing list