On Wed, Feb 01, 2017 at 11:17:39AM +0000, Tvrtko Ursulin wrote:
> >+static noinline int expect_pfn_sg(struct pfn_table *pt,
> 
> Why noinline?

So they show up in perf individually.

> >+
> >+                    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.
 
> >+
> >+                            prandom_seed_state(&prng,
> >+                                               i915_selftest.random_seed);
> >+                            err = expect_pfn_sgtable(&pt, *npages, &prng,
> >+                                                     "sg_alloc_table",
> >+                                                     end_time);
> 
> Random numbers you use are guaranteed to be the same sequence after
> you re-set the seed? Probably yes since otherwise this wouldn't have
> ever worked.. I just remember some discussion on what source we use
> and it looked like we might be using proper random numbers on some
> CPUs, or even urandom which I didn't think has that property.

It's a completely deterministic prng. get_random_int() is the urandom
equivalent.

> >+static int igt_sg_trim(void *ignored)
> >+{
> >+    IGT_TIMEOUT(end_time);
> >+    const unsigned long max = PAGE_SIZE; /* not prime! */
> >+    struct pfn_table pt;
> >+    unsigned long prime;
> >+
> >+    for_each_prime_number(prime, max) {
> >+            const npages_fn_t *npages;
> >+            int err;
> >+
> >+            for (npages = npages_funcs; *npages; npages++) {
> >+                    struct rnd_state prng;
> >+
> >+                    prandom_seed_state(&prng, i915_selftest.random_seed);
> >+                    if (!alloc_table(&pt, prime, max, *npages, &prng))
> >+                            return 0; /* out of memory, give up */
> >+
> >+                    err = 0;
> >+                    if (i915_sg_trim(&pt.st)) {
> >+                            if (pt.st.orig_nents != prime ||
> >+                                pt.st.nents != prime) {
> >+                                    pr_err("i915_sg_trim failed (nents %u, 
> >orig_nents %u), expected %lu\n",
> >+                                           pt.st.nents, pt.st.orig_nents, 
> >prime);
> >+                                    err = -EINVAL;
> >+                            } else {
> >+                                    prandom_seed_state(&prng,
> >+                                                       
> >i915_selftest.random_seed);
> >+                                    err = expect_pfn_sgtable(&pt,
> >+                                                             *npages, &prng,
> >+                                                             "i915_sg_trim",
> >+                                                             end_time);
> >+                            }
> >+                    }
> 
> Similar to alloc_table failures above - no log or action when
> i915_sg_trim fails due out of memory?

No, simply because that's an expected and acceptable result. The
question should be whether we always want to check after sg_trim.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to