Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1395867rwo; Wed, 2 Aug 2023 13:22:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlFLbhV9IBWvpx762BEzSqUZgpoy6WuWHMOHwuEKfCBFkrq8B6MiJjur+SvvVQWOidWb9rz9 X-Received: by 2002:a17:903:32c2:b0:1b5:522a:1578 with SMTP id i2-20020a17090332c200b001b5522a1578mr21477352plr.29.1691007769605; Wed, 02 Aug 2023 13:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691007769; cv=none; d=google.com; s=arc-20160816; b=UptFW9/ltQHriNf+FAoTV9X72ttVEslsWINd+vpRuLFP3hbzDrtNtu31jzWPv1yARB viZQMwlAASWyrSzP7bvMvhzLjWs5NxCB+OqU/xaJ1BX7uXGZ9tLX23cheXs71I7Cnx40 Rmn1h1QSb6zL/AZGA/87rno29LLDJ9DX2U1mVKrpC4PD9CnZ8sgkP21sImsppXUb+DEd Lg2miBkpomW7GMZrjTTuw8HJCAudhgdtICcjPZ/2NMrHtJPdTjfzuppVtjfr6ZNiGd4w ZH04Bg1cQrL1iwvof7fh73a2r527SwQoH31AmNx1Dv+ZGXN9DB5WUaw5jz/9UouGGTwC 1wjw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=TAs2W0UQPvG+IMRnbk4btgVlH770IjvAYL2tx8M/WQo=; fh=ML/h89zwL2i23wtHRYpgYlrliZagsZqaTpp1QDgi4yg=; b=fAVCVqky8uGUDps+iXDwBWacDmOnbZ9MfE73NQ8CuxJaEiNzH/KawMTEYZIpWnjKgg H5MF6ntGpwK4uTEZJ+J09dmgJn59VYfYn5s+peOI63+rqarW2B/cH0Ghwx4qPzPfdZn4 G8bvpN0yONjw5tdmp8EMDRdqU2eVOVSI/AhZjxtI0DMkS7644tj/s1BtyJY9s0101drv a/M4ZKu3eFpxLTIXpG7s3v7oU2QHdkcHX3rxPEXSl2hPlso3UQ1wF1Ksfat1n48tvDX2 YKiApsLDJwqmQAiyUewXaFkppjYi3pHy8ukuDPtA0zBKDgKIXUOkBz0X1HhbBTDpENyT 8IFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Y0WhxoV/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv129-20020a632e87000000b0056482047ae0si1292045pgb.723.2023.08.02.13.22.37; Wed, 02 Aug 2023 13:22:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Y0WhxoV/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbjHBSgU (ORCPT + 99 others); Wed, 2 Aug 2023 14:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjHBSgT (ORCPT ); Wed, 2 Aug 2023 14:36:19 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 970BE19AD for ; Wed, 2 Aug 2023 11:36:18 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbc63c2e84so1620785e9.3 for ; Wed, 02 Aug 2023 11:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691001377; x=1691606177; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TAs2W0UQPvG+IMRnbk4btgVlH770IjvAYL2tx8M/WQo=; b=Y0WhxoV/BzAocRJ6IJmR0uV2Pq0+TNdd0NezQ/SRyF+Kbz8K4DGauZiFY/NktvtwR0 1IBGENdk8cwRnPqNa33a+uZXNT9V4HdV0yfHr/VWbEekJctSBupAqMset2u9zbJOZ976 bhsank+kn1yQpM9JJ4BooL1vewrYaI2dLDP9umlvIPMbfuAXNtzSR00hhscVorvRA+lQ KMhZqxbj/QJ9zVLnG6kFquAUgKvNJOBI/kNU8+QYQB0Q29xGXT8v9pYI/G/JPWA5GriJ RjRHb9hVHKjvzAGFIWl3Q+FkXr9reiTFWq+TZQUxmug9fhUJyfVc62Sh4R08PiOuDd1G /JSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691001377; x=1691606177; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TAs2W0UQPvG+IMRnbk4btgVlH770IjvAYL2tx8M/WQo=; b=BOwDwOiwpf1yQe6ulemJU0Ohy7hHMOfYXCUKVQNXMsL4FS75pQoop5swZdosfCXz+H 3rNr/YaoLGxNVIKduOuCARlduRMshCWgGZrNltasKd57l+G8pilyq/EW4tJaPogyAggr WD4Fys62Gftm/S65gsRyRX8CdaSQXzrwN49jKRaAxceTXSmptV/BDw7eGrGaH6x0mgOz sF+gJITINbsttRfwWWM7lVmoJi4L4gfLi3ezCqFq1RMWvHAXWFM5Ggf9rIJVxH910Dg7 4/rLPQjZEcpHL9BCnCtT+i/7rWdLODfGKRHG8BIVjTindqoTjIpyu+tZLilCGhWlxfSX CsPQ== X-Gm-Message-State: ABy/qLZCMKzOFt6g9ZCCEXpKG348e6z32IdJgciO9ZOSb8cbpt3OmMnK ys95jxW98nrjBHIfnES2xmo= X-Received: by 2002:adf:ce8a:0:b0:317:5c18:f31d with SMTP id r10-20020adfce8a000000b003175c18f31dmr5318090wrn.35.1691001376650; Wed, 02 Aug 2023 11:36:16 -0700 (PDT) Received: from localhost.localdomain (host31-52-141-59.range31-52.btcentralplus.com. [31.52.141.59]) by smtp.gmail.com with ESMTPSA id z1-20020adfd0c1000000b0031424f4ef1dsm19839681wrh.19.2023.08.02.11.36.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 02 Aug 2023 11:36:16 -0700 (PDT) From: Levi Yun To: rppt@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Levi Yun Subject: [PATCH] mm/mm_init: Ignore kernelcore=mirror boot option when no mirror memory presents. Date: Wed, 2 Aug 2023 19:36:14 +0100 Message-ID: <20230802183614.15520-1-ppbuk5246@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the machine where no mirror memory is set, All memory region in ZONE_NORMAL is used as ZONE_MOVABLE when kernelcore=mirror boot option is used. So, ZONE_NORMAL couldn't be populated properly because all of ZONE_NORMAL pages is absent. To avoid this abnormal situation, ignore disable kernelcore=mirror option when no mirror memory is found. Signed-off-by: Levi Yun --- mm/mm_init.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index a1963c3322af..4c180ef1a993 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -376,10 +376,13 @@ static void __init find_zone_movable_pfns_for_nodes(void) */ if (mirrored_kernelcore) { bool mem_below_4gb_not_mirrored = false; + bool no_mirror_mem = true; for_each_mem_region(r) { - if (memblock_is_mirror(r)) + if (memblock_is_mirror(r)) { + no_mirror_mem = false; continue; + } nid = memblock_get_region_node(r); @@ -398,6 +401,12 @@ static void __init find_zone_movable_pfns_for_nodes(void) if (mem_below_4gb_not_mirrored) pr_warn("This configuration results in unmirrored kernel memory.\n"); + if (no_mirror_mem) { + pr_warn("There is no mirrored memory. Ignore kernelcore=mirror.\n"); + mirrored_kernelcore = false; + memset(zone_movable_pfn, 0x00, sizeof(zone_movable_pfn)); + } + goto out2; } -- 2.37.2