Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1284597lfc; Wed, 1 Jun 2022 14:13:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjnItujwo7vmV0AA9E4dPcAW6bufC3eeFbsy6ThdTbbGWdeppePws8sjLcW2qQ2bBUoB+S X-Received: by 2002:a17:90a:5985:b0:1e3:39f:ec1b with SMTP id l5-20020a17090a598500b001e3039fec1bmr17382852pji.88.1654117986456; Wed, 01 Jun 2022 14:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654117986; cv=none; d=google.com; s=arc-20160816; b=vfHRHkdhQWfqp3OlhG5wbTBE5RBAnIqRogRoqe27tIvH5RAqRN2gtV7ruvVbC0zQme yppqHdMNWJzZ4F4LYV08kL+9XODT8VESOiQFnoXhZoaV4usTx+Yi1AMTeu3CsycxNtDu Fjklewdz4ihVrJmojvQLpboaIRpRknw914+Zj6Tzkr5U+EDb4r8MJg2x92B4ll5Mv163 ig/A3O9aJN4ukaQlY804/y+XJ6R3bmXyUQQDW5xqL0hePrdxUexNjCpPZ96vODnSlt5P RsD1PEC/Pov6cE9SY8ZcC4rlNazG3nNXlbUU8pJ8tnY5mQDjByCLXBTHKIlphxSLSI5H 0lZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=qlU0tkzpCjcg/jU3LgCOcXpRFl3qkGqk9lVl6FW9S+g=; b=cPzCxTmiXeR3QBF52lBw3FLix5EvEOxu0O9dVQYO9MCDSeDJKdaEuggjVtyzptnnlD JSev6/mdjSBgxFgL17MFwapiL+0w9emRxl0jrkBeK57x0jFt3M+3FTqssk0hW35a+Ehk lDjDkU74v+aX9fYU7absvWLCivL0P84u1Sf2KYAp4rUnA6isg4T5IVi6haYl9TbIqXzM Pi8tH2/WjdSKMrBBQuJbS0OJetQDp2Ms4cX0ZimJ9vSxd6XfqMxhvNiQ2+bM7JUsPYX8 NVQ8h8sHzmQxAi66h43SF3IHdFiXDWrSeJPTB0osAxfLMeJ/RRUcWBzT2T3B2v1e6IOM 2Uuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T3lLK89+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f185-20020a636ac2000000b003fcb1baaf06si2459504pgc.163.2022.06.01.14.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:13:06 -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=@redhat.com header.s=mimecast20190719 header.b=T3lLK89+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 75F19223BE2; Wed, 1 Jun 2022 13:04:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354921AbiFAOjd (ORCPT + 99 others); Wed, 1 Jun 2022 10:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354947AbiFAOj2 (ORCPT ); Wed, 1 Jun 2022 10:39:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B06B338BC for ; Wed, 1 Jun 2022 07:39:22 -0700 (PDT) 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-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-615-bbHG5tH7NnK2htDUV0xOGA-1; Wed, 01 Jun 2022 10:39:20 -0400 X-MC-Unique: bbHG5tH7NnK2htDUV0xOGA-1 Received: by mail-wr1-f72.google.com with SMTP id p10-20020adfaa0a000000b0020c4829af5fso344618wrd.16 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=LmHflgZPJTpZyukkKXgJTdCTAFPXCzxlCgct+Dr2Q0YZet1BVG6NCcwloXK7KN0IVz O/5zORPZVE6BsomgrFxVf83C+F0an+DvoSCfEL/5YAX7Z+NoJdoQHBvz9Xnsu1RHPLge fw8k8BMQ0qr5b5uBUMiSjTqxW3BWDVpAhBbdGiun8b2tc9v9sA3qOMghlARcEP9uSR1Z 49dDibYPQ0gM2sCP2a6h0Dwmzf68ZnVHknaxYlBU/sBmuy7VBlsua4RDCMHijwGnOvjl 631nZhod0U81JqpGIX653/pLAEYbQlsf+z9MEaGLLsS08wQ8SY/Xq87W7hh8iWGJuGrp PUyw== X-Gm-Message-State: AOAM5302IeZ9FxKqBUEu63cxMKWfKMt70IcYTP0ZJvCRAf+c5XQVv3V5 rQY/LwpIoLKprhfQ98q/ysKp9oh98ZnjWkuAyt3uNOqpzHvM+lKBTSN2LPrnNVYHy53lthlBrUy rMcWokIF2RXQxjDVp9nMjR4zF X-Received: by 2002:a05:600c:1d99:b0:397:482b:429 with SMTP id p25-20020a05600c1d9900b00397482b0429mr28614916wms.130.1654094359707; Wed, 01 Jun 2022 07:39:19 -0700 (PDT) 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() Content-Language: en-US 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> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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