Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4631039pxb; Tue, 25 Jan 2022 15:01:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyojDD4wi8DCaGOhBWWeUGLyGROQxn133fApmPDukdX2el4YGxaVWeT7+xu/eAybzGfxaeZ X-Received: by 2002:a17:906:58cc:: with SMTP id e12mr955026ejs.527.1643151680448; Tue, 25 Jan 2022 15:01:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643151680; cv=none; d=google.com; s=arc-20160816; b=stV8ldfdEdaemul7zT+kq23Uij/x1Yah3wVP6tcSd7H+WUDyAIoFZujFwNanx/ySjP h/E91WqvL7Q6j1Zzi1plpiK5OqFYaQBO3wwu1s0kIlo9JWICObKIcWON0UelAR8W+3ne ZH7HggfJnFEKyo0uFTFYeIfzfKcprdCCsqtShgzegkr79z0ceUUy59C+YOSP+5dAFqow 2KAiUgJPZEEc1aeTY1JL9/+r83MNnkdW0yNUu64VpZVfYDAvxuxODe3lNnbDcjzFvnN/ ZvAAOOD/H5IYIAN5ocUzIpgLledGYcZtE/9dBlHMj5ENCQGm0aVdhte5WowJM19EaVux OBiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=C7xko9p+ul1XXK5sENXyzT1WsYUMQrC2iaG0UHldmug=; b=h2iIZktxMbpOYMtW1LIMJk556H75+7DDI/+lynu+OkpanXqHz4tHijUV8cxhBOGFvj xp1w4HTN+EQ9b3pxEvPqwFnokCfvm01+lcPmrbtMh+TSfZc4ZQWTBQMK3YV05Rx5zJPK Kc6LmlPv010BBLaQWK51EyfIbvqQpVh6T/HrfXcitjfQzXi8OTE2sgDMKY2LnTQr9Ypy XaNqjiORpI4QxwJLQzc3aBIjJBOHROMlNykwwdYfGgh9peAzT85+u2uFDYxxIP8L3ZEz Z97nwMELYDAL1WMX/4tGiQcI0dE9r1lpTr1kVdRkz4l9fDXTCwNkZQiBOfO8lRA3EU86 c1jQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gn42si2025344ejc.902.2022.01.25.15.00.56; Tue, 25 Jan 2022 15:01:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353367AbiAYQOg (ORCPT + 99 others); Tue, 25 Jan 2022 11:14:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1583346AbiAYQKz (ORCPT ); Tue, 25 Jan 2022 11:10:55 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D215FC061760 for ; Tue, 25 Jan 2022 08:10:46 -0800 (PST) Received: (Authenticated sender: alex@ghiti.fr) by mail.gandi.net (Postfix) with ESMTPSA id 930DDC0005; Tue, 25 Jan 2022 16:10:41 +0000 (UTC) Message-ID: <36519886-cedc-a3e3-70d2-712f8a6d3a10@ghiti.fr> Date: Tue, 25 Jan 2022 17:10:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] riscv: mm: remove the BUG_ON check of mapping the last 4K bytes of memory Content-Language: en-US To: Jisheng Zhang , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20220125155542.3753-1-jszhang@kernel.org> From: Alexandre Ghiti In-Reply-To: <20220125155542.3753-1-jszhang@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/25/22 16:55, Jisheng Zhang wrote: > remove the BUG_ON check of mapping the last 4K bytes of the addressable > memory since "this is true for every kernel actually" as pointed out > by Alexandre. > > Signed-off-by: Jisheng Zhang > Reviewed-by: Alexandre Ghiti > --- > arch/riscv/mm/init.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index cf4d018b7d66..8347d0fda8cd 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -811,14 +811,6 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) > BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0); > BUG_ON((kernel_map.phys_addr % PMD_SIZE) != 0); > > -#ifdef CONFIG_64BIT > - /* > - * The last 4K bytes of the addressable memory can not be mapped because > - * of IS_ERR_VALUE macro. > - */ > - BUG_ON((kernel_map.virt_addr + kernel_map.size) > ADDRESS_SPACE_END - SZ_4K); > -#endif This BUG_ON seems pretty legit to me: I re-read the exchanges we had, and I see that I didn't notice that in your v2, you actually removed the BUG_ON. So that's my bad, what I meant in the first place was that the BUG_ON is true for 32-bit and 64-bit kernels actually. Sorry my RB was not right on this one :( Alex > - > pt_ops_set_early(); > > /* Setup early PGD for fixmap */