mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: moe@flashbots.net, Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Erdem Aktas <erdemaktas@google.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Dan Williams <djbw@kernel.org>
Cc: Jun Miao <jun.miao@intel.com>,
	x86@kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] virt: tdx-guest: Fix timeout detection in wait_for_quote_completion()
Date: Fri, 23 Oct 2026 13:43:59 -0700	[thread overview]
Message-ID: <4e8ffa1b-a0bc-4a77-b1f2-cc1c84f9d8ec@linux.intel.com> (raw)
In-Reply-To: <20261022-tdx-guest-quote-poll-v2-1-7543c6eb2d36@flashbots.net>

Hi,

On 10/22/2026 9:31 AM, Moe Mahhouk via B4 Relay wrote:
> From: Moe Mahhouk <moe@flashbots.net>
> 
> wait_for_quote_completion() counts the seconds it has waited in i and
> reports a timeout when i == timeout. That gets both outcomes of the
> last second wrong:
> 
> - If the request is still in flight after the last sleep, the loop
>   condition increments i once more before it fails, so the loop ends
>   with i == timeout + 1 and the function returns 0. The caller then
>   returns -EIO instead of -ETIMEDOUT, without the "GetQuote request
>   timedout" message. Before commit 0f409eaea53e ("virt: tdx-guest:
>   Return error for GetQuote failures") a timed-out request even
>   returned success with an empty Quote.
> 
> - If the VMM completes the request during the last sleep, the loop ends
>   on the status check with i == timeout, and the function returns
>   -ETIMEDOUT for a completed request, discarding the Quote.
> 
> Decide on the Quote buffer instead: the request timed out if it is
> still in flight when the wait ends.
> 
> Fixes: f4738f56d1dc ("virt: tdx-guest: Add Quote generation support using TSM_REPORTS")
> Reported-by: Kiryl Shutsemau <kas@kernel.org>
> Closes: https://lore.kernel.org/all/atoHWgQF-0vlTRK4@thinkstation/
> Signed-off-by: Moe Mahhouk <moe@flashbots.net>
> ---

Since it can be back ported add Cc: stable@vger.kernel.org

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>


>  drivers/virt/coco/tdx-guest/tdx-guest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/virt/coco/tdx-guest/tdx-guest.c b/drivers/virt/coco/tdx-guest/tdx-guest.c
> index 11d741da3b35..a5a53174f9d9 100644
> --- a/drivers/virt/coco/tdx-guest/tdx-guest.c
> +++ b/drivers/virt/coco/tdx-guest/tdx-guest.c
> @@ -282,7 +282,7 @@ static int wait_for_quote_completion(struct tdx_quote_buf *buf, u32 timeout)
>  			return -EINTR;
>  	}
>  
> -	return (i == timeout) ? -ETIMEDOUT : 0;
> +	return (buf->status == GET_QUOTE_IN_FLIGHT) ? -ETIMEDOUT : 0;
>  }
>  
>  static int tdx_report_new_locked(struct tsm_report *report)
> 

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


  reply	other threads:[~2026-10-23 20:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 16:31 [PATCH v2 0/2] virt: tdx-guest: Fix and speed up the wait for a Quote Moe Mahhouk via B4 Relay
2026-10-22 16:31 ` [PATCH v2 1/2] virt: tdx-guest: Fix timeout detection in wait_for_quote_completion() Moe Mahhouk via B4 Relay
2026-10-23 20:43   ` Kuppuswamy Sathyanarayanan [this message]
2026-10-22 16:31 ` [PATCH v2 2/2] virt: tdx-guest: Poll Quote status with exponential backoff Moe Mahhouk via B4 Relay
2026-10-23 20:58   ` Kuppuswamy Sathyanarayanan
2026-10-23 10:17 ` [PATCH v2 0/2] virt: tdx-guest: Fix and speed up the wait for a Quote Kiryl Shutsemau

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=4e8ffa1b-a0bc-4a77-b1f2-cc1c84f9d8ec@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=djbw@kernel.org \
    --cc=erdemaktas@google.com \
    --cc=jun.miao@intel.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moe@flashbots.net \
    --cc=rick.p.edgecombe@intel.com \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®