[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALzav=eeVJAOwUbg1QRnkWhhzn5WT8jgjWo2b-tu9uBJJKdG8A@mail.gmail.com>
Date: Thu, 17 Nov 2022 19:49:11 -0800
From: David Matlack <dmatlack@...gle.com>
To: Robert Hoo <robert.hu@...ux.intel.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, seanjc@...gle.com
Subject: Re: [PATCH] KVM: x86/mmu: simplify kvm_tdp_mmu_map flow when guest
has to retry
On Thu, Nov 17, 2022 at 6:01 PM Robert Hoo <robert.hu@...ux.intel.com> wrote:
>
> On Thu, 2022-11-17 at 10:43 -0800, David Matlack wrote:
> > On Thu, Nov 17, 2022 at 8:14 AM Paolo Bonzini <pbonzini@...hat.com>
> > wrote:
> > > if (is_shadow_present_pte(iter.old_spte))
> > > - ret = tdp_mmu_split_huge_page(kvm, &iter,
> > > sp, true);
> > > + r = tdp_mmu_split_huge_page(kvm, &iter, sp,
> > > true);
> > > else
> > > - ret = tdp_mmu_link_sp(kvm, &iter, sp,
> > > true);
> > > + r = tdp_mmu_link_sp(kvm, &iter, sp, true);
> >
> > Can this fix be squashed into [1]? It seems like a serious enough
> > bug.
> > If 2 threads race to update the same PTE, KVM will return -EBUSY out
> > to userspace from KVM_RUN, I think. I'm not sure about QEMU, but that
> > would be fatal for the VM in Vanadium.
> >
> > [1]
> > https://lore.kernel.org/kvm/20221109185905.486172-3-dmatlack@google.com/
> >
> I think in you patch it's all right, since then before
> kvm_tdp_mmu_map() returns, it must go through
> tdp_mmu_map_handle_target_level(), it returns RET_PF_* enum.
Ah that's right. kvm_tdp_mmu_map() won't actually return 0/-EBUSY,
because it either returns RET_PF_RETRY or goes through
tdp_mmu_map_handle_target_level().
Powered by blists - more mailing lists