Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2563800pxj; Mon, 31 May 2021 05:32:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwToH4slYIIMrlvZ6NR/LhPbwhTzc7T4EGiOyWa+wRmlxiZYqxiByALuNYpr4QcMcuZeoY X-Received: by 2002:a17:907:2071:: with SMTP id qp17mr22465975ejb.15.1622464370274; Mon, 31 May 2021 05:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622464370; cv=none; d=google.com; s=arc-20160816; b=OIR3VZpi1w8Ql92Wlj0ck9atPORKhDT5+UzrQY1YOR+cEeEgeEA7BQW/qwXk6ZsRWH pDDQofnjA7hZSR+2yJpuSVsquBH/jq3e8bBKR+exzrKeeruhLskhGgfjH5jYJ2lGtLjL bIjs0J+XXs5hG4LqFJyImCVYu7PpQGxtRiQHlMZsCZqi+np2/gqB6FViEi6EitZbqS5I SH3dEBFdk0yU6vBN8q/Bb6OJSa/Zt4dXLIf4qO3rbD9wLCuCyTmzR4bY81ajk976NSRr l+O1hN1tP7EwX6PhAybkeAvrr4Jm84mDOZyydpaIiMj0DPAbPGBy89Tiq0t09MM2Lmt7 w9dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZTKAbX7TqynoheQMvKurWsw+6oG/n3kVWYFYwwODJXw=; b=bHZvYqDqBzPr/nemJl9U8GAlCGZ/pS/JrwVnhKi3tWDLMIRak5L51uprVJfrKwrgxx +QXAcLSUgrPoMq4cynzyc3YN/O4Uxy/FGudk6RcETD2tCVI5AhlOxMFIvGbei9hbp0/Y 5gM+S8rwsMDFr2o+ZV9AObkFrXQBbtBvar/BEd2hamt5wmu1m70U81SLmmX8gJrx+YpZ uTpuhGtHucXTgu9qU7vFoOouoCu3Ioc0Hl0jQdHp8JDRsEtvB4kbPi8Na6vGrcuzchC5 mFxt/bqpZL5D+IEWH68x/yNRY6/Qa5DxBjxGo/K/NZ8cgMIuGuMsFR82Fv41oeJWf1df ZjUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MlpI4+NB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn20si16116805ejc.545.2021.05.31.05.32.27; Mon, 31 May 2021 05:32:50 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MlpI4+NB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231566AbhEaMdE (ORCPT + 99 others); Mon, 31 May 2021 08:33:04 -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