[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250730211120.4163536-1-jthoughton@google.com>
Date: Wed, 30 Jul 2025 21:11:18 +0000
From: James Houghton <jthoughton@...gle.com>
To: jthoughton@...gle.com
Cc: amoorthy@...gle.com, corbet@....net, dmatlack@...gle.com,
kalyazin@...zon.com, kvm@...r.kernel.org, kvmarm@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, maz@...nel.org, oliver.upton@...ux.dev,
pbonzini@...hat.com, peterx@...hat.com, pgonda@...gle.com, seanjc@...gle.com,
wei.w.wang@...el.com, yan.y.zhao@...el.com
Subject: Re: [PATCH v3 05/15] KVM: x86: Add support for KVM userfault exits
On Tue, Jun 17, 2025 at 9:24 PM James Houghton <jthoughton@...gle.com> wrote:
>
> Only a few changes are needed to support KVM userfault exits on x86:
>
> 1. Adjust kvm_mmu_hugepage_adjust() to force pages to be mapped at 4K
> while KVM_MEM_USERFAULT is enabled.
> 2. Return -EFAULT when kvm_do_userfault() when it reports that the page
> is userfault. (Upon failure to read from the bitmap,
> kvm_do_userfault() will return true without setting up a memory fault
> exit, so we'll return a bare -EFAULT).
>
> For hugepage recovery, the behavior when disabling KVM_MEM_USERFAULT
> should match the behavior when disabling KVM_MEM_LOG_DIRTY_PAGES; make
> changes to kvm_mmu_slot_apply_flags() to recover hugepages when
> KVM_MEM_USERFAULT is disabled.
>
> Signed-off-by: James Houghton <jthoughton@...gle.com>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
This patch fails to remove the WARN in recover_huge_pages_range(). The
diff below will be applied to the next version of this patch, whenever it
comes.
This WARN can be hit by enabling KVM_MEM_LOG_DIRTY_PAGES and
KVM_MEM_USERFAULT, then disabling KVM_MEM_USERFAULT.
I've been having offline discussions with Sean about this series; I'm
waiting for him to rework the KVM_GENERIC_PAGE_FAULT bits. I'll dedicate
some more time to the QEMU side of things too.
Thanks.
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index 7f3d7229b2c1f..2d83ddb233a9a 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -1779,7 +1779,7 @@ static void recover_huge_pages_range(struct kvm *kvm,
u64 huge_spte;
int r;
- if (WARN_ON_ONCE(kvm_slot_dirty_track_enabled(slot)))
+ if (kvm_slot_dirty_track_enabled(slot))
return;
rcu_read_lock();
Powered by blists - more mailing lists