diff mbox series

[i-g-t,v3] tests/gem_lmem_swapping: limit lmem to 4G

Message ID 20220328100859.13550-1-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [i-g-t,v3] tests/gem_lmem_swapping: limit lmem to 4G | expand

Commit Message

Matthew Auld March 28, 2022, 10:08 a.m. UTC
From: CQ Tang <cq.tang@intel.com>

On some systems lmem can be as large as 16G, which seems to trigger
various CI timeouts, and in the best case just takes a long time. For
the purposes of the test we should be able to limit to 4G, without any
big loss in coverage.

v2:
 - No need to try again without the modparam; if it's not supported it
   will still load the driver just fine.
v3(Petri):
 - Add a helpful debug print in case the kernel is missing support for
   the lmem_size modparam.

Signed-off-by: CQ Tang <cq.tang@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Nirmoy Das <nirmoy.das@linux.intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
---
 tests/i915/gem_lmem_swapping.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Petri Latvala March 28, 2022, 11:18 a.m. UTC | #1
On Mon, Mar 28, 2022 at 11:08:59AM +0100, Matthew Auld wrote:
> From: CQ Tang <cq.tang@intel.com>
> 
> On some systems lmem can be as large as 16G, which seems to trigger
> various CI timeouts, and in the best case just takes a long time. For
> the purposes of the test we should be able to limit to 4G, without any
> big loss in coverage.
> 
> v2:
>  - No need to try again without the modparam; if it's not supported it
>    will still load the driver just fine.
> v3(Petri):
>  - Add a helpful debug print in case the kernel is missing support for
>    the lmem_size modparam.
> 
> Signed-off-by: CQ Tang <cq.tang@intel.com>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Nirmoy Das <nirmoy.das@linux.intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
>  tests/i915/gem_lmem_swapping.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/i915/gem_lmem_swapping.c b/tests/i915/gem_lmem_swapping.c
> index 31644bcd..6cf1acec 100644
> --- a/tests/i915/gem_lmem_swapping.c
> +++ b/tests/i915/gem_lmem_swapping.c
> @@ -526,11 +526,20 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
>  
>  	igt_fixture {
>  		struct intel_execution_engine2 *e;
> +		char *tmp;
>  
> -		i915 = drm_open_driver(DRIVER_INTEL);
> +		igt_i915_driver_unload();
> +		igt_assert_eq(igt_i915_driver_load("lmem_size=4096"), 0);
> +
> +		i915 = __drm_open_driver(DRIVER_INTEL);
>  		igt_require_gem(i915);
>  		igt_require(gem_has_lmem(i915));
>  
> +		tmp = __igt_params_get(i915, "lmem_size");
> +		if (!tmp)
> +			igt_info("lmem_size modparam not supported on this kernel. Continuing with full lmem size. This may result in CI timeouts.");
> +		free(tmp);

Newline at the end missing. With that added,
Reviewed-by: Petri Latvala <petri.latvala@intel.com>

> +
>  		regions = gem_get_query_memory_regions(i915);
>  		igt_require(regions);
>  
> @@ -556,6 +565,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
>  		intel_ctx_destroy(i915, ctx);
>  		free(regions);
>  		close(i915);
> +		igt_i915_driver_unload();
>  	}
>  
>  	igt_exit();
> -- 
> 2.34.1
>
Tvrtko Ursulin April 8, 2022, 8:56 a.m. UTC | #2
On 28/03/2022 12:18, Petri Latvala wrote:
> On Mon, Mar 28, 2022 at 11:08:59AM +0100, Matthew Auld wrote:
>> From: CQ Tang <cq.tang@intel.com>
>>
>> On some systems lmem can be as large as 16G, which seems to trigger
>> various CI timeouts, and in the best case just takes a long time. For
>> the purposes of the test we should be able to limit to 4G, without any
>> big loss in coverage.
>>
>> v2:
>>   - No need to try again without the modparam; if it's not supported it
>>     will still load the driver just fine.
>> v3(Petri):
>>   - Add a helpful debug print in case the kernel is missing support for
>>     the lmem_size modparam.
>>
>> Signed-off-by: CQ Tang <cq.tang@intel.com>
>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Cc: Nirmoy Das <nirmoy.das@linux.intel.com>
>> Cc: Petri Latvala <petri.latvala@intel.com>
>> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
>> ---
>>   tests/i915/gem_lmem_swapping.c | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/i915/gem_lmem_swapping.c b/tests/i915/gem_lmem_swapping.c
>> index 31644bcd..6cf1acec 100644
>> --- a/tests/i915/gem_lmem_swapping.c
>> +++ b/tests/i915/gem_lmem_swapping.c
>> @@ -526,11 +526,20 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
>>   
>>   	igt_fixture {
>>   		struct intel_execution_engine2 *e;
>> +		char *tmp;
>>   
>> -		i915 = drm_open_driver(DRIVER_INTEL);
>> +		igt_i915_driver_unload();
>> +		igt_assert_eq(igt_i915_driver_load("lmem_size=4096"), 0);
>> +
>> +		i915 = __drm_open_driver(DRIVER_INTEL);
>>   		igt_require_gem(i915);
>>   		igt_require(gem_has_lmem(i915));
>>   
>> +		tmp = __igt_params_get(i915, "lmem_size");
>> +		if (!tmp)
>> +			igt_info("lmem_size modparam not supported on this kernel. Continuing with full lmem size. This may result in CI timeouts.");
>> +		free(tmp);
> 
> Newline at the end missing. With that added,
> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
> 
>> +
>>   		regions = gem_get_query_memory_regions(i915);
>>   		igt_require(regions);
>>   
>> @@ -556,6 +565,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
>>   		intel_ctx_destroy(i915, ctx);
>>   		free(regions);
>>   		close(i915);
>> +		igt_i915_driver_unload();

If this causes an extra module unload on legacy platforms just after 
tests skips due not having local memory, is it a good idea? Would it 
make sense to move the skip to before unload and reload with lmem_size 
param and only unload if that condition was passed?

Regards,

Tvrtko

>>   	}
>>   
>>   	igt_exit();
>> -- 
>> 2.34.1
>>
diff mbox series

Patch

diff --git a/tests/i915/gem_lmem_swapping.c b/tests/i915/gem_lmem_swapping.c
index 31644bcd..6cf1acec 100644
--- a/tests/i915/gem_lmem_swapping.c
+++ b/tests/i915/gem_lmem_swapping.c
@@ -526,11 +526,20 @@  igt_main_args("", long_options, help_str, opt_handler, NULL)
 
 	igt_fixture {
 		struct intel_execution_engine2 *e;
+		char *tmp;
 
-		i915 = drm_open_driver(DRIVER_INTEL);
+		igt_i915_driver_unload();
+		igt_assert_eq(igt_i915_driver_load("lmem_size=4096"), 0);
+
+		i915 = __drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(i915);
 		igt_require(gem_has_lmem(i915));
 
+		tmp = __igt_params_get(i915, "lmem_size");
+		if (!tmp)
+			igt_info("lmem_size modparam not supported on this kernel. Continuing with full lmem size. This may result in CI timeouts.");
+		free(tmp);
+
 		regions = gem_get_query_memory_regions(i915);
 		igt_require(regions);
 
@@ -556,6 +565,7 @@  igt_main_args("", long_options, help_str, opt_handler, NULL)
 		intel_ctx_destroy(i915, ctx);
 		free(regions);
 		close(i915);
+		igt_i915_driver_unload();
 	}
 
 	igt_exit();