From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 444E1C4CECD for ; Mon, 27 Apr 2020 19:11:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28EE5214D8 for ; Mon, 27 Apr 2020 19:11:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="lVp5EA5L" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726757AbgD0TLw (ORCPT ); Mon, 27 Apr 2020 15:11:52 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:56138 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726384AbgD0TLw (ORCPT ); Mon, 27 Apr 2020 15:11:52 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03RJ9QJn028975; Mon, 27 Apr 2020 19:10:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=hEDia4zMBZ8uXaQ9p7jtiwi1+JFZYurTsb0V3zlgmAU=; b=lVp5EA5Li9X7YNs4kLFUL1LfUFYDpCR2wtVaUroDVUM0FHlQiOHrt5HEtZF6hplhGwCH ck76IiH+mttB+uE0fo3QwHY8wUZgbvrweYNU069YcHGQsC+mYIw7EE0LFPlTgq8M0ZGK f8Uvq2Oz+7vIrdPyFNByjDDIEnWd+Gy2E2ISBo8cw347SwEigzmcQXrYtAMKWIQX9pRu ApCDOKA1QDKxu3lNvX+KaVT9zod7cyXLF6M0DCe2AFvIj2iLfDt+gDH0WngjweUDGoYl QCyjNxOiX7EosxGJQMVEmkSyjYB8t+7jtbV2lH8J8w3h9oLd7+ce/f7+9Z89zr4O2G4x iw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 30p2p00y0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 19:10:01 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03RJ88fW054624; Mon, 27 Apr 2020 19:10:01 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 30mxrqvqxc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 19:10:00 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 03RJ9owN023990; Mon, 27 Apr 2020 19:09:50 GMT Received: from [192.168.2.157] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Apr 2020 12:09:50 -0700 Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code From: Mike Kravetz To: Sandipan Das Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-doc@vger.kernel.org, Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , "David S.Miller" , Thomas Gleixner , Ingo Molnar , Dave Hansen , Jonathan Corbet , Longpeng , Christophe Leroy , Randy Dunlap , Mina Almasry , Peter Xu , Nitesh Narayan Lal , Andrew Morton References: <20200417185049.275845-1-mike.kravetz@oracle.com> <20200417185049.275845-3-mike.kravetz@oracle.com> <7583dfcc-62d8-2a54-6eef-bcb4e01129b3@gmail.com> <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> Message-ID: Date: Mon, 27 Apr 2020 12:09:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9604 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270154 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9604 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 clxscore=1015 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270154 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/27/20 10:25 AM, Mike Kravetz wrote: > On 4/26/20 10:04 PM, Sandipan Das wrote: >> On 18/04/20 12:20 am, Mike Kravetz wrote: >>> Now that architectures provide arch_hugetlb_valid_size(), parsing >>> of "hugepagesz=" can be done in architecture independent code. >> >> This isn't working as expected on powerpc64. >> >> [ 0.000000] Kernel command line: root=UUID=dc7b49cf-95a2-4996-8e7d-7c64ddc7a6ff hugepagesz=16G hugepages=2 >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepagesz = 16G >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepages = 2 >> [ 0.284177] HugeTLB registered 16.0 MiB page size, pre-allocated 0 pages >> [ 0.284182] HugeTLB registered 16.0 GiB page size, pre-allocated 0 pages >> [ 2.585062] hugepagesz=16G >> [ 2.585063] hugepages=2 >> > > In the new arch independent version of hugepages_setup, I added the following > code in patch 4 off this series: > >> + if (!hugepages_supported()) { >> + pr_warn("HugeTLB: huge pages not supported, ignoring hugepages = %s\n", s); >> + return 0; >> + } >> + > > The easy solution is to remove all the hugepages_supported() checks from > command line parsing routines and rely on the later check in hugetlb_init(). Here is a patch to address the issue. Sorry, as my series breaks all hugetlb command line processing on powerpc. Sandipan, can you test the following patch? >From 480fe2847361e2a85aeec1fb39fe643bb7100a07 Mon Sep 17 00:00:00 2001 From: Mike Kravetz Date: Mon, 27 Apr 2020 11:37:30 -0700 Subject: [PATCH] hugetlbfs: fix changes to command line processing Previously, a check for hugepages_supported was added before processing hugetlb command line parameters. On some architectures such as powerpc, hugepages_supported() is not set to true until after command line processing. Therefore, no hugetlb command line parameters would be accepted. Remove the additional checks for hugepages_supported. In hugetlb_init, print a warning if !hugepages_supported and command line parameters were specified. Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1075abdb5717..5548e8851b93 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3212,8 +3212,11 @@ static int __init hugetlb_init(void) { int i; - if (!hugepages_supported()) + if (!hugepages_supported()) { + if (hugetlb_max_hstate || default_hstate_max_huge_pages) + pr_warn("HugeTLB: huge pages not supported, ignoring associated command-line parameters\n"); return 0; + } /* * Make sure HPAGE_SIZE (HUGETLB_PAGE_ORDER) hstate exists. Some @@ -3315,11 +3318,6 @@ static int __init hugepages_setup(char *s) unsigned long *mhp; static unsigned long *last_mhp; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepages = %s\n", s); - return 0; - } - if (!parsed_valid_hugepagesz) { pr_warn("HugeTLB: hugepages=%s does not follow a valid hugepagesz, ignoring\n", s); parsed_valid_hugepagesz = true; @@ -3372,11 +3370,6 @@ static int __init hugepagesz_setup(char *s) struct hstate *h; parsed_valid_hugepagesz = false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepagesz = %s\n", s); - return 0; - } - size = (unsigned long)memparse(s, NULL); if (!arch_hugetlb_valid_size(size)) { @@ -3424,11 +3417,6 @@ static int __init default_hugepagesz_setup(char *s) unsigned long size; parsed_valid_hugepagesz = false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring default_hugepagesz = %s\n", s); - return 0; - } - if (parsed_default_hugepagesz) { pr_err("HugeTLB: default_hugepagesz previously specified, ignoring %s\n", s); return 0; -- 2.25.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Kravetz Date: Mon, 27 Apr 2020 19:09:47 +0000 Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code Message-Id: List-Id: References: <20200417185049.275845-1-mike.kravetz@oracle.com> <20200417185049.275845-3-mike.kravetz@oracle.com> <7583dfcc-62d8-2a54-6eef-bcb4e01129b3@gmail.com> <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> In-Reply-To: <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Sandipan Das Cc: linux-doc@vger.kernel.org, Catalin Marinas , Dave Hansen , Heiko Carstens , Peter Xu , linux-mm@kvack.org, Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Mina Almasry , linux-s390@vger.kernel.org, Jonathan Corbet , Christian Borntraeger , Ingo Molnar , Benjamin Herrenschmidt , Longpeng , Albert Ou , Vasily Gorbik , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Nitesh Narayan Lal , Randy Dunlap , linux-kernel@vger.kernel.org, Palmer Dabbelt , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S.Miller" On 4/27/20 10:25 AM, Mike Kravetz wrote: > On 4/26/20 10:04 PM, Sandipan Das wrote: >> On 18/04/20 12:20 am, Mike Kravetz wrote: >>> Now that architectures provide arch_hugetlb_valid_size(), parsing >>> of "hugepagesz=3D" can be done in architecture independent code. >> >> This isn't working as expected on powerpc64. >> >> [ 0.000000] Kernel command line: root=3DUUID=DC7b49cf-95a2-4996-8e7= d-7c64ddc7a6ff hugepagesz=16G hugepages=3D2=20 >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepagesz = =3D 16G >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepages = =3D 2 >> [ 0.284177] HugeTLB registered 16.0 MiB page size, pre-allocated 0 = pages >> [ 0.284182] HugeTLB registered 16.0 GiB page size, pre-allocated 0 = pages >> [ 2.585062] hugepagesz=16G >> [ 2.585063] hugepages=3D2 >> >=20 > In the new arch independent version of hugepages_setup, I added the follo= wing > code in patch 4 off this series: >=20 >> + if (!hugepages_supported()) { >> + pr_warn("HugeTLB: huge pages not supported, ignoring hugepages =3D %s= \n", s); >> + return 0; >> + } >> + >=20 > The easy solution is to remove all the hugepages_supported() checks from > command line parsing routines and rely on the later check in hugetlb_init= (). Here is a patch to address the issue. Sorry, as my series breaks all huget= lb command line processing on powerpc. Sandipan, can you test the following patch? >From 480fe2847361e2a85aeec1fb39fe643bb7100a07 Mon Sep 17 00:00:00 2001 From: Mike Kravetz Date: Mon, 27 Apr 2020 11:37:30 -0700 Subject: [PATCH] hugetlbfs: fix changes to command line processing Previously, a check for hugepages_supported was added before processing hugetlb command line parameters. On some architectures such as powerpc, hugepages_supported() is not set to true until after command line processing. Therefore, no hugetlb command line parameters would be accepted. Remove the additional checks for hugepages_supported. In hugetlb_init, print a warning if !hugepages_supported and command line parameters were specified. Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1075abdb5717..5548e8851b93 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3212,8 +3212,11 @@ static int __init hugetlb_init(void) { int i; =20 - if (!hugepages_supported()) + if (!hugepages_supported()) { + if (hugetlb_max_hstate || default_hstate_max_huge_pages) + pr_warn("HugeTLB: huge pages not supported, ignoring associated command= -line parameters\n"); return 0; + } =20 /* * Make sure HPAGE_SIZE (HUGETLB_PAGE_ORDER) hstate exists. Some @@ -3315,11 +3318,6 @@ static int __init hugepages_setup(char *s) unsigned long *mhp; static unsigned long *last_mhp; =20 - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepages =3D %s\n"= , s); - return 0; - } - if (!parsed_valid_hugepagesz) { pr_warn("HugeTLB: hugepages=3D%s does not follow a valid hugepagesz, ign= oring\n", s); parsed_valid_hugepagesz =3D true; @@ -3372,11 +3370,6 @@ static int __init hugepagesz_setup(char *s) struct hstate *h; =20 parsed_valid_hugepagesz =3D false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepagesz =3D %s\n= ", s); - return 0; - } - size =3D (unsigned long)memparse(s, NULL); =20 if (!arch_hugetlb_valid_size(size)) { @@ -3424,11 +3417,6 @@ static int __init default_hugepagesz_setup(char *s) unsigned long size; =20 parsed_valid_hugepagesz =3D false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring default_hugepagesz = =3D %s\n", s); - return 0; - } - if (parsed_default_hugepagesz) { pr_err("HugeTLB: default_hugepagesz previously specified, ignoring %s\n"= , s); return 0; --=20 2.25.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B96BC4CECC for ; Mon, 27 Apr 2020 19:11:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6945920B1F for ; Mon, 27 Apr 2020 19:11:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WM3jyUvc"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="lVp5EA5L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6945920B1F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hEDia4zMBZ8uXaQ9p7jtiwi1+JFZYurTsb0V3zlgmAU=; b=WM3jyUvcI6iibr n2vilYkHfJIhKoxt7v6JnXUU9DHf1JzfNPNFo5zQCAeFjGujXebW9CmqM23EieYVsUfEP30tjhNR8 9927moTEsRwHC9gYpme+MMVrWGUD9AdWStO/44u/wbprO/rcFU5eX3wYKGv4afjuVx07k7OiT/7Tf +R4gYSYMfv0VPIp5GPnhyKMWGrtP5jwSayP96wuMBqFRLcWtFPNv5KyI/5YjsAkbWOF0AqHNzlyuD A/XUrL3WmpQ43TzPIFc3L80anCEnxHhpX7sW/2uCvPBxLt91ri4X/K0zoo1orxMYWfumBapgwaH1u soPnPGnADFvIiJlwY0qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jT9AB-0003h6-D9; Mon, 27 Apr 2020 19:11:31 +0000 Received: from userp2120.oracle.com ([156.151.31.85]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jT9A9-0003fk-0l; Mon, 27 Apr 2020 19:11:30 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03RJ9QJn028975; Mon, 27 Apr 2020 19:10:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=hEDia4zMBZ8uXaQ9p7jtiwi1+JFZYurTsb0V3zlgmAU=; b=lVp5EA5Li9X7YNs4kLFUL1LfUFYDpCR2wtVaUroDVUM0FHlQiOHrt5HEtZF6hplhGwCH ck76IiH+mttB+uE0fo3QwHY8wUZgbvrweYNU069YcHGQsC+mYIw7EE0LFPlTgq8M0ZGK f8Uvq2Oz+7vIrdPyFNByjDDIEnWd+Gy2E2ISBo8cw347SwEigzmcQXrYtAMKWIQX9pRu ApCDOKA1QDKxu3lNvX+KaVT9zod7cyXLF6M0DCe2AFvIj2iLfDt+gDH0WngjweUDGoYl QCyjNxOiX7EosxGJQMVEmkSyjYB8t+7jtbV2lH8J8w3h9oLd7+ce/f7+9Z89zr4O2G4x iw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 30p2p00y0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 19:10:01 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03RJ88fW054624; Mon, 27 Apr 2020 19:10:01 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 30mxrqvqxc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 19:10:00 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 03RJ9owN023990; Mon, 27 Apr 2020 19:09:50 GMT Received: from [192.168.2.157] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Apr 2020 12:09:50 -0700 Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code From: Mike Kravetz To: Sandipan Das References: <20200417185049.275845-1-mike.kravetz@oracle.com> <20200417185049.275845-3-mike.kravetz@oracle.com> <7583dfcc-62d8-2a54-6eef-bcb4e01129b3@gmail.com> <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> Message-ID: Date: Mon, 27 Apr 2020 12:09:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9604 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270154 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9604 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 clxscore=1015 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270154 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200427_121129_209985_55B45D31 X-CRM114-Status: GOOD ( 28.38 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, Catalin Marinas , Dave Hansen , Heiko Carstens , Peter Xu , linux-mm@kvack.org, Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Mina Almasry , linux-s390@vger.kernel.org, Jonathan Corbet , Christian Borntraeger , Ingo Molnar , Benjamin Herrenschmidt , Longpeng , Albert Ou , Vasily Gorbik , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Nitesh Narayan Lal , Randy Dunlap , linux-kernel@vger.kernel.org, Palmer Dabbelt , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S.Miller" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org On 4/27/20 10:25 AM, Mike Kravetz wrote: > On 4/26/20 10:04 PM, Sandipan Das wrote: >> On 18/04/20 12:20 am, Mike Kravetz wrote: >>> Now that architectures provide arch_hugetlb_valid_size(), parsing >>> of "hugepagesz=" can be done in architecture independent code. >> >> This isn't working as expected on powerpc64. >> >> [ 0.000000] Kernel command line: root=UUID=dc7b49cf-95a2-4996-8e7d-7c64ddc7a6ff hugepagesz=16G hugepages=2 >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepagesz = 16G >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepages = 2 >> [ 0.284177] HugeTLB registered 16.0 MiB page size, pre-allocated 0 pages >> [ 0.284182] HugeTLB registered 16.0 GiB page size, pre-allocated 0 pages >> [ 2.585062] hugepagesz=16G >> [ 2.585063] hugepages=2 >> > > In the new arch independent version of hugepages_setup, I added the following > code in patch 4 off this series: > >> + if (!hugepages_supported()) { >> + pr_warn("HugeTLB: huge pages not supported, ignoring hugepages = %s\n", s); >> + return 0; >> + } >> + > > The easy solution is to remove all the hugepages_supported() checks from > command line parsing routines and rely on the later check in hugetlb_init(). Here is a patch to address the issue. Sorry, as my series breaks all hugetlb command line processing on powerpc. Sandipan, can you test the following patch? >From 480fe2847361e2a85aeec1fb39fe643bb7100a07 Mon Sep 17 00:00:00 2001 From: Mike Kravetz Date: Mon, 27 Apr 2020 11:37:30 -0700 Subject: [PATCH] hugetlbfs: fix changes to command line processing Previously, a check for hugepages_supported was added before processing hugetlb command line parameters. On some architectures such as powerpc, hugepages_supported() is not set to true until after command line processing. Therefore, no hugetlb command line parameters would be accepted. Remove the additional checks for hugepages_supported. In hugetlb_init, print a warning if !hugepages_supported and command line parameters were specified. Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1075abdb5717..5548e8851b93 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3212,8 +3212,11 @@ static int __init hugetlb_init(void) { int i; - if (!hugepages_supported()) + if (!hugepages_supported()) { + if (hugetlb_max_hstate || default_hstate_max_huge_pages) + pr_warn("HugeTLB: huge pages not supported, ignoring associated command-line parameters\n"); return 0; + } /* * Make sure HPAGE_SIZE (HUGETLB_PAGE_ORDER) hstate exists. Some @@ -3315,11 +3318,6 @@ static int __init hugepages_setup(char *s) unsigned long *mhp; static unsigned long *last_mhp; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepages = %s\n", s); - return 0; - } - if (!parsed_valid_hugepagesz) { pr_warn("HugeTLB: hugepages=%s does not follow a valid hugepagesz, ignoring\n", s); parsed_valid_hugepagesz = true; @@ -3372,11 +3370,6 @@ static int __init hugepagesz_setup(char *s) struct hstate *h; parsed_valid_hugepagesz = false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepagesz = %s\n", s); - return 0; - } - size = (unsigned long)memparse(s, NULL); if (!arch_hugetlb_valid_size(size)) { @@ -3424,11 +3417,6 @@ static int __init default_hugepagesz_setup(char *s) unsigned long size; parsed_valid_hugepagesz = false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring default_hugepagesz = %s\n", s); - return 0; - } - if (parsed_default_hugepagesz) { pr_err("HugeTLB: default_hugepagesz previously specified, ignoring %s\n", s); return 0; -- 2.25.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE1DCC4CECD for ; Mon, 27 Apr 2020 19:17:51 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31D0620775 for ; Mon, 27 Apr 2020 19:17:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="lVp5EA5L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31D0620775 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 499vgJ3f6SzDqdw for ; Tue, 28 Apr 2020 05:17:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=oracle.com (client-ip=156.151.31.85; helo=userp2120.oracle.com; envelope-from=mike.kravetz@oracle.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=lVp5EA5L; dkim-atps=neutral Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 499vX83WsyzDqbB for ; Tue, 28 Apr 2020 05:11:35 +1000 (AEST) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03RJ9QJn028975; Mon, 27 Apr 2020 19:10:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=hEDia4zMBZ8uXaQ9p7jtiwi1+JFZYurTsb0V3zlgmAU=; b=lVp5EA5Li9X7YNs4kLFUL1LfUFYDpCR2wtVaUroDVUM0FHlQiOHrt5HEtZF6hplhGwCH ck76IiH+mttB+uE0fo3QwHY8wUZgbvrweYNU069YcHGQsC+mYIw7EE0LFPlTgq8M0ZGK f8Uvq2Oz+7vIrdPyFNByjDDIEnWd+Gy2E2ISBo8cw347SwEigzmcQXrYtAMKWIQX9pRu ApCDOKA1QDKxu3lNvX+KaVT9zod7cyXLF6M0DCe2AFvIj2iLfDt+gDH0WngjweUDGoYl QCyjNxOiX7EosxGJQMVEmkSyjYB8t+7jtbV2lH8J8w3h9oLd7+ce/f7+9Z89zr4O2G4x iw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 30p2p00y0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 19:10:01 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03RJ88fW054624; Mon, 27 Apr 2020 19:10:01 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 30mxrqvqxc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 19:10:00 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 03RJ9owN023990; Mon, 27 Apr 2020 19:09:50 GMT Received: from [192.168.2.157] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Apr 2020 12:09:50 -0700 Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code From: Mike Kravetz To: Sandipan Das References: <20200417185049.275845-1-mike.kravetz@oracle.com> <20200417185049.275845-3-mike.kravetz@oracle.com> <7583dfcc-62d8-2a54-6eef-bcb4e01129b3@gmail.com> <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> Message-ID: Date: Mon, 27 Apr 2020 12:09:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9604 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270154 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9604 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 clxscore=1015 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270154 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, Catalin Marinas , Dave Hansen , Heiko Carstens , Peter Xu , linux-mm@kvack.org, Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Mina Almasry , linux-s390@vger.kernel.org, Jonathan Corbet , Christian Borntraeger , Ingo Molnar , Longpeng , Albert Ou , Vasily Gorbik , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Nitesh Narayan Lal , Randy Dunlap , linux-kernel@vger.kernel.org, Palmer Dabbelt , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S.Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 4/27/20 10:25 AM, Mike Kravetz wrote: > On 4/26/20 10:04 PM, Sandipan Das wrote: >> On 18/04/20 12:20 am, Mike Kravetz wrote: >>> Now that architectures provide arch_hugetlb_valid_size(), parsing >>> of "hugepagesz=" can be done in architecture independent code. >> >> This isn't working as expected on powerpc64. >> >> [ 0.000000] Kernel command line: root=UUID=dc7b49cf-95a2-4996-8e7d-7c64ddc7a6ff hugepagesz=16G hugepages=2 >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepagesz = 16G >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepages = 2 >> [ 0.284177] HugeTLB registered 16.0 MiB page size, pre-allocated 0 pages >> [ 0.284182] HugeTLB registered 16.0 GiB page size, pre-allocated 0 pages >> [ 2.585062] hugepagesz=16G >> [ 2.585063] hugepages=2 >> > > In the new arch independent version of hugepages_setup, I added the following > code in patch 4 off this series: > >> + if (!hugepages_supported()) { >> + pr_warn("HugeTLB: huge pages not supported, ignoring hugepages = %s\n", s); >> + return 0; >> + } >> + > > The easy solution is to remove all the hugepages_supported() checks from > command line parsing routines and rely on the later check in hugetlb_init(). Here is a patch to address the issue. Sorry, as my series breaks all hugetlb command line processing on powerpc. Sandipan, can you test the following patch? >From 480fe2847361e2a85aeec1fb39fe643bb7100a07 Mon Sep 17 00:00:00 2001 From: Mike Kravetz Date: Mon, 27 Apr 2020 11:37:30 -0700 Subject: [PATCH] hugetlbfs: fix changes to command line processing Previously, a check for hugepages_supported was added before processing hugetlb command line parameters. On some architectures such as powerpc, hugepages_supported() is not set to true until after command line processing. Therefore, no hugetlb command line parameters would be accepted. Remove the additional checks for hugepages_supported. In hugetlb_init, print a warning if !hugepages_supported and command line parameters were specified. Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1075abdb5717..5548e8851b93 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3212,8 +3212,11 @@ static int __init hugetlb_init(void) { int i; - if (!hugepages_supported()) + if (!hugepages_supported()) { + if (hugetlb_max_hstate || default_hstate_max_huge_pages) + pr_warn("HugeTLB: huge pages not supported, ignoring associated command-line parameters\n"); return 0; + } /* * Make sure HPAGE_SIZE (HUGETLB_PAGE_ORDER) hstate exists. Some @@ -3315,11 +3318,6 @@ static int __init hugepages_setup(char *s) unsigned long *mhp; static unsigned long *last_mhp; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepages = %s\n", s); - return 0; - } - if (!parsed_valid_hugepagesz) { pr_warn("HugeTLB: hugepages=%s does not follow a valid hugepagesz, ignoring\n", s); parsed_valid_hugepagesz = true; @@ -3372,11 +3370,6 @@ static int __init hugepagesz_setup(char *s) struct hstate *h; parsed_valid_hugepagesz = false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepagesz = %s\n", s); - return 0; - } - size = (unsigned long)memparse(s, NULL); if (!arch_hugetlb_valid_size(size)) { @@ -3424,11 +3417,6 @@ static int __init default_hugepagesz_setup(char *s) unsigned long size; parsed_valid_hugepagesz = false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring default_hugepagesz = %s\n", s); - return 0; - } - if (parsed_default_hugepagesz) { pr_err("HugeTLB: default_hugepagesz previously specified, ignoring %s\n", s); return 0; -- 2.25.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6919C4CECD for ; Mon, 27 Apr 2020 19:11:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ADE0A214D8 for ; Mon, 27 Apr 2020 19:11:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="op1wf9EC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="lVp5EA5L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADE0A214D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=y5iLWZCibrRRmDUjKc04Bg5o5hJ8FChCaeGrxuSQnq0=; b=op1wf9ECnwA8V9 ITr6tRiAxOY31vLK8XilpUW+tniC5iUJXYoEXz0m35RcQXxs/iAunR4Hce8+CeYC5oRXmXDuFS0ki 1Ec+zb1beB3cUxnSYPZKoH1A0TG96SNREK6oZEhYQKNXNw6dwM2PNMHG10XzoE6ddxPq3NAttaa/8 NmDkNMip2cFWotsXcoFOPlrRqVNYVBaDf9PLBko2Rdg5xmiwbbELXu4WOBrAAagRJ0xXkNDohZpUn D32bWK31wPDsQa/0ZiHn2rv3Nn7gEFO9sdC6TdAY9GdpRawwypFVD1+oo1zj6IzPcIJ0RaL+bYg4S CP2BYaLe9KkSRy3krV8g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jT9AF-0003j2-3S; Mon, 27 Apr 2020 19:11:35 +0000 Received: from userp2120.oracle.com ([156.151.31.85]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jT9A9-0003fk-0l; Mon, 27 Apr 2020 19:11:30 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03RJ9QJn028975; Mon, 27 Apr 2020 19:10:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=hEDia4zMBZ8uXaQ9p7jtiwi1+JFZYurTsb0V3zlgmAU=; b=lVp5EA5Li9X7YNs4kLFUL1LfUFYDpCR2wtVaUroDVUM0FHlQiOHrt5HEtZF6hplhGwCH ck76IiH+mttB+uE0fo3QwHY8wUZgbvrweYNU069YcHGQsC+mYIw7EE0LFPlTgq8M0ZGK f8Uvq2Oz+7vIrdPyFNByjDDIEnWd+Gy2E2ISBo8cw347SwEigzmcQXrYtAMKWIQX9pRu ApCDOKA1QDKxu3lNvX+KaVT9zod7cyXLF6M0DCe2AFvIj2iLfDt+gDH0WngjweUDGoYl QCyjNxOiX7EosxGJQMVEmkSyjYB8t+7jtbV2lH8J8w3h9oLd7+ce/f7+9Z89zr4O2G4x iw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 30p2p00y0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 19:10:01 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03RJ88fW054624; Mon, 27 Apr 2020 19:10:01 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 30mxrqvqxc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 19:10:00 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 03RJ9owN023990; Mon, 27 Apr 2020 19:09:50 GMT Received: from [192.168.2.157] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Apr 2020 12:09:50 -0700 Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code From: Mike Kravetz To: Sandipan Das References: <20200417185049.275845-1-mike.kravetz@oracle.com> <20200417185049.275845-3-mike.kravetz@oracle.com> <7583dfcc-62d8-2a54-6eef-bcb4e01129b3@gmail.com> <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> Message-ID: Date: Mon, 27 Apr 2020 12:09:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <5a380060-38db-b690-1003-678ca0f28f07@oracle.com> Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9604 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270154 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9604 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 clxscore=1015 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270154 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200427_121129_209985_55B45D31 X-CRM114-Status: GOOD ( 28.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, Catalin Marinas , Dave Hansen , Heiko Carstens , Peter Xu , linux-mm@kvack.org, Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Mina Almasry , linux-s390@vger.kernel.org, Jonathan Corbet , Christian Borntraeger , Ingo Molnar , Benjamin Herrenschmidt , Longpeng , Albert Ou , Vasily Gorbik , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Nitesh Narayan Lal , Randy Dunlap , linux-kernel@vger.kernel.org, Palmer Dabbelt , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S.Miller" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 4/27/20 10:25 AM, Mike Kravetz wrote: > On 4/26/20 10:04 PM, Sandipan Das wrote: >> On 18/04/20 12:20 am, Mike Kravetz wrote: >>> Now that architectures provide arch_hugetlb_valid_size(), parsing >>> of "hugepagesz=" can be done in architecture independent code. >> >> This isn't working as expected on powerpc64. >> >> [ 0.000000] Kernel command line: root=UUID=dc7b49cf-95a2-4996-8e7d-7c64ddc7a6ff hugepagesz=16G hugepages=2 >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepagesz = 16G >> [ 0.000000] HugeTLB: huge pages not supported, ignoring hugepages = 2 >> [ 0.284177] HugeTLB registered 16.0 MiB page size, pre-allocated 0 pages >> [ 0.284182] HugeTLB registered 16.0 GiB page size, pre-allocated 0 pages >> [ 2.585062] hugepagesz=16G >> [ 2.585063] hugepages=2 >> > > In the new arch independent version of hugepages_setup, I added the following > code in patch 4 off this series: > >> + if (!hugepages_supported()) { >> + pr_warn("HugeTLB: huge pages not supported, ignoring hugepages = %s\n", s); >> + return 0; >> + } >> + > > The easy solution is to remove all the hugepages_supported() checks from > command line parsing routines and rely on the later check in hugetlb_init(). Here is a patch to address the issue. Sorry, as my series breaks all hugetlb command line processing on powerpc. Sandipan, can you test the following patch? >From 480fe2847361e2a85aeec1fb39fe643bb7100a07 Mon Sep 17 00:00:00 2001 From: Mike Kravetz Date: Mon, 27 Apr 2020 11:37:30 -0700 Subject: [PATCH] hugetlbfs: fix changes to command line processing Previously, a check for hugepages_supported was added before processing hugetlb command line parameters. On some architectures such as powerpc, hugepages_supported() is not set to true until after command line processing. Therefore, no hugetlb command line parameters would be accepted. Remove the additional checks for hugepages_supported. In hugetlb_init, print a warning if !hugepages_supported and command line parameters were specified. Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1075abdb5717..5548e8851b93 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3212,8 +3212,11 @@ static int __init hugetlb_init(void) { int i; - if (!hugepages_supported()) + if (!hugepages_supported()) { + if (hugetlb_max_hstate || default_hstate_max_huge_pages) + pr_warn("HugeTLB: huge pages not supported, ignoring associated command-line parameters\n"); return 0; + } /* * Make sure HPAGE_SIZE (HUGETLB_PAGE_ORDER) hstate exists. Some @@ -3315,11 +3318,6 @@ static int __init hugepages_setup(char *s) unsigned long *mhp; static unsigned long *last_mhp; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepages = %s\n", s); - return 0; - } - if (!parsed_valid_hugepagesz) { pr_warn("HugeTLB: hugepages=%s does not follow a valid hugepagesz, ignoring\n", s); parsed_valid_hugepagesz = true; @@ -3372,11 +3370,6 @@ static int __init hugepagesz_setup(char *s) struct hstate *h; parsed_valid_hugepagesz = false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring hugepagesz = %s\n", s); - return 0; - } - size = (unsigned long)memparse(s, NULL); if (!arch_hugetlb_valid_size(size)) { @@ -3424,11 +3417,6 @@ static int __init default_hugepagesz_setup(char *s) unsigned long size; parsed_valid_hugepagesz = false; - if (!hugepages_supported()) { - pr_warn("HugeTLB: huge pages not supported, ignoring default_hugepagesz = %s\n", s); - return 0; - } - if (parsed_default_hugepagesz) { pr_err("HugeTLB: default_hugepagesz previously specified, ignoring %s\n", s); return 0; -- 2.25.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel