Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH] KVM: riscv: Fix infinite loop in NACL hfence entry allocation
@ 2026-07-16  7:37 Zongmin Zhou
  2026-07-16  7:55 ` sashiko-bot
  2026-08-01  8:58 ` Anup Patel
  0 siblings, 2 replies; 4+ messages in thread
From: Zongmin Zhou @ 2026-07-16  7:37 UTC (permalink / raw)
  To: anup, atish.patra, pjw, palmer, aou, alex
  Cc: kvm, kvm-riscv, linux-riscv, linux-kernel, Zongmin Zhou

From: Zongmin Zhou <zhouzongmin@kylinos.cn>

try_count is initialized to 5 but never decremented in the retry path,
making the `if (try_count)` check always true. If all NACL shared memory
hfence entries remain in the pending state after sync, the function loops
forever, causing a soft lockup. Decrement try_count on each retry so the
fallback warning and return become reachable.

Fixes: d466c19cead5 ("RISC-V: KVM: Add common nested acceleration support")
Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
---
 arch/riscv/kvm/nacl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kvm/nacl.c b/arch/riscv/kvm/nacl.c
index 6f9f8963e9dd..9aff03c4f667 100644
--- a/arch/riscv/kvm/nacl.c
+++ b/arch/riscv/kvm/nacl.c
@@ -33,7 +33,7 @@ void __kvm_riscv_nacl_hfence(void *shmem,
 	}
 
 	if (ent < 0) {
-		if (try_count) {
+		if (try_count--) {
 			nacl_sync_hfence(-1UL);
 			goto again;
 		} else {
-- 
2.34.1


No virus found
		Checked by Hillstone Network AntiVirus


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-01  8:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16  7:37 [PATCH] KVM: riscv: Fix infinite loop in NACL hfence entry allocation Zongmin Zhou
2026-07-16  7:55 ` sashiko-bot
2026-07-24  6:50   ` Zongmin Zhou
2026-08-01  8:58 ` Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox