From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: <kvm-ppc@vger.kernel.org>, <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: PPC: E500: Support hugetlbfs
Date: Tue, 20 Sep 2011 12:54:34 -0500 [thread overview]
Message-ID: <4E78D35A.9000301@freescale.com> (raw)
In-Reply-To: <1316475344-12033-1-git-send-email-agraf@suse.de>
On 09/19/2011 06:35 PM, Alexander Graf wrote:
> + /*
> + * e500 doesn't implement the lowest tsize bit,
> + * or 1K pages.
> + */
> + tsize = max(BOOK3E_PAGESZ_4K, tsize & ~1);
> +
> + /* take the smallest page size that satisfies host and
> + guest mapping */
kernel comment style...
I don't personally care much, but this leaves a checkpatch complaint for
the next person to modify the comment. Such as to make it say "take the
largest page size that...". :-)
> + asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (psize));
> + tsize = min(21 - lz, tsize);
No need to open-code the cntlz and subtract-from-21:
tsize = min(ilog2(psize) - 10, tsize);
/*
* e500 doesn't implement the lowest tsize bit,
* or 1K pages.
*/
tsize = max(BOOK3E_PAGESZ_4K, tsize & ~1);
There's still an open-coded subtraction of 10, but that relates more
straightforwardly to the definition of tsize (and could be factored out
into a size-to-tsize function).
> }
>
> up_read(¤t->mm->mmap_sem);
> }
>
> if (likely(!pfnmap)) {
> + unsigned long tsize_pages = 1 << (tsize - 2);
1 << (tsize + 10 - PAGE_SHIFT);
> pfn = gfn_to_pfn_memslot(vcpu_e500->vcpu.kvm, slot, gfn);
> + pfn &= ~(tsize_pages - 1);
> + gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1);
> if (is_error_pfn(pfn)) {
Won't the masking of pfn affect is_error_pfn()?
-Scott
next prev parent reply other threads:[~2011-09-20 17:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 23:35 [PATCH] KVM: PPC: E500: Support hugetlbfs Alexander Graf
2011-09-20 17:54 ` Scott Wood [this message]
2011-09-24 7:44 ` Alexander Graf
2011-09-26 20:28 ` Scott Wood
2011-09-22 6:50 ` Liu Yu-B13201
2011-09-24 7:47 ` Alexander Graf
2011-09-26 20:04 ` Scott Wood
-- strict thread matches above, loose matches on Subject: below --
2011-10-05 14:37 Alexander Graf
2011-10-05 16:06 ` Scott Wood
2011-10-05 18:55 ` Alexander Graf
2011-10-05 19:53 ` Scott Wood
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=4E78D35A.9000301@freescale.com \
--to=scottwood@freescale.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.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