Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp314251rwe; Fri, 14 Apr 2023 03:19:52 -0700 (PDT) X-Google-Smtp-Source: AKy350aVZoqTefUIDbHuPlcsXyd59q92YePXn35o8TbhNgJpPj73Ogl7IQSA5rcyBPH1/UHCbwzB X-Received: by 2002:a05:6a00:2448:b0:63a:cefa:9d44 with SMTP id d8-20020a056a00244800b0063acefa9d44mr7015114pfj.14.1681467591975; Fri, 14 Apr 2023 03:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681467591; cv=none; d=google.com; s=arc-20160816; b=FKAH4POe05F9f5ePk5HjKZIsR/vWrDed4cRWrSmnBniPvjVw0IY1BZ44zmfnmeYCr6 yk+wLSiLMLFAjChYvUmuaW0ar2VVhZ7ScwnRHyUfarPLuK3iMLAITBtU12AHHjMxBBfY ryFIVzIXyv9h5DYcXnsDb47CEfjUQa3c4ZLNrOIQqrxagAf+GDC9c8KOzklBUq137HWq FhYSGaxH3PPoqDFL8QPl7DMLGsACAXElv9+8yzUy2kPNFefyYHZL6sxtjWmaH7zVQ6A+ 6R90ODblz/xy7dD5EDRRxthREq2ZWy7euqjV8FjJiIqjpIPt3wqQyVIQAmRffKVePPXt F4yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=3WBXbUqLLLeQq1ZCi/ry0FRNyZxe7SfbSw3k4IDdgYw=; b=nia6MEoB4PthsUHGKymqEGbN1pSj0iJNR7/CDOX+AI52Did3GfzPiOB78i2Fc+05vc RzGI506jB9u92oJYCs4Y481DVQcHgidmonJvL0iFHUMDDWxztYoQS4Sur4BpOA25F8Q+ U0cL388L68WjoFUoj9c1N+Ov2Ozu48Xw4qTOvNLCqpvGTXZnDjHzP8fjUcfFn8NN4UIm rNb2WcomSLgOoyT3auKIlxMt4ueGzSpyHnXJZQfSEUbConNX9iHiXbZc9Bj4/x1CxYo0 1fRd7em7wl0WLKP/qhmMBmeMHzcneg3biy3awF+3ItireMI+5kErLeKvKJy7ciMGyDh3 WWhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm1 header.b=ZClIRosJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Upd2y1I6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020aa79f42000000b0063b6e71d1f1si566457pfr.40.2023.04.14.03.19.41; Fri, 14 Apr 2023 03:19: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; dkim=pass header.i=@shutemov.name header.s=fm1 header.b=ZClIRosJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Upd2y1I6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbjDNKTR (ORCPT + 99 others); Fri, 14 Apr 2023 06:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbjDNKTL (ORCPT ); Fri, 14 Apr 2023 06:19:11 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB1E4C06; Fri, 14 Apr 2023 03:19:09 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 829305C019C; Fri, 14 Apr 2023 06:19:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 14 Apr 2023 06:19:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1681467548; x= 1681553948; bh=3WBXbUqLLLeQq1ZCi/ry0FRNyZxe7SfbSw3k4IDdgYw=; b=Z ClIRosJvFYimXH424uFn+IMWuq7wHzSt3CljrY6r3b2AWz20JTr3/voTEg5m5Jwj UJozpW/Eb7z4fS8NJLngrRWiQwe9+eoOVt7aOHAQU8KHYLFuHpcZJ9KLPu/jJtH2 9khb9X0dhloRjI8UKC8rzGLqd4glPe/VOA+1sw47v8Kz2xTKBqAmvuIHRr2Hk9cb qkCx1iB5t55scuSTy14A81GS7dz2XtgBVN4oPJ1F8+Jje3pSWcAngphiyuKemx3f 5gvG9A4VrQlZBSySiKi8BqvxPS1CgAlqqjhMEMgsJmNEdYd+KfOodnUs9Md3q4qX aKeFlK5chukPhVnOAF12Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1681467548; x=1681553948; bh=3WBXbUqLLLeQq 1ZCi/ry0FRNyZxe7SfbSw3k4IDdgYw=; b=Upd2y1I6y+9hRCGMAhkcN7OzmAdK+ ZYWyZauB6wWOXiH4DJdR7jvPQF4zF5KAFENPCLq+iUnbuIbPxWvaRixT0yBUZDWB sURE8/aBRxo4kDgGlXUphkxSqWCNFJLcBsoXhTKFDVSmNnp/D+3t493rFbUl2G5m 3z7OHA3oU3wt8CMch2Ipsx0uZsyKbSEL8xR3x6AsfXqGa2qwbvzTwOpnZ0h15QFu yOoVpNQ7SoueL2JYoTHKrbUTt6bnABkk3OshYd7lnz0sYNwOyzoAwrcPb/l2hTse V/H/Nb6xu7Mwzmd/y/uH1C6F2FvXMRV1h25KH7yXB1zx++Pm/aVEoJ/lw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeltddgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpeekvddvjeffheetgedtvdfgieejiedvgeejieet jeehieehveffueekfeehffdvveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehkihhrihhllhesshhhuhhtvghmohhvrdhnrghmvg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Apr 2023 06:19:05 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id EE51510D7B4; Fri, 14 Apr 2023 13:19:01 +0300 (+03) Date: Fri, 14 Apr 2023 13:19:01 +0300 From: "Kirill A. Shutemov" To: Vlastimil Babka Cc: "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , Mel Gorman , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, aarcange@redhat.com, peterx@redhat.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv9 03/14] mm/page_alloc: Fake unaccepted memory Message-ID: <20230414101901.j3zoji6vmjzpjiec@box> References: <20230330114956.20342-1-kirill.shutemov@linux.intel.com> <20230330114956.20342-4-kirill.shutemov@linux.intel.com> <835dfe65-d9dd-0b16-37d4-920e97f1bca0@suse.cz> <20230403143915.uc4tnpgmssvpdqxu@box.shutemov.name> <20230403155011.aodnd5ratcyeie52@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230403155011.aodnd5ratcyeie52@box.shutemov.name> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 On Mon, Apr 03, 2023 at 06:50:11PM +0300, Kirill A. Shutemov wrote: > On Mon, Apr 03, 2023 at 05:39:15PM +0300, Kirill A. Shutemov wrote: > > On Mon, Apr 03, 2023 at 03:39:53PM +0200, Vlastimil Babka wrote: > > > On 3/30/23 13:49, Kirill A. Shutemov wrote: > > > > For testing purposes, it is useful to fake unaccepted memory in the > > > > system. It helps to understand unaccepted memory overhead to the page > > > > allocator. > > > > > > Ack on being useful for testing, but the question is if we want to also > > > merge this patch into mainline as it is? > > > > I don't insist on getting it upstream, but it can be handy to debug > > related bugs in the future. > > > > > > The patch allows to treat memory above the specified physical memory > > > > address as unaccepted. > > > > > > > > The change only fakes unaccepted memory for page allocator. Memblock is > > > > not affected. > > > > > > > > It also assumes that arch-provided accept_memory() on already accepted > > > > memory is a nop. > > > > > > I guess to be in mainline it would have to at least gracefully handle the > > > case of accept_memory actually not being a nop, and running on a system with > > > actual unaccepted memory (probably by ignoring the parameter in such case). > > > Then also the parameter would have to be documented. > > > > As it is written now, accept_memory() is nop on system with real > > unaccepted memory if the memory is already accepted. Arch-specific code > > will check against own records to see if the memory needs accepting. If > > not, just return. > > > > And the option will not interfere with unaccepted memory declared by EFI > > memmap. It can extend it, but that's it. > > > > Looks safe to me. > > > > > Speaking of documented parameters, I found at least two that seem a more > > > generic variant of this (but I didn't look closely if that makes sense): > > > > > > efi_fake_mem= nn[KMG]@ss[KMG]:aa[,nn[KMG]@ss[KMG]:aa,..] [EFI; X86] > > > Add arbitrary attribute to specific memory range by > > > updating original EFI memory map. > > As of now, efi_fake_mem= can adjust attributes of memory. Unaccepted is > type of memory, not an attribute. I guess we can allow it override type > too. But syntax is going to be fun. efi_fake_mem applied too late. Bitmap that represents unaccepted memory for kernel created at kernel decompression stage, but efi_fake_mem= handled in main kernel. I don't think pushing efi_fake_mem to decompressor makes sesne. I would rather drom the feature altogether. -- Kiryl Shutsemau / Kirill A. Shutemov