Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp635871yba; Wed, 24 Apr 2019 07:14:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwul1udrQVtORe0bQfj1Z0PIdFoL1MqQZtlzKA+jOr7m3ZWi6fsJPDu6yPPeuEgspkTnNmh X-Received: by 2002:aa7:9a89:: with SMTP id w9mr33507039pfi.213.1556115265559; Wed, 24 Apr 2019 07:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556115265; cv=none; d=google.com; s=arc-20160816; b=XYPLKZYKHYtZaYVTbsUuLiCgueX4d0ES0c30KF//2MaclinGa+zd5GosRBmvi8av5X iYnMO1dkQs2PbAsFm6Mrwnv+a3V83R7gY04i3w8iz+etRP/FZ/mBSJ2dI8zoXfvUCe7s EEhR+ZAXBPvI8+PN1Mjer7m1BvUVcpLis6+8iXy3yDr+eb7K+M52P9i7IRFzNlcFVyFo XNaQsf42Oak+VBMcfatuv9dhCcMvadJFEn4jauWKvjhC8SnEa+e5x4OaKCg5zcXEVulB RfEVQ3KZ+Xby0n1s7zRGS20ryKQOVSuz27yuIt3R1CeBjaBpEz8J+PbLTGDva47ZO43G HunA== 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=ZkxYiuuTQWNhHiGcWoMonTQOzxq5tb0F+/oyGFfaqlw=; b=SVMFmXX9xfeHIcCbAc0HvOIsFT2KAVBoY3N7Nv3rRbGZpvRBnKdTOnO4YayWn5pBl4 A6NQILu7vNrMT6Upzh7sATbJFog0n4l05F23RtQfmzzwdB3HHEQI1xqjDQRMAtMTOAPY PF+JOOKjnBzILbpf7fwmcI0GHaNohXfafGUxz/U1DqzvRFyuNlZRck8FVfqe1+jM2xgk HdyWOS2chp/zW9eKJ4FrsvPbyv38KXWXJ4l/HKxMeGIWyQnVMwZEhQvNWAGHXa2M3tMN ACmHFP/UfjmWoj0X9I3eDBiY6kZHG+69ONVDh1wCh15/6b6qWufXIxMqGiMDZxCbviT8 bJsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=RVZd5uYe; 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 b12si17675420pgl.264.2019.04.24.07.14.09; Wed, 24 Apr 2019 07:14:25 -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=RVZd5uYe; 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 S1729547AbfDXOJ5 (ORCPT + 99 others); Wed, 24 Apr 2019 10:09:57 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:63339 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbfDXOJ5 (ORCPT ); Wed, 24 Apr 2019 10:09:57 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44q2JK5T9Xz9v1Lt; Wed, 24 Apr 2019 16:09:53 +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=RVZd5uYe; 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 9yeek82dQeMp; Wed, 24 Apr 2019 16:09:53 +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 44q2JK4J1gz9v1Ls; Wed, 24 Apr 2019 16:09:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1556114993; bh=ZkxYiuuTQWNhHiGcWoMonTQOzxq5tb0F+/oyGFfaqlw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=RVZd5uYe+Vl+jg9lEZa4y6Dsm4vinqkZuJxdY21Cu/EbQFiAn/uLsrSkHGiwrIFPF iJqlcaIEEAeDagf/li/14uiFbZpiuJJaVxV51noz5jkqIRSCvdbUy+2AumC1mSsrAK L4pvqWNmRpPKllcsBe9QCuqodAOzTIpBhun9quR0= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1C28E8B913; Wed, 24 Apr 2019 16:09:55 +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 diAqZ10rf9Ks; Wed, 24 Apr 2019 16:09:55 +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 F2D4C8B8FB; Wed, 24 Apr 2019 16:09:54 +0200 (CEST) Subject: Re: [PATCH v1 03/27] powerpc/mm: don't BUG() in slice_mask_for_size() To: "Aneesh Kumar K.V" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <87lg0h3xpo.fsf@linux.ibm.com> From: Christophe Leroy Message-ID: <609ef207-614c-1abf-6ebc-770735ca94c7@c-s.fr> Date: Wed, 24 Apr 2019 16:09:52 +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: <87lg0h3xpo.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:41, Aneesh Kumar K.V a écrit : > Christophe Leroy writes: > >> When no mask is found for the page size, WARN() and return NULL >> instead of BUG()ing. >> >> Signed-off-by: Christophe Leroy >> --- >> arch/powerpc/mm/slice.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c >> index aec91dbcdc0b..011d470ea340 100644 >> --- a/arch/powerpc/mm/slice.c >> +++ b/arch/powerpc/mm/slice.c >> @@ -165,7 +165,8 @@ static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize) >> if (psize == MMU_PAGE_16G) >> return &mm->context.mask_16g; >> #endif >> - BUG(); >> + WARN_ON(true); >> + return NULL; >> } > > > 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? Ok, I'll switch to VM_BUG_ON() Christophe > > >> #elif defined(CONFIG_PPC_8xx) >> static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize) >> @@ -178,7 +179,8 @@ static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize) >> if (psize == MMU_PAGE_8M) >> return &mm->context.mask_8m; >> #endif >> - BUG(); >> + WARN_ON(true); >> + return NULL; >> } >> #else >> #error "Must define the slice masks for page sizes supported by the platform" >> -- >> 2.13.3