On Thu, Feb 02, 2017 at 12:41:42PM +0000, Tvrtko Ursulin wrote: > > On 01/02/2017 11:34, Chris Wilson wrote: > >On Wed, Feb 01, 2017 at 11:17:39AM +0000, Tvrtko Ursulin wrote: > > >>>+ > >>>+ for (npages = npages_funcs; *npages; npages++) { > >>>+ prandom_seed_state(&prng, > >>>+ i915_selftest.random_seed); > >>>+ if (!alloc_table(&pt, sz, sz, *npages, &prng)) > >>>+ return 0; /* out of memory, give up */ > >> > >>You don't have skip status? Sounds not ideal to silently abort. > > > >It runs until we use all physical memory, if left to its own devices. It's > >not a skip if we have already completed some tests. ENOMEM of the test > >setup itself is not what I'm testing for here, the test is for the > >iterators. > > But suppose you mess up the test so the starting condition asks for > impossible amount of memory but the test claims it passed. I don't > think that is a good behaviour. Returing ENOMEM when the failure is intentional is not an option either. diff --git a/drivers/gpu/drm/i915/selftests/scatterlist.c b/drivers/gpu/drm/i915/selftests/scatterlist.c index fa5bd09c863f..5eb732231749 100644 --- a/drivers/gpu/drm/i915/selftests/scatterlist.c +++ b/drivers/gpu/drm/i915/selftests/scatterlist.c @@ -245,6 +245,7 @@ static int igt_sg_alloc(void *ignored) const unsigned long max_order = 20; /* approximating a 4GiB object */ struct rnd_state prng; unsigned long prime; + int alloc_error = -ENOMEM; for_each_prime_number(prime, max_order) { unsigned long size = BIT(prime); @@ -260,7 +261,7 @@ static int igt_sg_alloc(void *ignored) prandom_seed_state(&prng, i915_selftest.random_seed); if (!alloc_table(&pt, sz, sz, *npages, &prng)) - return 0; /* out of memory, give up */ + return alloc_error; prandom_seed_state(&prng, i915_selftest.random_seed); @@ -270,6 +271,8 @@ static int igt_sg_alloc(void *ignored) sg_free_table(&pt.st); if (err) return err; + + alloc_error = 0; } } } -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx