[PATCH v1 0/2] RISC-V: KVM: fix vcpu vector context handling
Andy Chiu <[email protected]> Fri, 10 Jul 2026 20:58:28 -0500
| Newsgroups | org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
This series fixes a vtype corruption encountered when running perf + vector workload on KVM. The root cause of the bug is that the kernel-mode vector (KMV) misattributes the guest's vcpu context as the user's context. To solve this, we need to correctly save the vcpu context when the kernel-mode vector is serving a guest. However, calling directly into KVM from RISC-V generic architecture code creates a reverse dependency, which is problematic when KVM is built as a module. To address this, we introduce an RCU-protected callback for context flushing, which KVM registers during module init. This series will create merge conflict with my v4 [1] series on syscall optimization. I will send out a v5 that has the conflict resolved once this series is sufficiently reviewed. Patch 1 is a preparatory cleanup that refactors riscv_v_start_kernel_context(). Patch 2 implements the callback mechanism and fixes the context handling. [1]: https://lore.kernel.org/all/[email protected]/ Andy Chiu (2): riscv: vector: refactor riscv_v_start_kernel_context RISC-V: KVM: fix vcpu vector context handling for kernel-mode vector arch/riscv/include/asm/kvm_vcpu_vector.h | 24 ++++++++++ arch/riscv/include/asm/processor.h | 1 + arch/riscv/kernel/kernel_mode_vector.c | 58 +++++++++++++++++------- arch/riscv/kvm/main.c | 4 ++ arch/riscv/kvm/vcpu.c | 6 +++ arch/riscv/kvm/vcpu_vector.c | 18 ++++++++ 6 files changed, 94 insertions(+), 17 deletions(-) -- 2.43.0 -- kvm-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kvm-riscv