Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp973019yba; Wed, 24 Apr 2019 12:44:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzk11lqkf+hynMcvdQx13fi3cQtjScOlU0UnXfp0THJX7DcCNJA2FPixlm2KW2gZmqX/zJh X-Received: by 2002:aa7:8ac8:: with SMTP id b8mr34989270pfd.234.1556135041590; Wed, 24 Apr 2019 12:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556135041; cv=none; d=google.com; s=arc-20160816; b=dgy/7LeXyYCcqjqm0fieSZ4g8NRkgvnOxtvqA2/AF5bPqs6HB4povwwzIg6wYqrvm2 jJFnmn9Mf5AqYxJ7kPZ04PIqRdGoZLybLaT/cTwSQoh2Z50UNcWI3JGz472Fbl9MOpEz 2GcFV10waHekky97Mw46+iP3eLKNhzQXPUgS9djRH3cHMqAfVCO9J6AvZOI8sl21B3JT ZfuPoskoCuZ5jxiCnn9CHSQPxmcMwwHxeIvhUOhhRJvcXgHBFWRUSZPWckjWMFec2Eu7 5Akci+V3NCLA5injzKxtskSysqF1xOrGYESYC5nhWJX1ep6yHtJ411LsOGMXjHs3yMDi DEvw== 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=zwwAZWJV1BE8AwI49JQnbFk7+vD7247Kx8wwTVrhxzw=; b=vCtf5nxNLmV9BtwvfW/6s9/e0bFfu4pXXoMcVIwu8+3+kJSIyR354YIzEO029wQldN JCguDVsIvYvFCmZMdh+5/+jEYQ5RhrQLyqS/Uw3k/Rn398mjAZ1NOq1GpyeY8raaAsMN a26oynptuREt3dZCU7wQu3OAVVONTrwiZHSRvF5oSg1zjQn1LS2m5qB8fcQ3xS9Yn/IJ yds6z0St6nPBkxQCqCrbWRgJbQGsgDGB1zQqNkONo6dgH2wyMNDkvUxycFk2K+goQk51 QRUXQRVd4//9ovvQ6oO7uHpXvHNkq2jXG64wzHBbLZjMiZjhrwmqFK+KpgEfC/Ee3TRB 8oCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=AslU0E22; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3si19558580plo.243.2019.04.24.12.43.46; Wed, 24 Apr 2019 12:44:01 -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=@c-s.fr header.s=mail header.b=AslU0E22; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729336AbfDXOJh (ORCPT + 99 others); Wed, 24 Apr 2019 10:09:37 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:22856 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727331AbfDXOJh (ORCPT ); Wed, 24 Apr 2019 10:09:37 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44q2Hy3QfJz9v1Lv; Wed, 24 Apr 2019 16:09:34 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=AslU0E22; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id geB8DTC6TZOy; Wed, 24 Apr 2019 16:09:34 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 44q2Hy1mrTz9v1Ls; Wed, 24 Apr 2019 16:09:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1556114974; bh=zwwAZWJV1BE8AwI49JQnbFk7+vD7247Kx8wwTVrhxzw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=AslU0E22efgpUvJCJ+mk30KTUlre3aJ81f+Zuj9EcbFgpK0at+iwSSE2GR0SnDtMO 951JakSrNa7ejQN10hVbLaw6E8plxjM7FmVKTCEPZjfBFMlEjA6oyuQ8xciSJ6o/Cb PcP2GaFc5drqQGzynohSSymu9qtZ3TYwi1l+17v0= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B8E428B913; Wed, 24 Apr 2019 16:09:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 59CSbUfY2pt7; Wed, 24 Apr 2019 16:09:35 +0200 (CEST) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.6]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 961908B8FB; Wed, 24 Apr 2019 16:09:35 +0200 (CEST) Subject: Re: [PATCH v1 01/27] powerpc/mm: Don't BUG() in hugepd_page() To: "Aneesh Kumar K.V" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <9d6b0fe78346ff8e81a969a75a616bab59bc5cf5.1553076180.git.christophe.leroy@c-s.fr> <87r2a93xto.fsf@linux.ibm.com> From: Christophe Leroy Message-ID: Date: Wed, 24 Apr 2019 16:09:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <87r2a93xto.fsf@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 11/04/2019 à 07:39, Aneesh Kumar K.V a écrit : > Christophe Leroy writes: > >> Don't BUG(), just warn and return NULL. >> If the NULL value is not handled, it will get catched anyway. >> >> Signed-off-by: Christophe Leroy >> --- >> arch/powerpc/include/asm/hugetlb.h | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h >> index 8d40565ad0c3..48c29686c78e 100644 >> --- a/arch/powerpc/include/asm/hugetlb.h >> +++ b/arch/powerpc/include/asm/hugetlb.h >> @@ -14,7 +14,8 @@ >> */ >> static inline pte_t *hugepd_page(hugepd_t hpd) >> { >> - BUG_ON(!hugepd_ok(hpd)); >> + if (WARN_ON(!hugepd_ok(hpd))) >> + return NULL; > > We should not find that true. That BUG_ON was there to catch errors > when changing pte formats. May be switch that VM_BUG_ON()? Ok, I'll switch to VM_BUG_ON() Christophe > >> /* >> * We have only four bits to encode, MMU page size >> */ >> @@ -42,7 +43,8 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma, >> >> static inline pte_t *hugepd_page(hugepd_t hpd) >> { >> - BUG_ON(!hugepd_ok(hpd)); >> + if (WARN_ON(!hugepd_ok(hpd))) >> + return NULL; >> #ifdef CONFIG_PPC_8xx >> return (pte_t *)__va(hpd_val(hpd) & ~HUGEPD_SHIFT_MASK); >> #else >> -- >> 2.13.3