From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 750FF18DF9D; Thu, 6 Nov 2025 02:24:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.20 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762395865; cv=fail; b=FMMklIjdrad6H7EZe7hE9nIFjmFwnOWvx6XvtaZMoktkSe7f8izoH/PAekBpJiZHgT91sYLiy13eCXt4vgl5aaeDTKHe4M+w6B1MQwo16XixChz4B7iVBm4nkZVFN//LgvkjNzMyvj+mS0MVgBHYUxYSZs5eAlYWjsL4upSc0zM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762395865; c=relaxed/simple; bh=JvkL4M/uOoJuefMZTPptDFCGEQDF3cJa8SwRaQGHKz4=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=Ur7h0KYpZJUowxoTKIhuNtsz5uySizXHXz33dO0NIK5YtNTWhuDTc5aCZv3Zy8BIkp22A1UgPa8L+n6uSsuD940J1Agj/aC4RJdgxPcWPIfnVZZyjSNF48kA51Yi8bokxJpt5J7LIGJ01E/PSGSKPORUj4nwgbh9P6hPg3mOIfg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fI8Kszjb; arc=fail smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fI8Kszjb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1762395863; x=1793931863; h=date:from:to:cc:subject:message-id:reply-to:references: in-reply-to:mime-version; bh=JvkL4M/uOoJuefMZTPptDFCGEQDF3cJa8SwRaQGHKz4=; b=fI8KszjbZVUM4e3lYMNueyXPaCgMkytRlCuUR30/CcaiMXc1s0BNl6rk KqaAFF+1iEKCQxY9KlTe7FAe7mYr8GF2WLw3zI8tG3am590QfypiORt+S Yer9yFd/sW9io4RT36c7ORTb6PWFbxmQ3gSFo7UOWSxlGV9XYesgdXEVt md3I5+SNt6FEM0tQFDYYLoKzST5n4KTD+K4YvyFAFqgbtXD4HkZzN0bIL C75NST8m41ZMDrZXFvIfPHtFrC8/MNXsxNhdejGcY+WO7A4P0BH3pD+1u 5OX5BkU8yHDRI8TNsvRys2Ql6fvTDC92L1PQMhDNddmKSEJDGJdlytf+Y w==; X-CSE-ConnectionGUID: +J8Rmn3pTJ2HA/V1r5CzIA== X-CSE-MsgGUID: jsH91WktTr+iM+l9I8MP/Q== X-IronPort-AV: E=McAfee;i="6800,10657,11604"; a="64221497" X-IronPort-AV: E=Sophos;i="6.19,283,1754982000"; d="scan'208";a="64221497" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2025 18:24:22 -0800 X-CSE-ConnectionGUID: Zfhhwg8xTreduE0IpvQaKg== X-CSE-MsgGUID: RamX2LNURbOFq3Ux13juIQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,283,1754982000"; d="scan'208";a="186916968" Received: from orsmsx901.amr.corp.intel.com ([10.22.229.23]) by orviesa010.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2025 18:24:21 -0800 Received: from ORSMSX903.amr.corp.intel.com (10.22.229.25) by ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.27; Wed, 5 Nov 2025 18:24:21 -0800 Received: from ORSEDG901.ED.cps.intel.com (10.7.248.11) by ORSMSX903.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.27 via Frontend Transport; Wed, 5 Nov 2025 18:24:21 -0800 Received: from CH4PR04CU002.outbound.protection.outlook.com (40.107.201.17) by edgegateway.intel.com (134.134.137.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.27; Wed, 5 Nov 2025 18:24:20 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vr9Hv9ARFpDv+cYB+H6zGr2Th9WR1fa5fjzIuZlIwQXiugAdA0Ay5AOu1Ap3rp7i1RcsypauRNVvDxX1WzmMdaA2zf0SPRC9SCfDgAcoIGDNVD1iI64B/sITox0rMZKfRM4pAaJJ5rwLAWYEX7XSIYVpCP+h29CqRLQTBL5ZsLfCwkgxfRWCKjepjTvYeDwDgRKiJcV3+aFTpnyDW9AlQlRwJP5s8LBVd77Z1ygBGO0/BgfDfurty/6D5ZDj7bZ6A0iAcPDGQIQOVaBsIEdZJUKgBaFCw1cA3p0u/LLoRZ2udz8hFDIrh++JMH55fBbCNmNW7I1Kxq6fUhaOpjEZpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Gzibx/aUN5y1gYQwBFUu28LEMmXIXijvHnvoaLFOA7U=; b=LJtCSpcoB/o4Giot0Ne0yPJMLPZt305wjuOBxEANOawljdAiAROI5R2j31yWI8hF32IwNx5hh9dA0daaNjswv+hMpsVRUcwmuFKEDEXc/Y+wfwg2Mr4pRgHThMzHNW6t7RAKZGLUjK04uhQRMk//oR0qDGwyCR02nHbMG9IDGdvRWHaWRrEFk5yu8UxzFcTvD/MF4mYdSuDvUElAEyBRCCUGaM122/5Bhnusj4lHyzctlHvXrXuWraUhXglnF4bLqIWMsouXid59M59FQNZiLl2FbmE1MwfkYr+x1LV/4fY9H0iW/HqvyX8C5cOjzS39PdyPL50U6A8WrXZbj+YdeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS7PR11MB5966.namprd11.prod.outlook.com (2603:10b6:8:71::6) by MW3PR11MB4747.namprd11.prod.outlook.com (2603:10b6:303:2f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9298.9; Thu, 6 Nov 2025 02:24:18 +0000 Received: from DS7PR11MB5966.namprd11.prod.outlook.com ([fe80::e971:d8f4:66c4:12ca]) by DS7PR11MB5966.namprd11.prod.outlook.com ([fe80::e971:d8f4:66c4:12ca%6]) with mapi id 15.20.9275.015; Thu, 6 Nov 2025 02:24:17 +0000 Date: Thu, 6 Nov 2025 10:22:17 +0800 From: Yan Zhao To: Xiaoyao Li CC: Sean Christopherson , Paolo Bonzini , "Kirill A. Shutemov" , , , , , Rick Edgecombe , Hou Wenlong Subject: Re: [PATCH v5 1/4] KVM: TDX: Explicitly set user-return MSRs that *may* be clobbered by the TDX-Module Message-ID: Reply-To: Yan Zhao References: <20251030191528.3380553-1-seanjc@google.com> <20251030191528.3380553-2-seanjc@google.com> <969d1b3a-2a82-4ff1-85c5-705c102f0f8b@intel.com> <6ca6f19e-0bdd-4ad8-aaca-93a1247d2588@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <6ca6f19e-0bdd-4ad8-aaca-93a1247d2588@intel.com> X-ClientProxiedBy: KL1P15301CA0049.APCP153.PROD.OUTLOOK.COM (2603:1096:820:3d::6) To DS7PR11MB5966.namprd11.prod.outlook.com (2603:10b6:8:71::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR11MB5966:EE_|MW3PR11MB4747:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c092626-2c2d-4843-52d7-08de1cdb95be X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1xpXUAz74sp4eWMzvTcr3lMWL0KHIiNXkUBpDw238y2uIhwcHE/O6ystWZ6F?= =?us-ascii?Q?BdSBNxmxXafqBM4c3IcvUPzZvDxLxvLz0f1MwQgEiJCXvIjR1W+DQVRRNVQe?= =?us-ascii?Q?7tcn8u3Jvdit8yUxRiLwpefnFj+dtUn0QS5pwl10P1XQkAv3+tXbLfS3smQy?= =?us-ascii?Q?qYsWX38iR81z9xksdoSDf3M1OvFyQe9XlvlF77BEqOVDq88vLATXD9fGvVMr?= =?us-ascii?Q?mMG1p3mEj8miYpA7KDUiwICK7Zf17tqDQ2yJfYhKny77G/xcZ3EnT36fxbJM?= =?us-ascii?Q?XJBneV+rmxmp6uvBHSsYg+8sjQjIxMfpuVlsGwzV8aTPCbYiz77KMKXLq1IX?= =?us-ascii?Q?s5YGAnP/gDy+HJMsgHeSueFCyOWTiWYAW6D3OFZS3psk5V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Az3A5mZeLR36bLanWBV+ymGmgnRNwwxQf01+ggRyWSn?= =?us-ascii?Q?FQMZJ859ZZu9ni1CiEmEe6A5txJy+Lp5o2+IekHUfqNvZ09L36nIjLwRK5fD?= =?us-ascii?Q?SGk0cg1P8Xd+AnHR/viRTrgEYJwuqqZLXEzZW1pgFLGjnFLESR0SVOQZ7Tbz?= =?us-ascii?Q?ajwytDMo6F7NMwrnr7UB/odF+hA4yYRT?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR11MB5966.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?f6s1SZRAuLePZ+ODxRWG8nuZkhu74+uEQx+NIFo3FUogygthyS+JyWqTZR6j?= =?us-ascii?Q?dLmxy+HwZBsZPLdcm1vPX72MtNwCgjDZTLwHCt6ChLc2zOQ9brZFBEsCw4YP?= =?us-ascii?Q?8x8htLgECEB29IsbHpkcXNN2/rgmXtvvEdkFi1d3/Iz3tBkICONQNZTiDAs9?= =?us-ascii?Q?/dSi7LFt0QbaEuvUZzJc4Q9nAO04Qu81kjx8inD7g6SkK2gXMpHoZXnc8f7y?= =?us-ascii?Q?39nw0ad/nONuDjZhspHQanoF/yW3u4HrMHKJF7ShR/Z0CkK4Ej7oF9q9W8Gc?= =?us-ascii?Q?ErAwazGV2OR+YeKpR4UTuU+fPH1QKXLaUIYUwbAkDlcNzkKXQz1J1KfJWutx?= =?us-ascii?Q?8onLEVAisjarKM+03xygw2aMfqAJW4zg5u127Q+BdTbcwFLddsvIg/ythBpX?= =?us-ascii?Q?q1E0HFucYJbhwqaKi2KNc+dhfac7NwTFlEABgOYglus+42YLRMES0Al4bDYi?= =?us-ascii?Q?J9BKEgXD55ljF/LsnDq6QRiMAk1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ascii?Q?ygWBAkFaVsufIIhWvbuoDkQkZAiaq+2BXJ+APwiUbuZIX5YsHTKbQVDWihTi?= =?us-ascii?Q?KEcxPhp5yLolS7dz37/I6o87KjJY4fISGZ6pTSgX45MOptmaCXcWPKVxrfZp?= =?us-ascii?Q?wa2KN11oYe+zaK8/hO2GusTa872zZa9QcaoAjDUjuQh0+AEm5N9M9ypV+DJU?= =?us-ascii?Q?Ymq/Yp6SJ7Q/WFJ48PQeVUqA/UFz4tGq3bkOdFvd?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0c092626-2c2d-4843-52d7-08de1cdb95be X-MS-Exchange-CrossTenant-AuthSource: DS7PR11MB5966.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2025 02:24:17.2041 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Wfpr6J3c5Lr7da8/QF6/21cERSsBGEAjNYwV/yJoqUM8Tgb9mFcbUqV6SqueGHrquFF1RgPDoO+aBTjtg2Wb7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4747 X-OriginatorOrg: intel.com On Wed, Nov 05, 2025 at 05:16:56PM +0800, Xiaoyao Li wrote: > On 11/5/2025 9:52 AM, Yan Zhao wrote: > > On Tue, Nov 04, 2025 at 09:55:54AM -0800, Sean Christopherson wrote: > > > On Tue, Nov 04, 2025, Yan Zhao wrote: > > > > On Tue, Nov 04, 2025 at 04:40:44PM +0800, Xiaoyao Li wrote: > > > > > On 11/4/2025 3:06 PM, Yan Zhao wrote: > > > > > > Another nit: > > > > > > Remove the tdx_user_return_msr_update_cache() in the comment of __tdx_bringup(). > > > > > > > > > > > > Or could we just invoke tdx_user_return_msr_update_cache() in > > > > > > tdx_prepare_switch_to_guest()? > > > > > > > > > > No. It lacks the WRMSR operation to update the hardware value, which is the > > > > > key of this patch. > > > > As [1], I don't think the WRMSR operation to update the hardware value is > > > > necessary. The value will be updated to guest value soon any way if > > > > tdh_vp_enter() succeeds, or the hardware value remains to be the host value or > > > > the default value. > > > > > > As explained in the original thread: > > > > > > : > If the MSR's do not get clobbered, does it matter whether or not they get > > > : > restored. > > > : > > > : It matters because KVM needs to know the actual value in hardware. If KVM thinks > > > : an MSR is 'X', but it's actually 'Y', then KVM could fail to write the correct > > > : value into hardware when returning to userspace and/or when running a different > > > : vCPU. > > > > > > I.e. updating the cache effectively corrupts state if the TDX-Module doesn't > > > clobber MSRs as expected, i.e. if the current value is preserved in hardware. > > I'm not against this patch. But I think the above explanation is not that > > convincing, (or somewhat confusing). > > > > > > By "if the TDX-Module doesn't clobber MSRs as expected", > > - if it occurs due to tdh_vp_enter() failure, I think it's fine. > > Though KVM thinks the MSR is 'X', the actual value in hardware should be > > either 'Y' (the host value) or 'X' (the expected clobbered value). > > It's benign to preserving value 'Y', no? > > For example, after tdh_vp_enter() failure, the state becomes > > .curr == 'X' > hardware == 'Y' > > and the TD vcpu thread is preempted and the pcpu is scheduled to run another > VM's vcpu, which is a normal VMX vcpu and it happens to have the MSR value > of 'X'. So in > > vmx_prepare_switch_to_guest() > -> kvm_set_user_return_msr() > > it will skip the WRMSR because written_value == .curr == 'X', but the > hardware value is 'Y'. Then KVM fails to load the expected value 'X' for the > VMX vcpu. Oh. Thanks! I overlooked that there's another checking of .curr in kvm_set_user_return_msr(). It explains why .curr must be equal to the hardware value when outside guest mode. > > - if it occurs due to TDX module bugs, e.g., if after a successful > > tdh_vp_enter() and VM exits, the TDX module clobbers the MSR to 'Z', while > > the host value for the MSR is 'Y' and KVM thinks the actual value is 'X'. > > Then the hardware state will be incorrect after returning to userspace if > > 'X' == 'Y'. But this patch can't guard against this condition as well, right? > > > > > > > > But I think invoking tdx_user_return_msr_update_cache() in > > > > tdx_prepare_switch_to_guest() is better than in > > > > tdx_prepare_switch_to_host(). > > > > > > > > [1] https://lore.kernel.org/kvm/aQhJol0CvT6bNCJQ@yzhao56-desk.sh.intel.com/ >