Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peter Fang" <peter.fang@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 3/8] KVM: TDX: Require at least one quoting session and thread per CPU
Date: Fri, 04 Dec 2026 18:44:57 +0000	[thread overview]
Message-ID: <sashiko-outbox-250452@kernel.org> (raw)
In-Reply-To: <20261204182022.324230-4-peter.fang@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] KVM: TDX: quoting checks return -EINVAL and abort kvm-intel
  load
--

commit ad2ff9af18e518d36b330f0d2e71d20814ddc017
Author: Peter Fang <peter.fang@intel.com>

KVM: TDX: Require at least one quoting session and thread per CPU

This commit checks that the TDX-Module provides at least as many quoting
sessions and threads as present logical CPUs when quoting is enabled,
returning -EINVAL from __tdx_hardware_setup() if either count is too
small.

Link: https://lore.kernel.org/all/arRXqpG_4hCrhQLM@intel.com/ # [1]
Link: https://lore.kernel.org/all/DS4PPFA84FA90FC58F88D79B0EF19B34596E7832@DS4PPFA84FA90FC.namprd11.prod.outlook.com/ # [2]

> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 8a593159c9b7c..4ccb41f002dff 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c

[ ... ]

> @@ -3500,6 +3502,26 @@ static int __init __tdx_hardware_setup(void)
>  		return -EINVAL;
>  	}
>  
> +	/*
> +	 * KVM only allows one quoting session per TD. Make sure a free session
> +	 * is always available as long as there is no oversubscription of TDs,
> +	 * i.e. no more TDs than logical CPUs, and that a quoting thread can
> +	 * always be scheduled on any logical CPU.
> +	 */
> +	if (tdx_quoting_enabled(&quoting_max_size, &quoting_sessions,
> +				&quoting_threads)) {
> +		if (quoting_sessions < num_present_cpus()) {
> +			pr_err("Disable TDX: QUOTING_NUM_SESSIONS (%u) smaller than number of logical CPUs (%u).\n",
> +			       quoting_sessions, num_present_cpus());
> +			return -EINVAL;
> +		}
> +		if (quoting_threads < num_present_cpus()) {
> +			pr_err("Disable TDX: QUOTING_NUM_THREADS (%u) smaller than number of logical CPUs (%u).\n",
> +			       quoting_threads, num_present_cpus());
> +			return -EINVAL;
> +		}
> +	}

[Severity: Medium]
Does returning -EINVAL here abort kvm-intel loading instead of only
disabling TDX?

In tdx_hardware_setup(), only -ENODEV from __tdx_hardware_setup() jumps
to success_disable_tdx to clear enable_tdx and return 0.  Any other
error propagates through vt_hardware_setup() -> kvm_x86_vendor_init()
and fails kvm-intel loading, breaking regular VMX guests as well.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204182022.324230-1-peter.fang@intel.com?part=3

  reply	other threads:[~2026-12-04 18:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 18:18 [PATCH v3 0/8] Enable DICE-based TDX quoting Peter Fang
2026-12-04 18:18 ` [PATCH v3 1/8] x86/virt/tdx: Add interface to generate a Quote Peter Fang
2026-12-04 18:36   ` sashiko-bot
2026-12-04 19:15   ` Dave Hansen
2026-12-04 22:02     ` Edgecombe, Rick P
2026-12-04 21:44   ` Adrian Hunter
2026-12-04 22:04     ` Edgecombe, Rick P
2026-12-04 18:18 ` [PATCH v3 2/8] x86/virt/tdx: Add interface to check quoting capabilities Peter Fang
2026-12-04 18:44   ` sashiko-bot
2026-12-04 18:18 ` [PATCH v3 3/8] KVM: TDX: Require at least one quoting session and thread per CPU Peter Fang
2026-12-04 18:44   ` sashiko-bot [this message]
2026-12-04 18:18 ` [PATCH v3 4/8] KVM: TDX: Add KVM_TDX_GET_QUOTE sub-ioctl for quoting Peter Fang
2026-12-04 18:51   ` sashiko-bot
2026-12-04 18:18 ` [PATCH v3 5/8] KVM: TDX: Report maximum Quote size in TDX capabilities Peter Fang
2026-12-04 18:18 ` [PATCH v3 6/8] KVM: TDX: Document KVM_TDX_GET_QUOTE Peter Fang
2026-12-04 18:36   ` sashiko-bot
2026-12-04 18:18 ` [PATCH v3 7/8] x86/virt/tdx: Enable the quoting extension Peter Fang
2026-12-04 18:52   ` sashiko-bot
2026-12-04 18:18 ` [PATCH v3 8/8] x86/virt/tdx: Add documentation for DICE-based quoting Peter Fang
2026-12-04 18:40 ` [PATCH v3 0/8] Enable DICE-based TDX quoting Jason Gunthorpe
2026-12-04 18:47   ` Edgecombe, Rick P
2026-12-04 18:50     ` Jason Gunthorpe
2026-12-04 19:11       ` Edgecombe, Rick P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-250452@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=peter.fang@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox