Re: [PATCH] KVM: riscv: Fix infinite loop in NACL hfence entry allocation
Anup Patel <[email protected]> Sat, 1 Aug 2026 14:28:13 +0530
| Newsgroups | org.kernel.vger.kvm,org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAAhSdy2eTsxG=aoXb=LqG6+=mthMcwTY6cZOi+NSvzHJ0s7r=w@mail.gmail.com> |
On Thu, Jul 16, 2026 at 1:08 PM Zongmin Zhou <[email protected]> wrote: > > From: Zongmin Zhou <[email protected]> > > 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 <[email protected]> LGTM. Reviewed-by: Anup Patel <[email protected]> Queued this patch for Linux-7.3 Thanks, Anup > --- > 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 >