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 X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AD35C47080 for ; Mon, 31 May 2021 12:31:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C12B61263 for ; Mon, 31 May 2021 12:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231573AbhEaMdH (ORCPT ); Mon, 31 May 2021 08:33:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:38480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231524AbhEaMcy (ORCPT ); Mon, 31 May 2021 08:32:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C69E61263; Mon, 31 May 2021 12:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622464274; bh=nYK9qBjercVj0g6Vv+NGsdd2DIuSrcvW+FH79tlPIOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MlpI4+NBfpcRnUk2p9WdM+R+zCDdFBYfVK+3zwnxxQnmFLWqhxlf5Ho6ge/LWzGVb nZ+AnwUem6PB9mQd6Ze8IALrEJEGGMv74QJYt4ipJN/ZK1nVluMLJTnuuwRWj0PArE HQmd6+FDICPHAUZXJ6959+GgXcrfWdc2Hu9pNC5bP29gF2+/QrM6LzjGurbQuBA76P 1nYK5fZyzlfvijqrcdJHQ0dhWYS9C/2Nf5Nv/z4Y6OTYCZuSEFsvXnyegEUJ0g75DY EGGCul/YwrA6HnurFvtxliCuVYhV9+tyqSLHbWwi4AszS83kbrLDUwl7K7YLqJvsdI CAHIGrtRqU2YQ== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Catalin Marinas , Christian Borntraeger , David Hildenbrand , Heiko Carstens , Mike Rapoport , Mike Rapoport , Russell King , Thomas Bogendoerfer , Vasily Gorbik , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org Subject: [RFC/RFT PATCH 1/5] s390: make crashk_res resource a child of "System RAM" Date: Mon, 31 May 2021 15:29:55 +0300 Message-Id: <20210531122959.23499-2-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210531122959.23499-1-rppt@kernel.org> References: <20210531122959.23499-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport Commit 4e042af463f8 ("s390/kexec: fix crash on resize of reserved memory") added a comment that says "crash kernel resource should not be part of the System RAM resource" but never explained why. As it looks from the code in the kernel and in kexec there is no actual reason for that. Keeping crashk_res inline with other resources makes code simpler and cleaner, and allows future consolidation of the resources setup across several architectures. Signed-off-by: Mike Rapoport --- arch/s390/kernel/setup.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 5aab59ad5688..30430e7c1b03 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -500,6 +500,9 @@ static struct resource __initdata *standard_resources[] = { &code_resource, &data_resource, &bss_resource, +#ifdef CONFIG_CRASH_DUMP + &crashk_res, +#endif }; static void __init setup_resources(void) @@ -535,7 +538,7 @@ static void __init setup_resources(void) for (j = 0; j < ARRAY_SIZE(standard_resources); j++) { std_res = standard_resources[j]; - if (std_res->start < res->start || + if (!std_res->end || std_res->start < res->start || std_res->start > res->end) continue; if (std_res->end > res->end) { @@ -552,20 +555,6 @@ static void __init setup_resources(void) } } } -#ifdef CONFIG_CRASH_DUMP - /* - * Re-add removed crash kernel memory as reserved memory. This makes - * sure it will be mapped with the identity mapping and struct pages - * will be created, so it can be resized later on. - * However add it later since the crash kernel resource should not be - * part of the System RAM resource. - */ - if (crashk_res.end) { - memblock_add_node(crashk_res.start, resource_size(&crashk_res), 0); - memblock_reserve(crashk_res.start, resource_size(&crashk_res)); - insert_resource(&iomem_resource, &crashk_res); - } -#endif } static void __init setup_ident_map_size(void) @@ -733,7 +722,7 @@ static void __init reserve_crashkernel(void) diag10_range(PFN_DOWN(crash_base), PFN_DOWN(crash_size)); crashk_res.start = crash_base; crashk_res.end = crash_base + crash_size - 1; - memblock_remove(crash_base, crash_size); + memblock_reserve(crash_base, crash_size); pr_info("Reserving %lluMB of memory at %lluMB " "for crashkernel (System RAM: %luMB)\n", crash_size >> 20, crash_base >> 20, -- 2.28.0 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 X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 886ACC47080 for ; Mon, 31 May 2021 12:33:28 +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 551E461263 for ; Mon, 31 May 2021 12:33:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 551E461263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ClanrghyECEl67iEvRrw1vx/k7kKCTqrl1RP0Tafhq4=; b=IlUR1vdjbPKATW 75b9CvVaRY5YfTi8l6zBdE8CbEL3iC7zMWF0hwGRg9jcXLGuFSZ6l+PHICkbmm5610imh8iU5M9e4 43h9RQk8qy86gCAxfrXoWebXqtMJKfeh13Dk9djemCYhMEnUaWbeW980Tm4Gu05jubghV+hkS0R3S TQSR3HqimjZxZJNa9htXDSoE0PfNwm4SjIgTSViKRCyj7xOR180YsWdcOSPWsJCnj2twzCDZrAVJJ yYhXBBQ7HuBhbJ8D232xcLQdJFajJc4T6EM9oTZDo1V6JdOyFUoikBVHXzgt8sPg1PW/9i+o6wOUO ZXunzAGJzCrW11uCRDnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnh4q-00C9gs-Kn; Mon, 31 May 2021 12:31:28 +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 1lnh4c-00C9dW-IT for linux-arm-kernel@lists.infradead.org; Mon, 31 May 2021 12:31:15 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C69E61263; Mon, 31 May 2021 12:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622464274; bh=nYK9qBjercVj0g6Vv+NGsdd2DIuSrcvW+FH79tlPIOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MlpI4+NBfpcRnUk2p9WdM+R+zCDdFBYfVK+3zwnxxQnmFLWqhxlf5Ho6ge/LWzGVb nZ+AnwUem6PB9mQd6Ze8IALrEJEGGMv74QJYt4ipJN/ZK1nVluMLJTnuuwRWj0PArE HQmd6+FDICPHAUZXJ6959+GgXcrfWdc2Hu9pNC5bP29gF2+/QrM6LzjGurbQuBA76P 1nYK5fZyzlfvijqrcdJHQ0dhWYS9C/2Nf5Nv/z4Y6OTYCZuSEFsvXnyegEUJ0g75DY EGGCul/YwrA6HnurFvtxliCuVYhV9+tyqSLHbWwi4AszS83kbrLDUwl7K7YLqJvsdI CAHIGrtRqU2YQ== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Catalin Marinas , Christian Borntraeger , David Hildenbrand , Heiko Carstens , Mike Rapoport , Mike Rapoport , Russell King , Thomas Bogendoerfer , Vasily Gorbik , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org Subject: [RFC/RFT PATCH 1/5] s390: make crashk_res resource a child of "System RAM" Date: Mon, 31 May 2021 15:29:55 +0300 Message-Id: <20210531122959.23499-2-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210531122959.23499-1-rppt@kernel.org> References: <20210531122959.23499-1-rppt@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210531_053114_671955_074B50C6 X-CRM114-Status: GOOD ( 16.17 ) 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 From: Mike Rapoport Commit 4e042af463f8 ("s390/kexec: fix crash on resize of reserved memory") added a comment that says "crash kernel resource should not be part of the System RAM resource" but never explained why. As it looks from the code in the kernel and in kexec there is no actual reason for that. Keeping crashk_res inline with other resources makes code simpler and cleaner, and allows future consolidation of the resources setup across several architectures. Signed-off-by: Mike Rapoport --- arch/s390/kernel/setup.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 5aab59ad5688..30430e7c1b03 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -500,6 +500,9 @@ static struct resource __initdata *standard_resources[] = { &code_resource, &data_resource, &bss_resource, +#ifdef CONFIG_CRASH_DUMP + &crashk_res, +#endif }; static void __init setup_resources(void) @@ -535,7 +538,7 @@ static void __init setup_resources(void) for (j = 0; j < ARRAY_SIZE(standard_resources); j++) { std_res = standard_resources[j]; - if (std_res->start < res->start || + if (!std_res->end || std_res->start < res->start || std_res->start > res->end) continue; if (std_res->end > res->end) { @@ -552,20 +555,6 @@ static void __init setup_resources(void) } } } -#ifdef CONFIG_CRASH_DUMP - /* - * Re-add removed crash kernel memory as reserved memory. This makes - * sure it will be mapped with the identity mapping and struct pages - * will be created, so it can be resized later on. - * However add it later since the crash kernel resource should not be - * part of the System RAM resource. - */ - if (crashk_res.end) { - memblock_add_node(crashk_res.start, resource_size(&crashk_res), 0); - memblock_reserve(crashk_res.start, resource_size(&crashk_res)); - insert_resource(&iomem_resource, &crashk_res); - } -#endif } static void __init setup_ident_map_size(void) @@ -733,7 +722,7 @@ static void __init reserve_crashkernel(void) diag10_range(PFN_DOWN(crash_base), PFN_DOWN(crash_size)); crashk_res.start = crash_base; crashk_res.end = crash_base + crash_size - 1; - memblock_remove(crash_base, crash_size); + memblock_reserve(crash_base, crash_size); pr_info("Reserving %lluMB of memory at %lluMB " "for crashkernel (System RAM: %luMB)\n", crash_size >> 20, crash_base >> 20, -- 2.28.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel