mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-24 14:45:46 +00:00
gem_flink_race/prime_self_import: Improve test reliability
gem_flink_race and prime_self_import have subtests which read the number of open gem objects from debugfs to determine if objects have leaked during the test. However the test can fail sporadically if the number of gem objects changes due to other process activity. This patch introduces a change to check the number of gem objects several times to filter out any fluctuations. v2: Moved the common code to a library and made the loop android specific (Daniel Vetter) v3: Renamed get_stable_obj_count -> igt_get_stable_obj_count Signed-off-by: Derek Morton <derek.j.morton@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
committed by
Daniel Vetter
parent
5a8d063e42
commit
3953d2dd22
+3
-22
@@ -44,28 +44,11 @@ IGT_TEST_DESCRIPTION("Check for flink/open vs. gem close races.");
|
||||
* in the flink name and corresponding reference getting leaked.
|
||||
*/
|
||||
|
||||
/* We want lockless and I'm to lazy to dig out an atomic libarary. On x86 this
|
||||
/* We want lockless and I'm to lazy to dig out an atomic library. On x86 this
|
||||
* works, too. */
|
||||
volatile int pls_die = 0;
|
||||
int fd;
|
||||
|
||||
static int get_object_count(void)
|
||||
{
|
||||
FILE *file;
|
||||
int scanned, ret;
|
||||
|
||||
igt_drop_caches_set(DROP_RETIRE | DROP_ACTIVE);
|
||||
|
||||
file = igt_debugfs_fopen("i915_gem_objects", "r");
|
||||
|
||||
scanned = fscanf(file, "%i objects", &ret);
|
||||
igt_assert_eq(scanned, 1);
|
||||
igt_debug("Reports %d objects\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void *thread_fn_flink_name(void *p)
|
||||
{
|
||||
struct drm_gem_open open_struct;
|
||||
@@ -164,8 +147,7 @@ static void test_flink_close(void)
|
||||
* up the counts */
|
||||
fake = drm_open_driver(DRIVER_INTEL);
|
||||
|
||||
gem_quiescent_gpu(fake);
|
||||
obj_count = get_object_count();
|
||||
obj_count = igt_get_stable_obj_count(fake);
|
||||
|
||||
num_threads = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
|
||||
@@ -190,8 +172,7 @@ static void test_flink_close(void)
|
||||
|
||||
close(fd);
|
||||
|
||||
gem_quiescent_gpu(fake);
|
||||
obj_count = get_object_count() - obj_count;
|
||||
obj_count = igt_get_stable_obj_count(fake) - obj_count;
|
||||
|
||||
igt_info("leaked %i objects\n", obj_count);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user