From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/3] arm64: KVM: Implement 48 VA support for KVM EL2 and Stage-2
Date: Fri, 10 Oct 2014 10:16:12 +0200 [thread overview]
Message-ID: <20141010081612.GZ3717@cbox> (raw)
In-Reply-To: <20141009133625.GH17836@e104818-lin.cambridge.arm.com>
On Thu, Oct 09, 2014 at 02:36:26PM +0100, Catalin Marinas wrote:
> On Thu, Oct 09, 2014 at 12:01:37PM +0100, Christoffer Dall wrote:
> > On Wed, Oct 08, 2014 at 10:47:04AM +0100, Catalin Marinas wrote:
> > > On Tue, Oct 07, 2014 at 08:39:54PM +0100, Christoffer Dall wrote:
> > > > +static inline int kvm_prealloc_hwpgd(struct kvm *kvm, pgd_t *pgd)
> > > > +{
> > > > + pud_t *pud;
> > > > + pmd_t *pmd;
> > > > + unsigned int order, i;
> > > > + unsigned long hwpgd;
> > > > +
> > > > + if (KVM_PREALLOC_LEVEL == 0)
> > > > + return 0;
> > > > +
> > > > + order = get_order(PTRS_PER_S2_PGD);
> > >
> > > Isn't order always 0 here? Based on our IRC discussion, PTRS_PER_S2_PGD
> > > is 16 or less and the order should not be used.
> >
> > no, if the kernel has 4K pages and 4 levels, then PGDIR_SHIFT is 39, and
> > KVM_PHYS_SHIFT stays 40, so that means PTRS_PER_S2_PGD becomes 2, which
> > means we concatenate two first level stage-2 page tables, which means we
> > need to allocate two consecutive pages, giving us an order of 1, not 0.
>
> So if PTRS_PER_S2_PGD is 2, how come get_order(PTRS_PER_S2_PGD) == 1? My
> reading of the get_order() macro is that get_order(2) == 0.
>
> Did you mean get_order(PTRS_PER_S2_PGD * PAGE_SIZE)?
Ah, you're right. Sorry. Yes, that's what I meant.
>
> Or you could define a PTRS_PER_S2_PGD_SHIFT as (KVM_PHYS_SHIFT -
> PGDIR_SHIFT) and use this as the order directly.
>
That's better. I also experimented with defining S2_HWPGD_ORDER or
S2_PREALLOC_ORDER, but it didn't look much clear, so sticking with
PTRS_PER_S2_PGD_SHIFT.
> > > > + hwpgd = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
> > >
> > > I assume you need __get_free_pages() for alignment.
> >
> > yes, would you prefer a comment to that fact?
>
> No, that's fine.
>
Thanks,
-Christoffer
next prev parent reply other threads:[~2014-10-10 8:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 20:30 [PATCH v2 0/3] arm/arm64: KVM: Host 48-bit VA support and IPA limits Christoffer Dall
2014-10-06 20:30 ` [PATCH v2 1/3] arm64: KVM: Implement 48 VA support for KVM EL2 and Stage-2 Christoffer Dall
2014-10-07 10:48 ` Catalin Marinas
2014-10-07 13:28 ` Marc Zyngier
2014-10-07 19:39 ` Christoffer Dall
2014-10-08 9:34 ` Marc Zyngier
2014-10-08 9:47 ` Christoffer Dall
2014-10-08 10:27 ` Marc Zyngier
2014-10-08 9:47 ` Catalin Marinas
2014-10-09 11:01 ` Christoffer Dall
2014-10-09 13:36 ` Catalin Marinas
2014-10-10 8:16 ` Christoffer Dall [this message]
2014-10-07 13:40 ` Marc Zyngier
2014-10-08 9:48 ` Christoffer Dall
2014-10-06 20:30 ` [PATCH v2 2/3] arm/arm64: KVM: Ensure memslots are within KVM_PHYS_SIZE Christoffer Dall
2014-10-06 20:30 ` [PATCH v2 3/3] arm64: Allow 48-bits VA space without ARM_SMMU Christoffer Dall
2014-10-07 9:24 ` [PATCH v2 0/3] arm/arm64: KVM: Host 48-bit VA support and IPA limits Catalin Marinas
2014-10-07 9:36 ` Christoffer Dall
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=20141010081612.GZ3717@cbox \
--to=christoffer.dall@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).