linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: <linux-coco@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<x86@kernel.org>, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Kirill A. Shutemov" <kas@kernel.org>,
	Kai Huang <kai.huang@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH 1/2] x86/virt/tdx: Retrieve TDX module version
Date: Thu, 13 Nov 2025 09:24:45 +0800	[thread overview]
Message-ID: <aRUzXbIAcv8vOyBe@intel.com> (raw)
In-Reply-To: <aPiNy8Q3uPrlVlug@intel.com>

On Wed, Oct 22, 2025 at 03:55:01PM +0800, Chao Gao wrote:
>On Wed, Oct 01, 2025 at 08:15:46AM -0700, Dave Hansen wrote:
>>On 9/30/25 19:22, Chao Gao wrote:
>>> +	if (!ret && !(ret = read_sys_metadata_field(0x0800000100000003, &val)))
>>> +		sysinfo_version->minor_version = val;
>>> +	if (!ret && !(ret = read_sys_metadata_field(0x0800000100000004, &val)))
>>> +		sysinfo_version->major_version = val;
>>> +	if (!ret && !(ret = read_sys_metadata_field(0x0800000100000005, &val)))
>>> +		sysinfo_version->update_version = val;
>>
>>Heh, how long does this take in practice to get 6 bytes of data out of
>>the module?
>
>~8us. And the whole metadata reading process (i.e., get_tdx_sys_info()) takes
>~113us.
>
>>When is the point that we move  over to TDH.SYS.RDALL?
>
>TDH.SYS.RDALL takes ~16us.
>
>I'm uncertain whether the saved CPU time of ~100us justifies implementing
>TDH.SYS.RDALL.

I chatted with Dave and Yilun offline. We think that saving 100us for this
one-off operation isn't worth the code churn.

For the record, the idea of moving over to TDH.SYS.RDALL is:

1. Call TDH.SYS.RDALL to dump all metadata into a data structure
2. Add a tdx_get_one() helper to look up the data structure and get the
   metadata for a given field ID
3. Replace read_sys_metadata_field() with tdx_get_one()

  parent reply	other threads:[~2025-11-13  1:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-01  2:22 [PATCH 0/2] Expose TDX Module version Chao Gao
2025-10-01  2:22 ` [PATCH 1/2] x86/virt/tdx: Retrieve TDX module version Chao Gao
2025-10-01 15:15   ` Dave Hansen
2025-10-22  7:54     ` Chao Gao
2025-10-22 10:26       ` Kiryl Shutsemau
2025-10-24  6:33         ` Chao Gao
2025-10-24  9:35           ` Kiryl Shutsemau
2025-10-24 10:04             ` Chao Gao
2025-11-13  1:24       ` Chao Gao [this message]
2025-10-24 14:20   ` Vishal Annapurve
2025-10-01  2:22 ` [PATCH 2/2] coco/tdx-host: Expose " Chao Gao
2025-10-01  4:12   ` Huang, Kai
2025-10-01 11:27     ` Kiryl Shutsemau
2025-10-01 21:41       ` Huang, Kai
2025-10-01 11:30   ` 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=aRUzXbIAcv8vOyBe@intel.com \
    --to=chao.gao@intel.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kai.huang@intel.com \
    --cc=kas@kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).