From: Lai Jiangshan <jiangshanlai@gmail.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Maxim Levitsky <mlevitsk@redhat.com>,
Lai Jiangshan <jiangshan.ljs@antgroup.com>
Subject: [PATCH 12/12] KVM: X86/MMU: Rename struct kvm_mmu_pages to struct kvm_mmu_page_vec
Date: Sun, 5 Jun 2022 14:43:42 +0800 [thread overview]
Message-ID: <20220605064342.309219-13-jiangshanlai@gmail.com> (raw)
In-Reply-To: <20220605064342.309219-1-jiangshanlai@gmail.com>
From: Lai Jiangshan <jiangshan.ljs@antgroup.com>
It is implemented as a vector and variable names for it are pvec.
Rename it to kvm_mmu_page_vec for better describing it.
Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
---
arch/x86/kvm/mmu/mmu.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 7cfc4bc89f60..64e0d155068c 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1742,12 +1742,12 @@ static int nonpaging_sync_page(struct kvm_vcpu *vcpu,
#define KVM_PAGE_ARRAY_NR 16
-struct kvm_mmu_pages {
+struct kvm_mmu_page_vec {
struct kvm_mmu_page *sp[KVM_PAGE_ARRAY_NR];
unsigned int nr;
};
-static int mmu_pages_add(struct kvm_mmu_pages *pvec, struct kvm_mmu_page *sp)
+static int mmu_pages_add(struct kvm_mmu_page_vec *pvec, struct kvm_mmu_page *sp)
{
int i;
@@ -1768,7 +1768,7 @@ static inline void clear_unsync_child_bit(struct kvm_mmu_page *sp, int idx)
}
static int __mmu_unsync_walk_and_clear(struct kvm_mmu_page *sp,
- struct kvm_mmu_pages *pvec)
+ struct kvm_mmu_page_vec *pvec)
{
int i, ret, nr_unsync_leaf = 0;
@@ -1808,7 +1808,7 @@ static int __mmu_unsync_walk_and_clear(struct kvm_mmu_page *sp,
}
static int mmu_unsync_walk_and_clear(struct kvm_mmu_page *sp,
- struct kvm_mmu_pages *pvec)
+ struct kvm_mmu_page_vec *pvec)
{
pvec->nr = 0;
if (!sp->unsync_children)
@@ -1885,7 +1885,7 @@ static bool is_obsolete_sp(struct kvm *kvm, struct kvm_mmu_page *sp)
unlikely(sp->mmu_valid_gen != kvm->arch.mmu_valid_gen);
}
-#define for_each_sp(pvec, sp, i) \
+#define page_vec_for_each_sp(pvec, sp, i) \
for (i = 0; i < pvec.nr && ({ sp = pvec.sp[i]; 1;}); i++)
static int mmu_sync_children(struct kvm_vcpu *vcpu,
@@ -1893,14 +1893,14 @@ static int mmu_sync_children(struct kvm_vcpu *vcpu,
{
int i;
struct kvm_mmu_page *sp;
- struct kvm_mmu_pages pages;
+ struct kvm_mmu_page_vec pvec;
LIST_HEAD(invalid_list);
bool flush = false;
- while (mmu_unsync_walk_and_clear(parent, &pages)) {
+ while (mmu_unsync_walk_and_clear(parent, &pvec)) {
bool protected = false;
- for_each_sp(pages, sp, i)
+ page_vec_for_each_sp(pvec, sp, i)
protected |= kvm_vcpu_write_protect_gfn(vcpu, sp->gfn);
if (protected) {
@@ -1908,7 +1908,7 @@ static int mmu_sync_children(struct kvm_vcpu *vcpu,
flush = false;
}
- for_each_sp(pages, sp, i) {
+ page_vec_for_each_sp(pvec, sp, i) {
kvm_mmu_page_clear_unsync(vcpu->kvm, sp);
flush |= kvm_sync_page(vcpu, sp, &invalid_list) > 0;
}
@@ -2208,15 +2208,15 @@ static int mmu_zap_unsync_children(struct kvm *kvm,
struct list_head *invalid_list)
{
int i, zapped = 0;
- struct kvm_mmu_pages pages;
+ struct kvm_mmu_page_vec pvec;
if (parent->role.level == PG_LEVEL_4K)
return 0;
- while (mmu_unsync_walk_and_clear(parent, &pages)) {
+ while (mmu_unsync_walk_and_clear(parent, &pvec)) {
struct kvm_mmu_page *sp;
- for_each_sp(pages, sp, i) {
+ page_vec_for_each_sp(pvec, sp, i) {
kvm_mmu_prepare_zap_page(kvm, sp, invalid_list);
zapped++;
}
--
2.19.1.6.gb485710b
next prev parent reply other threads:[~2022-06-05 6:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-05 6:43 [PATCH 00/12] KVM: X86/MMU: Simpliy mmu_unsync_walk() Lai Jiangshan
2022-06-05 6:43 ` [PATCH 01/12] KVM: X86/MMU: Warn if sp->unsync_children > 0 in link_shadow_page() Lai Jiangshan
2022-06-05 6:43 ` [PATCH 02/12] KVM: X86/MMU: Rename kvm_unlink_unsync_page() to kvm_mmu_page_clear_unsync() Lai Jiangshan
2022-07-14 22:10 ` Sean Christopherson
2022-06-05 6:43 ` [PATCH 03/12] KVM: X86/MMU: Split a part of kvm_unsync_page() as kvm_mmu_page_mark_unsync() Lai Jiangshan
2022-07-14 22:19 ` Sean Christopherson
2022-06-05 6:43 ` [PATCH 04/12] KVM: X86/MMU: Remove mmu_pages_clear_parents() Lai Jiangshan
2022-07-14 23:15 ` Sean Christopherson
2022-06-05 6:43 ` [PATCH 05/12] KVM: X86/MMU: Clear unsync bit directly in __mmu_unsync_walk() Lai Jiangshan
2022-07-19 19:52 ` Sean Christopherson
2022-07-21 9:32 ` Lai Jiangshan
2022-07-21 16:26 ` Sean Christopherson
2022-06-05 6:43 ` [PATCH 06/12] KVM: X86/MMU: Rename mmu_unsync_walk() to mmu_unsync_walk_and_clear() Lai Jiangshan
2022-07-19 20:07 ` Sean Christopherson
2022-06-05 6:43 ` [PATCH 07/12] KVM: X86/MMU: Remove the useless struct mmu_page_path Lai Jiangshan
2022-07-19 20:15 ` Sean Christopherson
2022-07-21 9:43 ` Lai Jiangshan
2022-07-21 15:25 ` Sean Christopherson
2022-06-05 6:43 ` [PATCH 08/12] KVM: X86/MMU: Remove the useless idx from struct kvm_mmu_pages Lai Jiangshan
2022-07-19 20:31 ` Sean Christopherson
2022-06-05 6:43 ` [PATCH 09/12] KVM: X86/MMU: Unfold struct mmu_page_and_offset in " Lai Jiangshan
2022-06-05 6:43 ` [PATCH 10/12] KVM: X86/MMU: Don't add parents to " Lai Jiangshan
2022-07-19 20:34 ` Sean Christopherson
2022-06-05 6:43 ` [PATCH 11/12] KVM: X86/MMU: Remove mmu_pages_first() and mmu_pages_next() Lai Jiangshan
2022-07-19 20:40 ` Sean Christopherson
2022-06-05 6:43 ` Lai Jiangshan [this message]
2022-07-19 20:45 ` [PATCH 12/12] KVM: X86/MMU: Rename struct kvm_mmu_pages to struct kvm_mmu_page_vec Sean Christopherson
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=20220605064342.309219-13-jiangshanlai@gmail.com \
--to=jiangshanlai@gmail.com \
--cc=jiangshan.ljs@antgroup.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®