From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 916BF2EB856 for ; Mon, 2 Feb 2026 06:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770013205; cv=none; b=X+W+3wqtzT1vtJ4p56pzWEWe00VcwJKAFpPdKjraIQd8CxTlEmGqYC1dnoY2OWl/+mFyWQpNz+gMr3tEVZ9Jk+eaW1wLjOKfhbPM367czbhO5BGz5DZXIsmlRqgDUJrRgUb2Ys98eoaQsaOamfmO5xIzW5VDbq93eVN/PR59zp0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770013205; c=relaxed/simple; bh=e+vygG1opwSSk2lhM00V8KAPs5cPYOhL9wMXsNVwVp4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HcfAJHXr/koO5zhEB53KMK4vjKqMPk75fJG76c1sHIIW1O3NR6RJUnypAC20a79oqS4H+ZksiEYivbQzJ58QzmLoe+StcwemDjqFXHXQdx1ITbr8RwN9FlmV3Syw3HD/ThbVVtsAawHcpE5I+ny174/EKmthSjFCrmFQ6+rpKfg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bT8t47ig; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bT8t47ig" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770013203; x=1801549203; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=e+vygG1opwSSk2lhM00V8KAPs5cPYOhL9wMXsNVwVp4=; b=bT8t47ig4Y1FDDX0dzoM3pY67gxXvgUMmG1PDaBpaIOUNA/9ihID/Dlf 9r0vxqKB/QHy+NLa5HHkkX/uJp2jbLz8oX+emWpfLhIG33zrO60ElSnqo GQx4sGnKbECjxbcPcHUtFNJB+V/v2d4uyhPucVyOJ77rzz9sYj6Pxbf/V DRoI95nvVV5Up51OYgu1EejW/xHcYjTZymKf2cIEXuOWuw/2avqf0SGu4 yJvBiBQwF86D4BCcQQRUTOrmC0qPdDSOk8u9VZ36DQfL899SlcFY2cPfy JOLDlfHMY987/NoXBD6S2sINFWtB3DdAoR9CuHUAHCpV8JiEibAkPZtVi Q==; X-CSE-ConnectionGUID: t7GuU/wRRv2yLEkCa5pfwg== X-CSE-MsgGUID: +Ole+ccnQSqMDnAdww5t+g== X-IronPort-AV: E=McAfee;i="6800,10657,11689"; a="71066672" X-IronPort-AV: E=Sophos;i="6.21,268,1763452800"; d="scan'208";a="71066672" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2026 22:20:02 -0800 X-CSE-ConnectionGUID: BRyCJipZTeiMIi6xHeu0uQ== X-CSE-MsgGUID: m/9M5LJOQWGHWoZmNVCqtw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,268,1763452800"; d="scan'208";a="247042456" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by orviesa001.jf.intel.com with ESMTP; 01 Feb 2026 22:19:57 -0800 Date: Mon, 2 Feb 2026 14:01:32 +0800 From: Xu Yilun To: Chao Gao Cc: linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, reinette.chatre@intel.com, ira.weiny@intel.com, kai.huang@intel.com, dan.j.williams@intel.com, sagis@google.com, vannapurve@google.com, paulmck@kernel.org, nik.borisov@suse.com, zhenzhong.duan@intel.com, seanjc@google.com, rick.p.edgecombe@intel.com, kas@kernel.org, dave.hansen@linux.intel.com, vishal.l.verma@intel.com, Farrah Chen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Subject: Re: [PATCH v3 14/26] x86/virt/seamldr: Introduce skeleton for TDX Module updates Message-ID: References: <20260123145645.90444-1-chao.gao@intel.com> <20260123145645.90444-15-chao.gao@intel.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260123145645.90444-15-chao.gao@intel.com> On Fri, Jan 23, 2026 at 06:55:22AM -0800, Chao Gao wrote: > The P-SEAMLDR requires that no TDX Module SEAMCALLs are invoked during a > runtime TDX Module update. > > But currently, TDX Module SEAMCALLs are invoked in various contexts and in > parallel across CPUs. Additionally, considering the need to force all vCPUs > out of guest mode, no single lock primitive, except for stop_machine(), can > meet this requirement. > > Perform TDX Module updates within stop_machine() as it achieves the > P-SEAMLDR requirements and is an existing well understood mechanism. > > TDX Module updates consist of several steps: shutting down the old > module, installing the new module, and initializing the new one and etc. > Some steps must be executed on a single CPU, others serially across all > CPUs, and some can be performed concurrently on all CPUs and there are > ordering requirements between steps. So, all CPUs need to perform the work > in a step-locked manner. > > In preparation for adding concrete steps for TDX Module updates, > establish the framework by mimicking multi_cpu_stop(). Specifically, use a > global state machine to control the work done on each CPU and require all > CPUs to acknowledge completion before proceeding to the next stage. > > Potential alternative to stop_machine() > ======================================= > An alternative approach is to lock all KVM entry points and kick all > vCPUs. Here, KVM entry points refer to KVM VM/vCPU ioctl entry points, > implemented in KVM common code (virt/kvm). Adding a locking mechanism > there would affect all architectures. And to lock only TDX vCPUs, new > logic would be needed to identify TDX vCPUs, which the common code > currently lacks. This would add significant complexity and maintenance > overhead for a TDX-specific use case. > > Signed-off-by: Chao Gao > Tested-by: Farrah Chen Reviewed-by: Xu Yilun