Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2774964rwe; Sun, 28 Aug 2022 22:49:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4f/xM5fIhlrHNYieQ41u1F555oESZGfrZC0CMZV55OcUH3TPGeuymUOV/tzrFnhzSXbR2h X-Received: by 2002:a17:90a:c095:b0:1fd:5bee:8a17 with SMTP id o21-20020a17090ac09500b001fd5bee8a17mr16718268pjs.147.1661752171826; Sun, 28 Aug 2022 22:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661752171; cv=none; d=google.com; s=arc-20160816; b=ZsTODT9bbKB/NofIi6JFYzvlgotxOGe4mPtkhG8a3xPaRUIgtozcqpfTjNr3Km60ai WZ7yf4NJWKEGVYGO0PaywTYdpCRoMh26smAPJoiIbZPA9va4cxJEhYKHWIcS4Z+Dd2kb 91JR6NtYOQY6nOXq6jElYSPAKf0iedfrA9DqltnqUx4cg1p3ApvA6YZYLzOTDv9tacw5 TZ2SJKo7YRZMR/beTXO/q5Ukzq+Kwb3aF0eUEa0F5Qf0uy4crplc5QzecKXUprkAmyHG Nb+PufaH844nYzq3qeMTwIHKi+ufnqg+FszhyFWPsvUNkUhbGkSgm7dYCRswCWKPAjzg Ob0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qzCY2eZwJvzDHJFmLgZa2uQpp1/JIIawuLNgdJXBZ+M=; b=ZMqteHpl4kYNIwTVjwQtIBorxWS6jRQssTpPMIB8Q51sxSK1dAlGRDVnJsT7rzWOry /tnL3ez8mhuVdPv3wnFls4SigeUa73Qw1ZHMgtpNIp6gu5NVe8xGM5UI9OgBrq+idLnx c1PUsFDeefp1m38U6Ta6IFmHC0QptdKfEWAQRP1flweSf/+hLDTW7gHmv8wXLG/BkuJX aPC5QDZagNdM8Eza+5fXtQVK639yqBxujgrpJp6hLSlCbdW6xqpxt3Ern8aLltQtryFV c4yfngOrycOQf4dXz5jmDvTmwkF0TN0S5PRAPapPmzxed9/szNdmibP5XJgkZBmHCfcX IylQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fLy5N72F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a170902ea0600b0016ed7864f83si3267943plg.367.2022.08.28.22.49.21; Sun, 28 Aug 2022 22:49:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fLy5N72F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229559AbiH2F3w (ORCPT + 99 others); Mon, 29 Aug 2022 01:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbiH2F3t (ORCPT ); Mon, 29 Aug 2022 01:29:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C5EB27; Sun, 28 Aug 2022 22:29:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0D00C60FDE; Mon, 29 Aug 2022 05:29:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3260C433D7; Mon, 29 Aug 2022 05:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661750985; bh=hzP4nkAeBpnmq1LiTZnUTTHZIw0ee9DQKe/6c5MU3Nc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fLy5N72FEUxoJDDEA1dGVs6Pe+kHiFv+TFKmvpWj66xiNrtEZf1bDVQBzshT5kBbj gwHH0EDgXUafHFCW+6uSVdX4WKOWjZddJUeEm7evgpsjTz/PEuIIqLl9FuyrtjHnhE Lnyb9Ob2gI0UKAV2jcw7dHXhowWHZaN9p3S3Fofw= Date: Mon, 29 Aug 2022 07:30:00 +0200 From: Greg Kroah-Hartman To: Sathyanarayanan Kuppuswamy Cc: Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Shuah Khan , "H . Peter Anvin" , "Kirill A . Shutemov" , Tony Luck , Andi Kleen , Kai Huang , Wander Lairson Costa , Isaku Yamahata , 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 Message-ID: References: <20220826150638.2397576-1-sathyanarayanan.kuppuswamy@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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