[{"id":1709109,"web_url":"http://patchwork.ozlabs.org/comment/1709109/","msgid":"<9daa97d2-b0a7-6416-c6c5-28e6dbc727ef@linux.vnet.ibm.com>","date":"2017-07-05T03:42:08","subject":"Re: [RFC] powerpc/mm: Enable gigantic HugeTLB page support for\n\tpowernv","submitter":{"id":664,"url":"http://patchwork.ozlabs.org/api/people/664/","name":"Aneesh Kumar K.V","email":"aneesh.kumar@linux.vnet.ibm.com"},"content":"On Tuesday 04 July 2017 04:16 PM, Anshuman Khandual wrote:\n> All the functionality for memblock allocation during boot was\n> already present in Book3e and embeded platforms. This change\n> just moves around some code under config conditions to make\n> the function happen on powernv platforms.\n> \n> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>\n> ---\n> Tested lightly on both powernv and pseries platforms with two\n> 16GB pages. Will appreciate comments and suggestions on the\n> approach.\n> \n> On PowerNV while asking for 16GB pages through kernel command\n> line, we need to be careful not to starve the system of memory\n> which can make it unable to boot.\n\nI have a patch series that does this here. How is this different ?\n\nhttp://mid.gmane.org/1496327441-7368-1-git-send-email- \naneesh.kumar@linux.vnet.ibm.com\n\n\n\n\n> \n>   arch/powerpc/include/asm/hugetlb.h |  2 +-\n>   arch/powerpc/mm/hash_utils_64.c    |  8 ++---\n>   arch/powerpc/mm/hugetlbpage.c      | 66 ++++++++++++++++++++------------------\n>   3 files changed, 39 insertions(+), 37 deletions(-)\n> \n> diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h\n> index 7f4025a..b0c1464 100644\n> --- a/arch/powerpc/include/asm/hugetlb.h\n> +++ b/arch/powerpc/include/asm/hugetlb.h\n> @@ -224,7 +224,7 @@ static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,\n>    * the .dts as on IBM platforms.\n>    */\n>   #if defined(CONFIG_HUGETLB_PAGE) && (defined(CONFIG_PPC_FSL_BOOK3E) || \\\n> -    defined(CONFIG_PPC_8xx))\n> +    defined(CONFIG_PPC_8xx) || defined(CONFIG_PPC_POWERNV))\n>   extern void __init reserve_hugetlb_gpages(void);\n>   #else\n>   static inline void reserve_hugetlb_gpages(void)\n> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c\n> index a3f1e7d..7862fdb 100644\n> --- a/arch/powerpc/mm/hash_utils_64.c\n> +++ b/arch/powerpc/mm/hash_utils_64.c\n> @@ -473,7 +473,7 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,\n>   \treturn 1;\n>   }\n> \n> -#ifdef CONFIG_HUGETLB_PAGE\n> +#if defined(CONFIG_HUGETLB_PAGE) && !defined(CONFIG_PPC_POWERNV)\n>   /* Scan for 16G memory blocks that have been set aside for huge pages\n>    * and reserve those blocks for 16G huge pages.\n>    */\n> @@ -513,7 +513,7 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,\n>   \t}\n>   \treturn 0;\n>   }\n> -#endif /* CONFIG_HUGETLB_PAGE */\n> +#endif /* CONFIG_HUGETLB_PAGE && !CONFIG_PPC_POWERNV*/\n> \n>   static void mmu_psize_set_default_penc(void)\n>   {\n> @@ -566,10 +566,10 @@ static void __init htab_scan_page_sizes(void)\n>   \t\t       sizeof(mmu_psize_defaults_gp));\n>   \t}\n> \n> -#ifdef CONFIG_HUGETLB_PAGE\n> +#if defined(CONFIG_HUGETLB_PAGE) && !defined(CONFIG_PPC_POWERNV)\n>   \t/* Reserve 16G huge page memory sections for huge pages */\n>   \tof_scan_flat_dt(htab_dt_scan_hugepage_blocks, NULL);\n> -#endif /* CONFIG_HUGETLB_PAGE */\n> +#endif /* CONFIG_HUGETLB_PAGE && !CONFIG_PPC_POWERNV */\n>   }\n> \n>   /*\n> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c\n> index a4f33de..be0be5d 100644\n> --- a/arch/powerpc/mm/hugetlbpage.c\n> +++ b/arch/powerpc/mm/hugetlbpage.c\n> @@ -258,6 +258,40 @@ int alloc_bootmem_huge_page(struct hstate *hstate)\n> \n>   \treturn 1;\n>   }\n> +#else /* !PPC_FSL_BOOK3E */\n> +\n> +/* Build list of addresses of gigantic pages.  This function is used in early\n> + * boot before the buddy allocator is setup.\n> + */\n> +void add_gpage(u64 addr, u64 page_size, unsigned long number_of_pages)\n> +{\n> +\tif (!addr)\n> +\t\treturn;\n> +\twhile (number_of_pages > 0) {\n> +\t\tgpage_freearray[nr_gpages] = addr;\n> +\t\tnr_gpages++;\n> +\t\tnumber_of_pages--;\n> +\t\taddr += page_size;\n> +\t}\n> +}\n> +\n> +/* Moves the gigantic page addresses from the temporary list to the\n> + * huge_boot_pages list.\n> + */\n> +int alloc_bootmem_huge_page(struct hstate *hstate)\n> +{\n> +\tstruct huge_bootmem_page *m;\n> +\tif (nr_gpages == 0)\n> +\t\treturn 0;\n> +\tm = phys_to_virt(gpage_freearray[--nr_gpages]);\n> +\tgpage_freearray[nr_gpages] = 0;\n> +\tlist_add(&m->list, &huge_boot_pages);\n> +\tm->hstate = hstate;\n> +\treturn 1;\n> +}\n> +#endif\n> +\n> +#if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx) || defined(CONFIG_PPC_POWERNV)\n>   /*\n>    * Scan the command line hugepagesz= options for gigantic pages; store those in\n>    * a list that we use to allocate the memory once all options are parsed.\n> @@ -339,38 +373,6 @@ void __init reserve_hugetlb_gpages(void)\n>   \t\tadd_gpage(base, size, gpage_npages[i]);\n>   \t}\n>   }\n> -\n> -#else /* !PPC_FSL_BOOK3E */\n> -\n> -/* Build list of addresses of gigantic pages.  This function is used in early\n> - * boot before the buddy allocator is setup.\n> - */\n> -void add_gpage(u64 addr, u64 page_size, unsigned long number_of_pages)\n> -{\n> -\tif (!addr)\n> -\t\treturn;\n> -\twhile (number_of_pages > 0) {\n> -\t\tgpage_freearray[nr_gpages] = addr;\n> -\t\tnr_gpages++;\n> -\t\tnumber_of_pages--;\n> -\t\taddr += page_size;\n> -\t}\n> -}\n> -\n> -/* Moves the gigantic page addresses from the temporary list to the\n> - * huge_boot_pages list.\n> - */\n> -int alloc_bootmem_huge_page(struct hstate *hstate)\n> -{\n> -\tstruct huge_bootmem_page *m;\n> -\tif (nr_gpages == 0)\n> -\t\treturn 0;\n> -\tm = phys_to_virt(gpage_freearray[--nr_gpages]);\n> -\tgpage_freearray[nr_gpages] = 0;\n> -\tlist_add(&m->list, &huge_boot_pages);\n> -\tm->hstate = hstate;\n> -\treturn 1;\n> -}\n>   #endif\n> \n>   #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx)\n>","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3x2RY86Qxhz9s8V\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  5 Jul 2017 13:43:24 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3x2RY85Js8zDqyc\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  5 Jul 2017 13:43:24 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n\t[148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3x2RX04QBbzDqhn\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed,  5 Jul 2017 13:42:24 +1000 (AEST)","from pps.filterd (m0098416.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id\n\tv653dPKH033832\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 4 Jul 2017 23:42:21 -0400","from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2bg9tq4fkc-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 04 Jul 2017 23:42:21 -0400","from localhost\n\tby e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from\n\t<aneesh.kumar@linux.vnet.ibm.com>; Tue, 4 Jul 2017 21:42:19 -0600","from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16)\n\tby e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tTue, 4 Jul 2017 21:42:18 -0600","from b03ledav002.gho.boulder.ibm.com\n\t(b03ledav002.gho.boulder.ibm.com [9.17.130.233])\n\tby b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v653gH0f6816170; Tue, 4 Jul 2017 20:42:17 -0700","from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 7D66F136048;\n\tTue,  4 Jul 2017 21:42:17 -0600 (MDT)","from [9.102.0.123] (unknown [9.102.0.123])\n\tby b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP id\n\tB8F3113603A; Tue,  4 Jul 2017 21:42:15 -0600 (MDT)"],"Subject":"Re: [RFC] powerpc/mm: Enable gigantic HugeTLB page support for\n\tpowernv","To":"Anshuman Khandual <khandual@linux.vnet.ibm.com>,\n\tlinuxppc-dev@lists.ozlabs.org","References":"<20170704104608.22397-1-khandual@linux.vnet.ibm.com>","From":"\"Aneesh Kumar K.V\" <aneesh.kumar@linux.vnet.ibm.com>","Date":"Wed, 5 Jul 2017 09:12:08 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.1.1","MIME-Version":"1.0","In-Reply-To":"<20170704104608.22397-1-khandual@linux.vnet.ibm.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-TM-AS-GCONF":"00","x-cbid":"17070503-0004-0000-0000-0000128308E1","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007321; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000214; SDB=6.00883004; UDB=6.00440459;\n\tIPR=6.00663196; \n\tBA=6.00005453; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016087;\n\tXFM=3.00000015; UTC=2017-07-05 03:42:19","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17070503-0005-0000-0000-00008014169C","Message-Id":"<9daa97d2-b0a7-6416-c6c5-28e6dbc727ef@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-07-05_02:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000\n\tdefinitions=main-1707050059","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1709112,"web_url":"http://patchwork.ozlabs.org/comment/1709112/","msgid":"<d21b1afc-2aae-8903-557a-bfc31628422b@linux.vnet.ibm.com>","date":"2017-07-05T03:49:33","subject":"Re: [RFC] powerpc/mm: Enable gigantic HugeTLB page support for\n\tpowernv","submitter":{"id":9057,"url":"http://patchwork.ozlabs.org/api/people/9057/","name":"Anshuman Khandual","email":"khandual@linux.vnet.ibm.com"},"content":"On 07/05/2017 09:12 AM, Aneesh Kumar K.V wrote:\n> \n> \n> On Tuesday 04 July 2017 04:16 PM, Anshuman Khandual wrote:\n>> All the functionality for memblock allocation during boot was\n>> already present in Book3e and embeded platforms. This change\n>> just moves around some code under config conditions to make\n>> the function happen on powernv platforms.\n>>\n>> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>\n>> ---\n>> Tested lightly on both powernv and pseries platforms with two\n>> 16GB pages. Will appreciate comments and suggestions on the\n>> approach.\n>>\n>> On PowerNV while asking for 16GB pages through kernel command\n>> line, we need to be careful not to starve the system of memory\n>> which can make it unable to boot.\n> \n> I have a patch series that does this here. How is this different ?\n> \n> http://mid.gmane.org/1496327441-7368-1-git-send-email-\n> aneesh.kumar@linux.vnet.ibm.com\n\nHmm, did not know you have attempted this before. The link does\nnot open for me. Could you give the subject line for the patch\nseries.","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3x2RjY0nx5z9s82\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  5 Jul 2017 13:50:41 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3x2RjX72LLzDr1n\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  5 Jul 2017 13:50:40 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3x2RhR5WSgzDqhn\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed,  5 Jul 2017 13:49:43 +1000 (AEST)","from pps.filterd (m0098404.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id\n\tv653n24b111850\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 4 Jul 2017 23:49:41 -0400","from e23smtp03.au.ibm.com (e23smtp03.au.ibm.com [202.81.31.145])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2bg4vus249-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 04 Jul 2017 23:49:40 -0400","from localhost\n\tby e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from\n\t<khandual@linux.vnet.ibm.com>; Wed, 5 Jul 2017 13:49:38 +1000","from d23relay09.au.ibm.com (202.81.31.228)\n\tby e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tWed, 5 Jul 2017 13:49:35 +1000","from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138])\n\tby d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tv653nZZo6619492\n\tfor <linuxppc-dev@lists.ozlabs.org>; Wed, 5 Jul 2017 13:49:35 +1000","from d23av02.au.ibm.com (localhost [127.0.0.1])\n\tby d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tv653nQ3I030199\n\tfor <linuxppc-dev@lists.ozlabs.org>; Wed, 5 Jul 2017 13:49:26 +1000","from [9.202.24.168] ([9.202.24.168])\n\tby d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tv653nPMj030189; Wed, 5 Jul 2017 13:49:26 +1000"],"Subject":"Re: [RFC] powerpc/mm: Enable gigantic HugeTLB page support for\n\tpowernv","To":"\"Aneesh Kumar K.V\" <aneesh.kumar@linux.vnet.ibm.com>,\n\tlinuxppc-dev@lists.ozlabs.org","References":"<20170704104608.22397-1-khandual@linux.vnet.ibm.com>\n\t<9daa97d2-b0a7-6416-c6c5-28e6dbc727ef@linux.vnet.ibm.com>","From":"Anshuman Khandual <khandual@linux.vnet.ibm.com>","Date":"Wed, 5 Jul 2017 09:19:33 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101\n\tThunderbird/45.5.1","MIME-Version":"1.0","In-Reply-To":"<9daa97d2-b0a7-6416-c6c5-28e6dbc727ef@linux.vnet.ibm.com>","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"7bit","X-TM-AS-MML":"disable","x-cbid":"17070503-0008-0000-0000-0000014C94CE","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17070503-0009-0000-0000-0000097CC3D7","Message-Id":"<d21b1afc-2aae-8903-557a-bfc31628422b@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-07-05_02:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000\n\tdefinitions=main-1707050062","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}}]