linux-stable/arch/riscv
Rajnesh Kanwal 1a4f36397e riscv/kvm: Fix VM hang in case of timer delta being zero.
[ Upstream commit 6eff380489 ]

In case when VCPU is blocked due to WFI, we schedule the timer
from `kvm_riscv_vcpu_timer_blocking()` to keep timer interrupt
ticking.

But in case when delta_ns comes to be zero, we never schedule
the timer and VCPU keeps sleeping indefinitely until any activity
is done with VM console.

This is easily reproduce-able using kvmtool.
./lkvm-static run -c1 --console virtio -p "earlycon root=/dev/vda" \
         -k ./Image -d rootfs.ext4

Also, just add a print in kvm_riscv_vcpu_vstimer_expired() to
check the interrupt delivery and run `top` or similar auto-upating
cmd from guest. Within sometime one can notice that print from
timer expiry routine stops and the `top` cmd output will stop
updating.

This change fixes this by making sure we schedule the timer even
with delta_ns being zero to bring the VCPU out of sleep immediately.

Fixes: 8f5cb44b1b ("RISC-V: KVM: Support sstc extension")
Signed-off-by: Rajnesh Kanwal <rkanwal@rivosinc.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-06 12:12:31 +02:00
..
boot riscv: dts: sifive: fu740: fix size of pcie 32bit memory 2023-01-07 19:31:37 +00:00
configs RISC-V Patches for the 6.2 Merge Window, Part 1 2022-12-14 15:23:49 -08:00
errata RISC-V: fix taking the text_mutex twice during sifive errata patching 2023-03-17 08:58:03 +01:00
include riscv: mm: Fix incorrect ASID argument when flushing TLB 2023-03-30 12:51:40 +02:00
kernel RISC-V: take text_mutex during alternative patching 2023-03-17 08:58:00 +01:00
kvm riscv/kvm: Fix VM hang in case of timer delta being zero. 2023-04-06 12:12:31 +02:00
lib riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit 2022-08-10 14:06:31 -07:00
mm riscv: mm: Fix incorrect ASID argument when flushing TLB 2023-03-30 12:51:40 +02:00
net riscv, bpf: Emit fixed-length instructions for BPF_PSEUDO_FUNC 2022-12-06 20:59:27 +01:00
purgatory riscv/purgatory: Omit use of bin2c 2022-08-11 09:32:34 -07:00
Kbuild riscv: move errata/ and kvm/ builds to arch/riscv/Kbuild 2022-06-01 22:26:32 -07:00
Kconfig riscv: Handle zicsr/zifencei issues between clang and binutils 2023-03-30 12:51:40 +02:00
Kconfig.debug
Kconfig.erratas drivers/perf: riscv_pmu_sbi: add support for PMU variant on T-Head C9xx cores 2022-10-27 14:35:20 -07:00
Kconfig.socs RISC-V Patches for the 6.2 Merge Window, Part 1 2022-12-14 15:23:49 -08:00
Makefile riscv: Handle zicsr/zifencei issues between clang and binutils 2023-03-30 12:51:40 +02:00