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 B41CBC433EF for ; Wed, 1 Jun 2022 14:39:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 525648D001E; Wed, 1 Jun 2022 10:39:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D42D8D001C; Wed, 1 Jun 2022 10:39:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 373978D001E; Wed, 1 Jun 2022 10:39:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 28F8E8D001C for ; Wed, 1 Jun 2022 10:39:24 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CD463CB9 for ; Wed, 1 Jun 2022 14:39:23 +0000 (UTC) X-FDA: 79529925006.21.D602D1E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 5094FC0064 for ; Wed, 1 Jun 2022 14:38:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654094362; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qlU0tkzpCjcg/jU3LgCOcXpRFl3qkGqk9lVl6FW9S+g=; b=T3lLK89+tCok2oiaNJSiZBSncEZtYjmnOl/e5+nrPhcmiStbyNe6+A8ok7E25fl3Eda3rA BajBq/dTwZTasUz5zrBJdCWoIXS/xgiWYlnwNqH1NL2JPfq2Yp9F8tS33Zf4nrisPs+FZF Lm+gX7CljDof55uNm1A5TwfTTiFz8Dk= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-615-Ln14qbckMx-yYiMB4qR7fQ-1; Wed, 01 Jun 2022 10:39:20 -0400 X-MC-Unique: Ln14qbckMx-yYiMB4qR7fQ-1 Received: by mail-wr1-f69.google.com with SMTP id z5-20020a5d4d05000000b0020e6457f2b4so347695wrt.1 for ; Wed, 01 Jun 2022 07:39:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=qlU0tkzpCjcg/jU3LgCOcXpRFl3qkGqk9lVl6FW9S+g=; b=QDchC3EsQqVcebLVQwlD35SzCe7+bbOi4KKBpK7u2sUtnzu5GmrOq3BNcVNI9TDpQv jDgMy1J+oaamOU5slqVaxuGsgqlLPyT7pUmtmm9MlVHCOjJA81AYbRyuR/Hzo9MKXEda 4saYYyc0z/D+cSejkp1aH65G+n3tZ7V6MTE349N7JYQByfCJ9+/BeobS+gV5cZsWRsOO d0dlxmARvnwYPAn8INaJ6knt5uhNpY5g89tfI6vvT80n4DOKcN2YS/FpuLOdwlZuiHxd S4WeU9wLpB7zuQ5v1Nf4HHEkSU6jnGewiJFL/QT+uhnG+gKp0+VtCj4yfxJmjfTpqPqc WWig== X-Gm-Message-State: AOAM530S6r5DSLFg9pfY3nWkeid7hGBTnDa0REP5apo6VaiRNnl17cHe k5Z0CMx3L1MylcY+t9Eoavd+8lfG9IGxzkDY1dv2y4qNTp8QEPTqi0h4PdFvmkcD7TNmXdw9ABZ Qaam4Rxqw4jw= X-Received: by 2002:a05:600c:1d99:b0:397:482b:429 with SMTP id p25-20020a05600c1d9900b00397482b0429mr28614923wms.130.1654094359708; Wed, 01 Jun 2022 07:39:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZmvS/ySSMSACfcbs5N8wx4zgU89IJgDAitfH9pT2OXqot4AKsgn1nc41biOJdFJqGw1r+Pw== X-Received: by 2002:a05:600c:1d99:b0:397:482b:429 with SMTP id p25-20020a05600c1d9900b00397482b0429mr28614883wms.130.1654094359401; Wed, 01 Jun 2022 07:39:19 -0700 (PDT) Received: from ?IPV6:2003:cb:c705:2600:951d:63df:c091:3b45? (p200300cbc7052600951d63dfc0913b45.dip0.t-ipconnect.de. [2003:cb:c705:2600:951d:63df:c091:3b45]) by smtp.gmail.com with ESMTPSA id t22-20020a05600c41d600b00397550b387bsm2720288wmh.23.2022.06.01.07.39.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jun 2022 07:39:18 -0700 (PDT) Message-ID: <116f7be4-7b75-a83b-899b-c23b52534b30@redhat.com> Date: Wed, 1 Jun 2022 16:39:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCHv6 03/15] efi/x86: Get full memory map in allocate_e820() To: "Kirill A. Shutemov" 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 References: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> <20220517153444.11195-4-kirill.shutemov@linux.intel.com> <20220601143515.iavmtysdchirbtel@box.shutemov.name> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220601143515.iavmtysdchirbtel@box.shutemov.name> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 5094FC0064 X-Stat-Signature: wrhjk1ziub799xdquwtcnbehx8utojbi X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T3lLK89+; spf=none (imf10.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam08 X-HE-Tag: 1654094319-346176 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 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. > > On EFI system, E820 is constructed based on EFI memory map and size of > bitmap calculated based of EFI memmap will always be enough to address all > memory. e820__end_of_ram_pfn() can be smaller than what what we calculate > as size of memory here, if kernel reserve very top of the memory, but it > will never be larger. > > Later during the boot we use e820__end_of_ram_pfn() to infer size of > bitmap and it is safe. > -- Thanks, David / dhildenb