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 C7541C433EF for ; Wed, 12 Jan 2022 19:43:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4008C6B020C; Wed, 12 Jan 2022 14:43:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D7B56B020D; Wed, 12 Jan 2022 14:43:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2795C6B020E; Wed, 12 Jan 2022 14:43:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 022256B020C for ; Wed, 12 Jan 2022 14:43:37 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8A14692E0D for ; Wed, 12 Jan 2022 19:43:37 +0000 (UTC) X-FDA: 79022659674.26.624520D Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf19.hostedemail.com (Postfix) with ESMTP id 1F2601A0012 for ; Wed, 12 Jan 2022 19:43:36 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id o15so11770317lfo.11 for ; Wed, 12 Jan 2022 11:43:36 -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=HWx7ejiUd6c11eHL/2LW4rxQ9jG3blTr/paj//+W3GA=; b=FXbhuy+QL6aQ+AoiJhfsAUjxL9AQtZNPH1/MjYiUg+Nx4vLGl/8M3mFWKS9FnfvuGD 3yyer0YkC/HwBnY+KtCefbdzX/JuU/13Qi+4vSmRZPZom99Utfn2yDm917kaPpi2hSRI 6/D6rlwaZv2TsttUB6JlVVKCSawSE+uVUgr/1vjRAqOsD1NEsxNfjSLJfy7xjwX8UNHw 2Feexa8N6Jzklhn18KjxUIxXY74qWOWd7tvy2tu8esYcDnyBvPQyTMezT8R+mepS6mYY dNENprpfkaZkRJpBQXv7R3h3KhOA36hQnTqAiYgikUy9dDds9b/U+jm8tMTb1HURd1Le jEaA== 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=HWx7ejiUd6c11eHL/2LW4rxQ9jG3blTr/paj//+W3GA=; b=JBC9JXF/oXUtncKlxrOC/fvAfLxxLMwNQ4jLdo4AesZP6krd3Ltq/XY5koF+5DS0m5 42PoC/EyuWx9wv5R2xk6ShgWN9wGg0dtqnkHXO/45LQoi2dRqxk2FAdMrEvqoVioYzR6 qM8FvOWmPX5TgFXH/gSsMYvbOIIvJ49+/asE3vCfBmwYd4zfTRcMEEQId903NTF8AaMi IGbFCMrCehc3zvbXFLB7XYiW5dNm+hPPqeyMB90pho460ChF0h4MgqOnLUsVBhOQrDtk lY3IynUZ8GsbWyD7Bkr8tsbzfM3xcwIJX1QI3byh+2KZGKw2OkUhLYl6o38T2QPMEZ/N 3RUg== X-Gm-Message-State: AOAM530IMLK/BHh6mgVS95S7259mL9DD21cT15FJJBlAG04S0ZFTJz6I IVSQ8VnilhNIw2wna/MZUSppGQ== X-Google-Smtp-Source: ABdhPJzS4Xf5WDj+CW236gyVeYs5tYSyEAdbNEh2R2wQCw8aCu2hEsekTBRphxyuWPJWkJiJSpH7Gg== X-Received: by 2002:a19:5514:: with SMTP id n20mr878945lfe.178.1642016615543; Wed, 12 Jan 2022 11:43:35 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id g4sm74056lfu.137.2022.01.12.11.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 11:43:34 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 08C82103A6D; Wed, 12 Jan 2022 22:43:58 +0300 (+03) Date: Wed, 12 Jan 2022 22:43:58 +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 6/7] x86/mm: Provide helpers for unaccepted memory Message-ID: <20220112194358.u5akdxqrzvfepcq4@box.shutemov.name> References: <20220111113314.27173-1-kirill.shutemov@linux.intel.com> <20220111113314.27173-7-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1F2601A0012 X-Stat-Signature: cmzjbpuekqk5j4krc9y13chbjmpnydef Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=FXbhuy+Q; spf=none (imf19.hostedemail.com: domain of kirill@shutemov.name has no SPF policy when checking 209.85.167.52) smtp.mailfrom=kirill@shutemov.name; dmarc=none X-HE-Tag: 1642016616-134243 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 12:01:56PM -0800, Dave Hansen wrote: > On 1/11/22 03:33, Kirill A. Shutemov wrote: > > Core-mm requires few helpers to support unaccepted memory: > > > > - accept_memory() checks the range of addresses against the bitmap and > > accept memory if needed; > > > > - maybe_set_page_offline() checks the bitmap and marks a page with > > PageOffline() if memory acceptance required on the first > > allocation of the page. > > > > - accept_and_clear_page_offline() accepts memory for the page and clears > > PageOffline(). > > > ... > > +void accept_memory(phys_addr_t start, phys_addr_t end) > > +{ > > + unsigned long flags; > > + if (!boot_params.unaccepted_memory) > > + return; > > + > > + spin_lock_irqsave(&unaccepted_memory_lock, flags); > > + __accept_memory(start, end); > > + spin_unlock_irqrestore(&unaccepted_memory_lock, flags); > > +} > > Not a big deal, but please cc me on all the patches in the series. This is > called from the core mm patches which I wasn't cc'd on. > > This also isn't obvious, but this introduces a new, global lock into the > fast path of the page allocator and holds it for extended periods of time. > It won't be taken any more once all memory is accepted, but you can sure bet > that it will be noticeable until that happens. > > *PLEASE* document this. It needs changelog and probably code comments. Okay, will do. -- Kirill A. Shutemov