summaryrefslogtreecommitdiff
path: root/tests/i915/gem_pwrite.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-02-29 10:50:06 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2020-02-29 10:59:02 +0000
commitd6cebd806cef8693201eaa4e86ac98763bf47e0c (patch)
treed71722e3938251b23d5eb7f305717756caf1d1ed /tests/i915/gem_pwrite.c
parent0c01647760d5b64ec4fa8b60c4058fec777b80b0 (diff)
i915/gem_pwrite: Replace exhaustive tests with bounded probes
Our current tests for pwrite do an exhaustive test of each page within the object in multiple directions to try and trick the page lookup into flummoxing. This is quite time consuming, so replace those for CI with a just a randomised, time-bounded check. Closes: https://gitlab.freedesktop.org/drm/intel/issues/1283 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_pwrite.c')
-rw-r--r--tests/i915/gem_pwrite.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/tests/i915/gem_pwrite.c b/tests/i915/gem_pwrite.c
index 69f823d5..20e9728b 100644
--- a/tests/i915/gem_pwrite.c
+++ b/tests/i915/gem_pwrite.c
@@ -25,7 +25,6 @@
*
*/
-#include "igt.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
@@ -37,8 +36,12 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/time.h>
+
#include "drm.h"
+#include "igt.h"
+#include "igt_rand.h"
+
#define MiB(x) ((x) * 1024 * 1024)
typedef void *(*mmap_fn_t)(int, uint32_t, uint64_t, uint64_t, unsigned int);
@@ -238,6 +241,41 @@ static void test_big_gtt(int fd, int scale, unsigned flags)
gem_close(fd, handle);
}
+static void test_random(int fd)
+{
+ uint32_t prng = 0xdeadbeef;
+ unsigned long count;
+ uint32_t handle;
+ uint64_t *map;
+ uint64_t size;
+
+ gem_require_mmap_wc(fd);
+
+ size = min(intel_get_total_ram_mb() / 2,
+ gem_mappable_aperture_size() + 4096);
+ intel_require_memory(1, size, CHECK_RAM);
+
+ handle = gem_create(fd, size);
+ map = gem_mmap__wc(fd, handle, 0, size, PROT_WRITE);
+
+ count = 0;
+ igt_until_timeout(5) {
+ uint64_t a = hars_petruska_f54_1_random64(&prng) % (size / sizeof(uint64_t));
+ uint64_t x = hars_petruska_f54_1_random64(&prng);
+
+ gem_write(fd, handle, a * sizeof(x), &x, sizeof(x));
+
+ gem_set_domain(fd, handle, I915_GEM_DOMAIN_WC, 0);
+ igt_assert_eq_u64(map[a], x);
+
+ count++;
+ }
+ igt_info("Completed %lu cycles\n", count);
+
+ munmap(map, handle);
+ gem_close(fd, handle);
+}
+
uint32_t *src, dst;
uint32_t *src_user, dst_stolen;
int fd;
@@ -369,6 +407,9 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL)
gem_close(fd, dst_stolen);
}
+ igt_subtest_f("basic-random")
+ test_random(fd);
+
{
const struct mode {
const char *name;