From f942e42815ad81901dbccd984d0f8a4775826be7 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 8 May 2016 20:58:26 +0100 Subject: benchmarks/gem_latency: Revert to unsafe mmio access on gen7 In theory, we need to only worry about concurrent mmio writes to the same cacheline. So far, disabling the spinlock hasn't hung the machine. Signed-off-by: Chris Wilson --- benchmarks/gem_latency.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'benchmarks/gem_latency.c') diff --git a/benchmarks/gem_latency.c b/benchmarks/gem_latency.c index d9cb44e3..4b36d5ae 100644 --- a/benchmarks/gem_latency.c +++ b/benchmarks/gem_latency.c @@ -55,14 +55,9 @@ static volatile uint32_t *timestamp_reg; #define REG(x) (volatile uint32_t *)((volatile char *)igt_global_mmio + x) #define REG_OFFSET(x) ((volatile char *)(x) - (volatile char *)igt_global_mmio) -static uint32_t read_timestamp_unlocked(void) -{ - return *timestamp_reg; -} -static uint32_t (*read_timestamp)(void) = read_timestamp_unlocked; - -#ifdef __USE_XOPEN2K +#if defined(__USE_XOPEN2K) && defined(gen7_safe_mmio) static pthread_spinlock_t timestamp_lock; + static uint32_t read_timestamp_locked(void) { uint32_t t; @@ -81,10 +76,23 @@ static int setup_timestamp_locked(void) read_timestamp = read_timestamp_locked; return 1; } + +static uint32_t read_timestamp_unlocked(void) +{ + return *timestamp_reg; +} + +static uint32_t (*read_timestamp)(void) = read_timestamp_unlocked; + #else static int setup_timestamp_locked(void) { - return 0; + return 1; +} + +inline static uint32_t read_timestamp(void) +{ + return *timestamp_reg; } #endif -- cgit v1.2.3