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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9383EB64DD for ; Fri, 30 Jun 2023 18:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233108AbjF3Smk (ORCPT ); Fri, 30 Jun 2023 14:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232498AbjF3Smi (ORCPT ); Fri, 30 Jun 2023 14:42:38 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8EC3C26; Fri, 30 Jun 2023 11:42:37 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6687466137bso1746742b3a.0; Fri, 30 Jun 2023 11:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688150557; x=1690742557; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=s90sSJDGZ4o69CYENWCxmFlyZZs5Y1mAusgwMiJFmQc=; b=qTdD+kQ/dZz9jFS4u5KBrSV1OOJAOhIlDM0dffuAP0q3sUhu/kxp8taqzzUmdZpudY c22eskJXTrN4HL16oes8igxcavJCz/amPw78uiR4IBRXlUFSHO6sCHH13SbUrTlmIPsg MbFxEY4ya8HuDWT4NfdtdKdqi+77XSdGXWebLa9+pMmjF9olCc/kuS2bY0Ejj4jrK+s9 WC99WMEyGCsdIdaIoBGMD0/aVJ10bej66ILx9pklM69fAPeHlENKvBGOgThvqX2p7UOB bkCHri3FXlSAhTrsava4uloq6l8Y63TpLaQLLlB4QpNi4DhDALNbEUcGTDqNpRPb2x3x +knA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688150557; x=1690742557; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=s90sSJDGZ4o69CYENWCxmFlyZZs5Y1mAusgwMiJFmQc=; b=WuzSuEd/JfngwL5rGpzr8te0PsV5YNmvR3+vX5RFhO4s6FJIRjXgJWsnML2tjHwPOV gzC/dJaIAgWhNJtwTeatOpXYoXT/xiPsic8RxCMmG+FQVANPBeUx1hMpAPyyX3CU0dkC bf1HHw2Bp1uIri2O/O3rZ7yxW/UGUZFRRpocfSTGn+br6JBOBcezWiiZjuH2fZv1KWZO LeiS6u7xBBj3/oh2zVpOe/SDuxncEGkBKzzKKPxGJsEgF1EaXt5br30wds8CgqhjPqXm G0S7eYR/hth8M+O/ll7bWkqQX2k3FgRDydMeXequ3J31oCrfq6ZaTrhB8BNqnAU5i5fx juWg== X-Gm-Message-State: ABy/qLbNNTHNgOAjqyA7k5euOMb4vMw2q7WZPEIdpuOlVDGkJ5Of5Q6M l1L4IjySfQLNRDSVuKEQTVg= X-Google-Smtp-Source: APBJJlEGsVVJrMfSJnWrKK8x9XhlvZ/lVjRS2VwnK4Qau3PCGMmGslkxKbq9jz3H2x84e9lAp+eoow== X-Received: by 2002:a62:7b07:0:b0:682:57f0:7c00 with SMTP id w7-20020a627b07000000b0068257f07c00mr3143508pfc.3.1688150556680; Fri, 30 Jun 2023 11:42:36 -0700 (PDT) Received: from localhost ([192.55.54.50]) by smtp.gmail.com with ESMTPSA id j18-20020a62e912000000b00666add7f047sm10215681pfh.207.2023.06.30.11.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 11:42:35 -0700 (PDT) Date: Fri, 30 Jun 2023 11:42:29 -0700 From: Isaku Yamahata To: "Huang, Kai" Cc: "peterz@infradead.org" , "kvm@vger.kernel.org" , "Gao, Chao" , "Raj, Ashok" , "Shahar, Sagi" , "Hansen, Dave" , "david@redhat.com" , "bagasdotme@gmail.com" , "ak@linux.intel.com" , "Wysocki, Rafael J" , "linux-kernel@vger.kernel.org" , "Chatre, Reinette" , "Christopherson,, Sean" , "pbonzini@redhat.com" , "mingo@redhat.com" , "Yamahata, Isaku" , "nik.borisov@suse.com" , "tglx@linutronix.de" , "Luck, Tony" , "kirill.shutemov@linux.intel.com" , "hpa@zytor.com" , "imammedo@redhat.com" , "linux-mm@kvack.org" , "bp@alien8.de" , "Brown, Len" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "Huang, Ying" , "x86@kernel.org" , "Williams, Dan J" , isaku.yamahata@gmail.com Subject: Re: [PATCH v12 07/22] x86/virt/tdx: Add skeleton to enable TDX on demand Message-ID: <20230630184229.GG3436214@ls.amr.corp.intel.com> References: <104d324cd68b12e14722ee5d85a660cccccd8892.1687784645.git.kai.huang@intel.com> <20230627095012.ln47s62pqzdrnb7x@box.shutemov.name> <20230627121853.ek5zr7sfiezfkfyj@box.shutemov.name> <9361abfa9bf22c2a1a4b25e5495bcccc5b8dcd43.camel@intel.com> <7b61715ad35d7b9916f55df72378e02e62c5cc4e.camel@intel.com> <20230628133541.GF2438817@hirez.programming.kicks-ass.net> <03def8b40a7db14f31d2ad67fb1a201e8ae8bce0.camel@intel.com> <20230630092232.GB2533791@hirez.programming.kicks-ass.net> <716cdf73799a5322cbe34c7f23d582f8a3ecf301.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <716cdf73799a5322cbe34c7f23d582f8a3ecf301.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 30, 2023 at 10:09:08AM +0000, "Huang, Kai" wrote: > On Fri, 2023-06-30 at 11:22 +0200, Peter Zijlstra wrote: > > On Thu, Jun 29, 2023 at 12:15:13AM +0000, Huang, Kai wrote: > > > > > > Can be called locally or through an IPI function call. > > > > > > > > > > Thanks. As in another reply, if using spinlock is OK, then I think we can say > > > it will be called either locally or through an IPI function call. Otherwise, we > > > do via a new separate function tdx_global_init() and no lock is needed in that > > > function. The caller should call it properly. > > > > IPI must use raw_spinlock_t. I'm ok with using raw_spinlock_t if there's > > actual need for that, but the code as presented didn't -- in comments or > > otherwise -- make it clear why it was as it was. > > There's no hard requirement as I replied in another email. > > Presumably you prefer the option to have a dedicated tdx_global_init() so we can > avoid the raw_spinlock_t? TDX KVM calls tdx_cpu_enable() in IPI context as KVM hardware_setup() callback. tdx_cpu_enable() calls tdx_global_init(). -- Isaku Yamahata