From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] i915/gem_mmap_gtt: Trim object size for ptracing
Date: Fri, 23 Oct 2020 13:21:45 +0300 [thread overview]
Message-ID: <87tuulqm2u.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20201022150943.3041180-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> 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.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> tests/i915/gem_mmap_gtt.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
> index 6637bba06..3cce19e9a 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);
> }
>
> --
> 2.28.0
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2020-10-23 10:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 15:09 [Intel-gfx] [PATCH i-g-t] i915/gem_mmap_gtt: Trim object size for ptracing Chris Wilson
2020-10-23 10:21 ` Mika Kuoppala [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tuulqm2u.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox