Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp525454imn; Tue, 26 Jul 2022 02:22:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u7xCwNlBl2ONOAVsGwTbkFSaFv1cBsXipMfuM4mbJHc2AB4vNVyr65XYzqkv9qiPAaqKRm X-Received: by 2002:a17:907:60d1:b0:72f:42a0:f3f9 with SMTP id hv17-20020a17090760d100b0072f42a0f3f9mr13334654ejc.727.1658827323957; Tue, 26 Jul 2022 02:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658827323; cv=none; d=google.com; s=arc-20160816; b=yBcu+aSl2yBjBV9gJz/sBbDtuXKYEjRJZ66CRV802BKS9BI9TdphU/KrsHMJXnhjWc pGCaY1wfhaBRX3MkxlkXGLFNH2pkVugHzdA4F2UDMpPtAHLZUduB3Zy4xUwMtSYEFOzj r08k5eBBs4WrUugTjgnM4D61hAXVgo4qo/9In6rL7Y4vyXOahts42yOfwOR0sQpZjZfy i9R35mwp3MRdX+Hw3InboGBhbV7UkSU1Ucesq6Uy1xDfFDc+p1xkSDLHUN5iKYg1C/SW Tm0I/p/bh9qsf1G0pTFrnJBwvm6FXrvFUx1R5Q+LuQ+JEbcJYXev0Ruw9XSsZv1ziPs4 p5YQ== 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:dkim-signature; bh=YvKICD3C3EkdneDF/q9lFJXRTdW4l8BIH7qdHQLIvtU=; b=CLrue67WG9ijVvFG4wCfjRmD74N5maqjTszKBRav2imK3DulHHDWqVt7aPk9Zz1vuT jD189Lqy3FPKVV4bmy7HQivIcVqkIdvJyr8NGovYa5O0T1QqkOzq8qoCnkJY1ScYxTkT W3T2j+h6JY0uu8grnYHHDffCRHIidarMzGeHVUSChVoGWNiY6gLNpqXuD5sLYjCBaWdk aWO0XBytFuqefeuzbYwwWE03NHLpReNJuml0ykvsPNZqJlKGS1PVMoBfEhpBpkhUYa5H lEefWID3Jau0YQpAbF72pp7VnjE6r+YErbZow2ItfEh6JnW4vSKhYObaKchjnbBiSPYp H9wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Yo9S+ums; 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=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa39-20020a1709076d2700b0072a9ec4c1fdsi14153848ejc.594.2022.07.26.02.21.39; Tue, 26 Jul 2022 02:22:03 -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=@alien8.de header.s=dkim header.b=Yo9S+ums; 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=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232300AbiGZJHZ (ORCPT + 99 others); Tue, 26 Jul 2022 05:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiGZJHY (ORCPT ); Tue, 26 Jul 2022 05:07:24 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B011FCDC; Tue, 26 Jul 2022 02:07:23 -0700 (PDT) Received: from zn.tnic (p200300ea970f4ff2329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:970f:4ff2:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 85EDD1EC056D; Tue, 26 Jul 2022 11:07:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1658826438; h=from:from: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; bh=YvKICD3C3EkdneDF/q9lFJXRTdW4l8BIH7qdHQLIvtU=; b=Yo9S+umsUXGkd2N2+EJPjWHBFHulzSwL9NmkQdv/cdl2EDyyA6myeHNDdQLkmsXhTX+CJa hFis4wDZIQh1r/G1t6t4646L8o8ZrbZ6R6AKgLpZktkblMeH0IzdFc8vIR0hlPqJd3EAMk hjdt9RuEmy2kI+NqvDzu3VR2K45AYbc= Date: Tue, 26 Jul 2022 11:07:14 +0200 From: Borislav Petkov To: "Kirill A. Shutemov" Cc: Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: Re: [PATCHv7 08/14] x86/mm: Reserve unaccepted memory bitmap Message-ID: References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> <20220614120231.48165-9-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220614120231.48165-9-kirill.shutemov@linux.intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 Tue, Jun 14, 2022 at 03:02:25PM +0300, Kirill A. Shutemov wrote: > diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c > index f267205f2d5a..22d1fe48dcba 100644 > --- a/arch/x86/kernel/e820.c > +++ b/arch/x86/kernel/e820.c > @@ -1316,6 +1316,16 @@ void __init e820__memblock_setup(void) > int i; > u64 end; > > + /* Mark unaccepted memory bitmap reserved */ > + if (boot_params.unaccepted_memory) { > + unsigned long size; > + > + /* One bit per 2MB */ > + size = DIV_ROUND_UP(e820__end_of_ram_pfn() * PAGE_SIZE, > + PMD_SIZE * BITS_PER_BYTE); > + memblock_reserve(boot_params.unaccepted_memory, size); > + } > + Hmm, I don't like how this is dropped right in the middle of a unrelated function. You're adding arch/x86/mm/unaccepted_memory.c later. Why don't you put that chunk in a function there which is called by early_reserve_memory() which does exactly what you want - reserve memory early, before memblock allocations? Hmm. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette