Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1276275lfc; Wed, 1 Jun 2022 13:56:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8r5wlHphnwtFqvezUbzFXkN8CvWnJil2wptLipPs7omMoSCgQGy2Xhuz4D8J3PFNhFR0j X-Received: by 2002:a17:90a:5206:b0:1e0:ab19:5f41 with SMTP id v6-20020a17090a520600b001e0ab195f41mr1327311pjh.142.1654116995435; Wed, 01 Jun 2022 13:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654116995; cv=none; d=google.com; s=arc-20160816; b=CxaVQprmesIwbGgypUe8izMqNRt7QsXt8ETCAeFh/KYd5MmGAn5irv+qzbk1L35nMA tFQ8/0u2JbuUeECvwX/WKl7vm7DEiC3Ns1hKnPPiNCluN31caiUNF+vZLPx8qEyTcPzt WduUVnoNCf+BoV7z6p8IAn9gyrkLvwpiiKDqiYQbqF5Rt+UkKwv/o4+iI47X6Du3+d90 fwrDnkxXR2aapaqRBxmB1IUNmiZLURdU3rYA5cT0m9BL1dOsxcmvNmrH8JoWdOYXNOaY 8fVJqNtd+gj2kMCgBJq2O1WuYiPSMw24+k2RmwNK7VLLv1oW6z1Uv6TfdR8oUZBkskC2 UFyw== 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=LvrIFqHHGXUVgoifCY/oFu21MGkFJUkJFZqNI+NbYR8=; b=SqAFyaN3bZ+S1CQpEQF4VVrVoux3cR4IsdWa4QnLyJ3qpvC933Mo4CTUUTKvvrLwEm kJPaGqJqegIeREzGYbNCbJ6IUZAPRH7NN1JUQiQbqF+OFhy0RaIM7ZJfOd0OtGk3bMIy fP45W/kNZEHinkmLdfSI/VX+hV7l6KuZgJfvtO7TD1GuBn9z+xnuD8R/pmqTAaHVVPs6 ejY48nGxpsXUjqypU0bUwbgmmxRylaEi1v0+iT78YuBOWni4aKbqXz3dB+tGkoN71gZU nJlXbIzGCvEhYCIf5YAMUlTUhXHgENT0epmANAxpdxSwsoYfS/3zCNmHnUp93iDc8wti kCBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=yUdMxLaD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 144-20020a630296000000b003fcc51079ebsi1264507pgc.704.2022.06.01.13.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:56:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=yUdMxLaD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D424F20B179; Wed, 1 Jun 2022 12:57:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353387AbiFAOpA (ORCPT + 99 others); Wed, 1 Jun 2022 10:45:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233844AbiFAOo6 (ORCPT ); Wed, 1 Jun 2022 10:44:58 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13D934D9CB for ; Wed, 1 Jun 2022 07:44:57 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id o15so2235983ljp.10 for ; Wed, 01 Jun 2022 07:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LvrIFqHHGXUVgoifCY/oFu21MGkFJUkJFZqNI+NbYR8=; b=yUdMxLaD0W66OdCYioHhoD9gW6M1g+oPiTwhz8QjBPsmhZRk+xpyKrrZYMwaBI5XQw jZF29wuwBsRx9N/Ef1/0c3+T4sWHE9lfvTYgEsiMHIG8hfjDoNd7eBMVEOq+EIbYfQuq 9lroUnnbox8DbJ4OUbkF5AFRgPeJFaJ1g5LJcEaThvWz1dkS1fHiHSeV4xE5gOEIuLHP WlEqu0rJ8yR1wISJEvp2oCUG3dcfqARrIGtk4Mh6RoKRDLOnG4pjqMoIAoBV5xrkNfba ZHu59dGJs7depH3ibMoOoWZRMc0pm9M3SMCETLJJIkFFmHwmz8JyPj1ES6NBP8fjhql2 x2Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LvrIFqHHGXUVgoifCY/oFu21MGkFJUkJFZqNI+NbYR8=; b=J4FFsvcJlIAq3DxyUaULxP57K44HBrwL/DSPN9PgVeyh1trAvURqUj3kGSMGoZOBpR PBmGcHYiD7oWWUsgVb7F+ZUmGfCg96aE1KlqPvv1d76vzkoNDY9/vnyje92q27P3vejP OeGEyPx5Y09A+GbkNKWmT3Syc7R11k+s9tQR5icrVQKGv0/+K2caQFW/BQw81pq7YPHI gyvuEgWaeKcOO8cj8njzdOQfBIoyJuFk0tmucVvNIdZWz6FmaRkrHtT/daJLJsN9NgW2 z/Ee46PEhVfIwPB07EkTzJMpBrrtkHbhzdiLt8ovR0s562D5k1accLJk5Nd3DLxzHK+l +MnQ== X-Gm-Message-State: AOAM532BVrXJREgkIdl+gPYEHTqJbQYElrmZquv+gBgpHh83unE9O/s8 VlvM0nz0bJmOVTy2osmvSdAhxQ== X-Received: by 2002:a2e:a176:0:b0:253:dbf1:b023 with SMTP id u22-20020a2ea176000000b00253dbf1b023mr36240386ljl.421.1654094695470; Wed, 01 Jun 2022 07:44:55 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id h10-20020ac250ca000000b0047255d2119fsm397178lfm.206.2022.06.01.07.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 07:44:55 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id E21D6109789; Wed, 1 Jun 2022 17:46:54 +0300 (+03) Date: Wed, 1 Jun 2022 17:46:54 +0300 From: "Kirill A. Shutemov" To: David Hildenbrand Cc: "Kirill A. Shutemov" , Borislav Petkov , 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 , 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 Subject: Re: [PATCHv6 03/15] efi/x86: Get full memory map in allocate_e820() Message-ID: <20220601144654.jtp6t2c6u4su4gwd@box.shutemov.name> References: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> <20220517153444.11195-4-kirill.shutemov@linux.intel.com> <20220601143515.iavmtysdchirbtel@box.shutemov.name> <116f7be4-7b75-a83b-899b-c23b52534b30@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <116f7be4-7b75-a83b-899b-c23b52534b30@redhat.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Jun 01, 2022 at 04:39:16PM +0200, David Hildenbrand wrote: > On 01.06.22 16:35, Kirill A. Shutemov wrote: > > On Wed, Jun 01, 2022 at 11:00:23AM +0200, David Hildenbrand wrote: > >> On 17.05.22 17:34, Kirill A. Shutemov wrote: > >>> Currently allocate_e820() only interested in the size of map and size of > >>> memory descriptor to determine how many e820 entries the kernel needs. > >>> > >>> UEFI Specification version 2.9 introduces a new memory type -- > >>> unaccepted memory. To track unaccepted memory kernel needs to allocate > >>> a bitmap. The size of the bitmap is dependent on the maximum physical > >>> address present in the system. A full memory map is required to find > >>> the maximum address. > >>> > >>> Modify allocate_e820() to get a full memory map. > >> > >> Usually we use max_pfn, if we want to know the maximum pfn that's > >> present in the system (well, IIRC, excluding hotunplug). > >> > >> How exactly will this (different?) maximum from UEFI for the bitmap > >> interact with > >> > >> max_pfn = e820__end_of_ram_pfn(); > >> > >> from e820 in existing code > >> > >> ? > > > > I'm not sure I understand the question. > > Essentially, if the PFN you calculate here for the bitmap size will > essentially match later max_pfn. Yes, generally. But is can decrease if kernel transit memory from TYPE_RAM to TYPE_RESERVE. In any case we will not step out of the allocated bitmap. -- Kirill A. Shutemov