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 AB377C4332F for ; Tue, 22 Nov 2022 19:13:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 283826B0071; Tue, 22 Nov 2022 14:13:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 233E26B0073; Tue, 22 Nov 2022 14:13:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FBDC6B0074; Tue, 22 Nov 2022 14:13:32 -0500 (EST) 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 001DB6B0071 for ; Tue, 22 Nov 2022 14:13:31 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A06031403CD for ; Tue, 22 Nov 2022 19:13:31 +0000 (UTC) X-FDA: 80162027022.15.9160A59 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf26.hostedemail.com (Postfix) with ESMTP id AB0AB14000D for ; Tue, 22 Nov 2022 19:13:30 +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=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> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669144411; a=rsa-sha256; cv=none; b=mOB8BjksD3jmE0Q6EY6EeFwRHxZ8NFwI45PSs1+vhmWfMcRP1GbXwadQ5WHeI/D0pKKTyk 2BIOZIKyVYPJDvxPeqZWoCHP6odFJA4D0Hw85H96LeT7dUtWKkTq8kM5vyOhokpbnYrZUZ 7zr0IXL84fKhpeCEgPJnENOhNpa+is8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=NXABkzLh; dmarc=none; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669144411; 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=7fBCU6btn2ZSChSQBKi+ngIee2Y4f+0YlH8/FhLpy98=; b=2BrEK0eUWnP9DbdbjQWYY6WbA5bMMfqXVHDqAe3Bhjy2syB+1G60ohmCMpRkxvwn0ZVUoZ n/7BI0EL9d1XbXg8jI+H2NdDVQlt3kQlnaN8A17fJS5Yt8yxFb5p9ckjmucAzuS/togVBw Z8jL39N2mmeXSDT2LpDgIR/8cFsj8ZM= Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=NXABkzLh; dmarc=none; 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 X-Stat-Signature: 7s771x874nmffaog9ijcd33i54nxesgd X-Rspamd-Queue-Id: AB0AB14000D X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1669144410-584366 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 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.