tests/gem_userptr_blits: Rework userptr tests to copy with changes
PATCH 1/1 tests/gem_userptr_blits: Rework userptr tests to copy with changes
Userptr semantics are changed to no longer allow forked processes to obtain pages, it will fail with -EFAULT. We also no longer allow unsynchronized access, so has_userptr needs to check with the notifier installed.
The only way to make forked tests work would be to do use a fork without clone_vm set, which we have no igt infrastructure for, and can't work like the current igt_fork().
--- tests/i915/gem_userptr_blits.c | 64 +++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 16 deletions(-)
tests/i915/gem_userptr_blits.c +48 -16
@@ -71,7 +71,7 @@#define PAGE_SIZE 4096#endif -static uint32_t userptr_flags =I915_USERPTR_UNSYNCHRONIZED ; +static uint32_t userptr_flags =0 ;static bool *can_mmap;
@@ -504,14 +504,10 @@ static int has_userptr(int fd) {uint32_t handle =0 ;void *ptr; -uint32_t oldflags;int ret;igt_assert (posix_memalign (&ptr,PAGE_SIZE ,PAGE_SIZE ) ==0 ); - oldflags = userptr_flags; -gem_userptr_test_unsynchronized (); ret =__gem_userptr (fd, ptr,PAGE_SIZE ,0 , userptr_flags, &handle); - userptr_flags = oldflags;if (ret !=0 ) {free (ptr);return 0 ;
@@ -703,10 +699,9 @@ static void test_forked_access(int fd)void *ptr1 =NULL , *ptr2 =NULL ;int ret; - ret =posix_memalign (&ptr1,PAGE_SIZE ,sizeof (linear)); -#ifdef MADV_DONTFORK - ret |=madvise (ptr1,sizeof (linear),MADV_DONTFORK ); -#endif + ptr1 =mmap (NULL ,sizeof (linear),PROT_READ |PROT_WRITE ,MAP_SHARED |MAP_ANONYMOUS ,-1 ,0 ); +igt_assert (ptr1 !=MAP_FAILED ); +gem_userptr (fd, ptr1,sizeof (linear),0 , userptr_flags, &handle1);igt_assert (ptr1);igt_assert (handle1);
@@ -722,8 +717,17 @@ static void test_forked_access(int fd)memset (ptr1,0x1 ,sizeof (linear));memset (ptr2,0x2 ,sizeof (linear)); - igt_fork(child, 1) -igt_assert_eq (copy (fd, handle1, handle2),0 ); + igt_fork(child, 1) { + ret =copy (fd, handle1, handle2); +if (ret) { +/* +* userptr being exportable is a misfeature, +* and has now been disallowed +*/ +igt_assert_eq (ret, -EFAULT ); +memset (ptr1,0x2 ,sizeof (linear)); + } + }igt_waitchildren ();gem_userptr_sync (fd, handle1);
@@ -734,11 +738,7 @@ static void test_forked_access(int fd)igt_assert (memcmp (ptr1, ptr2,sizeof (linear)) ==0 ); -#ifdef MADV_DOFORK - ret =madvise (ptr1,sizeof (linear),MADV_DOFORK ); -igt_assert_eq (ret,0 ); -#endif -free (ptr1); +munmap (ptr1,sizeof (linear));#ifdef MADV_DOFORK ret =madvise (ptr2,sizeof (linear),MADV_DOFORK );
@@ -1615,12 +1615,44 @@ static int can_swap(void)return 1 ; } +static bool forked_userptr (int fd) +{ +uint32_t handle =0 ; +int *ptr =NULL ; +int ret; + + ptr =mmap (NULL ,sizeof (linear),PROT_READ |PROT_WRITE ,MAP_SHARED |MAP_ANONYMOUS ,-1 ,0 ); +igt_assert (ptr !=MAP_FAILED ); + + *ptr =-1 ; + +gem_userptr (fd, linear,sizeof (linear),0 , userptr_flags, &handle); +igt_assert (handle); + +igt_fork (child,1 ) + *ptr =copy (fd, handle, handle); + +igt_waitchildren (); + ret = *ptr; + +gem_close (fd, handle); + +munmap (ptr,sizeof (linear)); + +if (ret) +igt_assert_eq (ret, -EFAULT ); + +return !ret; +} +static void test_forking_evictions (int fd,int size,int count,unsigned flags) {int trash_count;int num_threads; +igt_require (forked_userptr (fd)); + trash_count =intel_get_total_ram_mb () *11 /10 ;/* Use the fact test will spawn a number of child * processes meaning swapping will be triggered system
Signature · 6 lines
2.28.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for tests/gem_userptr_blits: Rework userptr tests to copy with changes
== Series Details ==
== Series Details ==
Series: tests/gem_userptr_blits: Rework userptr tests to copy with changes
URL : https://patchwork.freedesktop.org/series/81136/
State : failure
== Summary ==
CI Bug Log - changes from IGT_5774 -> IGTPW_4916
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_4916 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_4916, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_4916:
### IGT changes ###
#### Possible regressions ####
* igt@gem_exec_parallel@engines@basic:
- fi-icl-y: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5774/fi-icl-y/igt@gem_exec_parallel@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/fi-icl-y/igt@gem_exec_parallel@[email protected]
* igt@runner@aborted:
- fi-icl-y: NOTRUN -> [FAIL][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/fi-icl-y/igt@[email protected]
Known issues
------------
Here are the changes found in IGTPW_4916 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-icl-u2: [PASS][4] -> [DMESG-WARN][5] ([i915#1982]) +2 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5774/fi-icl-u2/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/fi-icl-u2/igt@[email protected]
#### Possible fixes ####
* igt@kms_cursor_legacy@basic-flip-before-cursor-legacy:
- fi-icl-u2: [DMESG-WARN][6] ([i915#1982]) -> [PASS][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5774/fi-icl-u2/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/fi-icl-u2/igt@[email protected]
* igt@kms_flip@basic-flip-vs-wf_vblank@c-hdmi-a2:
- fi-skl-guc: [DMESG-WARN][8] ([i915#2203]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5774/fi-skl-guc/igt@kms_flip@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/fi-skl-guc/igt@kms_flip@[email protected]
#### Warnings ####
* igt@gem_exec_suspend@basic-s0:
- fi-kbl-x1275: [DMESG-WARN][10] ([i915#1982] / [i915#62] / [i915#92]) -> [DMESG-WARN][11] ([i915#62] / [i915#92])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5774/fi-kbl-x1275/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/fi-kbl-x1275/igt@[email protected]
* igt@i915_pm_rpm@module-reload:
- fi-kbl-x1275: [DMESG-FAIL][12] ([i915#62]) -> [DMESG-FAIL][13] ([i915#62] / [i915#95])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5774/fi-kbl-x1275/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/fi-kbl-x1275/igt@[email protected]
* igt@kms_force_connector_basic@prune-stale-modes:
- fi-kbl-x1275: [DMESG-WARN][14] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][15] ([i915#62] / [i915#92]) +6 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5774/fi-kbl-x1275/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/fi-kbl-x1275/igt@[email protected]
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2203]: https://gitlab.freedesktop.org/drm/intel/issues/2203
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95
Participating hosts (39 -> 34)
------------------------------
Missing (5): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_5774 -> IGTPW_4916
CI-20190529: 20190529
CI_DRM_8937: 78b090a913c972368c81f05352a532590200cc89 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_4916: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/index.html
IGT_5774: 2a5db9f60241383272aeec176e1b97b3f487209f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4916/index.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev