From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 90C027E0E8; Fri, 30 Jan 2026 03:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769743444; cv=none; b=bL+K10MLSUJuuY9rFaL1H5z+zAmeD0f1mGjwJ1HsTP2KptSe0lUcYZWNNGzBC6ZREyRinexivTkUaJNqxXkPR0FBtT5dp7wlmyk6BnS4QOj/hrRhHQalG7ad5u8oZPjwOtwLsRGvtcdfLsG5362A2eC2U3v9b0zG3dJ0frucKHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769743444; c=relaxed/simple; bh=F9atmiyM11HhfTRulkobq/MVMJTG1x4p+28ptQY6q4U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=imhUlyx+KSt8lNMa4qAj0zb88JfOCpr2N8Ri1158rDNG/gCKYo3X1YoC9bKafrWNk+tsgN7NC8INAGMMZUix0ses1uCxMPjtW1+MEpLOWg2W79Gbgb1bcx+Yu9yaxTzyulkVb9zYE6mtt/tG7LwNJ97YD5rnqfgdUziQ5PvSdEs= ARC-Authentication-Results:i=1; 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=QCvYrkF4; arc=none smtp.client-ip=192.198.163.18 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="QCvYrkF4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1769743443; x=1801279443; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=F9atmiyM11HhfTRulkobq/MVMJTG1x4p+28ptQY6q4U=; b=QCvYrkF4mFTTVLFQtnIbcBV7sa8Jx38z5A7v+NKLzVgMUirP3Y0ZQeNp FXVnIsSmZVE573jFROcx65bqknGlp5U4Jy/bOjblgAyIXe1++B8W6jqvl QfJLF+CmTeRcTj30kc08cqRL99vxW7Wv8FsxeIsHIl453U8k6NueAyYCH f8iecNBD/hAQTQA2Zbk4pGq1f1ada5jnZXwx/SJkkMfDLNPt1mky1HQLj 0ofScF8fmyOGMJZdualPSYmViX899txm9moqvpXj4eBmEHwWj3XG1TWNP Q6BycdaP8wpXmPhzMOxMUaeXsVud+FuwRnz6kA8gs6u9GihRCxEqEsvaN g==; X-CSE-ConnectionGUID: jj7vhp0+RIKG3NuSl5bQCg== X-CSE-MsgGUID: i86VV+A8R+yc8Fp7Hqjfkg== X-IronPort-AV: E=McAfee;i="6800,10657,11686"; a="70192790" X-IronPort-AV: E=Sophos;i="6.21,262,1763452800"; d="scan'208";a="70192790" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2026 19:24:02 -0800 X-CSE-ConnectionGUID: sK9dqNLdTxOAwEijwR7Qcw== X-CSE-MsgGUID: 4K/+vb0KTJCgSjGtmWW2kQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,262,1763452800"; d="scan'208";a="208660486" Received: from unknown (HELO [10.238.3.203]) ([10.238.3.203]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2026 19:23:59 -0800 Message-ID: Date: Fri, 30 Jan 2026 11:23:56 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/3] KVM: x86: Explicitly configure supported XSS from {svm,vmx}_set_cpu_caps() To: Binbin Wu , Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Mathias Krause , John Allen , Rick Edgecombe , Chao Gao , Jim Mattson References: <20260128014310.3255561-1-seanjc@google.com> <20260128014310.3255561-2-seanjc@google.com> <9856fb02-b72a-4626-b34a-16a7adb55fc6@linux.intel.com> Content-Language: en-US From: Xiaoyao Li In-Reply-To: <9856fb02-b72a-4626-b34a-16a7adb55fc6@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/29/2026 3:34 PM, Binbin Wu wrote: > > > On 1/28/2026 9:43 AM, Sean Christopherson wrote: >> Explicitly configure KVM's supported XSS as part of each vendor's setup >> flow to fix a bug where clearing SHSTK and IBT in kvm_cpu_caps, e.g. due >> to lack of CET XFEATURE support, makes kvm-intel.ko unloadable when nested >> VMX is enabled, i.e. when nested=1. The late clearing results in >> nested_vmx_setup_{entry,exit}_ctls() clearing VM_{ENTRY,EXIT}_LOAD_CET_STATE >> when nested_vmx_setup_ctls_msrs() runs during the CPU compatibility checks, >> ultimately leading to a mismatched VMCS config due to the reference config >> having the CET bits set, but every CPU's "local" config having the bits >> cleared. > > A bit confuse about the description. > > Before this patch: > > kvm_x86_vendor_init > | vmx_hardware_setup > | nested_vmx_hardware_setup > | nested_vmx_setup_ctls_msrs > | ... > | for_each_online_cpu(cpu) > | smp_call_function_single(cpu, kvm_x86_check_cpu_compat, &r, 1) > | | kvm_x86_check_processor_compatibility > | | kvm_x86_call(check_processor_compatibility)() > | | vmx_check_processor_compatibility > | | setup_vmcs_config > | | nested_vmx_setup_ctls_msrs > | ... > | //late clearing of SHSTK and IBT > > If we don't consider CPU hotplug case, both the setup of reference VMCS and the > local config are before the late clearing of SHSTK and IBT. They should be > consistent. > > So you are referring the mismatch situation during CPU hotplug? I guess it's triggered the path kvm_init() kvm_init_virtualization() kvm_enable_virtualization() cpuhp_setup_state() kvm_online_cpu() ... (note, it requires enable_virt_at_load to be true) which is after vmx_init() kvm_x86_vendor_init()