kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] KVM: Drop gfn_to_pfn_atomic()
@ 2020-03-05 15:57 Peter Xu
  2020-03-05 15:57 ` [PATCH v2 1/2] KVM: Documentation: Update fast page fault for indirect sp Peter Xu
  2020-03-05 15:57 ` [PATCH v2 2/2] KVM: Drop gfn_to_pfn_atomic() Peter Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Xu @ 2020-03-05 15:57 UTC (permalink / raw)
  To: kvm, linux-kernel; +Cc: linmiaohe, Paolo Bonzini, peterx

v2:
- add a document update for indirect sp fast path which referenced
  gfn_to_pfn_atomic(). [linmiaohe]

Please review, thanks.

Peter Xu (2):
  KVM: Documentation: Update fast page fault for indirect sp
  KVM: Drop gfn_to_pfn_atomic()

 Documentation/virt/kvm/locking.rst | 9 ++++-----
 include/linux/kvm_host.h           | 1 -
 virt/kvm/kvm_main.c                | 6 ------
 3 files changed, 4 insertions(+), 12 deletions(-)

-- 
2.24.1



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

* [PATCH v2 1/2] KVM: Documentation: Update fast page fault for indirect sp
  2020-03-05 15:57 [PATCH v2 0/2] KVM: Drop gfn_to_pfn_atomic() Peter Xu
@ 2020-03-05 15:57 ` Peter Xu
  2020-03-05 15:57 ` [PATCH v2 2/2] KVM: Drop gfn_to_pfn_atomic() Peter Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Xu @ 2020-03-05 15:57 UTC (permalink / raw)
  To: kvm, linux-kernel; +Cc: linmiaohe, Paolo Bonzini, peterx

gfn_to_pfn_atomic() is not used anywhere.  Before dropping it,
reorganize the locking document to state the fact that we're not
enabling fast page fault for indirect sps.  The previous wording is
confusing that it seems we have implemented it however it's not.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 Documentation/virt/kvm/locking.rst | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Documentation/virt/kvm/locking.rst b/Documentation/virt/kvm/locking.rst
index c02291beac3f..d045b2a89505 100644
--- a/Documentation/virt/kvm/locking.rst
+++ b/Documentation/virt/kvm/locking.rst
@@ -96,8 +96,10 @@ will happen:
 We dirty-log for gfn1, that means gfn2 is lost in dirty-bitmap.
 
 For direct sp, we can easily avoid it since the spte of direct sp is fixed
-to gfn. For indirect sp, before we do cmpxchg, we call gfn_to_pfn_atomic()
-to pin gfn to pfn, because after gfn_to_pfn_atomic():
+to gfn.  For indirect sp, we disabled fast page fault for simplicity.
+
+A solution for indirect sp is that, before we do cmpxchg, we pin the
+pfn of the gfn atomically.  After the pinning:
 
 - We have held the refcount of pfn that means the pfn can not be freed and
   be reused for another gfn.
@@ -106,9 +108,6 @@ to pin gfn to pfn, because after gfn_to_pfn_atomic():
 
 Then, we can ensure the dirty bitmaps is correctly set for a gfn.
 
-Currently, to simplify the whole things, we disable fast page fault for
-indirect shadow page.
-
 2) Dirty bit tracking
 
 In the origin code, the spte can be fast updated (non-atomically) if the
-- 
2.24.1


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

* [PATCH v2 2/2] KVM: Drop gfn_to_pfn_atomic()
  2020-03-05 15:57 [PATCH v2 0/2] KVM: Drop gfn_to_pfn_atomic() Peter Xu
  2020-03-05 15:57 ` [PATCH v2 1/2] KVM: Documentation: Update fast page fault for indirect sp Peter Xu
@ 2020-03-05 15:57 ` Peter Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Xu @ 2020-03-05 15:57 UTC (permalink / raw)
  To: kvm, linux-kernel; +Cc: linmiaohe, Paolo Bonzini, peterx

It's never used anywhere now.

Reviewed-by: linmiaohe <linmiaohe@huawei.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/linux/kvm_host.h | 1 -
 virt/kvm/kvm_main.c      | 6 ------
 2 files changed, 7 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index bcb9b2ac0791..3faa062ea108 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -704,7 +704,6 @@ void kvm_release_page_clean(struct page *page);
 void kvm_release_page_dirty(struct page *page);
 void kvm_set_page_accessed(struct page *page);
 
-kvm_pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn);
 kvm_pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
 kvm_pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,
 		      bool *writable);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 70f03ce0e5c1..d29718c7017c 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1754,12 +1754,6 @@ kvm_pfn_t gfn_to_pfn_memslot_atomic(struct kvm_memory_slot *slot, gfn_t gfn)
 }
 EXPORT_SYMBOL_GPL(gfn_to_pfn_memslot_atomic);
 
-kvm_pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn)
-{
-	return gfn_to_pfn_memslot_atomic(gfn_to_memslot(kvm, gfn), gfn);
-}
-EXPORT_SYMBOL_GPL(gfn_to_pfn_atomic);
-
 kvm_pfn_t kvm_vcpu_gfn_to_pfn_atomic(struct kvm_vcpu *vcpu, gfn_t gfn)
 {
 	return gfn_to_pfn_memslot_atomic(kvm_vcpu_gfn_to_memslot(vcpu, gfn), gfn);
-- 
2.24.1


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

end of thread, other threads:[~2020-03-05 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05 15:57 [PATCH v2 0/2] KVM: Drop gfn_to_pfn_atomic() Peter Xu
2020-03-05 15:57 ` [PATCH v2 1/2] KVM: Documentation: Update fast page fault for indirect sp Peter Xu
2020-03-05 15:57 ` [PATCH v2 2/2] KVM: Drop gfn_to_pfn_atomic() Peter Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).