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 B0CB0C4321E for ; Wed, 23 Nov 2022 09:29:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A7546B0071; Wed, 23 Nov 2022 04:29:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 457EF6B0073; Wed, 23 Nov 2022 04:29:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 320B86B0074; Wed, 23 Nov 2022 04:29:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 235A76B0071 for ; Wed, 23 Nov 2022 04:29:54 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B17AA12113C for ; Wed, 23 Nov 2022 09:29:53 +0000 (UTC) X-FDA: 80164185066.19.0ED6AA8 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf26.hostedemail.com (Postfix) with ESMTP id 0D2E314000E for ; Wed, 23 Nov 2022 09:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SbJhBd7PxrHJEEletiUuq25lFGytClcwopVER3Q2f6w=; b=XaXRz8zC3xm7EJCawMUmwqri3E 0Yakm1KamvbVF1bwfXXRl7qK5BDfuiT19inEPTo1JRNjmAP8rnlX5xK3JjT5ziWsRghmLTBHXhsL1 aJUHV27hP9jqjU1EbiQr+jakO1Sy4K2/QjohzNvpgzMhQvPp680+AbVAmAe1mGptCkBW9+j2GrqoI l5/qrc8II+GyCwMJ7Q7av262Q3AWAfDOirpb5i7dplgQDRx2Gqv8K0AFz9we2KfL3KyYFTzuR0/zY DTHCA/0v0zCpGuKKSKcn3vmMRdLj3j8uRQn58iPQGrE353fd5n5mL0eHm06E/nHTETGYbPJnRT9dB nUloIqNw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxm4i-003jja-0E; Wed, 23 Nov 2022 09:29:48 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D98DF300202; Wed, 23 Nov 2022 10:29:46 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C05DA2D819C22; Wed, 23 Nov 2022 10:29:46 +0100 (CET) Date: Wed, 23 Nov 2022 10:29:46 +0100 From: Peter Zijlstra To: Dave Hansen Cc: Kai Huang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, seanjc@google.com, pbonzini@redhat.com, dan.j.williams@intel.com, rafael.j.wysocki@intel.com, kirill.shutemov@linux.intel.com, ying.huang@intel.com, reinette.chatre@intel.com, len.brown@intel.com, tony.luck@intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, chao.gao@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, bagasdotme@gmail.com, sagis@google.com, imammedo@redhat.com Subject: Re: [PATCH v7 10/20] x86/virt/tdx: Use all system memory when initializing TDX module as TDX memory Message-ID: References: <9b545148275b14a8c7edef1157f8ec44dc8116ee.1668988357.git.kai.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=XaXRz8zC; spf=none (imf26.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669195793; a=rsa-sha256; cv=none; b=PjUSG8oAxgZ3Sy8Nglc6I1TgWdBO3ZDdaP3hcvXCKd/WuiL/NxtGm3p5zwdeBw4c0DtX1i yG5TX2YMdm1qz3rcTqwvT73abF0d1qMdQUfkfMmBSZizNqUigwAHXnAmaMRLb3fPm7hqe+ yqDrnk37OppE8TDMl2pz+GYJxx6wB2w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669195793; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SbJhBd7PxrHJEEletiUuq25lFGytClcwopVER3Q2f6w=; b=dTyc/Mjtqu/x2VIqhzCJ8Kls3WsA7lbtkfi77yNJbbm8dWfuwzSkbVVND0ecHKBYFBJRPh nf/vked6VhkQCVI4ZXrxlu1aJt0it6AR2MoNulcPX6Oi/aDkyioOdMYz9B52BEWTeZJDpp lRKvqfL/FBDXWJDd1q+utP2o4tffPUU= X-Rspamd-Queue-Id: 0D2E314000E X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=XaXRz8zC; spf=none (imf26.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Rspamd-Server: rspam06 X-Stat-Signature: cghctdsd9k999n1atb14iz7wpdia4j8r X-HE-Tag: 1669195792-923654 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, Nov 22, 2022 at 04:21:38PM -0800, Dave Hansen wrote: > > + /* > > + * All memory regions that can be used by the TDX module must be > > + * passed to the TDX module during the module initialization. > > + * Once this is done, all "TDX-usable" memory regions are fixed > > + * during module's runtime. > > + * > > + * The initial support of TDX guests only allocates memory from > > + * the global page allocator. To keep things simple, for now > > + * just make sure all pages in the page allocator are TDX memory. > > + * > > + * To achieve this, use all system memory in the core-mm at the > > + * time of initializing the TDX module as TDX memory, and at the > > + * meantime, reject any new memory in memory hot-add. > > + * > > + * This works as in practice, all boot-time present DIMM is TDX > > + * convertible memory. However if any new memory is hot-added > > + * before initializing the TDX module, the initialization will > > + * fail due to that memory is not covered by CMR. > > + * > > + * This can be enhanced in the future, i.e. by allowing adding or > > + * onlining non-TDX memory to a separate node, in which case the > > + * "TDX-capable" nodes and the "non-TDX-capable" nodes can exist > > + * together -- the userspace/kernel just needs to make sure pages > > + * for TDX guests must come from those "TDX-capable" nodes. > > + * > > + * Build the list of TDX memory regions as mentioned above so > > + * they can be passed to the TDX module later. > > + */ > > This is msotly Documentation/, not a code comment. Please clean it up. So personally, I *vastly* prefer code comments over this Documentation/ cesspit. Putting things in Documentation/ is a bit like an old-folks-home, neatly out of the way to (bit)rot in peace. And that whole .rst disease is making it unreadable for anybody that still knows how to use a text editor :-(