From: Oliver Upton <oliver.upton@linux.dev>
To: David Matlack <dmatlack@google.com>
Cc: Ricardo Koller <ricarkol@google.com>,
Ben Gardon <bgardon@google.com>,
pbonzini@redhat.com, maz@kernel.org, yuzenghui@huawei.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, gshan@redhat.com,
reijiw@google.com, rananta@google.com, ricarkol@gmail.com
Subject: Re: [PATCH 3/9] KVM: arm64: Add kvm_pgtable_stage2_split()
Date: Tue, 24 Jan 2023 12:28:50 -0800 [thread overview]
Message-ID: <Y9A/gk0uAdNbbmbE@thinky-boi> (raw)
In-Reply-To: <Y9AZ7ORdmIPQ1YGL@google.com>
On Tue, Jan 24, 2023 at 09:48:28AM -0800, David Matlack wrote:
> On Tue, Jan 24, 2023 at 09:18:33AM -0800, Ricardo Koller wrote:
> > On Tue, Jan 24, 2023 at 9:11 AM Oliver Upton <oliver.upton@linux.dev> wrote:
[...]
> > > The numbering we use in the page table walkers is deliberate, as it
> > > directly matches the Arm ARM. While we can certainly use either scheme
> > > I'd prefer we keep aligned with the architecture.
> >
> > hehe, I was actually subtly suggesting our x86 friends to change their side.
>
> Yeah KVM/x86 and KVM/ARM use basically opposite numbering schemes for
> page table levels.
>
> Level | KVM/ARM | KVM/x86
> ----- | ------- | ---------------
> pte | 3 | 1 (PG_LEVEL_4K)
> pmd | 2 | 2 (PG_LEVEL_2M)
> pud | 1 | 3 (PG_LEVEL_1G)
> p4d | 0 | 4
> | -1 | 5
>
> The ARM levels come from the architecture, whereas the x86 levels are
> arbitrary.
>
> I do think it would be valuable to standardize on one leveling scheme at
> some point. Otherwise, mixing level schemes is bound to be a source of
> bugs if and when we are sharing more MMU code across architectures.
That could work, so long as the respective ISAs don't depend on any
specific numbering scheme. For arm64 the level hints encoded in TLBIs
match our numbering scheme, which is quite valuable. We are definitely
at odds with RISC-V's numbering scheme (descending order, starting from
root), but AFAICT there doesn't appear to be any portion of the ISA that
depends on it (yet).
Sure, we could add some glue code to transform KVM's common leveling
scheme into an architecture-specific one for these use cases, but I
worry that'll be incredibly error-prone.
In any case I'd prefer we not make any changes at this point, as they'd
be purely cosmetic.
--
Thanks,
Oliver
next prev parent reply other threads:[~2023-01-24 20:29 UTC|newest]
Thread overview: 47+ 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-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 [this message]
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
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=Y9A/gk0uAdNbbmbE@thinky-boi \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox