All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: maz@kernel.org, jiangshanlai@gmail.com,
	linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org,
	bgardon@google.com, dmatlack@google.com,
	maciej.szmigiero@oracle.com, kvmarm@lists.cs.columbia.edu,
	pfeiner@google.com
Subject: [PATCH v7 08/23] KVM: x86/mmu: Rename shadow MMU functions that deal with shadow pages
Date: Wed, 22 Jun 2022 15:26:55 -0400	[thread overview]
Message-ID: <20220622192710.2547152-9-pbonzini@redhat.com> (raw)
In-Reply-To: <20220622192710.2547152-1-pbonzini@redhat.com>

From: David Matlack <dmatlack@google.com>

Rename 2 functions:

  kvm_mmu_get_page() -> kvm_mmu_get_shadow_page()
  kvm_mmu_free_page() -> kvm_mmu_free_shadow_page()

This change makes it clear that these functions deal with shadow pages
rather than struct pages. It also aligns these functions with the naming
scheme for kvm_mmu_find_shadow_page() and kvm_mmu_alloc_shadow_page().

Prefer "shadow_page" over the shorter "sp" since these are core
functions and the line lengths aren't terrible.

No functional change intended.

Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20220516232138.1783324-9-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/mmu/mmu.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 8b84cdd8c6cd..bd45364bf465 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1626,7 +1626,7 @@ static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, long nr)
 	percpu_counter_add(&kvm_total_used_mmu_pages, nr);
 }
 
-static void kvm_mmu_free_page(struct kvm_mmu_page *sp)
+static void kvm_mmu_free_shadow_page(struct kvm_mmu_page *sp)
 {
 	MMU_WARN_ON(!is_empty_shadow_page(sp->spt));
 	hlist_del(&sp->hash_link);
@@ -2081,8 +2081,9 @@ static struct kvm_mmu_page *kvm_mmu_alloc_shadow_page(struct kvm_vcpu *vcpu,
 	return sp;
 }
 
-static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, gfn_t gfn,
-					     union kvm_mmu_page_role role)
+static struct kvm_mmu_page *kvm_mmu_get_shadow_page(struct kvm_vcpu *vcpu,
+						    gfn_t gfn,
+						    union kvm_mmu_page_role role)
 {
 	struct hlist_head *sp_list;
 	struct kvm_mmu_page *sp;
@@ -2146,7 +2147,7 @@ static struct kvm_mmu_page *kvm_mmu_get_child_sp(struct kvm_vcpu *vcpu,
 	union kvm_mmu_page_role role;
 
 	role = kvm_mmu_child_role(sptep, direct, access);
-	return kvm_mmu_get_page(vcpu, gfn, role);
+	return kvm_mmu_get_shadow_page(vcpu, gfn, role);
 }
 
 static void shadow_walk_init_using_root(struct kvm_shadow_walk_iterator *iterator,
@@ -2422,7 +2423,7 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
 
 	list_for_each_entry_safe(sp, nsp, invalid_list, link) {
 		WARN_ON(!sp->role.invalid || sp->root_count);
-		kvm_mmu_free_page(sp);
+		kvm_mmu_free_shadow_page(sp);
 	}
 }
 
@@ -3415,7 +3416,7 @@ static hpa_t mmu_alloc_root(struct kvm_vcpu *vcpu, gfn_t gfn, int quadrant,
 	WARN_ON_ONCE(quadrant && !role.has_4_byte_gpte);
 	WARN_ON_ONCE(role.direct && role.has_4_byte_gpte);
 
-	sp = kvm_mmu_get_page(vcpu, gfn, role);
+	sp = kvm_mmu_get_shadow_page(vcpu, gfn, role);
 	++sp->root_count;
 
 	return __pa(sp->spt);
-- 
2.31.1


_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: maz@kernel.org, anup@brainfault.org, seanjc@google.com,
	bgardon@google.com, peterx@redhat.com,
	maciej.szmigiero@oracle.com, kvmarm@lists.cs.columbia.edu,
	linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org,
	pfeiner@google.com, jiangshanlai@gmail.com, dmatlack@google.com
Subject: [PATCH v7 08/23] KVM: x86/mmu: Rename shadow MMU functions that deal with shadow pages
Date: Wed, 22 Jun 2022 15:26:55 -0400	[thread overview]
Message-ID: <20220622192710.2547152-9-pbonzini@redhat.com> (raw)
In-Reply-To: <20220622192710.2547152-1-pbonzini@redhat.com>

From: David Matlack <dmatlack@google.com>

Rename 2 functions:

  kvm_mmu_get_page() -> kvm_mmu_get_shadow_page()
  kvm_mmu_free_page() -> kvm_mmu_free_shadow_page()

This change makes it clear that these functions deal with shadow pages
rather than struct pages. It also aligns these functions with the naming
scheme for kvm_mmu_find_shadow_page() and kvm_mmu_alloc_shadow_page().

Prefer "shadow_page" over the shorter "sp" since these are core
functions and the line lengths aren't terrible.

No functional change intended.

Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20220516232138.1783324-9-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/mmu/mmu.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 8b84cdd8c6cd..bd45364bf465 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1626,7 +1626,7 @@ static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, long nr)
 	percpu_counter_add(&kvm_total_used_mmu_pages, nr);
 }
 
-static void kvm_mmu_free_page(struct kvm_mmu_page *sp)
+static void kvm_mmu_free_shadow_page(struct kvm_mmu_page *sp)
 {
 	MMU_WARN_ON(!is_empty_shadow_page(sp->spt));
 	hlist_del(&sp->hash_link);
@@ -2081,8 +2081,9 @@ static struct kvm_mmu_page *kvm_mmu_alloc_shadow_page(struct kvm_vcpu *vcpu,
 	return sp;
 }
 
-static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, gfn_t gfn,
-					     union kvm_mmu_page_role role)
+static struct kvm_mmu_page *kvm_mmu_get_shadow_page(struct kvm_vcpu *vcpu,
+						    gfn_t gfn,
+						    union kvm_mmu_page_role role)
 {
 	struct hlist_head *sp_list;
 	struct kvm_mmu_page *sp;
@@ -2146,7 +2147,7 @@ static struct kvm_mmu_page *kvm_mmu_get_child_sp(struct kvm_vcpu *vcpu,
 	union kvm_mmu_page_role role;
 
 	role = kvm_mmu_child_role(sptep, direct, access);
-	return kvm_mmu_get_page(vcpu, gfn, role);
+	return kvm_mmu_get_shadow_page(vcpu, gfn, role);
 }
 
 static void shadow_walk_init_using_root(struct kvm_shadow_walk_iterator *iterator,
@@ -2422,7 +2423,7 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
 
 	list_for_each_entry_safe(sp, nsp, invalid_list, link) {
 		WARN_ON(!sp->role.invalid || sp->root_count);
-		kvm_mmu_free_page(sp);
+		kvm_mmu_free_shadow_page(sp);
 	}
 }
 
@@ -3415,7 +3416,7 @@ static hpa_t mmu_alloc_root(struct kvm_vcpu *vcpu, gfn_t gfn, int quadrant,
 	WARN_ON_ONCE(quadrant && !role.has_4_byte_gpte);
 	WARN_ON_ONCE(role.direct && role.has_4_byte_gpte);
 
-	sp = kvm_mmu_get_page(vcpu, gfn, role);
+	sp = kvm_mmu_get_shadow_page(vcpu, gfn, role);
 	++sp->root_count;
 
 	return __pa(sp->spt);
-- 
2.31.1



  parent reply	other threads:[~2022-06-22 19:27 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 19:26 [PATCH v7 00/23] KVM: Extend Eager Page Splitting to the shadow MMU Paolo Bonzini
2022-06-22 19:26 ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 01/23] KVM: x86/mmu: Optimize MMU page cache lookup for all direct SPs Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 02/23] KVM: x86/mmu: Use a bool for direct Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 03/23] KVM: x86/mmu: Stop passing "direct" to mmu_alloc_root() Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 04/23] KVM: x86/mmu: Derive shadow MMU page role from parent Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 05/23] KVM: x86/mmu: Always pass 0 for @quadrant when gptes are 8 bytes Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 06/23] KVM: x86/mmu: Decompose kvm_mmu_get_page() into separate functions Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 07/23] KVM: x86/mmu: Consolidate shadow page allocation and initialization Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` Paolo Bonzini [this message]
2022-06-22 19:26   ` [PATCH v7 08/23] KVM: x86/mmu: Rename shadow MMU functions that deal with shadow pages Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 09/23] KVM: x86/mmu: Move guest PT write-protection to account_shadowed() Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 10/23] KVM: x86/mmu: Pass memory caches to allocate SPs separately Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 11/23] KVM: x86/mmu: Replace vcpu with kvm in kvm_mmu_alloc_shadow_page() Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:26 ` [PATCH v7 12/23] KVM: x86/mmu: Pass kvm pointer separately from vcpu to kvm_mmu_find_shadow_page() Paolo Bonzini
2022-06-22 19:26   ` Paolo Bonzini
2022-06-22 19:27 ` [PATCH v7 13/23] KVM: x86/mmu: Allow NULL @vcpu in kvm_mmu_find_shadow_page() Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-22 19:27 ` [PATCH v7 14/23] KVM: x86/mmu: Pass const memslot to rmap_add() Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-22 19:27 ` [PATCH v7 15/23] KVM: x86/mmu: Decouple rmap_add() and link_shadow_page() from kvm_vcpu Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-22 19:27 ` [PATCH v7 16/23] KVM: x86/mmu: Update page stats in __rmap_add() Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-22 19:27 ` [PATCH v7 17/23] KVM: x86/mmu: Cache the access bits of shadowed translations Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-22 19:27 ` [PATCH v7 18/23] KVM: x86/mmu: Extend make_huge_page_split_spte() for the shadow MMU Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-22 19:27 ` [PATCH v7 19/23] KVM: x86/mmu: Zap collapsible SPTEs in shadow MMU at all possible levels Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-23 23:53   ` Sean Christopherson
2022-06-23 23:53     ` Sean Christopherson
2022-06-22 19:27 ` [PATCH v7 20/23] KVM: x86/mmu: pull call to drop_large_spte() into __link_shadow_page() Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-23 23:48   ` Sean Christopherson
2022-06-23 23:48     ` Sean Christopherson
2022-06-22 19:27 ` [PATCH v7 21/23] KVM: Allow for different capacities in kvm_mmu_memory_cache structs Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-29 12:34   ` Anup Patel
2022-06-29 12:34     ` Anup Patel
2022-06-22 19:27 ` [PATCH v7 22/23] KVM: x86/mmu: Extend Eager Page Splitting to nested MMUs Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-23 16:17   ` David Matlack
2022-06-23 16:17     ` David Matlack
2022-06-23 19:48     ` Sean Christopherson
2022-06-23 19:48       ` Sean Christopherson
2022-06-23 22:36       ` David Matlack
2022-06-23 22:36         ` David Matlack
2022-06-22 19:27 ` [PATCH v7 23/23] KVM: x86/mmu: Avoid unnecessary flush on eager page split Paolo Bonzini
2022-06-22 19:27   ` Paolo Bonzini
2022-06-23 23:50 ` [PATCH v7 00/23] KVM: Extend Eager Page Splitting to the shadow MMU David Matlack
2022-06-23 23:50   ` David Matlack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220622192710.2547152-9-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bgardon@google.com \
    --cc=dmatlack@google.com \
    --cc=jiangshanlai@gmail.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maciej.szmigiero@oracle.com \
    --cc=maz@kernel.org \
    --cc=pfeiner@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.