Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6315037rwb; Tue, 22 Nov 2022 11:32:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf7EiPpKmHyDs1dSulCuP/ZcDUvqHJjBfre0mvcLBq1pfV61OkcddGdtaSVRvb3LY+KNha8x X-Received: by 2002:a17:906:4b18:b0:7a1:b573:c99e with SMTP id y24-20020a1709064b1800b007a1b573c99emr4930240eju.55.1669145535239; Tue, 22 Nov 2022 11:32:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669145535; cv=none; d=google.com; s=arc-20160816; b=yrv8Aggn8yOHG4Uf2fC2d+hP8J4nKywlcWQoIH3Rrl8pqqcDmIV4C7/sHJ30rE+IyM i0IEVTf/iO5mzVx1ellr2dvUYD3E2dwa2jtteJI/I+hsz5E31DSlbtcPeHmiCm1PUmAW ZLDS46YbTDmuWsMl5H0WHIc4ABCkjFiwBi/hkumhGh2/VRwsZdbN5oPEwMw/zQksFj/+ G3Ae3Naf8axbH4PlGzWmmosIhB3hIK5k0ChU1bRY5MQWDo0/4DPoerKhxbSOnY6tG1Y/ tyfepQ1syP/yhqJ97xoXP+REynLRQpkWONGmC+KLbdMG7/6tx5ltzPcUR80ExB2MtfJb BkJQ== 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=7fBCU6btn2ZSChSQBKi+ngIee2Y4f+0YlH8/FhLpy98=; b=nt4wWefad8vzOYqLogEyuR2BCINCjY05HIjnVt9P5oYuffB2VZhsw2boVzypBSrN2/ 5DJNQHf3l354KHvHdvd36/PcZYDrREwAHhfUoHnnLk2Nw6pO2XyMblSGa+yvlONMDCMt 6LB90OHL25ADRnzTPzSBOYFy66X5kC3ZY5yrrA0XBCFcDtooxxfNtHpz85uPfOLeda2Y PJqzeMpKjwnzTLrTlKOJ8b6EYTHOsZpsHhdzElRkuVYhMJ1t8NuijihI6FGFngUmutrL MpfNMZTP7CFskgOtTX1V6Gbhf8D0c1qDl/xHy0H134gr+jVvk9NGqyBSeJ4+CtfhJN3d fOkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=NXABkzLh; 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 i21-20020a170906251500b00741688254f4si1459360ejb.163.2022.11.22.11.31.50; Tue, 22 Nov 2022 11:32:15 -0800 (PST) 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=desiato.20200630 header.b=NXABkzLh; 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 S234700AbiKVTNl (ORCPT + 90 others); Tue, 22 Nov 2022 14:13:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232355AbiKVTNj (ORCPT ); Tue, 22 Nov 2022 14:13:39 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5833E86A6A; Tue, 22 Nov 2022 11:13:38 -0800 (PST) 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=7fBCU6btn2ZSChSQBKi+ngIee2Y4f+0YlH8/FhLpy98=; b=NXABkzLhZPVQ4q4a4a5Yn8tSo0 MpkbPG9F3xJcLgKUhnksbXsl+A0KKeCEGpacNd6khyo7SXFFybehzs+XaYEDAn5t9pRrYq1TThlAJ pDwp1yGZg9RyfqSwt55C622Igr8IQwnqDHb9p98ufNLcFi3y6Kqwu+WAtZiENmUHQ3A7lklhPEEN/ rvmB3RX1Gv0OfMoMQQ0358KnLBBAAlKaKjAC3j5NUgiRAmkzp73rbJ1mf3u+dwXlW5gc0JeXwHAZj in2Gi8wKxOgqX5jOWarRVzxnkkoz4L/EKQ4t51BQwZg3wv+PFqlaGVdnvYbyzPN9CvbyoQKaR25E5 kzt6K8Wg==; 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 1oxYhv-003Ys2-IN; Tue, 22 Nov 2022 19:13:23 +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 C7653300202; Tue, 22 Nov 2022 20:13:21 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AC26120B64111; Tue, 22 Nov 2022 20:13:21 +0100 (CET) Date: Tue, 22 Nov 2022 20:13:21 +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 06/20] x86/virt/tdx: Shut down TDX module in case of error Message-ID: References: <48505089b645019a734d85c2c29f3c8ae2dbd6bd.1668988357.git.kai.huang@intel.com> <52b2be9b-defd-63ce-4cb2-96cd624a95a6@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52b2be9b-defd-63ce-4cb2-96cd624a95a6@intel.com> 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 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 Tue, Nov 22, 2022 at 07:14:14AM -0800, Dave Hansen wrote: > On 11/22/22 01:13, Peter Zijlstra wrote: > > On Mon, Nov 21, 2022 at 01:26:28PM +1300, Kai Huang wrote: > >> +/* > >> + * Call the SEAMCALL on all online CPUs concurrently. Caller to check > >> + * @sc->err to determine whether any SEAMCALL failed on any cpu. > >> + */ > >> +static void seamcall_on_each_cpu(struct seamcall_ctx *sc) > >> +{ > >> + on_each_cpu(seamcall_smp_call_function, sc, true); > >> +} > > > > Suppose the user has NOHZ_FULL configured, and is already running > > userspace that will terminate on interrupt (this is desired feature for > > NOHZ_FULL), guess how happy they'll be if someone, on another parition, > > manages to tickle this TDX gunk? > > Yeah, they'll be none too happy. > > But, what do we do? Not intialize TDX on busy NOHZ_FULL cpus and hard-limit the cpumask of all TDX using tasks. > There are technical solutions like detecting if NOHZ_FULL is in play and > refusing to initialize TDX. There are also non-technical solutions like > telling folks in the documentation that they better modprobe kvm early > if they want to do TDX, or their NOHZ_FULL apps will pay. Surely modprobe kvm isn't the point where TDX gets loaded? Because that's on boot for everybody due to all the auto-probing nonsense. I was expecting TDX to not get initialized until the first TDX using KVM instance is created. Am I wrong? > We could also force the TDX module to be loaded early in boot before > NOHZ_FULL is in play, but that would waste memory on TDX metadata even > if TDX is never used. I'm thikning it makes sense to have a tdx={off,on-demand,force} toggle anyway. > How do NOHZ_FULL folks deal with late microcode updates, for example? > Those are roughly equally disruptive to all CPUs. I imagine they don't do that -- in fact I would recommend we make the whole late loading thing mutually exclusive with nohz_full; can't have both.