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 7F37EC433FE for ; Tue, 11 Jan 2022 20:02:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E5E146B00C2; Tue, 11 Jan 2022 15:02:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E0D266B00C3; Tue, 11 Jan 2022 15:02:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAEAF6B00C4; Tue, 11 Jan 2022 15:02:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id BA8A66B00C2 for ; Tue, 11 Jan 2022 15:02:04 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 63BC4823C500 for ; Tue, 11 Jan 2022 20:02:04 +0000 (UTC) X-FDA: 79019077368.08.919A379 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf29.hostedemail.com (Postfix) with ESMTP id 15EF7120016 for ; Tue, 11 Jan 2022 20:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641931323; x=1673467323; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=3gIIh0QobaXhCl5g47l0oKFFAo+4H11ox4GXioaEwbU=; b=NQwFlJbz82Cy02IX3We69MimX7LbZ8qa3bsYsboCVNdPZH5PVG/wXwp5 2mzipl/I18EKwXOaKVKmEAvOXkBmpA0rKeb1QEC375xJvMos2GMcBK+sU mRdkl+7SDnEhUL/1RMQB9Ogcc14YaluioE/PalYgPBNTf20SdAvqWxfIE TNKrDk7VBZJgMaDnq+iEP765HMb//1+huXM/HiMSYpEKjfBRCMQAdKALA R4+NiC1VhmJP1r06I8hAtbiakr612+txGInqJ823zR/DOsbX9+bxhxM30 uPI4gywszoEbUbnS72r6tdIiPx5HdA8xwoSKKYdyT1upUoyVbxBKBqh7p A==; X-IronPort-AV: E=McAfee;i="6200,9189,10224"; a="224269156" X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="224269156" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2022 12:02:01 -0800 X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="613327803" Received: from padhika1-mobl.amr.corp.intel.com (HELO [10.209.13.65]) ([10.209.13.65]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2022 12:01:59 -0800 Message-ID: Date: Tue, 11 Jan 2022 12:01:56 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCHv2 6/7] x86/mm: Provide helpers for unaccepted memory Content-Language: en-US To: "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: 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 References: <20220111113314.27173-1-kirill.shutemov@linux.intel.com> <20220111113314.27173-7-kirill.shutemov@linux.intel.com> From: Dave Hansen In-Reply-To: <20220111113314.27173-7-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 15EF7120016 X-Stat-Signature: e5pijxkatam8yowic7hgdfctheb7au4x Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=NQwFlJbz; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf29.hostedemail.com: domain of dave.hansen@intel.com has no SPF policy when checking 192.55.52.151) smtp.mailfrom=dave.hansen@intel.com X-HE-Tag: 1641931322-778717 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 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.