Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5506271yba; Wed, 10 Apr 2019 22:42:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxn2UGpFxrz1KuNFZYB9kLOs0rdw0U68K6oDu2zULZnh97rHIHks8DmS6du1ZyCS9EfDjOL X-Received: by 2002:aa7:8e0d:: with SMTP id c13mr11240240pfr.193.1554961340207; Wed, 10 Apr 2019 22:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554961340; cv=none; d=google.com; s=arc-20160816; b=ZpYbN2ddez14UhXK4RRYmn3/LUzs4N8uBeX2kxjmoLSzs9tYudCguWPBlB792XvArF STdgv3DTGXt2MjkSjHqTaKeV4l6hDti372ejW78+ZvDyywulmUMQu0/wqAWIj8spMFR3 hASdxSIO4vpsJ/x1K380Dj8FJ1hFDr5q1/tA62mHop2ixbVIvxyUfqncpyrF4JnKgUuq KJU2e97o74aAGEu44siTcn74ZckxfR/kXD11FVS5f8R8K0KX3tgJOAFvUV+lwE12p+5/ CsBENVpQmQ3gUExSyKzXO09Fgrd9qAwwsuTpWl1c0mdIEuZbF3SAjMGprjQVyWxRip8Q 6RaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:mime-version:date:references :in-reply-to:subject:cc:to:from; bh=UjBcRorYZs1bKQLCIYl5r87bw+Ez5R35ifN/HJuL1/Q=; b=NleFq5DFMmxJ/z8VoYPlUZr887TcXwSU04++AsjHXbEyGfQ0SXGcGdzE23XIeISiEM frSX2anYIjZ5jl3imwXbQLGYyKbDJfGMuhBFDGbOriWXjgtQX66lpGFXj5MiGmMpIJrg rJM2FrRQTx7qAYP/W5bCpmM23Va/DWAFVamFe8pUm5sVQolZulz+qooCSayGb4ACW3GE a8J7o120115iKvqNDsK/0aWwl3NYtT/FZwzxukx6lD6Kip+OQCSnbBQAexjlMQ0k1Elo 44wI2+xsaxCrxvBQRoj9YmHdSp+JzGXD41FjB53LD9YU+xWKjE19ck1AR6/OPC2e2EGh DmQA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si33880516pgh.303.2019.04.10.22.42.04; Wed, 10 Apr 2019 22:42:20 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726646AbfDKFlX (ORCPT + 99 others); Thu, 11 Apr 2019 01:41:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39352 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726104AbfDKFlX (ORCPT ); Thu, 11 Apr 2019 01:41:23 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3B5cWao132499 for ; Thu, 11 Apr 2019 01:41:21 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2rsyavrse8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 11 Apr 2019 01:41:21 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 11 Apr 2019 06:41:19 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 11 Apr 2019 06:41:17 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3B5fG6S28311608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Apr 2019 05:41:16 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 39CCF4C040; Thu, 11 Apr 2019 05:41:16 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7EBF4C058; Thu, 11 Apr 2019 05:41:14 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.85.73.26]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 11 Apr 2019 05:41:14 +0000 (GMT) X-Mailer: emacs 26.1 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 02/27] powerpc/mm: don't BUG in add_huge_page_size() In-Reply-To: <02e312b13129a9bf96f0cd4a30b1802be0644900.1553076180.git.christophe.leroy@c-s.fr> References: <02e312b13129a9bf96f0cd4a30b1802be0644900.1553076180.git.christophe.leroy@c-s.fr> Date: Thu, 11 Apr 2019 11:11:13 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 19041105-0008-0000-0000-000002D894F0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19041105-0009-0000-0000-00002244BB2A Message-Id: <87o95d3xqe.fsf@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-11_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904110040 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > No reason to BUG() in add_huge_page_size(). Just WARN and > reject the add. > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/mm/hugetlbpage.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c > index 9e732bb2c84a..cf2978e235f3 100644 > --- a/arch/powerpc/mm/hugetlbpage.c > +++ b/arch/powerpc/mm/hugetlbpage.c > @@ -634,7 +634,8 @@ static int __init add_huge_page_size(unsigned long long size) > } > #endif > > - BUG_ON(mmu_psize_defs[mmu_psize].shift != shift); > + if (WARN_ON(mmu_psize_defs[mmu_psize].shift != shift)) > + return -EINVAL; Same here. There are not catching runtime errors. We should never find that true. This is to catch mistakes during development changes. Switch to VM_BUG_ON? > > /* Return if huge page size has already been setup */ > if (size_to_hstate(size)) > -- > 2.13.3