All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t v2] tests/gem_lmem_swapping: add some coverage for big objects
Date: Tue,  9 Aug 2022 11:26:38 +0100	[thread overview]
Message-ID: <20220809102638.146913-1-matthew.auld@intel.com> (raw)

Everything we are testing here unfortunately fits within one packet (8M)
which means we have zero coverage when we need to split the copy over
multiple packets (including the aux CCS state).

v2:
 - Add some coverage for 2G objects, just to see if something blows up
   with overflowing int. (Ram)
 - Just make TEST_RANDOM use bigger sizes to ensure we get coverage of
   objects that require splitting the copy into multiple packets.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Ramalingam C <ramalingam.c@intel.com>
---
 tests/i915/gem_lmem_swapping.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_lmem_swapping.c b/tests/i915/gem_lmem_swapping.c
index 1a4f4ca5..cccdb319 100644
--- a/tests/i915/gem_lmem_swapping.c
+++ b/tests/i915/gem_lmem_swapping.c
@@ -63,6 +63,7 @@ struct params {
 #define TEST_ENGINES	(1 << 4)
 #define TEST_MULTI	(1 << 5)
 #define TEST_CCS	(1 << 6)
+#define TEST_MASSIVE	(1 << 7)
 	unsigned int flags;
 	unsigned int seed;
 	bool oom_test;
@@ -477,8 +478,8 @@ static void fill_params(int i915, struct params *params,
 {
 	const int swap_mb = /* For lmem, swap is total of smem + swap. */
 		igt_get_total_ram_mb() + igt_get_total_swap_mb();
-	const unsigned int size = 1 << 20;
 	const int max_swap_pct = 75;
+	unsigned int size;
 	/*
 	 * In random mode, add 85% hard limit to use system memory.
 	 * noticed that 88.8% can trigger OOM on some system.
@@ -487,12 +488,23 @@ static void fill_params(int i915, struct params *params,
 	int spill_mb;
 	uint32_t handle;
 
+	size = 1 << 20;
+	if (flags & TEST_MASSIVE)
+		size = 1u << 31;
+
 	if (flags & TEST_RANDOM) {
 		params->size.min = 4096;
 		handle = create_bo(i915, &params->size.min, &region->region,
 				   do_oom_test);
 		gem_close(i915, handle);
-		params->size.max = 2 * size + params->size.min;
+		/*
+		 * Big enough to ensure we need to split the copy (both the
+		 * actual pages and aux CCS state) into multiple packets. Also
+		 * larger enough to ensure we get a mix of 64K and 2M GTT pages
+		 * (1G GTT pages are still missing from the kernel).
+		 */
+		params->size.max = (1ul << 24) + size + params->size.min;
+		size = params->size.max;
 	} else {
 		params->size.min = size;
 		params->size.max = size;
@@ -733,6 +745,8 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		unsigned int flags;
 	} *test, tests[] = {
 		{ "basic", 0 },
+		{ "massive",  TEST_MASSIVE }, /* check for (int) overflows */
+		{ "massive-random",  TEST_RANDOM | TEST_MASSIVE },
 		{ "random", TEST_RANDOM },
 		{ "random-engines", TEST_RANDOM | TEST_ENGINES },
 		{ "heavy-random", TEST_RANDOM | TEST_HEAVY },
-- 
2.37.1


WARNING: multiple messages have this Message-ID (diff)
From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2] tests/gem_lmem_swapping: add some coverage for big objects
Date: Tue,  9 Aug 2022 11:26:38 +0100	[thread overview]
Message-ID: <20220809102638.146913-1-matthew.auld@intel.com> (raw)

Everything we are testing here unfortunately fits within one packet (8M)
which means we have zero coverage when we need to split the copy over
multiple packets (including the aux CCS state).

v2:
 - Add some coverage for 2G objects, just to see if something blows up
   with overflowing int. (Ram)
 - Just make TEST_RANDOM use bigger sizes to ensure we get coverage of
   objects that require splitting the copy into multiple packets.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Ramalingam C <ramalingam.c@intel.com>
---
 tests/i915/gem_lmem_swapping.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_lmem_swapping.c b/tests/i915/gem_lmem_swapping.c
index 1a4f4ca5..cccdb319 100644
--- a/tests/i915/gem_lmem_swapping.c
+++ b/tests/i915/gem_lmem_swapping.c
@@ -63,6 +63,7 @@ struct params {
 #define TEST_ENGINES	(1 << 4)
 #define TEST_MULTI	(1 << 5)
 #define TEST_CCS	(1 << 6)
+#define TEST_MASSIVE	(1 << 7)
 	unsigned int flags;
 	unsigned int seed;
 	bool oom_test;
@@ -477,8 +478,8 @@ static void fill_params(int i915, struct params *params,
 {
 	const int swap_mb = /* For lmem, swap is total of smem + swap. */
 		igt_get_total_ram_mb() + igt_get_total_swap_mb();
-	const unsigned int size = 1 << 20;
 	const int max_swap_pct = 75;
+	unsigned int size;
 	/*
 	 * In random mode, add 85% hard limit to use system memory.
 	 * noticed that 88.8% can trigger OOM on some system.
@@ -487,12 +488,23 @@ static void fill_params(int i915, struct params *params,
 	int spill_mb;
 	uint32_t handle;
 
+	size = 1 << 20;
+	if (flags & TEST_MASSIVE)
+		size = 1u << 31;
+
 	if (flags & TEST_RANDOM) {
 		params->size.min = 4096;
 		handle = create_bo(i915, &params->size.min, &region->region,
 				   do_oom_test);
 		gem_close(i915, handle);
-		params->size.max = 2 * size + params->size.min;
+		/*
+		 * Big enough to ensure we need to split the copy (both the
+		 * actual pages and aux CCS state) into multiple packets. Also
+		 * larger enough to ensure we get a mix of 64K and 2M GTT pages
+		 * (1G GTT pages are still missing from the kernel).
+		 */
+		params->size.max = (1ul << 24) + size + params->size.min;
+		size = params->size.max;
 	} else {
 		params->size.min = size;
 		params->size.max = size;
@@ -733,6 +745,8 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		unsigned int flags;
 	} *test, tests[] = {
 		{ "basic", 0 },
+		{ "massive",  TEST_MASSIVE }, /* check for (int) overflows */
+		{ "massive-random",  TEST_RANDOM | TEST_MASSIVE },
 		{ "random", TEST_RANDOM },
 		{ "random-engines", TEST_RANDOM | TEST_ENGINES },
 		{ "heavy-random", TEST_RANDOM | TEST_HEAVY },
-- 
2.37.1

             reply	other threads:[~2022-08-09 10:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09 10:26 Matthew Auld [this message]
2022-08-09 10:26 ` [igt-dev] [PATCH i-g-t v2] tests/gem_lmem_swapping: add some coverage for big objects Matthew Auld
2022-08-09 10:55 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/gem_lmem_swapping: add some coverage for big objects (rev2) Patchwork
2022-08-09 11:41 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-08-09 13:14 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-08-16  8:06 ` [Intel-gfx] [PATCH i-g-t v2] tests/gem_lmem_swapping: add some coverage for big objects Das, Nirmoy
2022-08-16  8:06   ` [igt-dev] " Das, Nirmoy

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=20220809102638.146913-1-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.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.