29 Commits

Author SHA1 Message Date
Chris Wilson
a1b47ef6ae igt/gem_concurrent_blit: Disable libdrm buffer cache for child inheritance
It just ends up with buffer leaks all over. On the flip side, it does
allow us to inherit the bufmgr directly without worry of stomping over
the aliased entries (and causing double closes).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 19:59:16 +00:00
Chris Wilson
37f4da0d98 igt/gem_concurrent_all: Pass buffer data down
In order reduce the number of parameters being passed everywhere, whilst
simultaneously making more information available to the lower levels,
pass the struct buffers around.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 19:59:16 +00:00
Chris Wilson
5f6ebb2cb7 igt/gem_concurrent_blit: Tighter scoping of buffers variable
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 11:44:39 +00:00
Chris Wilson
a64f31b31e igt/gem_concurrent_blit: Close userptr handle after importing into bufmgr
The bufmgr import creates a new handle from a name for the userptr - we
can discard our original handle immediately.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 11:44:39 +00:00
Chris Wilson
6f75990af0 igt/gem_concurrent_blit: Tidy blt-fill using gem wrappers
Replace the open-coded ioctls with the thin gem wrappers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 11:44:39 +00:00
Chris Wilson
d4a05bc009 igt/gem_concurrent_blit: Switch to a shared mmap for userptr
If we use a MAP_SHARED mmaping for the our backing storage for userptr,
then it will be inherited across the fork with the same address. ideal
for continuity testing of children.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-23 09:08:39 +00:00
Chris Wilson
69ecedea73 igt/gem_concurrent_blit: Allocate a private batch cache for the child
We have to avoid the COW alias for the intel_bufmgr and intel_batch
cache as the child may close the object (in its local cache) leaving an
alias in the parent cache pointing to a stale object.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-23 08:18:23 +00:00
Chris Wilson
3eae640b81 igt/gem_concurrent_blit: Disable userptr+child tests
The issue here is that the pointer inherited upon the child is
copied-on-write, i.e. the pointer is private to each process, but the
handle is shared. This means that writes and reads in the child are
going to a different set of pages than the GPU's object - the test is
simply broken. To overcome this we would need to mmap the shared buffer
into the child.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 20:01:55 +00:00
Chris Wilson
4645630d3e igt/gem_concurrent_blit: Check inheritance of buffers
The current forked modes recreate their handles in the children and just
look at any complications arising from contention. This mode looks at
inheriting the fd+handles from the parent into the child and seeing if
we can use them within the child.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 19:40:30 +00:00
Chris Wilson
5b675f7b2f lib: Refactor common detection of missed interrupts
As we have the same function in a few places to read the
debugfs/i915_ring_missed_irq file, move it to the core.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22 17:45:06 +00:00
Chris Wilson
0143d4f337 igt/gem_concurrent_blit: Add userptr backing storage tests
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-21 17:48:01 +00:00
Chris Wilson
92caf138f2 tests: Drop the superfluous igt_require_hang_ring()
As the hang injection now itself checks for validity before use, the
tests don't need to do so themselves. Except in certain situations! If
the test forks, it should do requirement checks before the fork (so that
we don't anger the igt gods) and if the test plays around i915.reset
then it needs to do an early igt_require_hang_ring() that is not
affected by the changes to i915.reset.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-20 13:13:57 +00:00
Chris Wilson
571b876544 gem_concurrent_all: Add a "quick" tiny pass
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-19 14:03:15 +00:00
Chris Wilson
1c61c0f750 gem_concurrent_blit: Add a pread/pwrite variant to only set part of the buffer
The idea is to check partial cacheline reads/writes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-19 14:03:15 +00:00
Chris Wilson
42291f2510 gem_concurrent_blit: Don't call igt_require() outside of a subtest/fixture
gem_concurrent_blit tries to ensure that it doesn't try and run a test
that would grind the system to a halt, i.e. unexpectedly cause swap
thrashing. It currently calls intel_require_memory(), but outside of
the subtest (as the tests use fork, it cannot do requirement testing
within the test children) - but intel_require_memory() calls
igt_require() and triggers and abort. Wrapping that initial require
within an igt_fixture() stops the abort(), but also prevents any further
testing.

This patch restructures the requirement checking to ordinary conditions,
which though allowing the test to run, also prevents listing of subtests
on machines which cannot handle them.
2016-01-19 14:03:15 +00:00
Chris Wilson
1d6e5d3197 igt/gem_concurrent_all: Preparatory work for testing different create flags
In order to do concurrency checks using different allocation functions,
we need to hook those functions up to gem_concurrent_all. So let's add
another layer of combinations! The actual enabling for create2-ioctl
will come in the future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-03 14:22:24 +00:00
Chris Wilson
8bf09f3d12 tests/gem_concurrent_all: Add a couple more sanitycheck patterns
As always, the goal is to quickly stress a variety of workloads that
often lead to kernel bugs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-12-17 15:25:43 +00:00
Chris Wilson
2d08e9e9a1 igt/gem_concurrent_all: Expand testing to cover different memory regimes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-12-11 11:55:26 +00:00
Chris Wilson
4f5efc5c84 igt: s/basic/sanitycheck/ on prior smoketesting
In times past, I added "basic" variants of tests just to ensure that the
general principle of operation was sound before proceeding on to the
main test (which typically looked at thrashing, i.e. were long and
tedious and pointless if the test didn't even work in the normal
situation). Since "basic" now collides with BAT, rename my trivial tests
to "sanitycheck".

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-12-10 10:05:20 +00:00
Chris Wilson
197db8607d igt/gem_concurrent_blit: Explicitly check for "missed interrupts"
As the concurrency tests are a good source of stress for
i915_wait_request() (the tests are primarily designed to ensure that GPU
activity of one form or another is completed before access by third
parties), one of the common form of errors we can detect are the
"missing interrupts" (i.e. where the waits do not terminate because of a
race between the interrupt and the seqno write). Add an explicit check
for this error and flag it as a definite fail - which also helps narrow
it down to certain subtests when run as a batch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-12-09 20:57:52 +00:00
Chris Wilson
0c26652911 igt/gem_concurrent_all: Add testcases that split the copying across rings
More inter-ring concurrency tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-11 17:27:22 +00:00
Daniel Stone
de7ccdd083 tests: Run igt.cocci
Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-11-03 19:46:11 +00:00
Chris Wilson
46ec33e847 igt/gem_concurrent_all: Add snoop concurrency tests
Another caching mode worth exploring for bad flushing behaviour.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-23 10:45:36 +01:00
Ville Syrjälä
f52e7ec787 Replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with gem_mmap__{cpu,gtt,wc}()
gem_mmap__{cpu,gtt,wc}() already has the assert built in, so replace
 __gem_mmap__{cpu,gtt,wc}() + igt_assert() with it.

Mostly done with coccinelle, with some manual help:
@@
identifier I;
expression E1, E2, E3, E4, E5, E6;
@@
(
-  I = __gem_mmap__gtt(E1, E2, E3, E4);
+  I = gem_mmap__gtt(E1, E2, E3, E4);
...
-  igt_assert(I);
|
-  I = __gem_mmap__cpu(E1, E2, E3, E4, E5);
+  I = gem_mmap__cpu(E1, E2, E3, E4, E5);
...
-  igt_assert(I);
|
-  I = __gem_mmap__wc(E1, E2, E3, E4, E5);
+  I = gem_mmap__wc(E1, E2, E3, E4, E5);
...
-  igt_assert(I);
)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-12 19:57:58 +03:00
Ville Syrjälä
b8a77dd6c8 Make gem_mmap__{cpu,gtt,wc}() assert on failure
Rename the current gem_mmap__{cpu,gtt,wc}() functions into
__gem_mmap__{cpu,gtt,wc}(), and add back wrappers with the original name
that assert that the pointer is valid. Most callers will expect a valid
pointer and shouldn't have to bother with failures.

To avoid changing anything (yet), sed 's/gem_mmap__/__gem_mmap__/g'
over the entire codebase.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09 19:16:26 +03:00
Ville Syrjälä
91d295cf06 Remove gem_mmap__{cpu,gtt,wc} return value MAP_FAILED asserts
gem_mmap__{cpu,gtt,wc} never return MAP_FAILED, it gets converted to
NULL internally. So don't go asserting that the returned value is
not MAP_FAILED.

Done with coccinelle:
@@
type T;
identifier I;
@@
(
 I = gem_mmap__gtt(...);
|
 I = gem_mmap__cpu(...);
|
 I = gem_mmap__wc(...);
)
 ...
(
- igt_assert(I != MAP_FAILED);
+ igt_assert(I);
|
- igt_assert(I && I != MAP_FAILED);
+ igt_assert(I);
|
- igt_assert(I != (T *) MAP_FAILED);
+ igt_assert(I);
|
- igt_assert(I != NULL);
+ igt_assert(I);
)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09 17:09:45 +03:00
Micah Fedke
c81d293aed convert drm_open_any*() calls to drm_open_driver*(DRIVER_INTEL) calls with cocci
Apply the new API to all call sites within the test suite using the following
semantic patch:

// Semantic patch for replacing drm_open_any* with arch-specific drm_open_driver* calls
@@
identifier i =~ "\bdrm_open_any\b";
@@
- i()
+ drm_open_driver(DRIVER_INTEL)

@@
identifier i =~ "\bdrm_open_any_master\b";
@@
- i()
+ drm_open_driver_master(DRIVER_INTEL)

@@
identifier i =~ "\bdrm_open_any_render\b";
@@
- i()
+ drm_open_driver_render(DRIVER_INTEL)

@@
identifier i =~ "\b__drm_open_any\b";
@@
- i()
+ __drm_open_driver(DRIVER_INTEL)

Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-11 14:39:43 +01:00
Thomas Wood
804e11f40d lib: add a single include header
Add a header that includes all the headers for the library. This allows
reorganisation of the library without affecting programs using it and
also simplifies the headers that need to be included to use the library.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-21 09:37:10 +01:00
Tim Gore
ebb46bb2e2 tests/gem_concurrent.c: rename to gem_concurrent_all
Recent patch #7763349a9a87.. renamed gem_concurrent_blit.c
to gem_concurrent.c and then added entries to Makefile.am
to make two identical executeables (but with different
names) from this source file. This executeable changes its
behaviour based on argv[0]. But, this has broken the
Android build, which does not use autotools.

This patch instead renames the source file to match
the name of one executable (gem_concurrent_all.c) and
creates a second source file which simply #includes the
first. The Makefile.am entries are also removed.
This restores the simple test.c -> test executeable
relationship seen in the rest of IGT and allows the
Android build system to work without parsing Makfile.am
or having to incorporate a special workaround for this
test.

Signed-off-by: Tim Gore <tim.gore@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-02 16:35:42 +01:00