From: Oliver Upton <oliver.upton@linux.dev>
To: Sean Christopherson <seanjc@google.com>
Cc: Ricardo Koller <ricarkol@google.com>,
Marc Zyngier <maz@kernel.org>,
pbonzini@redhat.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,
alexandru.elisei@arm.com, suzuki.poulose@arm.com,
eric.auger@redhat.com, gshan@redhat.com, reijiw@google.com,
rananta@google.com, bgardon@google.com, ricarkol@gmail.com
Subject: Re: [PATCH 6/9] KVM: arm64: Split huge pages when dirty logging is enabled
Date: Tue, 31 Jan 2023 19:06:35 +0000 [thread overview]
Message-ID: <Y9lmu8Ql/5nPRkX3@google.com> (raw)
In-Reply-To: <Y9lV5XEf7NV8i9uI@google.com>
On Tue, Jan 31, 2023 at 05:54:45PM +0000, Sean Christopherson wrote:
> On Tue, Jan 31, 2023, Oliver Upton wrote:
> > On Tue, Jan 31, 2023 at 01:18:15AM +0000, Sean Christopherson wrote:
> > > On Mon, Jan 30, 2023, Oliver Upton wrote:
> > > > I think that Marc's suggestion of having userspace configure this is
> > > > sound. After all, userspace _should_ know the granularity of the backing
> > > > source it chose for guest memory.
> > > >
> > > > We could also interpret a cache size of 0 to signal that userspace wants
> > > > to disable eager page split for a VM altogether. It is entirely possible that
> > > > the user will want a differing QoS between slice-of-hardware and
> > > > overcommitted VMs.
> > >
> > > Maybe. It's also entirely possible that QoS is never factored in, e.g. if QoS
> > > guarantees for all VMs on a system are better met by enabling eager splitting
> > > across the board.
> > >
> > > There are other reasons to use module/kernel params beyond what Marc listed, e.g.
> > > to let the user opt out even when something is on by default. x86's TDP MMU has
> > > benefited greatly from downstream users being able to do A/B performance testing
> > > this way. I suspect x86's eager_page_split knob was added largely for this
> > > reason, e.g. to easily see how a specific workload is affected by eager splitting.
> > > That seems like a reasonable fit on the ARM side as well.
> >
> > There's a rather important distinction here in that we'd allow userspace
> > to select the page split cache size, which should be correctly sized for
> > the backing memory source. Considering the break-before-make rules of
> > the architecture, the only way eager split is performant on arm64 is by
> > replacing a block entry with a fully populated table hierarchy in one
> > operation. AFAICT, you don't have this problem on x86, as the
> > architecture generally permits a direct valid->valid transformation
> > without an intermediate invalidation. Well, ignoring iTLB multihit :)
> >
> > So, the largest transformation we need to do right now is on a PUD w/
> > PAGE_SIZE=4K, leading to 513 pages as proposed in the series. Exposing
> > that configuration option in a module parameter is presumptive that all
> > VMs on a host use the exact same memory configuration, which doesn't
> > feel right to me.
>
> Can you elaborate on the cache size needing to be tied to the backing source?
The proposed eager split mechanism attempts to replace a block with a
a fully populated page table hierarchy (i.e. mapped at PTE granularity)
in order to avoid successive break-before-make invalidations. The cache
size must be >= the number of pages required to build out that fully
mapped page table hierarchy.
> Do the issues arise if you get to a point where KVM can have PGD-sized hugepages
> with PAGE_SIZE=4KiB?
Those problems when splitting any hugepage larger than a PMD. It just
so happens that the only configuration that supports larger mappings is
4K at the moment.
If we were to take the step-down approach to eager page splitting, there
will be a lot of knock-on break-before-make operations as we go
PUD -> PMD -> PTE.
> Or do you want to let userspace optimize _now_ for PMD+4KiB?
The default cache value should probably optimize for PMD splitting and
give userspace the option to scale that up for PUD or greater if it sees
fit.
--
Thanks,
Oliver
next prev parent reply other threads:[~2023-01-31 21:01 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-13 3:49 [PATCH 0/9] KVM: arm64: Eager Huge-page splitting for dirty-logging Ricardo Koller
2023-01-13 3:49 ` [PATCH 1/9] KVM: arm64: Add KVM_PGTABLE_WALK_REMOVED into ctx->flags Ricardo Koller
2023-01-24 0:51 ` Ben Gardon
2023-01-24 0:56 ` Oliver Upton
2023-01-24 16:32 ` Ricardo Koller
2023-01-24 18:00 ` Ben Gardon
2023-01-26 18:48 ` Ricardo Koller
2023-01-24 16:30 ` Ricardo Koller
2023-01-13 3:49 ` [PATCH 2/9] KVM: arm64: Add helper for creating removed stage2 subtrees Ricardo Koller
2023-01-14 17:58 ` kernel test robot
2023-01-24 0:55 ` Ben Gardon
2023-01-24 16:35 ` Ricardo Koller
2023-01-24 17:07 ` Oliver Upton
2023-01-13 3:49 ` [PATCH 3/9] KVM: arm64: Add kvm_pgtable_stage2_split() Ricardo Koller
2023-01-24 1:03 ` Ben Gardon
2023-01-24 16:46 ` Ricardo Koller
2023-01-24 17:11 ` Oliver Upton
2023-01-24 17:18 ` Ricardo Koller
2023-01-24 17:48 ` David Matlack
2023-01-24 20:28 ` Oliver Upton
2023-02-06 9:20 ` Zheng Chuan
2023-02-06 16:28 ` Ricardo Koller
2023-01-13 3:49 ` [PATCH 4/9] KVM: arm64: Refactor kvm_arch_commit_memory_region() Ricardo Koller
2023-01-13 3:49 ` [PATCH 5/9] KVM: arm64: Add kvm_uninit_stage2_mmu() Ricardo Koller
2023-01-13 3:49 ` [PATCH 6/9] KVM: arm64: Split huge pages when dirty logging is enabled Ricardo Koller
2023-01-24 17:52 ` Ben Gardon
2023-01-24 22:19 ` Oliver Upton
2023-01-24 22:45 ` Oliver Upton
2023-01-26 18:45 ` Ricardo Koller
2023-01-26 19:25 ` Ricardo Koller
2023-01-26 20:10 ` Marc Zyngier
2023-01-27 15:45 ` Ricardo Koller
2023-01-30 21:18 ` Oliver Upton
2023-01-31 1:18 ` Sean Christopherson
2023-01-31 17:45 ` Oliver Upton
2023-01-31 17:54 ` Sean Christopherson
2023-01-31 19:06 ` Oliver Upton [this message]
2023-01-31 18:01 ` David Matlack
2023-01-31 18:19 ` Ricardo Koller
2023-01-31 18:35 ` Oliver Upton
2023-01-31 10:31 ` Marc Zyngier
2023-01-31 10:28 ` Marc Zyngier
2023-02-06 16:35 ` Ricardo Koller
2023-01-13 3:49 ` [PATCH 7/9] KVM: arm64: Open-code kvm_mmu_write_protect_pt_masked() Ricardo Koller
2023-01-13 3:49 ` [PATCH 8/9] KVM: arm64: Split huge pages during KVM_CLEAR_DIRTY_LOG Ricardo Koller
2023-01-13 3:50 ` [PATCH 9/9] KVM: arm64: Use local TLBI on permission relaxation Ricardo Koller
2023-01-24 0:48 ` [PATCH 0/9] KVM: arm64: Eager Huge-page splitting for dirty-logging Ben Gardon
2023-01-24 16:50 ` Ricardo Koller
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=Y9lmu8Ql/5nPRkX3@google.com \
--to=oliver.upton@linux.dev \
--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=pbonzini@redhat.com \
--cc=qperret@google.com \
--cc=rananta@google.com \
--cc=reijiw@google.com \
--cc=ricarkol@gmail.com \
--cc=ricarkol@google.com \
--cc=seanjc@google.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 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.