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=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 3C7A8C83004 for ; Tue, 28 Apr 2020 04:20:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B9282064C for ; Tue, 28 Apr 2020 04:20:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726338AbgD1EUI (ORCPT ); Tue, 28 Apr 2020 00:20:08 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:29364 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725803AbgD1EUH (ORCPT ); Tue, 28 Apr 2020 00:20:07 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03S44aiX124128; Tue, 28 Apr 2020 00:17:28 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pd53g8rh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 00:17:28 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 03S47gjm130005; Tue, 28 Apr 2020 00:17:27 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pd53g8pd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 00:17:26 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03S45tWP018939; Tue, 28 Apr 2020 04:17:24 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 30mcu58gsm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 04:17:24 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03S4HLNp41943218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Apr 2020 04:17:21 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79F1911C052; Tue, 28 Apr 2020 04:17:21 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6834611C04A; Tue, 28 Apr 2020 04:17:14 +0000 (GMT) Received: from [9.199.43.234] (unknown [9.199.43.234]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Apr 2020 04:17:14 +0000 (GMT) Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code To: Mike Kravetz 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> From: Sandipan Das Message-ID: <9c82a0b1-db0e-9b34-88a1-bc810d6b5eec@linux.ibm.com> Date: Tue, 28 Apr 2020 09:47:13 +0530 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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-27_17:2020-04-27,2020-04-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 clxscore=1011 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004280027 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mike, On 28/04/20 12:39 am, Mike Kravetz wrote: > 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? > The following patch does fix the issue. Thanks. Tested-by: Sandipan Das > 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; > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sandipan Das Date: Tue, 28 Apr 2020 04:29:13 +0000 Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code Message-Id: <9c82a0b1-db0e-9b34-88a1-bc810d6b5eec@linux.ibm.com> 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: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Mike Kravetz 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" Hi Mike, On 28/04/20 12:39 am, Mike Kravetz wrote: > 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-8e= 7d-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 >>> >> >> In the new arch independent version of hugepages_setup, I added the foll= owing >> code in patch 4 off this series: >> >>> + if (!hugepages_supported()) { >>> + pr_warn("HugeTLB: huge pages not supported, ignoring hugepages =3D %= 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_ini= t(). >=20 > Here is a patch to address the issue. Sorry, as my series breaks all hug= etlb > command line processing on powerpc. >=20 > Sandipan, can you test the following patch? >=20 The following patch does fix the issue. Thanks. Tested-by: Sandipan Das > 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 >=20 > 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. >=20 > Remove the additional checks for hugepages_supported. In hugetlb_init, > print a warning if !hugepages_supported and command line parameters were > specified. >=20 > Signed-off-by: Mike Kravetz > --- > mm/hugetlb.c | 20 ++++---------------- > 1 file changed, 4 insertions(+), 16 deletions(-) >=20 > 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 comma= nd-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, i= gnoring\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_hugepages= z =3D %s\n", s); > - return 0; > - } > - > if (parsed_default_hugepagesz) { > pr_err("HugeTLB: default_hugepagesz previously specified, ignoring %s\= n", s); > return 0; >=20 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 B39DFC83004 for ; Tue, 28 Apr 2020 04:18:21 +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 80B572053B for ; Tue, 28 Apr 2020 04:18:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Iyv48w0M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80B572053B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.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:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aY27Bt+v6f9CMxvJjowuNTwSN6WXzdYtnZyAwfK1y3c=; b=Iyv48w0MIyqudF yG0RcBbDaTtGfqgnU55lrdW1e6xcU/qcr4XffoPHe8yIaMDX70aEQEtuzeAVbLJvEzIV7T9q+h4Au WcAjKOQnVkkv1e4lcPhJz44M8S6LCUE+nzN3i7lWEhStc34JwIXrhuXFCaK+KV18HoLSzk39rmhGm jERS47NPaO5NGEdNK0vvx+eIxwxK7aYtk73bhbjbQYRyhdbPcGcd/XnqbUuNJQKCRxwi6jr5kdU41 InDXeOZCeXKZ1foe9i8Rp7+gil9H/gyOSlAY4WLpOqBWfD4405tyl/YDsB3JCVzIOUHD1Zvs+KflY 8WFXnTha1ICOQUdWhubw==; 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 1jTHhJ-0000NP-3v; Tue, 28 Apr 2020 04:18:17 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTHh4-0000CH-IH; Tue, 28 Apr 2020 04:18:04 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03S44aiX124128; Tue, 28 Apr 2020 00:17:28 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pd53g8rh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 00:17:28 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 03S47gjm130005; Tue, 28 Apr 2020 00:17:27 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pd53g8pd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 00:17:26 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03S45tWP018939; Tue, 28 Apr 2020 04:17:24 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 30mcu58gsm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 04:17:24 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03S4HLNp41943218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Apr 2020 04:17:21 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79F1911C052; Tue, 28 Apr 2020 04:17:21 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6834611C04A; Tue, 28 Apr 2020 04:17:14 +0000 (GMT) Received: from [9.199.43.234] (unknown [9.199.43.234]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Apr 2020 04:17:14 +0000 (GMT) Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code To: Mike Kravetz 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> From: Sandipan Das Message-ID: <9c82a0b1-db0e-9b34-88a1-bc810d6b5eec@linux.ibm.com> Date: Tue, 28 Apr 2020 09:47:13 +0530 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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-27_17:2020-04-27, 2020-04-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 clxscore=1011 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004280027 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200427_211802_716578_7D8CBFF6 X-CRM114-Status: GOOD ( 28.89 ) 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 Hi Mike, On 28/04/20 12:39 am, Mike Kravetz wrote: > 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? > The following patch does fix the issue. Thanks. Tested-by: Sandipan Das > 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; > 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=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 C44C2C83004 for ; Tue, 28 Apr 2020 04:19:53 +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 3F88F2064C for ; Tue, 28 Apr 2020 04:19:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F88F2064C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49B7hk1HfgzDqwf for ; Tue, 28 Apr 2020 14:19:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=sandipan@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 49B7fm0MytzDqvd for ; Tue, 28 Apr 2020 14:18:07 +1000 (AEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03S44aiX124128; Tue, 28 Apr 2020 00:17:28 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pd53g8rh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 00:17:28 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 03S47gjm130005; Tue, 28 Apr 2020 00:17:27 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pd53g8pd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 00:17:26 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03S45tWP018939; Tue, 28 Apr 2020 04:17:24 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 30mcu58gsm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 04:17:24 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03S4HLNp41943218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Apr 2020 04:17:21 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79F1911C052; Tue, 28 Apr 2020 04:17:21 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6834611C04A; Tue, 28 Apr 2020 04:17:14 +0000 (GMT) Received: from [9.199.43.234] (unknown [9.199.43.234]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Apr 2020 04:17:14 +0000 (GMT) Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code To: Mike Kravetz 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> From: Sandipan Das Message-ID: <9c82a0b1-db0e-9b34-88a1-bc810d6b5eec@linux.ibm.com> Date: Tue, 28 Apr 2020 09:47:13 +0530 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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-27_17:2020-04-27, 2020-04-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 clxscore=1011 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004280027 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" Hi Mike, On 28/04/20 12:39 am, Mike Kravetz wrote: > 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? > The following patch does fix the issue. Thanks. Tested-by: Sandipan Das > 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; > 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 CE908C83004 for ; Tue, 28 Apr 2020 04:18:07 +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 9D90A2053B for ; Tue, 28 Apr 2020 04:18:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ubIINp9v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D90A2053B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.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:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tM5npeUFF0jHFpPZ5MlihBBXy3opC/4/PvxRfhatpmw=; b=ubIINp9vD2AR+d SDnDx7QEeHG+EP1CfDw7HMtxtAuVgInzymjRW0f9i7vV4c8+jzvK0XxmbTxS8aKtnjBpq74nII8uY anAjttn6fPVcmWKc8DND+61OofoQl+unVXky6YzFI4udHNel/WEQ49shBSP9K4OA1ln+Tf5/CPQUH SVWJsiaBDh+gMn3QtmVG7TlxlOW8O3UjTbapnbwjY/K/3HF7Rvbh+kDlwiqxNJRWaQmh5q/0dGeSf L/BnMBu5ga1yiNOz1vpLe/Hdu2sBSamSFSaEgF6TMEgcGKjPnNK8kuUBXq10IbKju0A/Bm1Xnr0FY PpRcYiY/kCBi+i4vvQzw==; 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 1jTHh8-0000D0-NX; Tue, 28 Apr 2020 04:18:06 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTHh4-0000CH-IH; Tue, 28 Apr 2020 04:18:04 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03S44aiX124128; Tue, 28 Apr 2020 00:17:28 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pd53g8rh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 00:17:28 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 03S47gjm130005; Tue, 28 Apr 2020 00:17:27 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pd53g8pd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 00:17:26 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03S45tWP018939; Tue, 28 Apr 2020 04:17:24 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 30mcu58gsm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 04:17:24 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03S4HLNp41943218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Apr 2020 04:17:21 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79F1911C052; Tue, 28 Apr 2020 04:17:21 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6834611C04A; Tue, 28 Apr 2020 04:17:14 +0000 (GMT) Received: from [9.199.43.234] (unknown [9.199.43.234]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Apr 2020 04:17:14 +0000 (GMT) Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch independent code To: Mike Kravetz 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> From: Sandipan Das Message-ID: <9c82a0b1-db0e-9b34-88a1-bc810d6b5eec@linux.ibm.com> Date: Tue, 28 Apr 2020 09:47:13 +0530 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: Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-27_17:2020-04-27, 2020-04-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 clxscore=1011 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004280027 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200427_211802_716578_7D8CBFF6 X-CRM114-Status: GOOD ( 28.89 ) 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 Hi Mike, On 28/04/20 12:39 am, Mike Kravetz wrote: > 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? > The following patch does fix the issue. Thanks. Tested-by: Sandipan Das > 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; > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel