Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2181032pxm; Thu, 24 Feb 2022 18:41:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlDnGk0GDfCDGd5bbVJs+IQkQlIS5NmKs7zy1piteKkaQxjVzfyokPAEgIvBlONFFuSX9P X-Received: by 2002:a17:902:ccce:b0:14e:ed3f:e3a1 with SMTP id z14-20020a170902ccce00b0014eed3fe3a1mr5507167ple.12.1645756860686; Thu, 24 Feb 2022 18:41:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645756860; cv=none; d=google.com; s=arc-20160816; b=iXOO0CpNyTuTu5Btn/IgjgPuAhKMexbzC8mB31TTwopstOdRmRS1U3vhvBXkVc+1dw 8W3Zw40Q9F3N0RdukuyMx7ziGZLbyFeoe+xp84PDkRkK1C/pA9VM8LVdR4WWeqeONhrn v9rswReA0odMsK6pZkBn4Yi0tC7W2SQO12drLXzl9G2CJkhv8A2dciEjasPYNZV0xjpa +ggkIYc8n5HNSpN+cWg0KgzhiAkwzbOtj/kbGseijf7fiWh/Pz8pbCb4iuCwhyVvtXXG b/CfXUVghVp9Y4+ZXkRmieu+9OMalcIWU0tozdrGQyPYCxFKYA2k5a3EI3G3Yi1ii0m3 2CGw== 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=fJ096K3uCqGm+6nKNhlT1ABD6qK7T/HAjTVC+I9He5E=; b=M5ib+3xog2GAk5PFwFXVYAFgMghAM0KX4B9qVhgD+sydJCNwY54rX6ZPhbiPHt27ez p6Kp8KIpYyWuhlWfM7eZN1WfPcN/waH1VGHHXJS/6gNWrqMmu/MHoCrfWhbKbPGCkyFi x3hwuWUYQYGLWhvcs7gjMBz2Ni+VfCeaWDhNzJFrqf60dFxolnMHiUDaczrMTyt6lYo2 mF7YIRQrJAlCbY+vigbHXYYBOSTq/y6jTBPG7QRyin0oXLEfK9JZs8ior614GgvoWTV6 +O3eq7eQeQ5GlbinZQAepchFvN6oSi/wWVgz30n7XQ+nbLj5wYySy2cSXsBNv3JTrfDG IWfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GT1Qjs2w; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k1-20020a170902c40100b001500128b261si791229plk.437.2022.02.24.18.40.44; Thu, 24 Feb 2022 18:41:00 -0800 (PST) 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=@intel.com header.s=Intel header.b=GT1Qjs2w; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbiBXXye (ORCPT + 99 others); Thu, 24 Feb 2022 18:54:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiBXXye (ORCPT ); Thu, 24 Feb 2022 18:54:34 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DA811D6395 for ; Thu, 24 Feb 2022 15:54:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645746843; x=1677282843; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=lANl+8AEIhsmuwwaxKAns6Na25J2A7UFkUclSq5OcY4=; b=GT1Qjs2wwPr8jVStkMzyZkiiGhgm1WOoUmdmf5FEcnPEvmM/V+135pid +C6yppQTIIF/zfknceVoiGkA8sc5UD/2Dt+GmkNF0YSxIO1x+ub6T39pR bgpD60wAgn8QP5ygDWjVDD4w1knHh7gbgnudgtq7ZMikk6OHusV1t01IK OtCN32G+lUN9ea6WxFxGJrRV8T/oxg3bqeAPTUs2B87wLfEjWvjq4iKE1 6ACTDAt7GT2fRpp0S3s5Usz5n7bU6IZzYifEwkMOv18KSuFfBA8Oa7mLZ SJ84ZEhnfKFA6rxcCTS0JINkz3bn2+WZm+YR0ySF2qrPZvFwLJMmd07NZ A==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="239778281" X-IronPort-AV: E=Sophos;i="5.90,134,1643702400"; d="scan'208";a="239778281" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:54:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,134,1643702400"; d="scan'208";a="639924363" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 24 Feb 2022 15:53:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id 6B72994; Fri, 25 Feb 2022 01:54:13 +0200 (EET) Date: Fri, 25 Feb 2022 02:54:13 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, luto@kernel.org, peterz@infradead.org, sathyanarayanan.kuppuswamy@linux.intel.com, aarcange@redhat.com, ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, jgross@suse.com, jmattson@google.com, joro@8bytes.org, jpoimboe@redhat.com, knsathya@kernel.org, pbonzini@redhat.com, sdeep@vmware.com, seanjc@google.com, tony.luck@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv4 05/30] x86/tdx: Extend the confidential computing API to support TDX guests Message-ID: <20220224235413.lrzczn7re4mfdkup@black.fi.intel.com> References: <20220224155630.52734-1-kirill.shutemov@linux.intel.com> <20220224155630.52734-6-kirill.shutemov@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=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 Thu, Feb 24, 2022 at 09:54:16AM -0800, Dave Hansen wrote: > > This left me wondering two things. First, why this bothers storing > 'gpa_width' when it's only used to generate a mask? Why not just store > the mask in the structure? It was needed when tdx_shared_mask() was a thing. It takes a pair of fresh eyes to break the inertia. > Second, why have the global 'td_info' instead of just declaring it on > the stack. It is only used within a single function. Having it on the > stack is *REALLY* nice because the code ends up looking like: > > struct foo foo; > get_info(&foo); > cc_set_bar(foo.bar); > > The dependencies and scope are just stupidly obvious if you do that. Okay, I will rework it with plain gpa_width on stack and get_info(&gpa_width); Attributes will be needed after core enabling, so I will drop it from here. -- Kirill A. Shutemov