Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1608199iof; Tue, 7 Jun 2022 08:33:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWA5CFKb1RfxfGeAPekuS/tf1nIq0srgQdLDDWpplAqYpb5lATzHHc/GBz/Ymwb19z6g7A X-Received: by 2002:a05:6402:2481:b0:42e:13e9:1079 with SMTP id q1-20020a056402248100b0042e13e91079mr31768933eda.149.1654616031426; Tue, 07 Jun 2022 08:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654616031; cv=none; d=google.com; s=arc-20160816; b=IzjR+0+ZiS50fla5sPwV8zpqNYqj5OZhOj3JiNb2fQKQm7aOwFXyjnvUIzV/yDd3j2 4fBswsBJ5ocX0hNVPdqac5tzbjjtXZH0JAy4zscSK9FnaKr7X2zBtdIYeNfqaPM2g0vO Z2qcq416QN1662paRIKAKBUvT6cBKHaAQIVa1X6AxR2+JLW2G582bX2H4uTVI3j7zK21 YM32nbktWRRd6KG771EqNdoiTAwj6YxOMsWM3ShY3Pm4abecFyt2iVGdcp8MyML3WDQV E5V/TdgbihsGhtZAHglYLiFMUMNJq398tyuDRqcEXSo4HG578+BxPij6FtDPJxB+QzDp 1obA== 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; bh=ok6sL0mSqJtWrzltpVYE49yIYyZc318X49bOlBQ68rY=; b=HiT1M0gqltNe9M6LH1ehctqU0nFeqLr4s2PjVJzCcFkksA+Q3a7GvZ9NKAlwmKbxJ/ bKzfVaJAQp/+NN6U5XxZwu1IFIDpJ3k/+stF+Pct4adQOsvbb0+kuCxIwAlng9a7ONG0 qnPcbMQ4Q2QeHUyoyeAka//6rSsY79ySEtE+/C8vQBbtW2iBHJH7mJZW9HtgsRBI7Bfl BlodxluLLG3D+QuUNWJggHyR0OlOIvKET4p7r9bSFwBcgKnFLsZoRV+uT7Xa5CK4vMeJ i75sxk67wUWQeelqGimZ44tn0D2rRAr05Y6dOpU3D1Evy/4oFFFtrP//+k2H/9AWTMst zfvg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a170906b30700b006fe9e9ed643si10479894ejz.48.2022.06.07.08.33.24; Tue, 07 Jun 2022 08:33:51 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236587AbiFGJQ5 (ORCPT + 99 others); Tue, 7 Jun 2022 05:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239182AbiFGJQr (ORCPT ); Tue, 7 Jun 2022 05:16:47 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F3EDB0D00; Tue, 7 Jun 2022 02:16:44 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LHPmC185MzRp5T; Tue, 7 Jun 2022 17:13:31 +0800 (CST) Received: from dggpemm500014.china.huawei.com (7.185.36.153) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 7 Jun 2022 17:16:42 +0800 Received: from localhost.localdomain (10.175.112.125) by dggpemm500014.china.huawei.com (7.185.36.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 7 Jun 2022 17:16:40 +0800 From: Wupeng Ma To: , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v3 0/6] introduce mirrored memory support for arm64 Date: Tue, 7 Jun 2022 17:37:59 +0800 Message-ID: <20220607093805.1354256-1-mawupeng1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500014.china.huawei.com (7.185.36.153) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 From: Ma Wupeng Commit b05b9f5f9dcf ("x86, mirror: x86 enabling - find mirrored memory ranges") introduced mirrored memory support for x86. This support rely on UEFI to report mirrored memory address ranges. See UEFI 2.5 spec pages 157-158: http://www.uefi.org/sites/default/files/resources/UEFI%202_5.pdf Memory mirroring is a technique used to separate memory into two separate channels, usually on a memory device, like a server. In memory mirroring, one channel is copied to another to create redundancy. This method makes input/output (I/O) registers and memory appear with more than one address range because the same physical byte is accessible at more than one address. Using memory mirroring, higher memory reliability and a higher level of memory consolidation are possible. These EFI memory regions have various attributes, and the "mirrored" attribute is one of them. The physical memory region whose descriptors in EFI memory map has EFI_MEMORY_MORE_RELIABLE attribute (bit: 16) are mirrored. The address range mirroring feature of the kernel arranges such mirrored regions into normal zones and other regions into movable zones. Arm64 can support this too. So mirrored memory support is added to support arm64. The main purpose of this patch set is to introduce mirrored support for arm64 and we have already fixed the problems we had which is shown in patch #5 to patch #8 and try to bring total isolation in patch #9 which will disable mirror feature if kernelcore is not specified. In order to test this support in arm64: - patch this patch set - add kernelcore=mirror in kernel parameter - start you kernel Patch #1-#2 introduce mirrored memory support form arm64. Patch #3-#5 fix some bugs for arm64 if memory reliable is enabled. Patch #6 disable mirror feature if kernelcore is not specified. Thanks to Ard Biesheuvel's hard work [1], now kernel will perfer mirrored memory if kaslr is enabled. [1] https://lore.kernel.org/linux-arm-kernel/CAMj1kXEPVEzMgOM4+Yj6PxHA-jFuDOAUdDJSiSxy_XaP4P7LSw@mail.gmail.com/T/ Changelog since v2: - remove efi_fake_mem support - remove Commit ("remove some redundant code in ia64 efi_init") since efi_print_memmap() is not public - add mirror flag back on initrd memory Changelog since v1: - update changelog in cover letter - use PHYS_PFN in patch #7 Ma Wupeng (6): efi: Make efi_find_mirror() public arm64/mirror: arm64 enabling - find mirrored memory ranges mm: Ratelimited mirrored memory related warning messages mm: Demote warning message in vmemmap_verify() to debug level mm: Add mirror flag back on initrd memory efi: Disable mirror feature if kernelcore is not specified .../admin-guide/kernel-parameters.txt | 2 +- arch/arm64/kernel/setup.c | 1 + arch/arm64/mm/init.c | 9 +++++++ arch/x86/include/asm/efi.h | 4 --- arch/x86/platform/efi/efi.c | 23 ---------------- drivers/firmware/efi/efi.c | 26 +++++++++++++++++++ include/linux/efi.h | 3 +++ include/linux/memblock.h | 1 + include/linux/mm.h | 2 ++ mm/memblock.c | 24 +++++++++++++++-- mm/page_alloc.c | 2 +- mm/sparse-vmemmap.c | 2 +- 12 files changed, 67 insertions(+), 32 deletions(-) -- 2.25.1