summaryrefslogtreecommitdiff
path: root/tests/i915/gem_mmap_gtt.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-10-22 15:52:19 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-10-23 11:26:49 +0100
commit7dd2fe99bd9dde00456cc5abf7e5ef0c8d7d6118 (patch)
tree17bd491d4bde7db4adc2c92cc615dac90d72ef56 /tests/i915/gem_mmap_gtt.c
parentb4bcf05cb9839037128905deda7146434155cc41 (diff)
i915/gem_mmap_gtt: Trim object size for ptracing
For verifying vm_ops.access we only need a page or two to check we both advance across a page boundary and find the right offset within a page. 16MiB is overkill for the slow uncached reads through the slow ptrace interface, so reduce the object size by a couple of orders of magnitude. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2425 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_mmap_gtt.c')
-rw-r--r--tests/i915/gem_mmap_gtt.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index 6637bba0..3cce19e9 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -525,6 +525,7 @@ static void *memchr_inv(const void *s, int c, size_t n)
static void
test_ptrace(int fd)
{
+ unsigned long sz = 16 * 4096;
unsigned long AA, CC;
unsigned long *gtt, *cpy;
uint32_t bo;
@@ -533,16 +534,16 @@ test_ptrace(int fd)
memset(&AA, 0xaa, sizeof(AA));
memset(&CC, 0x55, sizeof(CC));
- cpy = malloc(OBJECT_SIZE);
- memset(cpy, AA, OBJECT_SIZE);
+ cpy = malloc(sz);
+ memset(cpy, AA, sz);
- bo = gem_create(fd, OBJECT_SIZE);
- gtt = mmap_bo(fd, bo, OBJECT_SIZE);
- memset(gtt, CC, OBJECT_SIZE);
+ bo = gem_create(fd, sz);
+ gtt = mmap_bo(fd, bo, sz);
+ memset(gtt, CC, sz);
gem_close(fd, bo);
- igt_assert(!memchr_inv(gtt, CC, OBJECT_SIZE));
- igt_assert(!memchr_inv(cpy, AA, OBJECT_SIZE));
+ igt_assert(!memchr_inv(gtt, CC, sz));
+ igt_assert(!memchr_inv(cpy, AA, sz));
igt_fork(child, 1) {
ptrace(PTRACE_TRACEME, 0, NULL, NULL);
@@ -553,7 +554,7 @@ test_ptrace(int fd)
pid = wait(NULL);
ptrace(PTRACE_ATTACH, pid, NULL, NULL);
- for (int i = 0; i < OBJECT_SIZE / sizeof(long); i++) {
+ for (int i = 0; i < sz / sizeof(long); i++) {
long ret;
ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i);
@@ -570,10 +571,10 @@ test_ptrace(int fd)
igt_waitchildren();
/* The contents of the two buffers should now be swapped */
- igt_assert(!memchr_inv(gtt, AA, OBJECT_SIZE));
- igt_assert(!memchr_inv(cpy, CC, OBJECT_SIZE));
+ igt_assert(!memchr_inv(gtt, AA, sz));
+ igt_assert(!memchr_inv(cpy, CC, sz));
- munmap(gtt, OBJECT_SIZE);
+ munmap(gtt, sz);
free(cpy);
}