From patchwork Tue Mar 9 00:40:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 12123651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E573C433DB for ; Tue, 9 Mar 2021 00:41:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B01C64F7C for ; Tue, 9 Mar 2021 00:41:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229821AbhCIAkq (ORCPT ); Mon, 8 Mar 2021 19:40:46 -0500 Received: from mga12.intel.com ([192.55.52.136]:23575 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbhCIAk1 (ORCPT ); Mon, 8 Mar 2021 19:40:27 -0500 IronPort-SDR: r0t1ehaWpEdcpsapiGs8l4OfqB+Rzf3AXpv2eQiYney2qPUIBiDeUeW8fzS6+0zFc07Eq5qgPz HrYFDbEVjuOA== X-IronPort-AV: E=McAfee;i="6000,8403,9917"; a="167400567" X-IronPort-AV: E=Sophos;i="5.81,233,1610438400"; d="scan'208";a="167400567" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2021 16:40:26 -0800 IronPort-SDR: 6gNcOCvhJki5z5np+3Wy3sRHRjCFuYYBCFIX5zuweeJNHM9hXC4/zI/I6CR1b8sJW5TNG+yKn0 VqrrPISAcxMA== X-IronPort-AV: E=Sophos;i="5.81,233,1610438400"; d="scan'208";a="386038115" Received: from hamidadx-mobl.amr.corp.intel.com (HELO [10.209.33.54]) ([10.209.33.54]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2021 16:40:26 -0800 Subject: SGX Performance Creep To: "Vij, Mona" , "Sakkinen, Jarkko" , "Kumar, Deepak1" , "Helm, Kent" , "Narjala, Ranjit S" , "Huang, Haitao" , "Mathew, Shama" , "Hossain, Md Iqbal" , "Saffores, Ryan D" , "Jaramillo, Alex V" , "Kuvaiskii, Dmitrii" , "Mahalingam, Ganesh" Cc: "Sterrett, Craig" , "Macieira, Thiago" , "Salunke, Manoj" , "Gandhi, Jinen" , "linux-sgx@vger.kernel.org" , Jarkko Sakkinen References: From: Dave Hansen Autocrypt: addr=dave.hansen@intel.com; keydata= xsFNBE6HMP0BEADIMA3XYkQfF3dwHlj58Yjsc4E5y5G67cfbt8dvaUq2fx1lR0K9h1bOI6fC oAiUXvGAOxPDsB/P6UEOISPpLl5IuYsSwAeZGkdQ5g6m1xq7AlDJQZddhr/1DC/nMVa/2BoY 2UnKuZuSBu7lgOE193+7Uks3416N2hTkyKUSNkduyoZ9F5twiBhxPJwPtn/wnch6n5RsoXsb ygOEDxLEsSk/7eyFycjE+btUtAWZtx+HseyaGfqkZK0Z9bT1lsaHecmB203xShwCPT49Blxz VOab8668QpaEOdLGhtvrVYVK7x4skyT3nGWcgDCl5/Vp3TWA4K+IofwvXzX2ON/Mj7aQwf5W iC+3nWC7q0uxKwwsddJ0Nu+dpA/UORQWa1NiAftEoSpk5+nUUi0WE+5DRm0H+TXKBWMGNCFn c6+EKg5zQaa8KqymHcOrSXNPmzJuXvDQ8uj2J8XuzCZfK4uy1+YdIr0yyEMI7mdh4KX50LO1 pmowEqDh7dLShTOif/7UtQYrzYq9cPnjU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6LYSMc4vKZ3QfCY7ipLRORyalFDF3j5AGCMRENJjHPD6O7bl3Xo 4DzMID+8eucbXxKiNEbs21IqBZbbKdY1GkcEGTE7AnkA3Y6YB7I/j9mQ3hCgm5muJuhM/2Fr OPsw5tV/LmQ5GXH0JQ/TZXWygyRFyyI2FqNTx4WHqUn3yFj8rwTAU1tluRUYyeLy0ayUlKBH ybj0N71vWO936MqP6haFERzuPAIpxj2ezwu0xb1GjTk4ynna6h5GjnKgdfOWoRtoWndMZxbA z5cecg== Message-ID: <990a55e9-5160-c2ae-08ab-7e1d277bd310@intel.com> Date: Mon, 8 Mar 2021 16:40:20 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org I got my hands on a NUC7CJYH, which is the first piece of functional Flexible Launch Control hardware I've actually laid my hands on. I went looking for any "performance creep". I tried a very simple test: Create and run an enclave that touches a 64MB statically-allocated buffer. (The patch to the kernel selftest to do this is attached). tl;dr: I'm not seeing any meaningful change in runtimes, even after running and tearing down the enclave for 6-7 hours. I'm running the selftest like this, creating a log file with /usr/bin/time: NOW=$(date +%s); make && while true; do /usr/bin/time ./test_sgx >> $NOW.log 2>> $NOW.timelog || break; done This lets me do a quick and dirty histogram of the runtimes. Note that there's a single, nice peak. It's not "smeared" like I would expect from slowly-degrading run times. $ cat 1615229976.timelog | grep elapsed | awk '{print $1}' | sort | uniq -c 4 2.08user 14 2.09user 106 2.10user 403 2.11user 1055 2.12user 1518 2.13user 1268 2.14user 726 2.15user 302 2.16user 96 2.17user 23 2.18user 8 2.19user 1 2.20user I'll run for another day or two and see if anything interesting shows up. But, for now, nothing interesting is happening. Whatever folks are seeing, it doesn't seem to be present on my little simple test case, or this Atom-based hardware. The kernel is: stock 5.12.0-rc2. The CPU is: Intel(R) Celeron(R) J4005 CPU @ 2.00GHz diff --git a/tools/testing/selftests/sgx/test_encl.c b/tools/testing/selftests/sgx/test_encl.c index cf25b5dc1e03..dd45a72a1b42 100644 --- a/tools/testing/selftests/sgx/test_encl.c +++ b/tools/testing/selftests/sgx/test_encl.c @@ -14,7 +14,21 @@ static void *memcpy(void *dest, const void *src, size_t n) return dest; } +#define DATA_LEN (64 * 1<<20) +static unsigned char data[DATA_LEN] = { 0x12 }; + void encl_body(void *rdi, void *rsi) { + int i; + int j; + int len = DATA_LEN; + int loops = 2; + + for (j = 0; j < loops; j++) { + for (i = 0; i < len; i++) { + data[i] = (unsigned long)rdi; + } + } + memcpy(rsi, rdi, 8); }