From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: ankitprasad.r.sharma@intel.com, intel-gfx@lists.freedesktop.org
Cc: akash.goel@intel.com, shashidhar.hiremath@intel.com
Subject: Re: [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj
Date: Wed, 22 Jul 2015 17:14:21 +0100 [thread overview]
Message-ID: <55AFC15D.7060204@linux.intel.com> (raw)
In-Reply-To: <1437572727-19084-3-git-send-email-ankitprasad.r.sharma@intel.com>
Hi,
On 07/22/2015 02:45 PM, ankitprasad.r.sharma@intel.com wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>
> This patch adds support to verify pread/pwrite for non-shmem backed
> objects. It also shows the pread/pwrite speed.
> It also tests speeds for pread with and without user side page faults
>
> v2: Fixed Rebase conflicts (Ankit)
>
> v3: Precalculating values to avoid redundant function calls (Dave)
> Replaced igt_subtest by igt_subtest_f, added asserts for mmap, corrected
> indentation (Tvrtko)
>
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma at intel.com>
> ---
> tests/gem_pread.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++---
> tests/gem_pwrite.c | 54 ++++++++++++++++++++++++---
> 2 files changed, 149 insertions(+), 11 deletions(-)
>
> diff --git a/tests/gem_pread.c b/tests/gem_pread.c
> index cc83948..21fccd0 100644
> --- a/tests/gem_pread.c
> +++ b/tests/gem_pread.c
> @@ -41,6 +41,10 @@
> #include "drmtest.h"
>
> #define OBJECT_SIZE 16384
> +#define LARGE_OBJECT_SIZE 1024 * 1024
> +#define KGRN "\x1B[32m"
> +#define KRED "\x1B[31m"
> +#define KNRM "\x1B[0m"
>
> static void do_gem_read(int fd, uint32_t handle, void *buf, int len, int loops)
> {
> @@ -76,12 +80,16 @@ static const char *bytes_per_sec(char *buf, double v)
>
>
> uint32_t *src, dst;
> +uint32_t *dst_user, src_stolen, large_stolen;
> +uint32_t *stolen_pf_user, *stolen_nopf_user;
> int fd, count;
>
> int main(int argc, char **argv)
> {
> int object_size = 0;
> + double usecs;
> uint32_t buf[20];
Well you could have changed this to char buf[something big], all the
users do (char *)buf and you have touched all (or at least a lot of)
lines which do that...
> + char* bps;
> const struct {
> int level;
> const char *name;
> @@ -106,6 +114,8 @@ int main(int argc, char **argv)
>
> dst = gem_create(fd, object_size);
> src = malloc(object_size);
> + src_stolen = gem_create_stolen(fd, object_size);
> + dst_user = malloc(object_size);
> }
>
> igt_subtest("normal") {
> @@ -115,10 +125,10 @@ int main(int argc, char **argv)
> gettimeofday(&start, NULL);
> do_gem_read(fd, dst, src, object_size, count);
> gettimeofday(&end, NULL);
> + usecs = elapsed(&start, &end, count);
> + bps = bytes_per_sec((char *)buf, object_size/usecs*1e6);
> igt_info("Time to pread %d bytes x %6d: %7.3fµs, %s\n",
> - object_size, count,
> - elapsed(&start, &end, count),
> - bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
> + object_size, count, usecs, bps);
> fflush(stdout);
> }
> }
> @@ -133,18 +143,102 @@ int main(int argc, char **argv)
> gettimeofday(&start, NULL);
> do_gem_read(fd, dst, src, object_size, count);
> gettimeofday(&end, NULL);
> + usecs = elapsed(&start, &end, count);
> + bps = bytes_per_sec((char *)buf, object_size/usecs*1e6);
> igt_info("Time to %s pread %d bytes x %6d: %7.3fµs, %s\n",
> - c->name, object_size, count,
> - elapsed(&start, &end, count),
> - bytes_per_sec((char *)buf, object_size/elapsed(&start, &end, count)*1e6));
> + c->name, object_size, count, usecs, bps);
> fflush(stdout);
> }
> }
> }
>
> + igt_subtest("stolen-normal") {
> + for (count = 1; count <= 1<<17; count <<= 1) {
> + struct timeval start, end;
> +
> + gettimeofday(&start, NULL);
> + do_gem_read(fd, src_stolen, dst_user, object_size, count);
> + gettimeofday(&end, NULL);
> + usecs = elapsed(&start, &end, count);
> + bps = bytes_per_sec((char *)buf, object_size/usecs*1e6);
> + igt_info("Time to pread %d bytes x %6d: %7.3fµs, %s\n",
> + object_size, count, usecs, bps);
> + fflush(stdout);
> + }
> + }
> + for (c = cache; c->level != -1; c++) {
> + igt_subtest_f("stolen-%s", c->name) {
> + gem_set_caching(fd, src_stolen, c->level);
> +
> + for (count = 1; count <= 1<<17; count <<= 1) {
> + struct timeval start, end;
> +
> + gettimeofday(&start, NULL);
> + do_gem_read(fd, src_stolen, dst_user,
> + object_size, count);
> + gettimeofday(&end, NULL);
> + usecs = elapsed(&start, &end, count);
> + bps = bytes_per_sec((char *)buf, object_size/usecs*1e6);
> + igt_info("Time to stolen-%s pread %d bytes x %6d: %7.3fµs, %s\n",
> + c->name, object_size, count, usecs, bps);
> + fflush(stdout);
> + }
> + }
> + }
> +
> + /* List the time taken in pread operation for stolen objects, with
> + * and without the overhead of page fault handling on accessing the
> + * user space buffer
> + */
> + igt_subtest("pagefault-pread") {
> + large_stolen = gem_create_stolen(fd, LARGE_OBJECT_SIZE);
> + stolen_nopf_user = (uint32_t *) mmap(NULL, LARGE_OBJECT_SIZE,
> + PROT_WRITE,
> + MAP_ANONYMOUS|MAP_PRIVATE,
> + -1, 0);
> + igt_assert(stolen_nopf_user);
> +
> + for (count = 1; count <= 10; count ++) {
> + struct timeval start, end;
> + double t_elapsed = 0;
> +
> + gettimeofday(&start, NULL);
> + do_gem_read(fd, large_stolen, stolen_nopf_user,
> + LARGE_OBJECT_SIZE, 1);
> + gettimeofday(&end, NULL);
> + t_elapsed = elapsed(&start, &end, 1);
> + bps = bytes_per_sec((char *)buf, object_size/t_elapsed*1e6);
> + igt_info("Pagefault-N - Time to pread %d bytes: %7.3fµs, %s\n",
> + LARGE_OBJECT_SIZE, t_elapsed, bps);
> +
> + stolen_pf_user = (uint32_t *) mmap(NULL, LARGE_OBJECT_SIZE,
> + PROT_WRITE,
> + MAP_ANONYMOUS|MAP_PRIVATE,
> + -1, 0);
> + igt_assert(stolen_pf_user);
> +
> + gettimeofday(&start, NULL);
> + do_gem_read(fd, large_stolen, stolen_pf_user,
> + LARGE_OBJECT_SIZE, 1);
> + gettimeofday(&end, NULL);
> + usecs = elapsed(&start, &end, count);
> + bps = bytes_per_sec((char *)buf, object_size/usecs*1e6);
> + igt_info("Pagefault-Y - Time to pread %d bytes: %7.3fµs, %s%s%s\n",
> + LARGE_OBJECT_SIZE, usecs,
> + t_elapsed < usecs ? KGRN : KRED, bps, KNRM);
> + fflush(stdout);
> + munmap(stolen_pf_user, LARGE_OBJECT_SIZE);
> + }
> + munmap(stolen_nopf_user, LARGE_OBJECT_SIZE);
> + gem_close(fd, large_stolen);
> + }
> +
> +
> igt_fixture {
> free(src);
> gem_close(fd, dst);
> + free(dst_user);
> + gem_close(fd, src_stolen);
>
> close(fd);
> }
> diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c
> index 5b6a77f..892c531 100644
> --- a/tests/gem_pwrite.c
> +++ b/tests/gem_pwrite.c
> @@ -135,11 +135,14 @@ static void test_big_gtt(int fd, int scale)
> }
>
> uint32_t *src, dst;
> +uint32_t *src_user, dst_stolen;
> int fd;
>
> int main(int argc, char **argv)
> {
> int object_size = 0;
> + double usecs;
> + char* bps;
> uint32_t buf[20];
> int count;
> const struct {
> @@ -150,6 +153,9 @@ int main(int argc, char **argv)
> { 1, "snoop" },
> { 2, "display" },
> { -1 },
> + { -1, "stolen-uncached"},
> + { -1, "stolen-snoop"},
> + { -1, "stolen-display"},
Oh you kept this hack and corresponding "c + 4" here. ;(
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-07-22 16:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 13:45 [PATCH v3 0/3] Tests for verifying the old and extended GEM_CREATE ioctl ankitprasad.r.sharma
2015-07-22 13:45 ` [PATCH 1/3] igt/gem_stolen: Verifying extended gem_create ioctl ankitprasad.r.sharma
2015-07-22 16:00 ` Tvrtko Ursulin
2015-07-22 13:45 ` [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj ankitprasad.r.sharma
2015-07-22 16:14 ` Tvrtko Ursulin [this message]
2015-07-22 13:45 ` [PATCH 3/3] igt/gem_create: Test to validate parameters for GEM_CREATE ioctl ankitprasad.r.sharma
2015-07-23 9:45 ` Tvrtko Ursulin
-- strict thread matches above, loose matches on Subject: below --
2015-09-15 8:36 [PATCH v4 0/3] Tests for verifying the old and extended " ankitprasad.r.sharma
2015-09-15 8:36 ` [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj ankitprasad.r.sharma
2015-09-15 15:35 ` Tvrtko Ursulin
2015-07-01 9:26 [PATCH v2 0/3] Tests for verifying the old and extended GEM_CREATE ioctl ankitprasad.r.sharma
2015-07-01 9:26 ` [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj ankitprasad.r.sharma
2015-07-03 9:37 ` Tvrtko Ursulin
2015-07-06 14:33 ` Dave Gordon
2015-07-21 12:38 ` Ankitprasad Sharma
2015-05-13 11:53 [PATCH 0/3] Tests for verifying the old and extended GEM_CREATE ioctl ankitprasad.r.sharma
2015-05-13 11:53 ` [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj ankitprasad.r.sharma
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=55AFC15D.7060204@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=akash.goel@intel.com \
--cc=ankitprasad.r.sharma@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=shashidhar.hiremath@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.