Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5780984ioo; Wed, 1 Jun 2022 12:27:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx69sbpHReD1rf/ugOidDBL5SiuTpPYqptd1tUfRMfdIJ2EVAf1ef9kSFrN/MLj2ZUBMldg X-Received: by 2002:a17:903:228e:b0:161:8632:2725 with SMTP id b14-20020a170903228e00b0016186322725mr1024255plh.126.1654111644707; Wed, 01 Jun 2022 12:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654111644; cv=none; d=google.com; s=arc-20160816; b=jXaUeLKdWHNjQQSF51BYyfPzoeTF5n6Xc9/LuCgrISkwrxgABAdMOHYxRrdDH07w2e bN9ys94dwYjDwc+rTcCmPSM6tPvg9sV4a35AYnsCQT0Vv75wlcmz2puICB+v9XlUvgqr 6u6knjKKZBsdh8HQHUDfoiGsyGRLNX3K7BbwLsYSOwGyYVyZLfPth5rPmwXXUcZ3RZX0 6DBxJUXCCPjOIvJolgKK10yaM6PE3QU9fNAH74yB4hRFpblAM/Uir2FPCN9Fkt1WLXzs GIGwrxGQ8ll9z1tVOLeiCtK7kf9+Ue9SWuOaM59SXI3YbALZRBx5sE3pcMa1XqPQuy2x NhwA== 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=ZCSZBRlbrl+wVf2rxucv5zcNIA855Ca5kZwzalOYvb0=; b=EZPp1Nw0yWQsyMVUhpFqCjjt7KRFHub7FdcNkJ+E+AkTI7BUjHaehmmleLjpCLynOS uslvk4dJFPlyajXnXMiOXl9OE19RhUaFfcVhXpyg7YL1dB4XHr0GmKod+TgWkLe2tbMv 5CkIv/v3TZ1Fv45dvcVoKf5pDWlJcUB9R9omPisycr9RvCVEb8SULwfFtWtOgFBV5zTY 0g3sxSQms8CMZQ0629K0CNpHKRIs/xdab/7zB4pT5zd0kzelC778N//6KhVAzMDupZZO S+g8JE2o+0hjCWjEvnb0NBfsfmRo5DOgA+nGEyLXwch+ZvCBAzxOOahyi/dKGx7eCOJ7 rXiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=VVLJD0NA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m10-20020a056a00080a00b0050e07e66d5asi3788883pfk.19.2022.06.01.12.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 12:27:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=VVLJD0NA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 70D011737E6; Wed, 1 Jun 2022 11:59:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345386AbiFAOdW (ORCPT + 99 others); Wed, 1 Jun 2022 10:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242256AbiFAOdT (ORCPT ); Wed, 1 Jun 2022 10:33:19 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1809C222BA for ; Wed, 1 Jun 2022 07:33:18 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id g25so2184044ljm.2 for ; Wed, 01 Jun 2022 07:33:18 -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=ZCSZBRlbrl+wVf2rxucv5zcNIA855Ca5kZwzalOYvb0=; b=VVLJD0NAQILvJHfkfQdPPcZQYLPIvuU383slFb0XqyUhc32YzHWh5sxJyXBVFHQYJy J92H5Fw4LbWBvdWB1iS6I3yvfJJWHZw8bqQDOC6b44r7JyavcgRc2mBCUj6eeznjSuDk nyIxkcatYhb+zHY7xIfeQHW+2ukP9E+RdX9pYQ/ykkIXmvJS9ayfu/0ACvyDq232jvYe SeMxgVf6YbK4Dc0/HecM5JX7ykfd2b36y1SR6Q6Szo5lJNS5UckHGL7PzNDLGZF4Hv2p M18Yixf8P1Cs2Qz2tWaphg/Rz3oQ7A+VQVQtbOGBofEaAAzm/2V2dk8Dql19ozH6RH8U GKhA== 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=ZCSZBRlbrl+wVf2rxucv5zcNIA855Ca5kZwzalOYvb0=; b=OXbIUoIQ7jQZ5Ns4BTuEJbflRf/163kv9hxLpyREmYLHynIecxaD3Vo6ZaAH4n7GWz zBmxOoZ/sE2jolPg6XLlcU07X3b+3VzjpumB3I1HbQ+Uf58cl+JZmvSrj2TRrVqH69Y4 d/evfOqNEFbcLP9mhalZnbwQCHV0shThU+X+lYsHeu/hjQTE0VH8lRTy7dXkjxNFU/TT xfY+F4TGTCH8w6rQICr3BLhkbzJJSaIYnqLuI32wBTSfu4sVfp5k5efr7YIkB9RzRERq xWqhw5jYDDekeOaz6iNRNHRyQRRN9zXiL4y3vQyhBuaZpQkYwcbJZQfzWvOTi404zpF5 JsZA== X-Gm-Message-State: AOAM5329oWvfLTQGf5Y/iJbD7u7/FlZvaQ+IkRL7uJVWDdwHIeyT3QJx 7tVkL0+c8zzybw9EBsMne6Rhuw== X-Received: by 2002:a2e:920f:0:b0:255:4f66:956 with SMTP id k15-20020a2e920f000000b002554f660956mr9356579ljg.191.1654093996359; Wed, 01 Jun 2022 07:33:16 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id o8-20020a056512230800b00478feae4f24sm388181lfu.268.2022.06.01.07.33.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 07:33:15 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 0A26E109789; Wed, 1 Jun 2022 17:35:15 +0300 (+03) Date: Wed, 1 Jun 2022 17:35:15 +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: <20220601143515.iavmtysdchirbtel@box.shutemov.name> References: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> <20220517153444.11195-4-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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. 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. -- Kirill A. Shutemov