Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1128694ybh; Wed, 18 Mar 2020 15:41:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsXkBkQ/obC8KjYtRW3o+2tjvw5BD7HRCE8GkEPv0AfAU2Vx3g25cERC+/IYggFGXsKlRRo X-Received: by 2002:aca:4843:: with SMTP id v64mr194690oia.13.1584571283146; Wed, 18 Mar 2020 15:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584571283; cv=none; d=google.com; s=arc-20160816; b=Jvu+e86ZInRB4GFvKwNq2H/n06QdIcRR9UPQ0yZ1+qRDKgpAVkTCQ+Wtot/l654RpN T5mb50qxk57Bid1PPASt5h2XVggvt54S7iwkWyMg1qCqdiwckxInP3VqEbdWXslufLcS ZvaMeqzA+KAaAS3Bs/NYz59nwZqK1mxMUR0spItlLnYzsMRD6/WIhWb1ms5ZTNuTMyDG naFNYGYGip+tKdv9wAT138uFKh15WCl4iS+X9oj70Mjm5YgRTWLDPfa0SDzlp4ZwdQtV uw4sgLqiD6t+tBzaHCt7BZn5IRWyrsHCd08MbdTmr0Vm3tZHzJ9seb6JDipPsgtjQOrj F80Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=H1MqLvxMQu57KLqvhSHFxWcNzIe9uVH2pzVyel8x3lY=; b=Jf+/2FaFm3FoLbYv4GcHqL1hC5B0xWWjpSLhDckl5jESgC7ttM9vanDkbFdX6+NSGT PoTEnM0ob+9qOVQk/j0FO9uc2ymqBX3dGi5LTQiUCBVAmq1Cwa9abK6CvEw7cSfK2FqG ct8gc+8KSquJ4x3/2YSjLkhmVUVmzG+a0dhvkfVzE9KLG0sEu0iJn0B/T7s/0VZ1iyNM 2xobtalUGIvXUfImrLo8KY6rGw8TQd3x+ra5G4s/NtB5iX1o15pMmPXlD47FyiT39hcJ uvf75k0Ody7ejByxK0P1ClhojTJai1bKI18tzQ6mzgEfSMx1ExvQpbd7NjxaNP1Gt/oc XThw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=YRFM8a6G; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e19si213349otp.40.2020.03.18.15.41.10; Wed, 18 Mar 2020 15:41:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=YRFM8a6G; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727218AbgCRWjt (ORCPT + 99 others); Wed, 18 Mar 2020 18:39:49 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:50512 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726777AbgCRWjt (ORCPT ); Wed, 18 Mar 2020 18:39:49 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02IMd6da003668; Wed, 18 Mar 2020 22:39:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=H1MqLvxMQu57KLqvhSHFxWcNzIe9uVH2pzVyel8x3lY=; b=YRFM8a6G/Nlx2vr+v00SsVqX8z+MTuEh6bQcPh317YpuKbvbvW/V1YrZ4GafwKwUWFAM CLTRLGdG/wGJv4fvSn/OIsLtkEOrE1kTK7QLdLjaOPhFHxLExj4mvQNWrxwRUaTodqK9 Yu66Qcg0aAbs0n1iKUfXdYUkL/lWY9RSzX635I6NqpyjvMqP23tsyz9CXmmiHVHW+XDv Dpvkszh0PGrln064nj1pqUqZWPmLM94FcgPKTGY0wczu7fBtU89e7l2RIiDXGcwbcY36 vT+6bjLnrYqH9P3W09Sh/G4ZPGweC2OG1tYuva0v3txraGIhO3Ko2ocoPmPlwXsDpdc/ Ag== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2yrq7m57nx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Mar 2020 22:39:05 +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 02IMaggY070076; Wed, 18 Mar 2020 22:39:05 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2ys8tuvjum-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Mar 2020 22:39:05 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 02IMctjE013967; Wed, 18 Mar 2020 22:38:56 GMT Received: from [192.168.1.206] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Mar 2020 15:38:55 -0700 Subject: Re: [PATCH 1/4] hugetlbfs: add arch_hugetlb_valid_size To: Will Deacon 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 , 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 , Andrew Morton References: <20200318220634.32100-1-mike.kravetz@oracle.com> <20200318220634.32100-2-mike.kravetz@oracle.com> <20200318220954.GD8477@willie-the-truck> From: Mike Kravetz Message-ID: <43735ae0-f5f6-1e7b-2d0f-a46f9af1627e@oracle.com> Date: Wed, 18 Mar 2020 15:38:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200318220954.GD8477@willie-the-truck> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9564 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003180097 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9564 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 malwarescore=0 mlxscore=0 phishscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003180097 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/18/20 3:09 PM, Will Deacon wrote: > On Wed, Mar 18, 2020 at 03:06:31PM -0700, Mike Kravetz wrote: >> The architecture independent routine hugetlb_default_setup sets up >> the default huge pages size. It has no way to verify if the passed >> value is valid, so it accepts it and attempts to validate at a later >> time. This requires undocumented cooperation between the arch specific >> and arch independent code. >> >> For architectures that support more than one huge page size, provide >> a routine arch_hugetlb_valid_size to validate a huge page size. >> hugetlb_default_setup can use this to validate passed values. >> >> arch_hugetlb_valid_size will also be used in a subsequent patch to >> move processing of the "hugepagesz=" in arch specific code to a common >> routine in arch independent code. >> >> Signed-off-by: Mike Kravetz >> --- >> arch/arm64/include/asm/hugetlb.h | 2 ++ >> arch/arm64/mm/hugetlbpage.c | 19 ++++++++++++++----- >> arch/powerpc/include/asm/hugetlb.h | 3 +++ >> arch/powerpc/mm/hugetlbpage.c | 20 +++++++++++++------- >> arch/riscv/include/asm/hugetlb.h | 3 +++ >> arch/riscv/mm/hugetlbpage.c | 28 ++++++++++++++++++---------- >> arch/s390/include/asm/hugetlb.h | 3 +++ >> arch/s390/mm/hugetlbpage.c | 18 +++++++++++++----- >> arch/sparc/include/asm/hugetlb.h | 3 +++ >> arch/sparc/mm/init_64.c | 23 ++++++++++++++++------- >> arch/x86/include/asm/hugetlb.h | 3 +++ >> arch/x86/mm/hugetlbpage.c | 21 +++++++++++++++------ >> include/linux/hugetlb.h | 7 +++++++ >> mm/hugetlb.c | 16 +++++++++++++--- >> 14 files changed, 126 insertions(+), 43 deletions(-) >> >> diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h >> index 2eb6c234d594..3248f35213ee 100644 >> --- a/arch/arm64/include/asm/hugetlb.h >> +++ b/arch/arm64/include/asm/hugetlb.h >> + >> +static __init int setup_hugepagesz(char *opt) >> +{ >> + unsigned long long ps = memparse(opt, &opt); >> + >> + if arch_hugetlb_valid_size(ps)) { > > Please compile your changes if you're touching multiple architectures. You > can get cross-compiler binaries from: > My apologies. I only cross compiled the result of the series on each architecture. The above code is obviously bad. -- Mike Kravetz