From: Ricardo Koller <ricarkol@google.com>
To: Gavin Shan <gshan@redhat.com>
Cc: pbonzini@redhat.com, maz@kernel.org, oupton@google.com,
yuzenghui@huawei.com, dmatlack@google.com, kvm@vger.kernel.org,
kvmarm@lists.linux.dev, qperret@google.com,
catalin.marinas@arm.com, andrew.jones@linux.dev,
seanjc@google.com, alexandru.elisei@arm.com,
suzuki.poulose@arm.com, eric.auger@redhat.com, reijiw@google.com,
rananta@google.com, bgardon@google.com, ricarkol@gmail.com,
Shaoqin Huang <shahuang@redhat.com>
Subject: Re: [PATCH v7 05/12] KVM: arm64: Refactor kvm_arch_commit_memory_region()
Date: Sun, 23 Apr 2023 12:47:48 -0700 [thread overview]
Message-ID: <ZEWLZDK39w737qiI@google.com> (raw)
In-Reply-To: <2819bd9d-9a8c-938c-9297-86c1b8614550@redhat.com>
On Mon, Apr 17, 2023 at 02:41:39PM +0800, Gavin Shan wrote:
> On 4/9/23 2:29 PM, Ricardo Koller wrote:
> > Refactor kvm_arch_commit_memory_region() as a preparation for a future
> > commit to look cleaner and more understandable. Also, it looks more
> > like its x86 counterpart (in kvm_mmu_slot_apply_flags()).
> >
> > Signed-off-by: Ricardo Koller <ricarkol@google.com>
> > Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> > ---
> > arch/arm64/kvm/mmu.c | 15 +++++++++++----
> > 1 file changed, 11 insertions(+), 4 deletions(-)
> >
>
> With the following nits addressed:
>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
>
> > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> > index efdaab3f154de..37d7d2aa472ab 100644
> > --- a/arch/arm64/kvm/mmu.c
> > +++ b/arch/arm64/kvm/mmu.c
> > @@ -1761,20 +1761,27 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
> > const struct kvm_memory_slot *new,
> > enum kvm_mr_change change)
> > {
> > + bool log_dirty_pages = new && new->flags & KVM_MEM_LOG_DIRTY_PAGES;
> > +
> > /*
> > * At this point memslot has been committed and there is an
> > * allocated dirty_bitmap[], dirty pages will be tracked while the
> > * memory slot is write protected.
> > */
> > - if (change != KVM_MR_DELETE && new->flags & KVM_MEM_LOG_DIRTY_PAGES) {
> > + if (log_dirty_pages) {
> > +
> > + if (change == KVM_MR_DELETE)
> > + return;
> > +
> > /*
> > * If we're with initial-all-set, we don't need to write
> > * protect any pages because they're all reported as dirty.
> > * Huge pages and normal pages will be write protect gradually.
> > */
>
> The comments need to be adjusted after this series is applied. The huge pages
> won't be write protected gradually. Instead, the huge pages will be split and
> write protected in one shoot.
>
I see, this comment is a bit confusing. Will update it to this:
/*
* Pages are write-protected on either of these two
* cases:
*
* 1. with initial-all-set: gradually with CLEAR ioctls,
*/
if (kvm_dirty_log_manual_protect_and_init_set(kvm))
return;
/*
* or
* 2. without initial-all-set: all in one shot when
* enabling dirty logging.
*/
kvm_mmu_wp_memory_region(kvm, new->id);
Will update the comment to include splitting when introducing eager-splitting
on the CLEAR ioctl (case 1.): "KVM: arm64: Split huge pages during
KVM_CLEAR_DIRTY_LOG".
> > - if (!kvm_dirty_log_manual_protect_and_init_set(kvm)) {
> > - kvm_mmu_wp_memory_region(kvm, new->id);
> > - }
> > + if (kvm_dirty_log_manual_protect_and_init_set(kvm))
> > + return;
> > +
> > + kvm_mmu_wp_memory_region(kvm, new->id);
> > }
> > }
> >
>
> Thanks,
> Gavin
>
next prev parent reply other threads:[~2023-04-23 19:47 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-09 6:29 [PATCH v7 00/12] Implement Eager Page Splitting for ARM Ricardo Koller
2023-04-09 6:29 ` [PATCH v7 01/12] KVM: arm64: Rename free_removed to free_unlinked Ricardo Koller
2023-04-17 6:08 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 02/12] KVM: arm64: Add KVM_PGTABLE_WALK ctx->flags for skipping BBM and CMO Ricardo Koller
2023-04-17 6:10 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 02/12] KVM: arm64: Add KVM_PGTABLE_WALK flags for skipping CMOs and BBM TLBIs Ricardo Koller
2023-04-17 6:13 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 03/12] KVM: arm64: Add helper for creating unlinked stage2 subtrees Ricardo Koller
2023-04-17 6:18 ` Gavin Shan
2023-04-22 20:09 ` Ricardo Koller
2023-04-22 20:32 ` Oliver Upton
2023-04-22 20:37 ` Ricardo Koller
2023-04-23 6:55 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 04/12] KVM: arm64: Add kvm_pgtable_stage2_split() Ricardo Koller
2023-04-09 9:36 ` kernel test robot
2023-04-10 17:40 ` Ricardo Koller
2023-04-17 6:38 ` Gavin Shan
2023-04-22 20:32 ` Ricardo Koller
2023-04-23 6:58 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 05/12] KVM: arm64: Refactor kvm_arch_commit_memory_region() Ricardo Koller
2023-04-17 6:41 ` Gavin Shan
2023-04-23 19:47 ` Ricardo Koller [this message]
2023-04-17 6:42 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 06/12] KVM: arm64: Add kvm_uninit_stage2_mmu() Ricardo Koller
2023-04-17 6:44 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 07/12] KVM: arm64: Export kvm_are_all_memslots_empty() Ricardo Koller
2023-04-17 6:47 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 08/12] KVM: arm64: Add KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE Ricardo Koller
2023-04-17 7:04 ` Gavin Shan
2023-04-23 20:27 ` Ricardo Koller
2023-04-24 11:14 ` Gavin Shan
2023-04-24 18:48 ` Ricardo Koller
2023-04-09 6:29 ` [PATCH v7 09/12] KVM: arm64: Split huge pages when dirty logging is enabled Ricardo Koller
2023-04-17 7:11 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 10/12] KVM: arm64: Open-code kvm_mmu_write_protect_pt_masked() Ricardo Koller
2023-04-17 7:14 ` Gavin Shan
2023-04-09 6:29 ` [PATCH v7 11/12] KVM: arm64: Split huge pages during KVM_CLEAR_DIRTY_LOG Ricardo Koller
2023-04-17 7:18 ` Gavin Shan
2023-04-09 6:30 ` [PATCH v7 12/12] KVM: arm64: Use local TLBI on permission relaxation Ricardo Koller
2023-04-17 7:20 ` Gavin Shan
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=ZEWLZDK39w737qiI@google.com \
--to=ricarkol@google.com \
--cc=alexandru.elisei@arm.com \
--cc=andrew.jones@linux.dev \
--cc=bgardon@google.com \
--cc=catalin.marinas@arm.com \
--cc=dmatlack@google.com \
--cc=eric.auger@redhat.com \
--cc=gshan@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@google.com \
--cc=pbonzini@redhat.com \
--cc=qperret@google.com \
--cc=rananta@google.com \
--cc=reijiw@google.com \
--cc=ricarkol@gmail.com \
--cc=seanjc@google.com \
--cc=shahuang@redhat.com \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.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