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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64D2DCCA47D for ; Sat, 11 Jun 2022 09:56:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC2488D0116; Sat, 11 Jun 2022 05:56:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D71688D0115; Sat, 11 Jun 2022 05:56:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C39EB8D0116; Sat, 11 Jun 2022 05:56:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B1CC18D0115 for ; Sat, 11 Jun 2022 05:56:29 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 83BE1360AF for ; Sat, 11 Jun 2022 09:56:29 +0000 (UTC) X-FDA: 79565500098.06.DB65A24 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf11.hostedemail.com (Postfix) with ESMTP id E258B40078 for ; Sat, 11 Jun 2022 09:56:28 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41DF8B80E9A; Sat, 11 Jun 2022 09:56:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF641C3411E; Sat, 11 Jun 2022 09:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654941386; bh=G3SijAZJFwW8PPbomjAxbmJ1C1Qf1Qf77wWOoRRw+dg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=je5xCyBasUps0lw+zm8BT+55x7BMo8QBuhxo7JbtlactdaXmHz6lygNzLVrkm8nAX HjEppJFc+QzCFrtWjpMbQ5TNT070wVV+inQya2B9+gtBdLCpCi5lhYrB8oioVSA00t hIu1Oa3GrD0WLeAPrt7UP5jlkYHkU2fo87dm0Y2tsE2pbKenH7urJXTDUAgrXYtoWI sACEfm3Hy0H/485yd2z03sytvQHGo5HqeAr0OHZgDGtUHNS7u3v0z9DoUqRmcgnTGS yJ2Edt+EBxtqLD6Zk4/TW4K+j7AB4xUoNv3rGt0AT9EmLHGsWZAuNEVqCOGQlFxuD6 6hRDH3YDodvdQ== Date: Sat, 11 Jun 2022 12:56:12 +0300 From: Mike Rapoport To: Ard Biesheuvel Cc: Wupeng Ma , Andrew Morton , Jonathan Corbet , Will Deacon , Catalin Marinas , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , Darren Hart , Andy Shevchenko , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Paul E. McKenney" , Kees Cook , songmuchun@bytedance.com, Randy Dunlap , damien.lemoal@opensource.wdc.com, Stephen Boyd , Wei Liu , Robin Murphy , David Hildenbrand , Anshuman Khandual , Zhen Lei , Kefeng Wang , gpiccoli@igalia.com, Huacai Chen , Geert Uytterhoeven , chenzhou10@huawei.com, vijayb@linux.microsoft.com, Linux Doc Mailing List , Linux Kernel Mailing List , Linux ARM , linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v3 0/6] introduce mirrored memory support for arm64 Message-ID: References: <20220607093805.1354256-1-mawupeng1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1654941389; a=rsa-sha256; cv=none; b=1LwNVKR133A82wpbB5j5pVry6TJqCKRVHvH3BgxTDZMoyd3w1LzZ8p5B++bM42f7gwarZP thG6e8gc8c9FxAuvEifC3mDhkCzR2dmUaaFi/l6yOk8MjpSom41i3hRV9yhS5SSdbSjJ/B Su7K8/fRDEG/WNWv2XsapDC5tDBVx94= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=je5xCyBa; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1654941389; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MBsP9WvSWmmFVMrndHRdQj4qf/JG0VeOJW7T3c0V280=; b=E1A6usEy1uJFLda0qAF8MakY/klYO58L1cVQrhrOUk2rWtK+xKT5gFHqVjaaA9aI7jGt3B tYvu4b7fZraso6VgodiOY0jtDTK5mxiNb1oxs2Yt6SpG3HOUYfF8azjj0u4S0Q/rylAxwh N5emtgFKWchcg+sjlyUlXDI0eAiI/G4= X-Stat-Signature: yhgi31uz1qccodybkp7j78qjj5tw7rhe X-Rspamd-Queue-Id: E258B40078 X-Rspam-User: X-Rspamd-Server: rspam10 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=je5xCyBa; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org X-HE-Tag: 1654941388-69608 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jun 10, 2022 at 01:23:34PM +0200, Ard Biesheuvel wrote: > On Tue, 7 Jun 2022 at 11:16, Wupeng Ma wrote: > > > > 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 > > > > I have tested these changes on QEMU/arm64 with the patch below, and > things seem to work as expected. We have some minor issues to work out > but the general shape of this code is good. > > As for the mm/ changes: does anyone mind if I take those through the > EFI tree as well? No objections from me. > I don't think the EFI and -mm changes depend on each other, so they > can go into -mm separately as well. -- Sincerely yours, Mike.