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: Mon, 26 Sep 2011 20:28:25 +0000 [thread overview]
Message-ID: <4E80E069.5080302@freescale.com> (raw)
In-Reply-To: <DE307CAA-1801-4CAF-ADEC-9A8F5BD78A65@suse.de>
On 09/24/2011 02:44 AM, Alexander Graf wrote:
> On 20.09.2011, at 19:54, Scott Wood wrote:
>> On 09/19/2011 06:35 PM, Alexander Graf wrote:
>>> + 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).
>
> Yeah, no need to micro-optimized those few bits. The reason I used the asm statement was that I copied the hugetlbfs code which does it that way :).
The "21 - lz" thing is broken on 64-bit, FWIW. It works by chance in
the hugetlbfs code (and in settlbcam) because it results in tsize being
too low by 32, which only affects bits that subsequently get masked off.
>>> }
>>>
>>> up_read(¤t->mm->mmap_sem);
>>> }
>>>
>>> if (likely(!pfnmap)) {
>>> + unsigned long tsize_pages = 1 << (tsize - 2);
>>
>> 1 << (tsize + 10 - PAGE_SHIFT);
>
> Are we getting variable page sizes anytime soon? Will change it nevertheless, just curious :).
Nothing imminent on our chips AFAIK, but there's some 64K page support
in Linux for IBM's book3e chips, and it's not nice to hardcode
(especially in a hidden way) regardless.
-Scott
WARNING: multiple messages have this Message-ID (diff)
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: Mon, 26 Sep 2011 15:28:25 -0500 [thread overview]
Message-ID: <4E80E069.5080302@freescale.com> (raw)
In-Reply-To: <DE307CAA-1801-4CAF-ADEC-9A8F5BD78A65@suse.de>
On 09/24/2011 02:44 AM, Alexander Graf wrote:
> On 20.09.2011, at 19:54, Scott Wood wrote:
>> On 09/19/2011 06:35 PM, Alexander Graf wrote:
>>> + 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).
>
> Yeah, no need to micro-optimized those few bits. The reason I used the asm statement was that I copied the hugetlbfs code which does it that way :).
The "21 - lz" thing is broken on 64-bit, FWIW. It works by chance in
the hugetlbfs code (and in settlbcam) because it results in tsize being
too low by 32, which only affects bits that subsequently get masked off.
>>> }
>>>
>>> up_read(¤t->mm->mmap_sem);
>>> }
>>>
>>> if (likely(!pfnmap)) {
>>> + unsigned long tsize_pages = 1 << (tsize - 2);
>>
>> 1 << (tsize + 10 - PAGE_SHIFT);
>
> Are we getting variable page sizes anytime soon? Will change it nevertheless, just curious :).
Nothing imminent on our chips AFAIK, but there's some 64K page support
in Linux for IBM's book3e chips, and it's not nice to hardcode
(especially in a hidden way) regardless.
-Scott
next prev parent reply other threads:[~2011-09-26 20:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 23:35 [PATCH] KVM: PPC: E500: Support hugetlbfs Alexander Graf
2011-09-19 23:35 ` Alexander Graf
2011-09-20 17:54 ` Scott Wood
2011-09-20 17:54 ` Scott Wood
2011-09-24 7:44 ` Alexander Graf
2011-09-24 7:44 ` Alexander Graf
2011-09-26 20:28 ` Scott Wood [this message]
2011-09-26 20:28 ` Scott Wood
2011-09-22 6:50 ` Liu Yu-B13201
2011-09-24 7:47 ` Alexander Graf
2011-09-24 7:47 ` Alexander Graf
2011-09-26 20:04 ` Scott Wood
2011-09-26 20:04 ` Scott Wood
2011-10-05 14:37 ` Alexander Graf
2011-10-05 14:37 ` Alexander Graf
2011-10-05 16:06 ` Scott Wood
2011-10-05 16:06 ` Scott Wood
2011-10-05 18:55 ` Alexander Graf
2011-10-05 18:55 ` Alexander Graf
2011-10-05 19:53 ` Scott Wood
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=4E80E069.5080302@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 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.