[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025a657-da62-ffd3-6c77-b93f677704cc@c-s.fr>
Date: Wed, 24 Apr 2019 16:09:43 +0200
From: Christophe Leroy <christophe.leroy@....fr>
To: "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 02/27] powerpc/mm: don't BUG in add_huge_page_size()
Le 11/04/2019 à 07:41, Aneesh Kumar K.V a écrit :
> Christophe Leroy <christophe.leroy@....fr> writes:
>
>> No reason to BUG() in add_huge_page_size(). Just WARN and
>> reject the add.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@....fr>
>> ---
>> 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?
Ok, I'll switch to VM_BUG_ON()
Christophe
>
>
>>
>> /* Return if huge page size has already been setup */
>> if (size_to_hstate(size))
>> --
>> 2.13.3
Powered by blists - more mailing lists