linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sathyanarayanan Kuppuswamy  <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, Shuah Khan <shuah@kernel.org>,
	"H . Peter Anvin" <hpa@zytor.com>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Tony Luck <tony.luck@intel.com>, Andi Kleen <ak@linux.intel.com>,
	Kai Huang <kai.huang@intel.com>,
	Wander Lairson Costa <wander@redhat.com>,
	Isaku Yamahata <isaku.yamahata@gmail.com>,
	marcelo.cerri@canonical.com, tim.gardner@canonical.com,
	khalid.elmously@canonical.com, philip.cox@canonical.com,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH v11 1/3] x86/tdx: Add TDX Guest attestation interface driver
Date: Mon, 29 Aug 2022 07:30:00 +0200	[thread overview]
Message-ID: <YwxO2L/MtCw/OHGB@kroah.com> (raw)
In-Reply-To: <c6ccbcac-c5b1-f460-01e2-e1b6684b6e65@linux.intel.com>

On Sun, Aug 28, 2022 at 05:19:33PM -0700, Sathyanarayanan Kuppuswamy wrote:
> Hi,
> 
> On 8/28/22 1:14 PM, Dave Hansen wrote:
> > On 8/26/22 08:06, Kuppuswamy Sathyanarayanan wrote:
> >> +struct tdx_report_req {
> >> +	__u8  subtype;
> >> +	__u64 reportdata;
> >> +	__u32 rpd_len;
> >> +	__u64 tdreport;
> >> +	__u32 tdr_len;
> >> +};
> > 
> > Please do take a look at how the compiler ends up building that structure.
> > 
> > If you sized things to "save space", the way the compiler treats that
> > structure may surprise you.  You might also want to look at how a 32-bit
> > compile deals with it versus a 64-bit one.
> 
> Since it is only used in user/kernel ABI, I did not consider the size
> issue.

That is _EXACTLY_ why you need to consider the size issues here.

> But I understand your point. The size of this struct in a 64-bit
> system is 40 bytes. So we did not gain anything with using different member
> sizes. In a 32-bit system, size due to padding is less compared to 64-bit.

That's not the issue here, please use a tool like pahole to see the
problems with this definition.

> I will re-arrange the struct as below. With this change, the size will come
> down to 32 bytes.
> 
> struct tdx_report_req {
>         __u64 reportdata;;
>         __u64 tdreport;
>         __u32 rpd_len
>         __u32 tdr_len;
>         __u8 subtype;
> };

That's better, but again, please use pahole.

thanks,

greg k-h

  reply	other threads:[~2022-08-29  5:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 15:06 [PATCH v11 1/3] x86/tdx: Add TDX Guest attestation interface driver Kuppuswamy Sathyanarayanan
2022-08-26 15:06 ` [PATCH v11 2/3] selftests: tdx: Test TDX attestation GetReport support Kuppuswamy Sathyanarayanan
2022-08-26 15:06 ` [PATCH v11 3/3] Documentation/x86: Document TDX attestation process Kuppuswamy Sathyanarayanan
2022-08-29  2:50   ` Bagas Sanjaya
2022-08-29  3:05     ` Sathyanarayanan Kuppuswamy
2022-08-27  7:33 ` [PATCH v11 1/3] x86/tdx: Add TDX Guest attestation interface driver Greg Kroah-Hartman
2022-08-28  1:38   ` Sathyanarayanan Kuppuswamy
2022-08-27  7:45 ` Bagas Sanjaya
2022-08-28  1:52   ` Sathyanarayanan Kuppuswamy
2022-08-28 20:14 ` Dave Hansen
2022-08-29  0:19   ` Sathyanarayanan Kuppuswamy
2022-08-29  5:30     ` Greg Kroah-Hartman [this message]
2022-08-29 20:09       ` Sathyanarayanan Kuppuswamy
2022-08-29 20:28         ` Dave Hansen
2022-08-29 20:34           ` Sathyanarayanan Kuppuswamy

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=YwxO2L/MtCw/OHGB@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=isaku.yamahata@gmail.com \
    --cc=kai.huang@intel.com \
    --cc=khalid.elmously@canonical.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=marcelo.cerri@canonical.com \
    --cc=mingo@redhat.com \
    --cc=philip.cox@canonical.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tim.gardner@canonical.com \
    --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;
as well as URLs for NNTP newsgroup(s).