Re: [PATCH] KVM: SVM: make svm_flush_tlb_gva do a full asid flush if NPT enabled

From: Yosry Ahmed

Date: Wed Jul 29 2026 - 20:25:39 EST


On Wed, Jul 29, 2026 at 4:41 PM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
> On 7/27/26 21:58, Yosry Ahmed wrote:
> > On Mon, Jul 27, 2026 at 12:23 PM Tycho Andersen <tycho@xxxxxxxxxx> wrote:
> >>
> >> Hi all,
> >>
> >> On Thu, Jul 23, 2026 at 11:44:19AM +0200, Paolo Bonzini wrote:
> >>> As to the workload, Alexander threw more or less everything at the same
> >>> time at the VM:
> >>>
> >>> - a full Windows Defender scan every 30 minutes
> >>>
> >>> - a disk I/O job
> >>>
> >>> - a loop doing repeated mmap of system files (mostly to hope that
> >>> it triggers some consistency check in the Windows memory manager)
> >>>
> >>> - SQL Express 2022 + StressDB (1.6M rows), with the host doing queries
> >>> (75% write/25% read) via sqlcmd
> >>
> >> Can you share the code for the mmap + disk io + DB content generator?
> >>
> >> We're looking at this and would like to reproduce.
> >
> > Not sure if this is relevant, but I see that hyperv_tlb_flush is flaky
> > with npt=0 on Turin at the tip of kvm-x86/next (commit 567329869b9c7).
>
> Same on Milan, but ept=0 works.
>
> > It's not likely because the problem fixed by this patch happens
> > specifically with npt=1 and not npt=0 AFAICT, but it is a weird
> > coincidence :)
>
> And also because this patch uses, in the end, the same flush mechanism
> that npt=0 and ept=0 already use. So that bug is probably in npt=0.
>
> That said, I'll do a quick experiment of running hyperv_tlb_flush in a
> loop with this patch.

I don't think this patch changes the behavior with npt=0 tho, right? I
would be surprised if the flakiness went away.

I mainly mentioned this in case the (preexisting) cause of the
flakiness is somehow related to the problem this patch is trying to
fix.