Create a new directory for hardware-targeting tests
cover Create a new directory for hardware-targeting tests
Original patch from Antonio Argenziano, split into separate commits for its separate steps.
New directory created, tests/hw-tests, meant for tests that target the hardware's behaviour more than the driver's (or the combination thereof). Currently just gem_bad_address moved, with Antonio's changes to the test.
The tests in hw-tests will install into
$libexec/intel-gpu-tools/hw-tests.
Running hw-tests is done by setting IGT_TEST_ROOT appropriately to the hw-tests directory. scripts/run-tests.sh is amended to support it instead of hardcoding to $srcdir/tests.
Antonio Argenziano (1):
hw-tests: Fix and update gem_bad_address
Petri Latvala (3):
tests: Add a hw-tests subdirectory
tests: Move gem_bad_address to hw-tests run-tests.sh: Allow users to override IGT_TEST_ROOT
configure.ac | 12 ++++++
scripts/run-tests.sh | 2 +-
tests/Makefile.am | 2 +-
tests/Makefile.sources | 1 -
tests/hw-tests/Makefile.am | 41 ++++++++++++++++++++
tests/hw-tests/Makefile.sources | 3 ++
tests/{ => hw-tests}/gem_bad_address.c | 69 +++++++++++++++++++---------------
tests/hw-tests/meson.build | 25 ++++++++++++
tests/meson.build | 3 +-
9 files changed, 124 insertions(+), 34 deletions(-)
create mode 100644 tests/hw-tests/Makefile.am
create mode 100644 tests/hw-tests/Makefile.sources
rename tests/{ => hw-tests}/gem_bad_address.c (52%)
create mode 100644 tests/hw-tests/meson.buildSignature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/4 tests: Add a hw-tests subdirectory
The hw-tests subdirectory is meant for tests that target the hardware's behaviour without the kernel having much say in matters. Tests in the directory are not meant for regular CI runs, and running them requires setting IGT_TEST_ROOT to that directory when using piglit.
--- configure.ac | 12 ++++++++++++ tests/Makefile.am | 2 +- tests/hw-tests/Makefile.am | 41 +++++++++++++++++++++++++++++++++++++++++ tests/hw-tests/Makefile.sources | 2 ++ tests/hw-tests/meson.build | 24 ++++++++++++++++++++++++ tests/meson.build | 2 ++ 6 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 tests/hw-tests/Makefile.am create mode 100644 tests/hw-tests/Makefile.sources create mode 100644 tests/hw-tests/meson.build
configure.ac +12 -0
@@ -374,6 +374,16 @@ if test "x$BUILD_TESTS" = xyes; then AC_DEFINE(BUILD_TESTS, 1, [Build tests]) fi AM_CONDITIONAL(BUILD_TESTS, [test "x$BUILD_TESTS" = xyes]) + +AC_ARG_ENABLE(hw_tests, + AS_HELP_STRING([--disable-hw-tests], + [Disable HW tests build (default: enabled)]), + [BUILD_HW_TESTS=$enableval], [BUILD_HW_TESTS="yes"]) +if test "x$BUILD_TESTS" = xyes; then + AC_DEFINE(BUILD_HW_TESTS, 1, [Build hw tests]) +fi +AM_CONDITIONAL(BUILD_HW_TESTS, [test "x$BUILD_HW_TESTS" = xyes]) + AC_DEFINE_UNQUOTED(TARGET_CPU_PLATFORM, ["$host_cpu"], [Target platform]) files="broadwell cherryview haswell ivybridge sandybridge valleyview skylake"
@@ -397,6 +407,7 @@ AC_CONFIG_FILES([ man/Makefile scripts/Makefile tests/Makefile + tests/hw-tests/Makefile tests/intel-ci/Makefile tools/Makefile tools/null_state_gen/Makefile
@@ -423,6 +434,7 @@ echo "Intel GPU tools" echo "" echo " • Tests:" echo " Build tests : ${BUILD_TESTS}" +echo " Build HW tests : ${BUILD_HW_TESTS}" echo " Chamelium tests : ${enable_chamelium}" echo " Audio tests : ${enable_audio}" echo " Compile prime tests: ${NOUVEAU}"
tests/Makefile.am +1 -1
@@ -1,6 +1,6 @@ include Makefile.sources -SUBDIRS = intel-ci +SUBDIRS = hw-tests intel-ci if HAVE_LIBDRM_AMDGPU TESTS_progs += $(AMDGPU_TESTS)
tests/hw-tests/Makefile.am new file +41 -0
41 lines not on this page · raw message
tests/hw-tests/Makefile.sources new file +2 -0
@@ -0,0 +1,2 @@ +hw_tests = \ + $(NULL)
tests/hw-tests/meson.build new file +24 -0
@@ -0,0 +1,24 @@ +hw_test_progs = [ +] + +hw_test_deps = [ igt_deps ] + +# TODO: Refactoring of all such paths +hw_libexecdir = join_paths(get_option('libexecdir'), 'intel-gpu-tools', 'hw-tests') + +hw_test_executables = [] + +foreach prog : hw_test_progs + hw_test_executables += executable(prog, prog + '.c', + dependencies : test_deps, + install_dir : hw_libexecdir, + install : true) +endforeach + +hw_pkgdatadir = join_paths(get_option('datadir'), 'intel-gpu-tools', 'hw-tests') + +hw_test_list = custom_target('hw_testlist', + output : 'test-list.txt', + command : [ gen_testlist, '@OUTPUT@', hw_test_progs ], + install : true, + install_dir : hw_pkgdatadir)
tests/meson.build +2 -0
@@ -316,3 +316,5 @@ image_files = [ 'pass.png', ] install_data(sources : image_files, install_dir : pkgdatadir) + +subdir('hw-tests')
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/4 tests: Move gem_bad_address to hw-tests
In reply to Petri LatvalaSince the test is considered to be HW focused, meaning that it doesn't really exercise the driver but rather an HW feature, it is placed in tests/hw-tests.
---
tests/Makefile.sources | 1 -
tests/hw-tests/Makefile.sources | 1 +
tests/{ => hw-tests}/gem_bad_address.c | 0
tests/hw-tests/meson.build | 1 +
tests/meson.build | 1 -
5 files changed, 2 insertions(+), 2 deletions(-)
rename tests/{ => hw-tests}/gem_bad_address.c (100%)tests/Makefile.sources +0 -1
@@ -264,7 +264,6 @@ HANG = \ gem_bad_batch \ gem_hang \ gem_bad_blit \ - gem_bad_address \ gem_non_secure_batch \ $(NULL)
tests/hw-tests/Makefile.sources +1 -0
@@ -1,2 +1,3 @@ hw_tests = \ + gem_bad_address \ $(NULL)
tests/hw-tests/gem_bad_address.c renamed from tests/gem_bad_address.c +0 -0
tests/hw-tests/meson.build +1 -0
@@ -1,4 +1,5 @@ hw_test_progs = [ + 'gem_bad_address', ] hw_test_deps = [ igt_deps ]
tests/meson.build +0 -1
@@ -301,7 +301,6 @@ hang_progs = [ 'gem_bad_batch', 'gem_hang', 'gem_bad_blit', - 'gem_bad_address', 'gem_non_secure_batch', ] foreach prog : hang_progs
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/4] tests: Move gem_bad_address to hw-tests
Quoting Petri Latvala (2017-12-13 12:58:14)
Quoted 3 lines
Since the test is considered to be HW focused, meaning that it doesn't really exercise the driver but rather an HW feature, it is placed in tests/hw-tests.
Do we really want to keep this test at all? It's an interesting debate whether we want to show how trivial it is to subvert the kernel and HW (in some circumstances).
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/4] tests: Move gem_bad_address to hw-tests
Quoted 6 lines · Chris Wilson
Quoting Petri Latvala (2017-12-13 12:58:14)
Quoted 3 lines
Since the test is considered to be HW focused, meaning that it doesn't really exercise the driver but rather an HW feature, it is placed in tests/hw-tests.
Do we really want to keep this test at all? It's an interesting debate
This test has been around for a long time now so I think keeping it around would not be a problem, plus it actually gets fixed in this series.
-Antonio
Quoted 7 lines
whether we want to show how trivial it is to subvert the kernel and HW (in some circumstances). > -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/4 hw-tests: Fix and update gem_bad_address
In reply to Petri LatvalaFrom: Antonio Argenziano <[email protected]>
When writing to an invalid memory location, the HW should be clever enough to silently discard the write without disrupting execution. gem_bad_address aim at just that. The test has been updated to move away from the libDrm wrappers and use the IOCTL wrappers instead. Also the invalid address has been updated to be just outside of the GTT space.
v2 (Petri): Split the directory changes to separate commits, fix indentation
--- tests/hw-tests/gem_bad_address.c | 69 +++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 30 deletions(-)
tests/hw-tests/gem_bad_address.c +39 -30
@@ -23,37 +23,53 @@* Authors: * Eric Anholt <[email protected]> * Jesse Barnes <[email protected]> (based on gem_bad_blit.c) +* Antonio Argenziano <[email protected]> * */ #include "igt.h" -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <fcntl.h> -#include <inttypes.h> -#include <errno.h> -#include <sys/stat.h> -#include <sys/time.h> -#include "drm.h" -#include "intel_bufmgr.h" -static drm_intel_bufmgr *bufmgr; -struct intel_batchbuffer *batch; - -#define BAD_GTT_DEST ((512*1024*1024))/* past end of aperture */ +/* +* This test aims at verifying that writing to an invalid location in memory, +* doesn't cause hangs. The store command should be ignored completely by the +* HW and the whole process should be transparent to the user. Therefore, +* the test doesn't perform any validation check but expects the wrapping +* execution environment to check no hangs have occurred. +* +* The test needs to send a privileged batch to be able to write to the GTT. +*/ static void -bad_store (void ) +bad_store (uint32_t fd,uint32_t engine) { -BEGIN_BATCH (4 ,0 ); -OUT_BATCH (MI_STORE_DWORD_IMM |MI_MEM_VIRTUAL |1 <<21 ); -OUT_BATCH (0 ); -OUT_BATCH (BAD_GTT_DEST ); -OUT_BATCH (0xdeadbeef ); -ADVANCE_BATCH (); +struct drm_i915_gem_exec_object2 obj; +struct drm_i915_gem_execbuffer2 execbuf; + +uint32_t batch[16 ]; +int i =0 ; + +memset (&obj,0 ,sizeof (obj)); +memset (&execbuf,0 ,sizeof (execbuf)); + + execbuf.buffers_ptr =to_user_pointer (&obj); + execbuf.buffer_count =1 ; + execbuf.flags = engine; + execbuf.flags |=I915_EXEC_SECURE ; -intel_batchbuffer_flush (batch); + obj.handle =gem_create (fd,4096 ); + + batch[i++] =MI_STORE_DWORD_IMM |MI_MEM_VIRTUAL ; + batch[i++] =0x0 ;//Low part of the GTT address = 4GByte + batch[i++] =0x1 ;//High part of the GTT address > GTT size + batch[i++] =0xdeadbeef ; + + batch[i++] =MI_BATCH_BUFFER_END ; + batch[i++] =0x0 ; + +gem_write (fd, obj.handle,0 , batch,sizeof (batch)); +gem_execbuf (fd, &execbuf); + +gem_close (fd, obj.handle); } igt_simple_main
@@ -62,14 +78,7 @@ igt_simple_main fd =drm_open_driver (DRIVER_INTEL ); - bufmgr =drm_intel_bufmgr_gem_init (fd,4096 ); -drm_intel_bufmgr_gem_enable_reuse (bufmgr); - batch =intel_batchbuffer_alloc (bufmgr,intel_get_drm_devid (fd)); - -bad_store (); - -intel_batchbuffer_free (batch); -drm_intel_bufmgr_destroy (bufmgr); +bad_store (fd,I915_EXEC_BLT );close (fd); }
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 3/4] hw-tests: Fix and update gem_bad_address
Quoting Petri Latvala (2017-12-13 12:58:15)
Quoted 7 lines
From: Antonio Argenziano <[email protected]>
When writing to an invalid memory location, the HW should be clever enough to silently discard the write without disrupting execution.
gem_bad_addressaim at just that. The test has been updated to move away from the libDrm wrappers and use the IOCTL wrappers instead. Also the invalid address has been updated to be just outside of the GTT space.
It barely scratch the surfaces of what could be done to feed in a bad address.
Quoted 34 lines
v2 (Petri): Split the directory changes to separate commits, fix indentation
Signed-off-by Antonio Argenziano <[email protected]>Signed-off-by Petri Latvala <[email protected]>--- tests/hw-tests/gem_bad_address.c | 69 +++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 30 deletions(-)tests/hw-tests/gem_bad_address.c +1
-10@@ -23,37 +23,53 @@* Authors: * Eric Anholt <[email protected]> * Jesse Barnes <[email protected]> (based on gem_bad_blit.c) +* Antonio Argenziano <[email protected]> * */ #include "igt.h" -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <fcntl.h> -#include <inttypes.h> -#include <errno.h> -#include <sys/stat.h> -#include <sys/time.h> -#include "drm.h" -#include "intel_bufmgr.h"
tests/hw-tests/gem_bad_address.c line 37
Quoted 10 lines
tests/hw-tests/gem_bad_address.c +6
-4-static drm_intel_bufmgr *bufmgr; -struct intel_batchbuffer *batch; - -#define BAD_GTT_DEST ((512*1024*1024))/* past end of aperture */ +/* +* This test aims at verifying that writing to an invalid location in memory, +* doesn't cause hangs. The store command should be ignored completely by the +* HW and the whole process should be transparent to the user. Therefore, +* the test doesn't perform any validation check but expects the wrapping +* execution environment to check no hangs have occurred.
igt provides the facilities to detect GPU hangs. Wrap in igt_fork_hang_detector, finish with gem_sync. Actual machine death sadly requires an outside body.
Quoted 17 lines
tests/hw-tests/gem_bad_address.c +7
-7+* +* The test needs to send a privileged batch to be able to write to the GTT. +*/ static void -bad_store (void ) +bad_store (uint32_t fd,uint32_t engine) { -BEGIN_BATCH (4 ,0 ); -OUT_BATCH (MI_STORE_DWORD_IMM |MI_MEM_VIRTUAL |1 <<21 ); -OUT_BATCH (0 ); -OUT_BATCH (BAD_GTT_DEST ); -OUT_BATCH (0xdeadbeef ); -ADVANCE_BATCH (); +struct drm_i915_gem_exec_object2 obj; +struct drm_i915_gem_execbuffer2 execbuf; +
tests/hw-tests/gem_bad_address.c line 57
Quoted 10 lines
tests/hw-tests/gem_bad_address.c +10
-0+uint32_t batch[16 ]; +int i =0 ; + +memset (&obj,0 ,sizeof (obj)); +memset (&execbuf,0 ,sizeof (execbuf)); + + execbuf.buffers_ptr =to_user_pointer (&obj); + execbuf.buffer_count =1 ; + execbuf.flags = engine; + execbuf.flags |=I915_EXEC_SECURE ;
That is asking to turn off the HW validator (for the most part), and requires drm_open_driver_master(). But since you are doing something illegal in a context that allows you to shoot yourself in the foot, what's the point? What does it prove?
tests/hw-tests/gem_bad_address.c line 61
Quoted 4 lines
tests/hw-tests/gem_bad_address.c +3
-1-intel_batchbuffer_flush (batch); + obj.handle =gem_create (fd,4096 ); + + batch[i++] =MI_STORE_DWORD_IMM |MI_MEM_VIRTUAL ;
Note that MI_STORE_DWORD doesn't even need a bad address to take over the machine on some platforms. You should start with a validation that a known good store works, before testing whether a bad one is skipped. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/4 run-tests.sh: Allow users to override IGT_TEST_ROOT
In reply to Petri Latvala--- scripts/run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/run-tests.sh +1 -1
@@ -24,7 +24,7 @@ ROOT="`dirname $0`" ROOT="`readlink -f $ROOT/..`" -IGT_TEST_ROOT="$ROOT/tests" +IGT_TEST_ROOT="${IGT_TEST_ROOT:-$ROOT/tests}" IGT_CONFIG_PATH="${IGT_CONFIG_PATH:-$HOME/.igtrc}" RESULTS="$ROOT/results" PIGLIT=`which piglit 2> /dev/null`
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 4/4] run-tests.sh: Allow users to override IGT_TEST_ROOT
Quoted 2 lines · Petri Latvala
Signed-off-by Petri Latvala <[email protected]>Cc Arkadiusz Hiler <[email protected]>
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Create a new directory for hardware-targeting tests
In reply to Petri Latvala== Series Details ==
== Series Details ==
Series: Create a new directory for hardware-targeting tests
URL : https://patchwork.freedesktop.org/series/35288/
State : success
== Summary ==
IGT patchset tested on top of latest successful build4112f30aedbb252bf8cdd27dbba485c0458faca7 igt/gem_shrink: Exercise allocations in the middle of execbuf under oom-pressure
with latest DRM-Tip kernel build CI_DRM_35081a717c76c96c drm-tip: 2017y-12m-13d-14h-48m-36s UTC integration manifest
No testlist changes.
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
pass -> DMESG-WARN (fi-kbl-r) fdo#104172 +1fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#104172 https://bugs.freedesktop.org/show_bug.cgi?id=104172
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:439s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:446s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:387s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:518s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:281s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:507s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:502s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:492s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:474s fi-elk-e7500 total:224 pass:163 dwarn:15 dfail:0 fail:0 skip:45 fi-gdg-551 total:288 pass:178 dwarn:1 dfail:0 fail:1 skip:108 time:265s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:535s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:411s fi-hsw-4770r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:423s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:392s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:491s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:432s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:491s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:522s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:477s fi-kbl-r total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:532s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:449s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:540s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:563s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:494s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:449s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:564s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:429s Blacklisted hosts: fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:599s fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:492s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_663/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for Create a new directory for hardware-targeting tests
In reply to Petri Latvala== Series Details ==
== Series Details ==
Series: Create a new directory for hardware-targeting tests
URL : https://patchwork.freedesktop.org/series/35288/
State : success
== Summary ==
Test kms_cursor_crc:
Subgroup cursor-256x256-suspend:
skip -> PASS (shard-snb) fdo#103375
Test kms_flip:
Subgroup flip-vs-absolute-wf_vblank:
pass -> INCOMPLETE (shard-hsw) fdo#100368fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
shard-hsw total:2648 pass:1506 dwarn:1 dfail:0 fail:10 skip:1130 time:9162s shard-snb total:2712 pass:1309 dwarn:1 dfail:0 fail:12 skip:1390 time:8093s
Blacklisted hosts:
shard-kbl total:2670 pass:1784 dwarn:1 dfail:0 fail:24 skip:860 time:10941s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_663/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx