summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-03-10 09:27:32 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-03-10 09:29:26 +0000
commit2a41c4b18391c2cd9094101edcdfdb6811313399 (patch)
treebc5405c932beaaf38bdd7646ad930596589b1684
parentc084c2b88b1ef6a1453de8a24b7a4cf01a82e0d2 (diff)
benchmarks/gem_syslatency: Prevent CPU sleeps (C-states)
In order to keep the latency as low as possible for the idle load, we need to keep the CPU awake. Otherwise we end up with the busy workload having lower latency than the idle workload! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--benchmarks/.gitignore1
-rw-r--r--benchmarks/gem_syslatency.c14
2 files changed, 14 insertions, 1 deletions
diff --git a/benchmarks/.gitignore b/benchmarks/.gitignore
index fcb23a16..25d2f3c0 100644
--- a/benchmarks/.gitignore
+++ b/benchmarks/.gitignore
@@ -8,6 +8,7 @@ gem_latency
gem_mmap
gem_prw
gem_set_domain
+gem_syslatency
gem_userptr_benchmark
intel_upload_blit_large
intel_upload_blit_large_gtt
diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 701b4362..bc513652 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -75,6 +75,16 @@ static void bind_cpu(pthread_t thread, int cpu)
pthread_setaffinity_np(thread, sizeof(mask), &mask);
}
+static void force_low_latency(void)
+{
+ int32_t target = 0;
+ int fd = open("/dev/cpu_dma_latency", O_RDWR);
+ if (fd < 0 || write(fd, &target, sizeof(target)) < 0)
+ fprintf(stderr,
+ "Unable to prevent CPU sleeps and force low latency using /dev/cpu_dma_latency: %s\n",
+ strerror(errno));
+}
+
#define LOCAL_I915_EXEC_NO_RELOC (1<<11)
#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
@@ -246,9 +256,11 @@ int main(int argc, char **argv)
default:
break;
}
-
}
+ /* Prevent CPU sleeps so that busy and idle loads are consistent. */
+ force_low_latency();
+
busy = calloc(ncpus, sizeof(*busy));
if (enable_gem_sysbusy) {
for (n = 0; n < ncpus; n++) {