[External] Re: [PATCH v2] RISC-V: KVM: Delegate kvm unhandled faults to VS mode

Xu Lu luxu.kernel at bytedance.com
Fri Jul 11 01:25:48 PDT 2025


On Fri, Jul 11, 2025 at 2:16 PM Radim Krčmář <rkrcmar at ventanamicro.com> wrote:
>
> 2025-07-10T21:30:30+08:00, Xu Lu <luxu.kernel at bytedance.com>:
> > Delegate faults which are not handled by kvm to VS mode to avoid
> > unnecessary traps to HS mode. These faults include illegal instruction
> > fault, instruction access fault, load access fault and store access
> > fault.
> >
> > The delegation of illegal instruction fault is particularly important
> > to guest applications that use vector instructions frequently. In such
> > cases, an illegal instruction fault will be raised when guest user thread
> > uses vector instruction the first time and then guest kernel will enable
> > user thread to execute following vector instructions.
>
> (This optimization will be even more significant when nesting, where it
>  would currently go -> HS0 -> HS1 -> HS0 -> VS1, instead of -> VS1.)

Nice supplement! Thanks.

>
> > The fw pmu event counters remain undeleted so that guest can still get
> > these events via sbi call. Guest will only see zero count on these
> > events and know 'firmware' has delegated these faults.
> >
> > Signed-off-by: Xu Lu <luxu.kernel at bytedance.com>
> > ---
>
> Reviewed-by: Radim Krčmář <rkrcmar at ventanamicro.com>



More information about the linux-riscv mailing list