linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Balbir Singh <bsingharora@gmail.com>,
	santhosh <santhog4@linux.vnet.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Rashmica Gupta <rashmicy@gmail.com>,
	linuxppc-dev@lists.ozlabs.org
Cc: manvanth@linux.vnet.ibm.com
Subject: Re: [V2] powerpc/Kconfig: Update config option based on page size.
Date: Fri, 16 Sep 2016 20:46:54 +0530	[thread overview]
Message-ID: <87oa3nyivt.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1e406f4d-25bc-c92b-8a5e-5d59ae28a274@gmail.com>

Balbir Singh <bsingharora@gmail.com> writes:

> On 14/09/16 20:40, santhosh wrote:
>> 
>>> Michael Ellerman <mpe@ellerman.id.au> writes:
>>>
>>>> On Fri, 2016-19-02 at 05:38:47 UTC, Rashmica Gupta wrote:
>>>>> Currently on PPC64 changing kernel pagesize from 4K to 64K leaves
>>>>> FORCE_MAX_ZONEORDER set to 13 - which produces a compile error.
>>>>>
>>>> ...
>>>>> So, update the range of FORCE_MAX_ZONEORDER from 9-64 to 8-9 for 64K pages
>>>>> and from 13-64 to 9-13 for 4K pages.
>>>>>
>>>>> Signed-off-by: Rashmica Gupta <rashmicy@gmail.com>
>>>>> Reviewed-by: Balbir Singh <bsingharora@gmail.com>
>>>> Applied to powerpc next, thanks.
>>>>
>>>> https://git.kernel.org/powerpc/c/a7ee539584acf4a565b7439cea
>>>>
>>> HPAGE_PMD_ORDER is not something we should check w.r.t 4k linux page
>>> size. We do have the below constraint w.r.t hugetlb pages
>>>
>>> static inline bool hstate_is_gigantic(struct hstate *h)
>>> {
>>>     return huge_page_order(h) >= MAX_ORDER;
>>> }
>>>
>>> That require MAX_ORDER to be greater than 12.
>>>
>
> 9 to 13 was done based on calculations you can find the commit
>
>
>
>>> Did we test hugetlbfs 4k config with this patch ? Will it work if we
>>> start marking hugepage as gigantic page ?
>>>
>>> -aneesh
>>>
>> Hello Rashmica,
>> 
>> With upstream linux kernel 4.8.0-rc1-00006-gbae9cc6 compiled with linux 4k page size we are not able set hugepages, Aneesh had a look at the problem and he mentioned this commit is causing the issue.
>> 
>> *Details:*
>> We are using pkvm ubuntu 16.04 guest with upstream kernel [4.8.0-rc1-00006-gbae9cc6] compiled with  4k page size
>> 
>> o/p from guest:
>> HugePages_Total:       0
>> HugePages_Free:        0
>> HugePages_Rsvd:        0
>> HugePages_Surp:        0
>> Hugepagesize:      16384 kB
>> 
>> Page sizes from device-tree: [dmesg]
>> [    0.000000] base_shift=12: shift=12, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=0
>> [    0.000000] base_shift=12: shift=24, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=56
>> [    0.000000] base_shift=24: shift=24, sllp=0x0100, avpnm=0x00000001, tlbiel=0, penc=0
>> 
>> while trying to configure the hugepages inside the guest it throws the below error:
>> 
>> echo 100 > /proc/sys/vm/nr_hugepages
>> -bash: echo: write error: Invalid argument
>> 
>> *Note*: we do not see the problem when the linux page is 64k
>
>
> Just to reiterate you are seeing this problem using 4k page size and 16M as the hugepage size.
> With FORCE_MAX_ZONEORDER set to 9 to 13 for 4k pages, you can do upto 32M if FORCE_MAX_ZONEORDER
> is 13 and same for 64K with FORCE_MAX_ZONEORDER set to 9.
>
> Basically the constraint is
>
>
> FORCE_MAX_ZONEBITS <= 25 - PAGESHIFT
>
> What is your value of FORCE_MAX_ZONEORDER in the .config?

The problem is the reverse of why the orginal fix was done. ie, When you
change the pae size from 64K to 4K using nconfig, we don't update the
FORCE_MAX_ZONEORDER and hence we end up a value of 9. That results in
the above error with hugetlb. So from a failed build when switching from
4k to 64K we now have a broken hugetlb when switching from 64K to 4K.

As suggested in the review of the original patch, we should make the 
FORCE_MAX_ZONEORDER range such that it picks the right value that will
get 16MB hugetlb to work.

Something like the below. That range is strange, but without that it picks a value
of 11.

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 927d2ab2ce08..792cb1768c8f 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -637,7 +637,7 @@ config FORCE_MAX_ZONEORDER
 	int "Maximum zone order"
 	range 8 9 if PPC64 && PPC_64K_PAGES
 	default "9" if PPC64 && PPC_64K_PAGES
-	range 9 13 if PPC64 && !PPC_64K_PAGES
+	range 13 13 if PPC64 && !PPC_64K_PAGES
 	default "13" if PPC64 && !PPC_64K_PAGES
 	range 9 64 if PPC32 && PPC_16K_PAGES
 	default "9" if PPC32 && PPC_16K_PAGES


-aneesh

  reply	other threads:[~2016-09-16 15:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19  5:38 [PATCH V2] powerpc/Kconfig: Update config option based on page size Rashmica Gupta
2016-02-19  6:07 ` Balbir Singh
2016-04-11 12:35 ` [V2] " Michael Ellerman
2016-04-19 14:59   ` Aneesh Kumar K.V
2016-04-19 23:09     ` Balbir Singh
2016-09-14 10:40     ` santhosh
2016-09-15 23:26       ` Michael Ellerman
2016-09-16  6:03       ` Balbir Singh
2016-09-16 15:16         ` Aneesh Kumar K.V [this message]
2016-09-19  7:15           ` Balbir Singh

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=87oa3nyivt.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=bsingharora@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=manvanth@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=rashmicy@gmail.com \
    --cc=santhog4@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).