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 1B3CBC43334 for ; Wed, 1 Jun 2022 19:35:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7333D8D0032; Wed, 1 Jun 2022 15:35:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E1AE8D0028; Wed, 1 Jun 2022 15:35:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A7B68D0032; Wed, 1 Jun 2022 15:35:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4B1DA8D0028 for ; Wed, 1 Jun 2022 15:35:08 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 34BA760AD7 for ; Wed, 1 Jun 2022 19:35:08 +0000 (UTC) X-FDA: 79530670296.04.2EC4CBA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf31.hostedemail.com (Postfix) with ESMTP id 604D52006F for ; Wed, 1 Jun 2022 19:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description; bh=Wkd+qK1A5XBz5WZBnQIdi6DW33K+oMosCMS+4sZy/cs=; b=AGVDXW8/nu43WRDD1uEPuOrwI9 QhL8aaFxX8SyDpgfEbqrvquPDhrASGgMBINTb5sv+WrH7Xh1sDd+n5Agn78lUIaSslsWWcG+aDLRX 58d0g5oAaZy8W/AHowNwVTzGv9KWJrSjhiPqUKaiwj2IbyUal9XsN2TUZY0LiW9ZmMGJNHUdgT6CL SBccDuSyXo4Bk96TwW7Le6bBfgHn12WoBvV6qqqhr1tCnkFiJ927xRMQDxKQlDSjMjbksTP3TWZk/ rTsCrcf9n+FtYzXV3GDBCUG2yI+aicquUJWjcO5Ph84LXWBe+qfoMoObnSkPW0dybPx/KvY6mBwVF MfoIpimw==; Received: from [2601:1c0:6280:3f0::aa0b] by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwU71-006YNd-JO; Wed, 01 Jun 2022 19:34:35 +0000 Message-ID: Date: Wed, 1 Jun 2022 12:34:24 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCHv5 06/12] x86/boot/compressed: Handle unaccepted memory Content-Language: en-US To: Dionna Amalie Glaze , "Gupta, Pankaj" Cc: "Xu, Min M" , "Kirill A. Shutemov" , Borislav Petkov , "Gao, Jiaqi" , Michael Roth , Borislav Petkov , "Kirill A. Shutemov" , "Lutomirski, Andy" , "Christopherson,, Sean" , Andrew Morton , "Rodel, Jorg" , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , "Hansen, Dave" , Mike Rapoport , David Hildenbrand , "x86@kernel.org" , "linux-mm@kvack.org" , "linux-coco@lists.linux.dev" , "linux-efi@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20220425033934.68551-1-kirill.shutemov@linux.intel.com> <20220425033934.68551-7-kirill.shutemov@linux.intel.com> <20220506153013.e6v4q2qhuhqumfiu@box.shutemov.name> <20220513144515.fx2cvo3rjued3vy5@black.fi.intel.com> <0c545c5f-3540-1441-7a7d-359b6795f43a@amd.com> From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="AGVDXW8/"; dmarc=none; spf=none (imf31.hostedemail.com: domain of rdunlap@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=rdunlap@infradead.org X-Stat-Signature: 1cjo9kg7hncts3mgf3qd33tpmnsmmr4z X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 604D52006F X-HE-Tag: 1654112066-264204 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: Hi-- On 6/1/22 09:20, Dionna Amalie Glaze wrote: > The memory accounting in Linux is probably the issue. Both times I ran > the test were from a freshly booted VM. The test parses the output of > $(free -k) to determine the amount of free memory it should allocate > and write/read from, with a given stride of pages to skip before > touching the next page. > > We grab the third column of numbers from the Mem output that looks like this > > total used free shared buff/cache available > Mem: 65856604 4128688 48558952 11208 13168964 60942928 > Swap: 1953788 118124 1835664 > > So my workstation has 48558952 free bytes. We take that, give it to > memtouch to allocate that much anonymous memory rounded down to the > nearest MB with mmap and randomly read/write the buffer. > > For an 8GB machine, the UEFI will have the initial 0-0xA000 memory and > 0x10_0000 to 0xC00_0000 (beginning of mmio hole) prevalidated. The > next 5GB is classified as the UEFI v2.9 memory type > EFI_RESOURCE_MEMORY_UNACCEPTED, 0x1_4000_000 to 0x2_0000_0000. > The Linux e820 map should see that range as unaccepted rather than > EFI_CONVENTIONAL_MEMORY (i.e., EDK2's EFI_RESOURCE_SYSTEM_MEMORY), but > I think it needs to be accounted as free conventional memory. > > So when I see 2044MB free vs 7089MB free in my VMs, the two are > roughly 5GB different. Please see/read/use https://people.kernel.org/tglx/notes-about-netiquette -- ~Randy