aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/xarray.c
diff options
context:
space:
mode:
authorAnup Patel <[email protected]>2025-07-07 03:53:44 +0000
committerAnup Patel <[email protected]>2025-07-11 13:03:27 +0000
commit4cec89db80ba81fa4524c6449c0494b8ae08eeb0 (patch)
tree9448c55a27133375d90f08d745a5d677fa36b4bb /rust/helpers/xarray.c
parentRISC-V: KVM: Disable vstimecmp before exiting to user-space (diff)
downloadkernel-4cec89db80ba81fa4524c6449c0494b8ae08eeb0.tar.gz
kernel-4cec89db80ba81fa4524c6449c0494b8ae08eeb0.zip
RISC-V: KVM: Move HGEI[E|P] CSR access to IMSIC virtualization
Currently, the common AIA functions kvm_riscv_vcpu_aia_has_interrupts() and kvm_riscv_aia_wakeon_hgei() lookup HGEI line using an array of VCPU pointers before accessing HGEI[E|P] CSR which is slow and prone to race conditions because there is a separate per-hart lock for the VCPU pointer array and a separate per-VCPU rwlock for IMSIC VS-file (including HGEI line) used by the VCPU. Due to these race conditions, it is observed on QEMU RISC-V host that Guest VCPUs sleep in WFI and never wakeup even with interrupt pending in the IMSIC VS-file because VCPUs were waiting for HGEI wakeup on the wrong host CPU. The IMSIC virtualization already keeps track of the HGEI line and the associated IMSIC VS-file used by each VCPU so move the HGEI[E|P] CSR access to IMSIC virtualization so that costly HGEI line lookup can be avoided and likelihood of race-conditions when updating HGEI[E|P] CSR is also reduced. Reviewed-by: Atish Patra <[email protected]> Tested-by: Atish Patra <[email protected]> Tested-by: Heinrich Schuchardt <[email protected]> Fixes: 3385339296d1 ("RISC-V: KVM: Use IMSIC guest files when available") Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Nutty Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'rust/helpers/xarray.c')
0 files changed, 0 insertions, 0 deletions