Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26021404rwd; Mon, 3 Jul 2023 04:32:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlGya5mmCB95tx3bv3UB1i/cr/lFq0mjPCMsMKpl3DoDifBcCjgNQwvHVNW4KVLjMRJkFt5r X-Received: by 2002:a17:902:ec8b:b0:1b6:7db2:57dd with SMTP id x11-20020a170902ec8b00b001b67db257ddmr7001757plg.19.1688383924602; Mon, 03 Jul 2023 04:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688383924; cv=none; d=google.com; s=arc-20160816; b=eLkhpvsRP2mqdOAUMKeE3tgUK7mGKCPgMSA4DpmpB20jWBPaKh5wzgmFDvPVAcwc0Q tlB9me/YanuFPezt/q+loPWulki1xhQoPrqupTkATj+Y2LrYZohKP2fQ1/TkMfX3WNe6 01Gs/y3N+W5d5WQI/X597E1t7OPHqsJcBn1t94KM/CU4eyaVIt41jXptKsK5nyFHTZV+ XBSWgYKRrPle4vIuADjdt7ePVpFxg5iCALnDbUwp8AfcMpnP8QWTS45kBlSTansNE0GC dTLct9XP1/KfDOoGYWOLTPL1h6CvH3jrnrCG5C7rz1HLr1WvZk3TU+ueZ17nc7fy07mh 4goQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Egmu4PcPG3YUkJp0tRZXJg7Ab4Gnh+DI3c4ffyVSY8s=; fh=j7W3KN+L7ex2D2bYJq+lINI5OYmxXBmoCw153h59cH4=; b=DV2t2qgIZ23O1bPvjJhH4dXRGR39pSrXJOyteuOo7qbCsmRA0nNFZYZpyNSqtraV+b Gw+KJ9ZXxx1KgQE7R1Luzj4u1lYQvvhOAOZWUlZWHeoNHL2+lbDU8LNWboMqPh+PFxr5 LFhRBcM9ysz+Wz+2M4BP2/LACmn+Y09esAXxGS/s9wB/bmHyjm27cUZZwVhntFyoCPi0 ZSTTyZFRD3F93SGdzLGyHD+zPM/7+cAFq90KpyRS+mi8qWzj/1fdTcAAh3SfYtk8QLFs Q1Yxl3uTw8px7fsxIoHBtBbfKR046k2oLdUbXofgwDUYzlQtLaLOQXW0L8wIjELdFxYU t4Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pLAZXR4p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170902c18b00b001b80641e90dsi14660179pld.438.2023.07.03.04.31.51; Mon, 03 Jul 2023 04:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pLAZXR4p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230451AbjGCKuD (ORCPT + 99 others); Mon, 3 Jul 2023 06:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjGCKuB (ORCPT ); Mon, 3 Jul 2023 06:50:01 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FFFDC9; Mon, 3 Jul 2023 03:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=Egmu4PcPG3YUkJp0tRZXJg7Ab4Gnh+DI3c4ffyVSY8s=; b=pLAZXR4pPvwfWO7Q6+RO4iVkSC 89KdYHUbzmv52oZQsddS68kNrKO1gS5HWOJ3mSnbApbQElGUoYWa1FfYTQZiGGdGI7ZoRuh3BiM5Z NakSPE6FSa14WvGpHUKF6yh1/t9P7ZZqJ6CEGahY/kTmKNkKRmsdgkGhV9AuIqrfQOvC6DmH6Jyl7 rgjJXdZBkj6XzBWdJC3kpV4JdCfV5Uvyib6Ix/fEoPmxFhOqhpUO5EXwEc1hHr7eM1+6soamrBdPH v355zIJglpkIRxKLkOVR+Q1tMAwkYQI/nij73qxWfoDB3GdWaFKYRjiZzDvot+3V2cr1mrUrT5/w3 bS4DQ97Q==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qGH7n-008A7x-Ed; Mon, 03 Jul 2023 10:49:43 +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 BDA463002E1; Mon, 3 Jul 2023 12:49:42 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A4CAF202A2A17; Mon, 3 Jul 2023 12:49:42 +0200 (CEST) Date: Mon, 3 Jul 2023 12:49:42 +0200 From: Peter Zijlstra To: Sean Christopherson Cc: Isaku Yamahata , Kai Huang , "kvm@vger.kernel.org" , Ashok Raj , Tony Luck , "david@redhat.com" , "bagasdotme@gmail.com" , Dave Hansen , "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: <20230703104942.GG4253@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 30, 2023 at 02:24:56PM -0700, Sean Christopherson wrote: > I dunno about that, *totally* killing TDX would make my life a lot simpler ;-) :-) > > > I don't get this obsession with doing at module load time :/ > > Waiting until userspace attempts to create the first TDX guest adds complexity > and limits what KVM can do to harden itself. Currently, all feature support in > KVM is effectively frozen at module load. E.g. most of the setup code is > contained in __init functions, many module-scoped variables are effectively > RO after init (though they can't be marked as such until we smush kvm-intel.ko > and kvm-amd.ko into kvm.ko, which is tentatively the long-term plan). All of > those patterns would get tossed aside if KVM waits until userspace attempts to > create the first guest. Pff, all that is perfectly possible, just a wee bit more work :-) I mean, we manage to poke text that's RO, surely we can poke a variable that supposedly RO. And I really wish we could put part of the kvm-intel/amd.ko things in the kernel proper and reduce the EXPORT_SYMBOL surface -- we're exporting a whole bunch of things that really shouldn't be, just for KVM :/ > The userspace experience would also be poor, as KVM can't know whether or TDX is > actually supported until the TDX module is fully loaded and configured. Quality that :-( > There are also latency and noisy neighbor concerns, e.g. we *really* don't want > to end up in a situation where creating a TDX guest for a customer can observe > arbitrary latency *and* potentially be disruptive to VMs already running on the > host. Well, that's a quality of implementation issue with the whole TDX crapola. Sounds like we want to impose latency constraints on the various TDX calls. Allowing it to consume arbitrary amounts of CPU time is unacceptable in any case. > Userspace can workaround the second and third issues by spawning a dummy TDX guest > as early as possible, but that adds complexity to userspace, especially if there's > any desire for it to be race free, e.g. with respect to reporting system capabilities > to the control plan. FWIW, I'm 100% behind pushing complexity into userspace if it makes for a simpler kernel. > On the flip side, limited hardware availability (unless Intel has changed its > tune) and the amount of enabling that's required in BIOS and whatnot makes it > highly unlikely that random Linux users are going to unknowingly boot with TDX > enabled. > > That said, if this is a sticking point, let's just make enable_tdx off by default, OK.