Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp169406pxb; Tue, 21 Sep 2021 22:29:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdSplpCATVd/DxrY/KTES1KyECBt+N19lv7tEbWESGxZ/mIXyoemp2q1607Iw1bJHnGEAC X-Received: by 2002:a05:6638:1389:: with SMTP id w9mr3229564jad.138.1632288549536; Tue, 21 Sep 2021 22:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632288549; cv=none; d=google.com; s=arc-20160816; b=wfdnX7akrwkiqt3rztRf8mwkgcPxipLMsfrVFAdUD05AJisc6dP/QX39GIvVI9z58V aPsv3gHs3IoHqtvLux5987CrldOd5d7sQEhSKqY6MwPGu6crSUVsEKvG3GdZRwxaTDV5 tWKN90gZsX36X+KF2OH+vThlGUZXzOcFWwpAcW8FGa8+z4hB5crZB7ixwtQaNiX59P1d MwzTAB4+kCtIuW/YpqZjyc4RFxkVWzsSnOTZw8DrZ78a6LiiuiyBHWTzkbi3ULel4D7b t8Xx1IeRzF1uJHBb0JPsvRSQI5aSg6KFJJ/1LWNgbvYV2SAppa9WWH8iTw80+Yg7cAjJ xg2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=tZ52D187Z2U/H8p5dszOu1uESGpLooo9x4q7X/Sah8s=; b=BOXCEtODOcRqmhjqY545Icc6ItvWBAUNzKrkD9+GkkuMGd9UasCFtqZ06LjVJXQqh2 KonygHfWhwcmc7cGI1v4QhEku4QDoOpOikdAQ3/U2OFei1UZEugIfmgOFc3SYH3b+3NA k0VeB/OjERt+7/cXA1vaAdpo3QENw3A61FmPSMRH5H9Em5Za4Mv2TUmE9DjHH17mtKmb YgOgS6EcuCAsRQP2g6Flsw3HpJyTuo2tjvD3uQIoAO7kBDuxD9PVe0E3mOlA5I8Yetl/ 8RBDC6YawDtFEqqMOaoB7haP2mH0+HQWIjsnOsYkeNoa6PJy+HAVFWCDxa9LtYtdndrf JAWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="O3eF/e2/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si1577283ilj.15.2021.09.21.22.28.58; Tue, 21 Sep 2021 22:29:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="O3eF/e2/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232124AbhIVF3d (ORCPT + 99 others); Wed, 22 Sep 2021 01:29:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:55840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231896AbhIVF3a (ORCPT ); Wed, 22 Sep 2021 01:29:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A8AAE6112F; Wed, 22 Sep 2021 05:28:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632288481; bh=BPl0WzWMl37d2k/3uxnnOLpKXcWTjHJrAMlccHcUi5M=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=O3eF/e2/0vcG+/9vQrsuSFgUTFzVDba4jm4/FNqlLUicDRXpJqgLL7lvHyy15F9vW DMhjanNmLTOAE6W5jpXpEkvu2a/TBx/aqaBX3pePBlkkcNwNHSzvy4B1hOW3jM0Hzi 3xi54CSK8rLYg9BdUsijZ/9Efmh9qE3MUU6AmdIiDI07RHiUVgfsAhcdkOb3e5aN6x URvrhK8Uv7GLcEGg+Yf+gURtdLv62pSAnRL6IVlFEfzf/dN3BLm4/ZLrQtreldV9TC nYn/MyxaE086qtfLfDao1tKwZkjbp4ucLP9npFh4LyF4//OOPg1IZtp6nI2PpNEpNf XTF4CfJh4Fo/w== Message-ID: <931e05840165b8285acf8d13ded01fb233b6549c.camel@kernel.org> Subject: Re: [PATCH v5 1/7] x86/sgx: Provide indication of life-cycle of EPC pages From: Jarkko Sakkinen To: Dave Hansen , Tony Luck , Sean Christopherson Cc: Cathy Zhang , linux-sgx@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Date: Wed, 22 Sep 2021 08:27:58 +0300 In-Reply-To: <057511a3-3bc8-f073-e0f8-7b14646f82fe@intel.com> References: <20210827195543.1667168-1-tony.luck@intel.com> <20210917213836.175138-1-tony.luck@intel.com> <20210917213836.175138-2-tony.luck@intel.com> <057511a3-3bc8-f073-e0f8-7b14646f82fe@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-09-21 at 15:15 -0700, Dave Hansen wrote: > On 9/21/21 2:28 PM, Jarkko Sakkinen wrote: > > > Since there are multiple uses of the "owner" field with different typ= es > > > change the sgx_epc_page structure to define an anonymous union with > > > each of the uses explicitly called out. > > But it's still always a pointer. > >=20 > > And not only that, but two alternative fields in that union have *exact= ly* the > > same type, so it's kind of artifically representing the problem more co= mplex > > than it really is. > >=20 > > I'm not just getting, why all this complexity, and not a few casts inst= ead? >=20 > I suggested this. It makes the structure more self-describing because > it explicitly lists the possibles uses of the space in the structure. >=20 > Maybe I stare at 'struct page' and its 4 unions too much and I'm > enamored by their shininess. But, in the end, I prefer unions to casting= . Yeah, packing data into constrained space (as in the case of struct page) i= s the only application for, where you can speak of a quantitative decision, w= hen you pick union. /Jarkko