summaryrefslogtreecommitdiff
path: root/tests/gem_mmap_gtt.c
AgeCommit message (Collapse)Author
2017-01-04igt/gem_mmap_gtt: Tiled access to the incomplete last row is undefinedChris Wilson
Trying to read/write into the last tiled row is invalid since we do not allocate sufficient pages for the writes to map to (hence they get lost). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-01-04igt/gem_mmap_gtt: Check read/writes across a GPU resetChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=99274 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-01Silence a bunch of "const discard" warningsChris Wilson
A few warnings of the form: gem_mmap_gtt.c: In function ‘copy_wc_page’: gem_mmap_gtt.c:480:16: warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default] __m128i *S = (const __m128i *)src; are no more. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-29igt/gem_gtt_speed: Spare clang the embarrassmentChris Wilson
Clang pretends to be GCC and then dies on GCC pragma. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-22igt/gem_mmap_gtt: Silence compile warning for !sse4.1Chris Wilson
gem_mmap_gtt.c: In function ‘test_huge_copy’: gem_mmap_gtt.c:589:4: warning: passing argument 2 of ‘copy_wc_page’ from incompatible pointer type [enabled by default] copy_wc_page(page, a + PAGE_SIZE*i); ^ gem_mmap_gtt.c:503:13: note: expected ‘const uint32_t *’ but argument is of type ‘char *’ static void copy_wc_page(uint32_t *dst, const uint32_t *src) ^ gem_mmap_gtt.c:601:4: warning: passing argument 2 of ‘copy_wc_page’ from incompatible pointer type [enabled by default] copy_wc_page(page, b + PAGE_SIZE*i); ^ gem_mmap_gtt.c:503:13: note: expected ‘const uint32_t *’ but argument is of type ‘char *’ static void copy_wc_page(uint32_t *dst, const uint32_t *src) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-10igt/gem_mmap_gtt: Swap thrash copyChris Wilson
Copy between two objects that together just exceed physical memory causing ping-pong on every page. Not for the faint hearted. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-10igt/gem_mmap_gtt: Add forked contention to the mmap copiesChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-07igt/gem_mmap_gtt: Use SSE4.1 streaming to speed up per-pixel checksChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-22igt/gem_mmap_gtt: Document the "expected" behaviourChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=9431 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-01igt/gem_mmap_gtt/wc: Reduce test runtimeChris Wilson
Add a new iterator macro to run for a specified number of milliseconds. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-01igt/gem_mmap_gtt: Ignore effects of CPU caches for comparing WBChris Wilson
When measuring WB performance we have the issue that it allows CPU caching which is many times faster than main memory! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-01igt/gem_mmap_gtt: Add a test to detect non-WC accessChris Wilson
WC access through the GTT should be much faster for writes than reads. Indeed, we expect writes to be close to WB performance (for large sequential transfers) and reads to be only equivalent to UC. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-03igt/gem_mmap_gtt: Exercise differing tile sizesChris Wilson
Importantly this verifies that we pick a partial alignment/size suitable for the tile. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-18igt: Report the global GTT sizeChris Wilson
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-01-19igt/gem_mmap_wc: Test cpu mmap vs wc mmap coherencyChris Wilson
Similar to the cpu mmap vs gtt mmap coherency test. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-08tests/gem_mmap_gtt: Make the small-bo tiling tests work on old platformsVille Syrjälä
Several factors conspire against us when trying to execute the tiled small-bo tests: - pre-gen4 require power of two fences, with natural alignment - the entire gtt may be mappable - we put a guard page at the end of gtt What all that means is that when we try to use a tiled object half the size of the mappable area, we can only fit it in the first half of the gtt. That leads to a SIGBUS when we try to fault in the object when there's already something (eg. fbdev) occupying the first half of gtt. So in order to make the tests run on old machines, let's further halve the object size when things look too tight. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-01-08tests/gem_mmap_gtt: Add progress indicatorsVille Syrjälä
Some of the copy tests take a while, so let the user know how far along we are via a progress indicator. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-01-08tests/gem_mmap_gtt: Deal with tile sizes on gen2/3Ville Syrjälä
Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-01-07igt/gem_mmap_gtt: Add a test to exercise coherency between GTT/CPUChris Wilson
This checks whether a write through the GTT is immediately visible to the CPU. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-12igt/gem_mmap_gtt: Require SET_TILING to work before doing large tiled testsChris Wilson
Older generations are more limited in how much they can fence, and the limits is enforced in the SET_TILING ioctl. So if it reports an EINVAL, we cannot perform the tiled test and may just skip it instead. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-03tests: Run igt.cocciDaniel Stone
Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-12Replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with gem_mmap__{cpu,gtt,wc}()Ville Syrjälä
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-09Make gem_mmap__{cpu,gtt,wc}() assert on failureVille Syrjälä
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-09Remove gem_mmap__{cpu,gtt,wc} return value MAP_FAILED assertsVille Syrjälä
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-09s/gem_mmap/gem_mmap__gtt/Ville Syrjälä
Get rid of the gem_mmap() alias of gem_mmap__gtt(). I don't see any point in having it. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-11convert drm_open_any*() calls to drm_open_driver*(DRIVER_INTEL) calls with cocciMicah Fedke
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-08-21lib: add a single include headerThomas Wood
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-14tests/gem_mmap_gtt: mark basic access and copy tests as basic v2Jesse Barnes
These ones should always pass and are fairly quick. v2: add more tests (Daniel) Reviewed-by: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2015-05-08igt/gem_mmap_gtt: Add pagefault-of-doom failure caseChris Wilson
This is a test that should be a showcase for partial views... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-08igt/gem_mmap_gtt: Check GTT mmapping of large tiled objectsChris Wilson
Move function CPU mmap test of large bo to gem_mmap, and include a page-by-page copy between two huge objects (as we have had many bugs triggering pagefault-of-doom for full apertures before). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-27tests/gem_mmap_gtt: Use PAGE_SIZE instead of hard coded valueJoonas Lahtinen
Now that there is PAGE_SIZE define, use it. Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-14tests/gem_mmap_gtt: add huge BO testJoonas Lahtinen
Add a straightforward test that allocates a BO that is bigger than (by 1 page currently) the mappable aperture, tests mmap access to it by CPU directly and through GTT in sequence. Currently it is expected for the GTT access to gracefully fail as all objects are attempted to get pinned to GTT completely for mmap access. Once the partial view support is merged to kernel, the test should pass for all parts. v2: - Corrected BO domain handling (Chris Wilson) - Check again after GTT access for added paranoia (Chris Wilson) v3: - Avoid flush by using pread (Chris Wilson) - Free gtt_pattern buffer too. v4: - Add more comments (Tvrtko Ursulin) - Use igt_require (Tvrtko Ursulin) v5: - Remove wrong message from igt_require_f (Tvrtko Ursulin) - After digging deeper to it, just igt_assert that the CPU mapping needs to succeed. Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> [Thomas: remove unused label] Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-14tests/gem_mmap_gtt: clarify BO domain setting functionsJoonas Lahtinen
Add suffix and complementary function for CPU domain. v2: - Change function signatures to be consistent with the rest Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-04ioctl_wrappers: Pass in offset to CPU mmapsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-08igt/gem_mmap_gtt: Check coherency between GTT and CPU mmappings with LLCChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-21gem_mmap_gtt: Test mmaping less than the full objectChris Wilson
A bug was recently introduced into the kernel that happened when the vma was smaller than the object. Test that. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-12igt/gem_mmap_gtt: Exercise concurrent pagefaultingChris Wilson
This should hit the BUG inside remap_pfn_range in commit c5158fabeaf53ed2c614c3333aaa4b3cce80f500 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Tue Jun 10 12:14:41 2014 +0100 [ 27.767634] kernel BUG at mm/memory.c:2315! [ 27.767655] invalid opcode: 0000 [#1] SMP [ 27.767679] Modules linked in: cpufreq_userspace cpufreq_powersave cpufreq_stats cpufreq_conservative binfmt_misc nfs lockd fscache sunrpc hid_generic usbhid hid x86_pkg_temp_thermal microcode i2c_i801 lpc_ich mfd_core battery acpi_cpufreq evdev processor ac loop ehci_pci xhci_hcd ehci_hcd sr_mod usbcore cdrom usb_common fan thermal [ 27.767872] CPU: 3 PID: 912 Comm: gem_mmap_gtt Not tainted 3.15.0-rc8+ #953 [ 27.767903] Hardware name: Intel Corporation Shark Bay Client platform/Flathead Creek Crb, BIOS HSWLPTU1.86C.0109.R03.1301282055 01/28/2013 [ 27.767956] task: ffff880448415010 ti: ffff88044d22c000 task.ti: ffff88044d22c000 [ 27.767988] RIP: 0010:[<ffffffff81130734>] [<ffffffff81130734>] remap_pfn_range+0x2a4/0x400 [ 27.768033] RSP: 0000:ffff88044d22fc28 EFLAGS: 00010282 [ 27.768057] RAX: 0000000000020002 RBX: 00000000000a3b57 RCX: ffff880448b73fe8 [ 27.768088] RDX: 0000000000000002 RSI: ffff880000000000 RDI: ffffea000efe8158 [ 27.768119] RBP: ffff88044d22fcd8 R08: 00007fc7b57fe000 R09: 00007fc7b57fe000 [ 27.768150] R10: 00000000000001fd R11: 0000000000000a9a R12: ffffea000efe8128 [ 27.768180] R13: 0000000000000001 R14: 00007fc7b57fd000 R15: 800000000000002f [ 27.768212] FS: 00007fc7977fc700(0000) GS:ffff88045e380000(0000) knlGS:0000000000000000 [ 27.768246] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 27.768272] CR2: 00007fc7b67fd000 CR3: 000000044866c000 CR4: 00000000001407e0 [ 27.768303] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 27.768333] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 27.768363] Stack: [ 27.768374] ffff880448bbb6f8 00000000ffffffff 00007fc7b57fdfff 00007fc7b57fdfff [ 27.768414] 00007fc7b57fe000 ffff88044866c7f8 ffff8804496b08f0 00007fc7b57fdfff [ 27.768454] fffffff8038ee35a 0000000000001000 ffff88044c208180 00007fc7b57fe000 [ 27.768494] Call Trace: [ 27.768511] [<ffffffff81365277>] i915_gem_fault+0x337/0x340 [ 27.768538] [<ffffffff8112d3c4>] __do_fault+0x34/0x70 [ 27.768565] [<ffffffff8109088e>] ? wake_up_process+0x1e/0x40 [ 27.768592] [<ffffffff8113015c>] do_shared_fault.isra.96+0x2c/0x1f0 [ 27.768623] [<ffffffff81502405>] ? rwsem_down_read_failed+0xe5/0x130 [ 27.768654] [<ffffffff810a2519>] ? __rwsem_do_wake+0x129/0x160 [ 27.768682] [<ffffffff81131085>] handle_mm_fault+0x2b5/0xb80 [ 27.768712] [<ffffffff81270a64>] ? call_rwsem_down_read_failed+0x14/0x30 [ 27.768745] [<ffffffff81036c67>] __do_page_fault+0x167/0x4c0 [ 27.768774] [<ffffffff8109a540>] ? pick_next_task_fair+0x700/0x870 [ 27.768804] [<ffffffff814ff23b>] ? __schedule+0x27b/0x860 [ 27.768831] [<ffffffff81036fec>] do_page_fault+0xc/0x10 [ 27.768857] [<ffffffff815034a2>] page_fault+0x22/0x30 [ 27.768881] Code: 4d 85 ed 49 0f 44 d7 80 cc 02 49 81 c6 00 10 00 00 48 83 c3 01 48 83 c1 08 48 09 d0 48 89 41 f8 4d 39 f0 74 32 48 83 39 00 74 c4 <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 48 39 37 75 63 48 8b 45 c8 [ 27.769081] RIP [<ffffffff81130734>] remap_pfn_range+0x2a4/0x400 [ 27.769113] RSP <ffff88044d22fc28> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-22lib: unnecessary header removal for drmtest.h, part 1Daniel Vetter
Brought a few missing headers to light in ioctl_wrappers.h, too. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12lib: move prefault helpers to igt_debugfs.cDaniel Vetter
This way all debugfs library code is in one place, ready for some api documentation care. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-01lib: add igt_main macroDaniel Vetter
In the past new testcases with subtest often forgot to add the call to igt_exit at the end of their main() function. That is now caught with a bit more obnoxious asserts, but it's still a nuissance. This little igt_main macro takes care of that (and also of calling the subtest machinery initialization code correctly). If no one objects I'll roll this out for all the simple cases (i.e. those tests that don't have additional argv parsing on top of the subtest machinery). v2: Roll it out across the board. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-03lib/drmtest: include sys/mman.h from drmtest.hDaniel Vetter
We need it for mmapping to get at PROT_READ|WRITE anyway. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-30tests/gem_mmap_gtt: fix access checksDaniel Vetter
Reading manpages advisable ;-) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-30tests/gem_mmap_gtt: clarify access check checks a bitDaniel Vetter
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-26tests/gem_mmap_gtt: Add testcase for the vma access managerDaniel Vetter
Currently fails since the patches aren't merged yet. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14tests: roll out igt_fixtureDaniel Vetter
Also sprinkle igt_assert and igt_require over the setup code to clean up code while at it. To avoid gcc getting upset about unitialized variables just move them out of main as global data (where they always get initialized to 0) - gcc can't see through our igt_fixture and igt_subtest maze properly. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14tests: use igt_exit() consistently with subtestsDaniel Vetter
This is mostly important to get the SKIP reporting right, but I've found a few stragglers that wanted to get converted over to the igt result reporting completely. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13tests: s/assert/igt_assertDaniel Vetter
Just a wholesale rollout for now, we can refine later on. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12s/drmtest_/igt_/Daniel Vetter
Requested-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12s/drmtest_subtest_block/drmtest_subtest/Daniel Vetter
The _block postfix meant to convey that a C statement/block must follow can be misread as the verb to block. So drop it. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12lib/drmtest: Add drmtest_subtest_block macroDaniel Vetter
Doesn't do more than an if (drmtest_run_test(name)) right now, but as soon as we get a bit of infrastructure to handle test failures and skipping, this will get more interesting. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>