Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19116156rwd; Wed, 28 Jun 2023 05:24:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mG9MgqiQ1DO9EA03B8GQ2Zch5hiVu79o5T2X5zQoHoj+32fe9ud2edw193QoXqAbW6Teg X-Received: by 2002:a2e:910a:0:b0:2b5:9f54:e28b with SMTP id m10-20020a2e910a000000b002b59f54e28bmr8416685ljg.7.1687955087654; Wed, 28 Jun 2023 05:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687955087; cv=none; d=google.com; s=arc-20160816; b=mC8KVynfFZGcPM3njZJGphYD/HPoMknmjhGclMiQABwOKbydCzf1H8OO0dhIBWvfFE C0eKf2sYYVfObORqp/X10dh5oXGAOU5WzuBT2ScWHMyzJIQaCLqTAvcjSxRHuR4IZu7Y e+/BwgSymKCDqJnuU5F97qN0O2lfBe+nAI2ze/n3lg6gqtlEi9RgsrdaOck1gvYz5iF5 7q4InxTApmcpXBLg600qZLtlGkFhTGjPjelekywAmIIyrBspfNWnHkYHs8JraRkVWj+E ykXOcCFYHhUWvJ5+sQpbgfJhePS3CMSiGuHi1zrkjVstusB/Xd2X08k9mEMe9c6nn9GC 1AZg== 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=MpAL4uqLqf+LSi6dSBKIkabyYAnvicRg4uaOueNp9rM=; fh=cJsSSP+m6CLn8TAORJDKS3+Bi1y9y73e91EEjMUsTis=; b=XUnb/YYl/KtjwC+SVll+LY9A/5wgVuRi656oiQQWwZmhBz6tCW0ed9S3YcZcySosWL JqCphHAm84paek168eEJlZPk92Bagzkpe3UJovhdB+2bG+cbTO5htmMdneivxUQuhLBl w4uvO0l+iktOxYSiA7Z00Jjlh8RBN1BBnis9cvbNU8Jc6Z/XxHXY/c9f3WzYsuvFZiD2 Ac1OgZi3NstF9fbO4AA2BfGV8MFiv1PGgzzUr8V/QxJo00OcQnrf+9ZbK5WZ6USq41Rl BdIIcI/d/WAMRvAj8L3kXUR0cHWNMxDXJBntwFXhQ86wmzPqY/w8YRB7/Ob4vITY41Pn QSMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=R8RwFHxL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y21-20020a056402135500b0051d9231b9ffsi4359394edw.160.2023.06.28.05.24.22; Wed, 28 Jun 2023 05:24:47 -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=@intel.com header.s=Intel header.b=R8RwFHxL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231213AbjF1Lzg (ORCPT + 99 others); Wed, 28 Jun 2023 07:55:36 -0400 Received: from mga14.intel.com ([192.55.52.115]:55149 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231504AbjF1Lzc (ORCPT ); Wed, 28 Jun 2023 07:55:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687953332; x=1719489332; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=WenmENrCtD5NWaxfSXRbwYTJrz8lTYnfUODoBwJSvko=; b=R8RwFHxL/5YtLhUhbbNvU5eQBlWQ5u570JNucuG5VRckVqgOv+h+tJt0 5HTxM+Ugr8PukDmwsf3fY96jbUzYSG4CHVcg+o8b8tqqTjD/j2oeetV37 YeKEXgDr3lzEZbLeXp23MOCARTIlCum66+r7YYikFnqlabXaWkgeS8VZ6 fCWoxAnq+MInX7vL8mOA8FFqFJu4lgRxHe6N/XOM+PQ7/FR+wzNHXilE3 OX1iPk6CxBdFTLw1xzjhlqIV5gYDLGOVAW/dxTO36HV/l9El1LGKL4reD 5CUF3tkCK9brtq0MXgOFkf2VRV/4e5MJAtzsCjG+eU3kDYk+8aIX0Kuyj A==; X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="361865554" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="361865554" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 04:55:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="711019721" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="711019721" Received: from rajritu-mobl2.ger.corp.intel.com (HELO box.shutemov.name) ([10.249.47.187]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 04:55:24 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 57DD21095C8; Wed, 28 Jun 2023 14:55:21 +0300 (+03) Date: Wed, 28 Jun 2023 14:55:21 +0300 From: "kirill.shutemov@linux.intel.com" To: "Huang, Kai" Cc: "kvm@vger.kernel.org" , "Raj, Ashok" , "Huang, Ying" , "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" , "linux-mm@kvack.org" , "hpa@zytor.com" , "peterz@infradead.org" , "imammedo@redhat.com" , "Shahar, Sagi" , "bp@alien8.de" , "Brown, Len" , "Gao, Chao" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "Williams, Dan J" , "x86@kernel.org" Subject: Re: [PATCH v12 07/22] x86/virt/tdx: Add skeleton to enable TDX on demand Message-ID: <20230628115521.bo7x6lhonsmyvr7v@box.shutemov.name> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7b61715ad35d7b9916f55df72378e02e62c5cc4e.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 28, 2023 at 12:28:12AM +0000, Huang, Kai wrote: > On Tue, 2023-06-27 at 22:37 +0000, Huang, Kai wrote: > > > > > > > > +/* > > > > + * Do the module global initialization if not done yet. > > > > + * It's always called with interrupts and preemption disabled. > > > > + */ > > > > > > If interrupts are always disabled why do you need _irqsave()? > > > > > > > I'll remove the _irqsave(). > > > > AFAICT Isaku preferred this for additional security, but this is not > > necessary. > > > > > > Damn. I think we can change the comment to say this function is called with > preemption being disabled, but _can_ be called with interrupt disabled. And we > keep using the _irqsave() version. > > /* > * Do the module global initialization if not done yet. It's always > * called with preemption disabled and can be called with interrupts > * disabled. > */ > > This allows a use case that the caller simply wants to call some SEAMCALL on > local cpu, e.g., IOMMU code may just use below to get some TDX-IO information: > > preempt_disable(); > vmxon(); > tdx_cpu_enable(); > SEAMCALL; > vmxoff(); > preempt_enable(); > > Are you OK with this? Is it hypothetical use-case? If so, I would rather keep it simple for now and adjust in the future if needed. -- Kiryl Shutsemau / Kirill A. Shutemov