50 Commits

Author SHA1 Message Date
Chris Wilson
459ff6b7e2 igt/gem_concurrent_blit: Ensure we only shrink the child buffers
As we reuse the parent arrays under the assumption that the child uses
fewer buffers, make sure that is true.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-20 07:50:18 +01:00
Chris Wilson
9e7e7c38a0 igt/gem_concurrent_blit: Tweak num_buffers to just exceed target
Remember that we allocate and use twice as many buffers as specified (we
have a num_buffers array of src and dst) and so adjust the computation
such that the combined allocation matches the target.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-11 09:17:33 +01:00
Chris Wilson
c46f3c341c igt/gem_concurrent_blit: Purge the libdrm caches before cloning
When forking, the entire VM is cloned including the VMA backed by GEM
objects from the libdrm buffer cache. This is not only slow, but can also
cause the system to exceed the maximum number of VMA and premature test
failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-10 20:49:26 +01:00
Chris Wilson
98dcf2f0dc igt/gem_concurrent_blit: Relax maxfiles restrictions
Only fail the dmabuf tests if we cannot prep the system to support
"unlimited" fd.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-25 18:23:56 +00:00
Chris Wilson
6867b87b73 igt/gem_concurrent_blit: Enable hang detection
When we aren't deliberately injecting hangs, we don't expect to see any
GPU hang. Detect them and fail early.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-24 11:25:38 +00:00
Chris Wilson
fcb4cfa520 igt/gem_concurrent_all: Inject a hang onto all rings
Also test a hang across all rings, rather than just one engine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-21 12:05:48 +00:00
Chris Wilson
c19b049d9c igt/gem_concurent_blit: Prevent a memleak if we assert whilst creating buffers
Assume that we may halt partway through buffers_create() and so be
careful to clear up the partial state in buffers_destroy().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-20 11:17:21 +00:00
Chris Wilson
3d8af56ed2 igt/gem_concurrent_blit: Reset process limits to allow dmabuf tests
Since dmabuf requires an actual fd for every object, we need to increase
the number of files our process is allowed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-20 10:51:09 +00:00
Chris Wilson
f338e9834c igt/gem_concurrent_blit: Enable quicker interruptible testing
v2: Because I managed to push the wrong version.

Make --list-subtests happer by creating the name before the igt_fixture,
not inside it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-19 15:59:27 +00:00
Chris Wilson
e85613b47c igt/gem_concurrent_blit: dmabuf requires twice the number of files
In order to keep the dmabuf mmap around whilst we keep the object alive,
we need a file descriptor for each. Check that the VFS supports that
many fd.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-19 15:21:28 +00:00
Chris Wilson
c2248efbca igt/gem_concurrent_blit: Enable quicker interruptible testing
Use the igt_sigiter interface to only repeat the -interruptible tests
when we can make further progress with another change at injecting a
signal.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-19 15:21:28 +00:00
Daniel Vetter
9665073c33 tests/gem_concurrent_blt|all: Use igt_subtest_group
Looks tidy again, and doesn't break igt assumptions.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-03-19 10:37:40 +01:00
Chris Wilson
5d669bf1dd igt/gem_concurent_blit: Exercise different object sizes
Searching for coherency problems that may arise with
smaller-then-cache/large-then-cache objects.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-18 14:46:23 +00:00
Chris Wilson
4eba8e22fa igt/gem_concurrent_all: struct buffers for all
Now that we started packaging all parameters in one handy struct, pass
them everywhere. This allows us to pass along requirements so that we
can perform the checks inside each indvidual subtest and so not anger
the igt gods.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-18 10:47:34 +00:00
Chris Wilson
5ec85f5bf8 igt/gem_concurrent_blit: 32bit compilation warning
gem_concurrent_all.c: In function ‘__real_main1556’:
gem_concurrent_all.c:1642:4: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘uint64_t’ [-Wformat=]
    igt_debug("Pinning %ld MiB\n", pin_sz);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-10 10:58:11 +00:00
Chris Wilson
094e0cbabb igt/gem_concurrent_blit: Deglobalify num_buffers
More num_buffers onto the local struct passed down into the tests to
avoid the issue with having to modify the global value inside the tests
leading to hilarity if the test asserts.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-01 13:25:07 +00:00
Chris Wilson
aed69b56d4 lib: Add read/write direction support for dmabuf synchronisation
Allow read-only synchronisation on dmabuf mmaps, useful to allow
concurrent read-read testing between the CPU and GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-01 13:25:07 +00:00
Chris Wilson
d627e30c9e igt/gem_concurrent_blit: Pretend tests exist
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-25 20:01:33 +00:00
Chris Wilson
cf569c216b igt/gem_concurrent_blit: Add dmabuf exercisers
Create and use dmabuf mmaps as well to ensure correct synchronisation
between concurrent rendering and CPU access.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-25 17:59:57 +00:00
Chris Wilson
391b32c382 igt: Report the global GTT size
For many tests, the relevant aperture is not the ppGTT but the internal
global GTT managed by the kernel. Use this limit appropriately.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-18 10:30:56 +00:00
Tiago Vignatti
e1f663b543 lib: Add gem_userptr and __gem_userptr helpers
This patch moves userptr definitions and helpers implementation that were
locally in gem_userptr_benchmark and gem_userptr_blits to the library, so other
tests can make use of them as well. There's no functional changes.

v2: added __ function to differentiate when errors want to be handled back in
the caller; bring gem_userptr_sync back to gem_userptr_blits; added gtkdoc.
v8: remove local_i915_gem_userptr from gem_concurrent_all.c to use the global
helpers instead.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-11 18:15:44 +01:00
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