From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D28B2ECAAD8 for ; Thu, 22 Sep 2022 21:40:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231284AbiIVVkA (ORCPT ); Thu, 22 Sep 2022 17:40:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbiIVVjy (ORCPT ); Thu, 22 Sep 2022 17:39:54 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D229114033; Thu, 22 Sep 2022 14:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663882793; x=1695418793; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=LziEyfJawc4QSz0lLnm/mVQqdAi9KJUUSw7+yO6FQ2U=; b=gPEQfjxow2GpepwrV6myffF8g/dR0a5Tiq0MfkOjd9MFkC4qXLOEyVlN /FjXq//T+lmEElCfuY/4Moz5RWmq/NNu3DSPuu0k2m8cp6t8MOZSoBkVK hMorp2rznH5d8/EuNuMl9NdTwh4H6ivlZtT2VNk1wd5lEWnrt7vOgxQG8 EqQx8OEzBDAA7zx1MFf3zLCXIOiBNDN0Z+eIsPo/i/tESidgGT8OrQiMI WbeiNWNSCW1jPtRZ0l/Zqk9xZr6NCQH9q+StD6cDZEXE9IYK2dPKghHJd AGUkZmWeEzdKncr6V1ETBzvwPCJPuZWDdWxy33ypfIMV7CF+DSr5pRU66 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="287549742" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="287549742" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 14:39:53 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="762373094" Received: from sponnura-mobl1.amr.corp.intel.com (HELO [10.209.58.200]) ([10.209.58.200]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 14:39:52 -0700 Message-ID: Date: Thu, 22 Sep 2022 14:39:53 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC PATCH 03/20] x86/sgx: Track owning enclave in VA EPC pages Content-Language: en-US To: Kristen Carlson Accardi , linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, cgroups@vger.kernel.org, Jarkko Sakkinen , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Cc: Sean Christopherson References: <20220922171057.1236139-1-kristen@linux.intel.com> <20220922171057.1236139-4-kristen@linux.intel.com> <1adb03c8-1274-3898-0677-03015a1f5a5d@intel.com> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/22/22 13:04, Kristen Carlson Accardi wrote: >> BTW, is there a flag or any other way to tell to what kind of object >> ->owner points? > The owner will only be an sgx_encl type if it is a va page, so to tell > what kind of object owner is, you look at the epc page flags - like > this: > if (epc_page->flags & SGX_EPC_PAGE_ENCLAVE) > encl = ((struct sgx_encl_page *)epc_page->owner)->encl; > else if (epc_page->flags & SGX_EPC_PAGE_VERSION_ARRAY) > encl = epc_page->owner; > ... I don't know how much refactoring it would take, but it would be nice if that was a bit more obvious. Basically, can we get the code that checks for or sets SGX_EPC_PAGE_VERSION_ARRAY close to the code that assigns or reads ->owner? From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: Re: [RFC PATCH 03/20] x86/sgx: Track owning enclave in VA EPC pages Date: Thu, 22 Sep 2022 14:39:53 -0700 Message-ID: References: <20220922171057.1236139-1-kristen@linux.intel.com> <20220922171057.1236139-4-kristen@linux.intel.com> <1adb03c8-1274-3898-0677-03015a1f5a5d@intel.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663882793; x=1695418793; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=LziEyfJawc4QSz0lLnm/mVQqdAi9KJUUSw7+yO6FQ2U=; b=gPEQfjxow2GpepwrV6myffF8g/dR0a5Tiq0MfkOjd9MFkC4qXLOEyVlN /FjXq//T+lmEElCfuY/4Moz5RWmq/NNu3DSPuu0k2m8cp6t8MOZSoBkVK hMorp2rznH5d8/EuNuMl9NdTwh4H6ivlZtT2VNk1wd5lEWnrt7vOgxQG8 EqQx8OEzBDAA7zx1MFf3zLCXIOiBNDN0Z+eIsPo/i/tESidgGT8OrQiMI WbeiNWNSCW1jPtRZ0l/Zqk9xZr6NCQH9q+StD6cDZEXE9IYK2dPKghHJd AGUkZmWeEzdKncr6V1ETBzvwPCJPuZWDdWxy33ypfIMV7CF+DSr5pRU66 g==; Content-Language: en-US In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" To: Kristen Carlson Accardi , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-sgx-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jarkko Sakkinen , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, "H. Peter Anvin" Cc: Sean Christopherson On 9/22/22 13:04, Kristen Carlson Accardi wrote: >> BTW, is there a flag or any other way to tell to what kind of object >> ->owner points? > The owner will only be an sgx_encl type if it is a va page, so to tell > what kind of object owner is, you look at the epc page flags - like > this: > if (epc_page->flags & SGX_EPC_PAGE_ENCLAVE) > encl = ((struct sgx_encl_page *)epc_page->owner)->encl; > else if (epc_page->flags & SGX_EPC_PAGE_VERSION_ARRAY) > encl = epc_page->owner; > ... I don't know how much refactoring it would take, but it would be nice if that was a bit more obvious. Basically, can we get the code that checks for or sets SGX_EPC_PAGE_VERSION_ARRAY close to the code that assigns or reads ->owner?