summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2022-08-09 11:26:38 +0100
committerMatthew Auld <matthew.auld@intel.com>2022-08-16 09:10:39 +0100
commit0aa9bc7e9074826a60f17abd697f94de2ca4ffbf (patch)
tree498c8c72114894ade8687216654fafc7fed126b1
parent2336caefa245c6e4bfc6991a000063c25b76f70d (diff)
tests/gem_lmem_swapping: add some coverage for big objects
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> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
-rw-r--r--tests/i915/gem_lmem_swapping.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/i915/gem_lmem_swapping.c b/tests/i915/gem_lmem_swapping.c
index 1a4f4ca5b..cccdb3195 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 },