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 7E4E8C433F5 for ; Wed, 12 Jan 2022 19:42:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00B296B020A; Wed, 12 Jan 2022 14:42:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EFCC76B020B; Wed, 12 Jan 2022 14:42:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4FC36B020C; Wed, 12 Jan 2022 14:42:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id AC2A56B020A for ; Wed, 12 Jan 2022 14:42:42 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4073D824C431 for ; Wed, 12 Jan 2022 19:42:42 +0000 (UTC) X-FDA: 79022657364.18.E0FB352 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by imf06.hostedemail.com (Postfix) with ESMTP id A8AC6180003 for ; Wed, 12 Jan 2022 19:42:41 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id g11so11902087lfu.2 for ; Wed, 12 Jan 2022 11:42:41 -0800 (PST) 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=cOQ/xWPl3tvthX8wOW9afvSYF1hlxSg5dmQKz7cg1rA=; b=EknpayJrAOCN1/MkEc37OWKDriaMtq0JwDs0lNvkfqcB7uPcXUaSrno1DUCY9OQCJj JeBtJgxRTF/jm9kwWgcun5p1maV/PEb/wz5Awq2uCeJZK63eBeszBuPCsS3NMGCIMOQ5 0UfBseExvdfhvW7o52YW5I5LI1D+lUI0kClR9eu3xdjjdfDkrUYi3EI9ZQRCXGpgdxLG FJgY+bVhKg5nntLrbcy+o2p4gLba5TtUVb08puKdTBNXTH9HcjLpLA7Yk1AnMRiyOLE1 RCZfkJ/ZZtuUGDAwd74tJrw53H8VOQOlaMLuFTMRd9Xfi9f3xpfgQxYQTNxCp/2sxGRs KPtQ== 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=cOQ/xWPl3tvthX8wOW9afvSYF1hlxSg5dmQKz7cg1rA=; b=2JVnzwyy8hN9gp5bqF+WgcbE7MAYo764lWFOBxMH7+kb8arDtS7sx8NbjXsPpUURwm 9z/uzvLenIZgbRtWcVUH7SnkDzByuxx+9s5xiQGwuEYFLLzFU7pUyxyhiYe8GyiBxfAV IDGbgAFlSdzh4ZhSNNhh1xHzp4aHX9sK0vpQcjA0U7Z2sjnPqh8MT/9o3OkBQXqPfNV3 XXMZ9wYUGt53u8dyPRDUFzxlYxDYxY+6a15QbvseCAvzYHI1XbGkp9cSnjn0DJElpM8T hDll8P1UltJQtDAXAK/eCvtdvQ0wynB0+5p0+Y2ivdwHzd5zh8/olr/ioyOGk+wgoohm 7OdQ== X-Gm-Message-State: AOAM532rJ55l1CRwyEuo3mGgh4C4yun/2WHxnV6/3akSj+Bzekehnbfn DRDDgIvvJ1NFVTgiNMf3KdBbbQ== X-Google-Smtp-Source: ABdhPJwTHrcLUKfFze3EfLRUMqmC0B1PnsBiDjZJKmSvB3k+WBc7vCS4TK6ASfyh26UvG0jZ0nk5QQ== X-Received: by 2002:a05:6512:b9e:: with SMTP id b30mr864164lfv.23.1642016559895; Wed, 12 Jan 2022 11:42:39 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id x39sm75833lfa.14.2022.01.12.11.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 11:42:39 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id C858B103A6D; Wed, 12 Jan 2022 22:43:02 +0300 (+03) Date: Wed, 12 Jan 2022 22:43:02 +0300 From: "Kirill A. Shutemov" To: Dave Hansen 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 , x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2 5/7] x86/mm: Reserve unaccepted memory bitmap Message-ID: <20220112194302.cyxhjypsptr4mtix@box.shutemov.name> References: <20220111113314.27173-1-kirill.shutemov@linux.intel.com> <20220111113314.27173-6-kirill.shutemov@linux.intel.com> <3a361a1d-0e14-8884-c5bb-90aeb87e38ef@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a361a1d-0e14-8884-c5bb-90aeb87e38ef@intel.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A8AC6180003 X-Stat-Signature: siwwqawqc7n9agndjj64zkux9twizydz Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=EknpayJr; spf=none (imf06.hostedemail.com: domain of kirill@shutemov.name has no SPF policy when checking 209.85.167.51) smtp.mailfrom=kirill@shutemov.name; dmarc=none X-HE-Tag: 1642016561-688531 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 Tue, Jan 11, 2022 at 11:10:40AM -0800, Dave Hansen wrote: > On 1/11/22 03:33, Kirill A. Shutemov wrote: > > Unaccepted memory bitmap is allocated during decompression stage and > > handed over to main kernel image via boot_params. The bitmap is used to > > track if memory has been accepted. > > > > Reserve unaccepted memory bitmap has to prevent reallocating memory for > > other means. > > I'm having a hard time parsing that changelog, especially the second > paragraph. Could you give it another shot? What about this: Unaccepted memory bitmap is allocated during decompression stage and handed over to main kernel image via boot_params. Kernel tracks what memory has been accepted in the bitmap. Reserve memory where the bitmap is placed to prevent memblock from re-allocating the memory for other needs. ? > > + /* Mark unaccepted memory bitmap reserved */ > > + if (boot_params.unaccepted_memory) { > > + unsigned long size; > > + > > + /* One bit per 2MB */ > > + size = DIV_ROUND_UP(e820__end_of_ram_pfn() * PAGE_SIZE, > > + PMD_SIZE * BITS_PER_BYTE); > > + memblock_reserve(boot_params.unaccepted_memory, size); > > + } > > Is it OK that the size of the bitmap is inferred from > e820__end_of_ram_pfn()? Is this OK in the presence of mem= and other things > that muck with the e820? Good question. I think we are fine. If kernel is not able to allocate memory from a part of physical address space we don't need the bitmap for it either. -- Kirill A. Shutemov