From: Dan Williams <dan.j.williams@intel.com>
To: "Huang, Kai" <kai.huang@intel.com>,
"sathyanarayanan.kuppuswamy@linux.intel.com"
<sathyanarayanan.kuppuswamy@linux.intel.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"Williams, Dan J" <dan.j.williams@intel.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "Yu, Guorui" <guorui.yu@linux.alibaba.com>,
"qinkun@apache.org" <qinkun@apache.org>,
"wander@redhat.com" <wander@redhat.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"Aktas, Erdem" <erdemaktas@google.com>,
"Luck, Tony" <tony.luck@intel.com>,
"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
"dionnaglaze@google.com" <dionnaglaze@google.com>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH v1] virt: tdx-guest: Add Quote generation support using TSM_REPORTS
Date: Fri, 8 Sep 2023 09:19:36 -0700 [thread overview]
Message-ID: <64fb499862936_7318294a0@dwillia2-mobl3.amr.corp.intel.com.notmuch> (raw)
In-Reply-To: <da4a6c3f4cb9118e10866cb1d624ad5ec5c96d7d.camel@intel.com>
Huang, Kai wrote:
>
> >
> > Changes since previous version:
> > * Used ConfigFS interface instead of IOCTL interface.
> > * Used polling model for Quote generation and dropped the event notification IRQ support.
>
> Can you elaborate why the notification IRQ is dropped?
Because it was a pile of hacks and non-idiomatic complexity. It can come
back when / if driver code can treat it like a typical interrupt.
[..]
> >
> > +/*
> > + * Intel's SGX QE implementation generally uses Quote size less
> > + * than 8K (2K Quote data + ~5K of ceritificate blob).
> > + */
> > +#define GET_QUOTE_BUF_SIZE SZ_8K
>
> SZ_8K is defined in <linux/sizes.h>. It seems it's not explicitly included.
> It's better to explicitly include it.
>
> Btw, although the size of the certificate blob shouldn't change dramatically,
> the Quote can also include the "QE Authentication Data", which can vary a lot
> depending on different QE implementation (e.g., containing geography
> information, etc).
>
> I wish eventually there's some /sysfs entry to configure the size of Quote
> buffer, but I guess it can be done in the future.
How would userspace have any idea of how big the quote buffer is to be
able to set it? The output format at least needs to standardized within
a given vendor's implementation, and future variation should be
de-emphasized relative to getting to a common report format across
vendors.
[..]
> > +/*
> > + * wait_for_quote_completion() - Wait for Quote request completion
> > + * @quote_buf: Address of Quote buffer.
> > + * @timeout: Timeout in seconds to wait for the Quote generation.
> > + *
> > + * As per TDX GHCI v1.0 specification, sec titled "TDG.VP.VMCALL<GetQuote>",
> > + * the status field in the Quote buffer will be set to GET_QUOTE_IN_FLIGHT
> > + * while VMM processes the GetQuote request, and will change it to success
> > + * or error code after processing is complete. So wait till the status
> > + * changes from GET_QUOTE_IN_FLIGHT or the request timedout.
> > + */
> > +static int wait_for_quote_completion(struct tdx_quote_buf *quote_buf, u32 timeout)
> > +{
> > + int i = 0;
> > +
> > + /*
> > + * Quote requests usually take a few seconds to complete, so waking up
> > + * once per second to recheck the status is fine for this use case.
> > + */
> > + while (quote_buf->status == GET_QUOTE_IN_FLIGHT && i++ < timeout)
> > + ssleep(1);
> > +
> > + return (i == timeout) ? -ETIMEDOUT : 0;
> > +}
>
> Why can't we use wait_for_completion_timeout() provided by the kernel?
>
> Btw, can we use _killable() variant? Supporting timeout brings extra
> complication, and I think supporting timeout isn't mandatory for the first
> version.
It definitely is required even if interrupts were supported. The kernel
needs to give up on stalled operations in a reasonable amount of time.
next prev parent reply other threads:[~2023-09-08 16:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 2:54 Kuppuswamy Sathyanarayanan
2023-09-08 0:03 ` kernel test robot
2023-09-08 1:30 ` Erdem Aktas
2023-09-08 2:29 ` Kuppuswamy Sathyanarayanan
2023-09-08 4:10 ` Dan Williams
2023-09-09 5:24 ` Kuppuswamy Sathyanarayanan
2023-09-13 3:51 ` Kuppuswamy Sathyanarayanan
2023-09-08 4:50 ` Huang, Kai
2023-09-08 16:19 ` Dan Williams [this message]
2023-09-11 0:10 ` Kuppuswamy Sathyanarayanan
2023-09-11 10:01 ` Huang, Kai
2023-09-11 10:00 ` Huang, Kai
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=64fb499862936_7318294a0@dwillia2-mobl3.amr.corp.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dionnaglaze@google.com \
--cc=erdemaktas@google.com \
--cc=guorui.yu@linux.alibaba.com \
--cc=hpa@zytor.com \
--cc=kai.huang@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=qinkun@apache.org \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=wander@redhat.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®