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 B252AEB64DA for ; Wed, 5 Jul 2023 14:58:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 088D28D0002; Wed, 5 Jul 2023 10:58:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 039288D0001; Wed, 5 Jul 2023 10:58:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1C058D0002; Wed, 5 Jul 2023 10:58:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CFD358D0001 for ; Wed, 5 Jul 2023 10:58:14 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 932A5A0AB2 for ; Wed, 5 Jul 2023 14:58:14 +0000 (UTC) X-FDA: 80977863708.14.485AE7B Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf13.hostedemail.com (Postfix) with ESMTP id D6D1D2001F for ; Wed, 5 Jul 2023 14:58:11 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=Zh3WsjW1; dmarc=none; spf=none (imf13.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688569092; 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=K66hg10RS0xPL3sDSP6x+hgXXU7ubwcqX1w5rGjcqkQ=; b=mAobxhxgQkDLQRmPrUhxBFvs5D75kyG+Xxbvr2nbW+lG/HwuxLT4OCHqzxiaxdwYBh/Z58 Atl+k6FlGHjBkhRcE1HZ+mAwMR6JHRuMDwREPH9AzA39paxs3PKWYCaPw/2yUzvgXnsK+s fGeImyuC0VDyp4JRjuYKAjZeI2us67Q= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=Zh3WsjW1; dmarc=none; spf=none (imf13.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688569092; a=rsa-sha256; cv=none; b=ofgiSsoGSv13DTmGu8MLMjSlY/dilF5qm1Oe+b+8AWISv8ST+tlD9bFysYLkzSh9xpwiin xTF/m5/EGB8dEpWuKsy8kEYc1klI17pdst/DWzaXFNbaPBDzuNfLAXmb6NtLV/nIXfoSWx 2x5ieBWmckR9npX2WWEIMQ4scvOgX8E= 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=K66hg10RS0xPL3sDSP6x+hgXXU7ubwcqX1w5rGjcqkQ=; b=Zh3WsjW1vqCcD+OuqBPmuZIecy PcdciMOT+MVMVIXVmHMPi4CulMbU/oCKAEmlanfajsmL4tOrr5jrRUOYkDWzpuwbttVmRvdQqyrkQ g6WDuev8lr3jltNE5qb/+XsnL0WZ8S4eyEzzPy5dV3tWmtBH3idKZO1H2Jd7PeTVQfa80M+t8bf85 ndJTbXlsu3gj60UERjKdpI3Df/bgmYJqQDBq27r5mWzBjnerUzgYN7pW6DLyOAHzJo4+k5+UEEvj6 3YsiG0Timevwn32rycrD0ZU8ZyitIF0AWWk5bkwZcu1DoembCkV4k4ghbd70J+//Cwq8q+g5JjmWF PcxuOZkQ==; 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.96 #2 (Red Hat Linux)) id 1qH3x2-00CBot-2S; Wed, 05 Jul 2023 14:57:53 +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 188B93001E7; Wed, 5 Jul 2023 16:57:51 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 025E72025BA45; Wed, 5 Jul 2023 16:57:50 +0200 (CEST) Date: Wed, 5 Jul 2023 16:57:50 +0200 From: Peter Zijlstra To: Dave Hansen Cc: Sean Christopherson , Isaku Yamahata , Kai Huang , "kvm@vger.kernel.org" , Ashok Raj , Tony Luck , "david@redhat.com" , "bagasdotme@gmail.com" , "ak@linux.intel.com" , Rafael J Wysocki , "kirill.shutemov@linux.intel.com" , Reinette Chatre , "pbonzini@redhat.com" , "mingo@redhat.com" , "tglx@linutronix.de" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Isaku Yamahata , "nik.borisov@suse.com" , "hpa@zytor.com" , Sagi Shahar , "imammedo@redhat.com" , "bp@alien8.de" , Chao Gao , Len Brown , "sathyanarayanan.kuppuswamy@linux.intel.com" , Ying Huang , Dan J Williams , "x86@kernel.org" Subject: Re: [PATCH v12 07/22] x86/virt/tdx: Add skeleton to enable TDX on demand Message-ID: <20230705145750.GD4253@hirez.programming.kicks-ass.net> References: <104d324cd68b12e14722ee5d85a660cccccd8892.1687784645.git.kai.huang@intel.com> <20230628131717.GE2438817@hirez.programming.kicks-ass.net> <0c9639db604a0670eeae5343d456e43d06b35d39.camel@intel.com> <20230630092615.GD2533791@hirez.programming.kicks-ass.net> <2659d6eef84f008635ba300f4712501ac88cef2c.camel@intel.com> <20230630183020.GA4253@hirez.programming.kicks-ass.net> <20230630190514.GH3436214@ls.amr.corp.intel.com> <20230704165836.GB462772@hirez.programming.kicks-ass.net> <1a8099e2-da28-6b2a-7b5a-1d6346b7f95d@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1a8099e2-da28-6b2a-7b5a-1d6346b7f95d@intel.com> X-Rspamd-Queue-Id: D6D1D2001F X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: xmsi4jdb89w97o8ongwqodr5x55rnfug X-HE-Tag: 1688569091-455534 X-HE-Meta: U2FsdGVkX1/r2hE+7LZrm9985YtQURcwpdKNEajOckuTU/dSAzZv//xSSPP6kpTm2ocrYUg+jP2XcOrxZqozUzau3vbEdD8kKfEKlWJ8bkzfZfPssGOK0va6ZrD2LSvTmIU+sbNbJx+LG74GP0YJYR2WVNyHrUYp7ZLhJmYqTrM/t2hJbRsNNRXEwwpHlP0I+dU/4qJwWwHW2NJP0A7UU4MH3nAUUzxbC3cJEVbSp8xq+bJwtXx+QH63jss6Iz351jECB3+qsoqhwmZ/+fjXjl2uAldhUke1WUyeXzE1rJGMsYVpdrJbIURz/7PsE4eg5GViNhNw5+8+ObzY/jO7fCMVeku7d2yQ0910QzvrCrrhovCPZVIf5BDhvWOyGke+ITkjngQTwM806/Zvh9qtdIfOexvYzlz1VexYqhrwBzJeJ8gNdj1WgLfV192JItPicLoBff4699eAS+7FrwRaMN2nGAlJwHJMK6pqRPhsVVbZcKX5jXP8zeqt42g68KyeBp2AMqr8wqDI7y2DQHfyHP0wdwf2IM4JDZiGs9TyGm0VolLo0KRdOSuZmh8/3g85p/0kPml7wl1OzyVP+TnK4m0h3TABZobl7e/0eh+t34mTgAUs9JMDXhD6/74v/Pe7EEB/GMciej4I7jLpNqmjG5HDcQL7OwYD9EjJQobzfSO6rHB4Y66hFcI+8ZV8LUglcwKiqL3/q/HwCZSq0RO5yaM4hm7iYs7ygdEhfeQQU3NxPb0I6xigNkfMpz/orMz7FF/uYsCSm7d6wZShbwtOJp+/bzfSB9jJ/pexX+dAJH5DL8yBe9MRr+pM5DHTVbZcfMwMDpcoYGBWJKqmOLzeR7vz7jPQzkGiom4QRnI0HFtlhPW7cwlAmR8dzJa3Z9GtgMYjvoyGOcLYaJ2du1r+tPnSD8veey+sTVsv9V1RmxpBGj5IZKsXyruVeMU/Czuch+bSarzkblYdzlwysup eiH0Bp3M kancWeN9V8vMbKipUqh1YPO/bwJA+Cm82aQfuOtbOfUQTDd08Rvccp4QrN4AslqhfsRXkar8xzcDvOwFsIXlLSmcejenAhvzn58acYQTr7jhmXCxWO0E4QZi+zcRTWigi4AQGSdLvEGR4Ll4xaNUJz5bCwjupiK4+wwFU4sM+zbzXinZnHYNqk8SgxXysAnJy2okyB1ttYU6Xw0cDR2YU2zY33A6XAItA3tRyCToUALtCg/qnnFEdm2cy0A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jul 05, 2023 at 07:34:06AM -0700, Dave Hansen wrote: > On 7/4/23 09:58, Peter Zijlstra wrote: > > If we have concerns about allocating the PAMT array, can't we use CMA > > for this? Allocate the whole thing at boot as CMA such that when not > > used for TDX it can be used for regular things like userspace and > > filecache pages? > > I never thought of CMA as being super reliable. Maybe it's improved > over the years. > > KVM also has a rather nasty habit of pinning pages, like for device > passthrough. I suspect that means that we'll have one of two scenarios: > > 1. CMA works great, but the TDX/CMA area is unusable for KVM because > it's pinning all its pages and they just get moved out of the CMA > area immediately. The CMA area is effectively wasted. > 2. CMA sucks, and users get sporadic TDX failures when they wait a long > time to run a TDX guest after boot. Users just work around the CMA > support by starting up TDX guests at boot or demanding a module > parameter be set. Hacking in CMA support was a waste. > > Am I just too much of a pessimist? Well, if CMA still sucks, then that needs fixing. If CMA works, but we have a circular fail in that KVM needs to long-term pin the PAMT pages but long-term pin is evicted from CMA (the whole point of long-term pin, after all), then surely we can break that cycle somehow, since in this case the purpose of the CMA is being able to grab that memory chunk when we needs it. That is, either way around is just a matter of a little code, no?