From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29670C433EF for ; Mon, 1 Nov 2021 01:55:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DED3B60F24 for ; Mon, 1 Nov 2021 01:55:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DED3B60F24 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ojz0r2DijKtRUVvJdjM+QWIcH62zommRdKI+0izNDwc=; b=sY1l1mJaDRJXE7 en2wkbL2x59HyTuAIgy8kQMAD/OvcRwuCTqeNH++HQJ1E+J0voTw67VFYxp9yT2OnxkvKMWlkVzqo 9H8RY86ojv1TUhWqjHsI+SnuZ37r7z0Kg8YyVUKtJvJVcF9u8QjfJANmfMk20tMNELQhZ9STQv0c0 z5A/bx+AsoBCe4KNgtwBm+baqNptw9yvWR5kZsdYnCpBTzaXPhvpAAa36kdEZ0s1Nucb9ej6T76k8 XaAcUnWnxxdVUq4unInLsj5EiBg4AO/92o7hJdUrSMaPDTOaqsxv7IPJ5ByW+6pgsKXhKZ38t10oR X6J1znAG9PJ+WSR5D4+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhMWA-00F3i9-5U; Mon, 01 Nov 2021 01:53:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhMW7-00F3he-An for linux-arm-kernel@lists.infradead.org; Mon, 01 Nov 2021 01:53:44 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85B1060E78 for ; Mon, 1 Nov 2021 01:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635731622; bh=1WHDkBkAg62loVHy5/GqtvU9rATy2GBl0FxKbK7663o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ehfC/ysSho4U0JjfizEqcEwf7x2q3UKeGLd9wfSu1b6L/6DZVAibzJkdVPlGBVbKq vYx4rUGUZgK9rqvBPERo92GcMDdYmvHNIkPIrkqgi0xuuybBGlR7kC6kFR5FrvtU/W XVt5J64For4yStaeyyW/D3RsKlJTWT8lQj7GhEbMkce7z6WUm3s4TwTc9eRVOUiU1S g5EgnShLoeoh26ADN878FdaZjJPdx3P7BIqrTDS6N4RjUB/H3Jb85rJ213TIH6/e9+ 07c95H2u7mNSk3HERvz69ycgmIIx3CFzC5M1YQhqSkchfhZ9S7ivrXzMu7udi+iIPa WtEtyVg7SgW0g== Received: by mail-ua1-f42.google.com with SMTP id b3so5487387uam.1 for ; Sun, 31 Oct 2021 18:53:42 -0700 (PDT) X-Gm-Message-State: AOAM5335vE8a28fWPq5uEs57am29DWNJkw5C0fFqC/o0eCEi8Nj/EAtr mlFWbv5/rlz53erXFm3Fn/BIyi9Fo2ZFmmhzsgU= X-Google-Smtp-Source: ABdhPJwkuMxoQmLv0gY2yh8vbEvubM4INFwsdJLvTLs83C6OOwGLISrMGimdOl9QtmcDxLNKofj9jTxL9q9ekPepIik= X-Received: by 2002:a67:fa93:: with SMTP id f19mr26682162vsq.43.1635731621685; Sun, 31 Oct 2021 18:53:41 -0700 (PDT) MIME-Version: 1.0 References: <20211022070646.41923-1-chenhuacai@loongson.cn> In-Reply-To: From: Guo Ren Date: Mon, 1 Nov 2021 09:53:30 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] arm64: Use correct method to calculate nomap region boundaries To: Huacai Chen Cc: Huacai Chen , Catalin Marinas , Will Deacon , Arnd Bergmann , Linux ARM , Jiaxun Yang X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211031_185343_457369_F641AE8B X-CRM114-Status: GOOD ( 20.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The real reserved memory have been initialized before in for_each_reserved_mem_region loop. If memblock_is_nomap still uses memblock_region_reserved, than it would cause overlap with reserved_mem_region. nomap_region: PFN_DOWN <-> PFN_UP reserved_region: PFN_DOWN <-> PFN_UP We would get overlapped reserved_mem_region. On Wed, Oct 27, 2021 at 4:35 PM Huacai Chen wrote: > > Ping? > > On Fri, Oct 22, 2021 at 3:07 PM Huacai Chen wrote: > > > > Nomap regions are treated as "reserved". When region boundaries are not > > page aligned, we usually increase the "reserved" regions rather than > > decrease them. So, we should use memblock_region_reserved_base_pfn()/ > > memblock_region_reserved_end_pfn() instead of memblock_region_memory_ > > base_pfn()/memblock_region_memory_base_pfn() to calculate boundaries. > > > > Signed-off-by: Huacai Chen > > --- > > arch/arm64/kernel/setup.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c > > index be5f85b0a24d..1e86d4c5ef8c 100644 > > --- a/arch/arm64/kernel/setup.c > > +++ b/arch/arm64/kernel/setup.c > > @@ -232,12 +232,14 @@ static void __init request_standard_resources(void) > > if (memblock_is_nomap(region)) { > > res->name = "reserved"; > > res->flags = IORESOURCE_MEM; > > + res->start = __pfn_to_phys(memblock_region_reserved_base_pfn(region)); > > + res->end = __pfn_to_phys(memblock_region_reserved_end_pfn(region)) - 1; > > } else { > > res->name = "System RAM"; > > res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; > > + res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region)); > > + res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1; > > } > > - res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region)); > > - res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1; > > > > request_resource(&iomem_resource, res); > > > > -- > > 2.27.0 > > -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel