diff mbox series

SGX Performance Creep

Message ID 990a55e9-5160-c2ae-08ab-7e1d277bd310@intel.com (mailing list archive)
State New, archived
Headers show
Series SGX Performance Creep | expand

Commit Message

Dave Hansen March 9, 2021, 12:40 a.m. UTC
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

Comments

Jarkko Sakkinen March 9, 2021, 5:16 p.m. UTC | #1
On Mon, 2021-03-08 at 16:40 -0800, Dave Hansen wrote:
> 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 think it would be a great enhancement for the self-test, if you could

1. Make the test program change attached.
2. Create a script for stress test and histogram.


> 
> 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
> 

/Jarkko
diff mbox series

Patch

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);
 }