From patchwork Fri Oct 28 09:31:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 9401713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C67D160588 for ; Fri, 28 Oct 2016 09:25:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B30102A6DB for ; Fri, 28 Oct 2016 09:25:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7E3E2A6DE; Fri, 28 Oct 2016 09:25:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A80AE2A6DB for ; Fri, 28 Oct 2016 09:25:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E4B16EAD2; Fri, 28 Oct 2016 09:25:25 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 565106EAD2 for ; Fri, 28 Oct 2016 09:25:22 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP; 28 Oct 2016 02:25:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,557,1473145200"; d="scan'208";a="24683411" Received: from mcvlad-wk.rb.intel.com ([10.237.105.57]) by fmsmga006.fm.intel.com with ESMTP; 28 Oct 2016 02:25:20 -0700 From: Marius Vlad To: intel-gfx@lists.freedesktop.org Date: Fri, 28 Oct 2016 12:31:28 +0300 Message-Id: <20161028093129.13275-4-marius.c.vlad@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161028093129.13275-1-marius.c.vlad@intel.com> References: <20161028093129.13275-1-marius.c.vlad@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 3/4 v4] tests/drv_module_reload: Convert sh script to C version. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP v4: - adjust test to make use of lib/igt_kmod - replaced SW_FINISH with SET_CACHEING (Chris Wilson) v3: - fix passing boolean value as flags to igt_kmod_unload(). v2: - embedded gem_alive and gem_exec_store into test (Chris Wilson) - int main() to igt_main (Chris Wilson) - moved tests/gem_alive -> tools/gem_info (Chris Wilson) - added to intel-ci/fast-feedback.testlist (Petri Latvala) - added hda_dynamic_debug() (Petri Latvala) - renamed from tests/drv_module_reload_basic to tests/drv_module_reload (all subtests are basic and have been added to fast-feedback.testlist) Signed-off-by: Marius Vlad --- tests/Makefile.am | 1 - tests/Makefile.sources | 2 +- tests/drv_module_reload.c | 415 ++++++++++++++++++++++++++++++++++ tests/drv_module_reload_basic | 105 --------- tests/gem_alive.c | 35 --- tests/intel-ci/fast-feedback.testlist | 13 +- tools/Makefile.sources | 1 + tools/intel_gem_info.c | 35 +++ 8 files changed, 464 insertions(+), 143 deletions(-) create mode 100644 tests/drv_module_reload.c delete mode 100755 tests/drv_module_reload_basic delete mode 100644 tests/gem_alive.c create mode 100644 tools/intel_gem_info.c diff --git a/tests/Makefile.am b/tests/Makefile.am index a408126..14a41ae 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,7 +26,6 @@ noinst_PROGRAMS = \ $(NULL) pkglibexec_PROGRAMS = \ - gem_alive \ gem_stress \ $(TESTS_progs) \ $(TESTS_progs_M) \ diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 6d081c3..b1511c6 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -211,6 +211,7 @@ TESTS_progs = \ kms_pwrite_crc \ kms_sink_crc_basic \ prime_udl \ + drv_module_reload \ $(NULL) # IMPORTANT: The ZZ_ tests need to be run last! @@ -221,7 +222,6 @@ TESTS_scripts_M = \ TESTS_scripts = \ debugfs_emon_crash \ drv_debugfs_reader \ - drv_module_reload_basic \ kms_sysfs_edid_timing \ sysfs_l3_parity \ test_rte_check \ diff --git a/tests/drv_module_reload.c b/tests/drv_module_reload.c new file mode 100644 index 0000000..e52f2f7 --- /dev/null +++ b/tests/drv_module_reload.c @@ -0,0 +1,415 @@ +/* + * Copyright © 2016 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#include "igt.h" +#include "igt_debugfs.h" +#include "igt_aux.h" +#include "igt_kmod.h" +#include "igt_sysfs.h" +#include "igt_core.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + +#define LOCAL_I915_EXEC_BSD_SHIFT (13) +#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT) + +#define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK) + +static void store_dword(int fd, unsigned ring) +{ + const int gen = intel_gen(intel_get_drm_devid(fd)); + struct drm_i915_gem_exec_object2 obj[2]; + struct drm_i915_gem_relocation_entry reloc; + struct drm_i915_gem_execbuffer2 execbuf; + uint32_t batch[16]; + int i; + + gem_require_ring(fd, ring); + igt_skip_on_f(gen == 6 && (ring & ~(3<<13)) == I915_EXEC_BSD, + "MI_STORE_DATA broken on gen6 bsd\n"); + + intel_detect_and_clear_missed_interrupts(fd); + memset(&execbuf, 0, sizeof(execbuf)); + execbuf.buffers_ptr = (uintptr_t)obj; + execbuf.buffer_count = 2; + execbuf.flags = ring; + if (gen < 6) + execbuf.flags |= I915_EXEC_SECURE; + + memset(obj, 0, sizeof(obj)); + obj[0].handle = gem_create(fd, 4096); + obj[1].handle = gem_create(fd, 4096); + + memset(&reloc, 0, sizeof(reloc)); + reloc.target_handle = obj[0].handle; + reloc.presumed_offset = 0; + reloc.offset = sizeof(uint32_t); + reloc.delta = 0; + reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION; + reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION; + obj[1].relocs_ptr = (uintptr_t)&reloc; + obj[1].relocation_count = 1; + + i = 0; + batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0); + if (gen >= 8) { + batch[++i] = 0; + batch[++i] = 0; + } else if (gen >= 4) { + batch[++i] = 0; + batch[++i] = 0; + reloc.offset += sizeof(uint32_t); + } else { + batch[i]--; + batch[++i] = 0; + } + batch[++i] = 0xc0ffee; + batch[++i] = MI_BATCH_BUFFER_END; + gem_write(fd, obj[1].handle, 0, batch, sizeof(batch)); + gem_execbuf(fd, &execbuf); + gem_close(fd, obj[1].handle); + + gem_read(fd, obj[0].handle, 0, batch, sizeof(batch)); + gem_close(fd, obj[0].handle); + igt_assert_eq(*batch, 0xc0ffee); + igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); +} + +static void store_all(int fd) +{ + const int gen = intel_gen(intel_get_drm_devid(fd)); + struct drm_i915_gem_exec_object2 obj[2]; + struct drm_i915_gem_relocation_entry reloc[32]; + struct drm_i915_gem_execbuffer2 execbuf; + unsigned engines[16], permuted[16]; + uint32_t batch[16]; + uint64_t offset; + unsigned engine, nengine; + int value; + int i, j; + + memset(&execbuf, 0, sizeof(execbuf)); + execbuf.buffers_ptr = (uintptr_t)obj; + execbuf.buffer_count = 2; + if (gen < 6) + execbuf.flags |= I915_EXEC_SECURE; + + memset(reloc, 0, sizeof(reloc)); + memset(obj, 0, sizeof(obj)); + obj[0].handle = gem_create(fd, 4096); + obj[1].handle = gem_create(fd, 4096); + obj[1].relocation_count = 1; + + offset = sizeof(uint32_t); + i = 0; + batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0); + if (gen >= 8) { + batch[++i] = 0; + batch[++i] = 0; + } else if (gen >= 4) { + batch[++i] = 0; + batch[++i] = 0; + offset += sizeof(uint32_t); + } else { + batch[i]--; + batch[++i] = 0; + } + batch[value = ++i] = 0xc0ffee; + batch[++i] = MI_BATCH_BUFFER_END; + + nengine = 0; + intel_detect_and_clear_missed_interrupts(fd); + for_each_engine(fd, engine) { + if (gen == 6 && (engine & ~(3<<13)) == I915_EXEC_BSD) + continue; + + igt_assert(2*(nengine+1)*sizeof(batch) <= 4096); + + execbuf.flags &= ~ENGINE_MASK; + execbuf.flags |= engine; + + j = 2*nengine; + reloc[j].target_handle = obj[0].handle; + reloc[j].presumed_offset = ~0; + reloc[j].offset = j*sizeof(batch) + offset; + reloc[j].delta = nengine*sizeof(uint32_t); + reloc[j].read_domains = I915_GEM_DOMAIN_INSTRUCTION; + reloc[j].write_domain = I915_GEM_DOMAIN_INSTRUCTION; + obj[1].relocs_ptr = (uintptr_t)&reloc[j]; + + batch[value] = 0xdeadbeef; + gem_write(fd, obj[1].handle, j*sizeof(batch), + batch, sizeof(batch)); + execbuf.batch_start_offset = j*sizeof(batch); + gem_execbuf(fd, &execbuf); + + j = 2*nengine + 1; + reloc[j].target_handle = obj[0].handle; + reloc[j].presumed_offset = ~0; + reloc[j].offset = j*sizeof(batch) + offset; + reloc[j].delta = nengine*sizeof(uint32_t); + reloc[j].read_domains = I915_GEM_DOMAIN_INSTRUCTION; + reloc[j].write_domain = I915_GEM_DOMAIN_INSTRUCTION; + obj[1].relocs_ptr = (uintptr_t)&reloc[j]; + + batch[value] = nengine; + gem_write(fd, obj[1].handle, j*sizeof(batch), + batch, sizeof(batch)); + execbuf.batch_start_offset = j*sizeof(batch); + gem_execbuf(fd, &execbuf); + + engines[nengine++] = engine; + } + gem_sync(fd, obj[1].handle); + + for (i = 0; i < nengine; i++) { + obj[1].relocs_ptr = (uintptr_t)&reloc[2*i]; + execbuf.batch_start_offset = 2*i*sizeof(batch); + memcpy(permuted, engines, nengine*sizeof(engines[0])); + igt_permute_array(permuted, nengine, igt_exchange_int); + for (j = 0; j < nengine; j++) { + execbuf.flags &= ~ENGINE_MASK; + execbuf.flags |= permuted[j]; + gem_execbuf(fd, &execbuf); + } + obj[1].relocs_ptr = (uintptr_t)&reloc[2*i+1]; + execbuf.batch_start_offset = (2*i+1)*sizeof(batch); + execbuf.flags &= ~ENGINE_MASK; + execbuf.flags |= engines[i]; + gem_execbuf(fd, &execbuf); + } + gem_close(fd, obj[1].handle); + + gem_read(fd, obj[0].handle, 0, engines, sizeof(engines)); + gem_close(fd, obj[0].handle); + + for (i = 0; i < nengine; i++) + igt_assert_eq_u32(engines[i], i); + igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); +} + +static int +unload(void) +{ + kick_fbcon(false); + + if (igt_kmod_is_loaded("snd_hda_intel")) { + igt_assert(!igt_pkill(SIGTERM, "alsactl")); + + if (igt_kmod_unload("snd_hda_intel", 0)) { + igt_info("Could not unload snd_hda_intel\n"); + return IGT_EXIT_FAILURE; + } + } + + /* gen5 */ + if (igt_kmod_is_loaded("intel_ips")) { + igt_kmod_unload("intel_ips", 0); + } + + if (igt_kmod_is_loaded("i915")) { + if (igt_kmod_unload("i915", 0)) { + igt_info("Could not unload i915\n"); + return IGT_EXIT_SKIP; + } else { + igt_info("i915.ko has been unloaded!\n"); + } + } + + if (igt_kmod_is_loaded("intel-gtt")) { + igt_kmod_unload("intel-gtt", 0); + } + + igt_assert(!igt_kmod_unload("drm_kms_helper", 0)); + igt_assert(!igt_kmod_unload("drm", 0)); + + if (igt_kmod_is_loaded("i915")) { + igt_info("WARNING: i915.ko still loaded!\n"); + return IGT_EXIT_FAILURE; + } else { + igt_info("module successfully unloaded\n"); + } + + return IGT_EXIT_SUCCESS; +} + +static int +load(const char *opts_i915) +{ + if (opts_i915) + igt_info("Reloading i915 with %s\n\n", opts_i915); + + /* we do not have automatic loading of dependencies */ + igt_assert(!igt_kmod_load("drm", NULL)); + igt_assert(!igt_kmod_load("drm_kms_helper", NULL)); + + if (igt_kmod_load("i915", opts_i915)) { + igt_info("Could not load i915\n"); + return IGT_EXIT_FAILURE; + } + + kick_fbcon(true); + igt_assert(!igt_kmod_load("snd_hda_intel", NULL)); + + return IGT_EXIT_SUCCESS; +} + +static int +reload(const char *opts_i915) +{ + int err = IGT_EXIT_SUCCESS; + + if ((err = unload())) + return err; + + if ((err = load(opts_i915))) + return err; + + return err; +} + +static int +gem_info(int fd) +{ + struct drm_i915_gem_sw_finish arg = { 0 }; + + signal(SIGALRM, SIG_IGN); + + alarm(1); + if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0) { + return IGT_EXIT_SKIP; + } + + switch (errno) { + case ENOENT: + return 0; + case EIO: + return 1; + case EINTR: + return 2; + default: + return 3; + } +} + +static int +gem_exec_store(int fd) +{ + const struct intel_execution_engine *e; + igt_fixture { + igt_fork_hang_detector(fd); + } + + for (e = intel_execution_engines; e->name; e++) { + igt_subtest_f("basic-exec-store-%s", e->name) + store_dword(fd, e->exec_id | e->flags); + } + + igt_subtest("basic-exec-store-all") + store_all(fd); + + igt_fixture + igt_stop_hang_detector(); + + return IGT_EXIT_SUCCESS; +} + +static void +hda_dynamic_debug(bool enable) +{ + FILE *fp; + const char snd_hda_intel_on[] = "module snd_hda_intel +pf"; + const char snd_hda_core_on[] = "module snd_hda_core +pf"; + + const char snd_hda_intel_off[] = "module snd_hda_core =_"; + const char snd_hda_core_off[] = "module snd_hda_intel =_"; + + fp = fopen("/sys/kernel/debug/dynamic_debug/control", "w"); + igt_assert(fp != NULL); + + if (enable) { + fwrite(snd_hda_intel_on, 1, sizeof(snd_hda_intel_on), fp); + fwrite(snd_hda_core_on, 1, sizeof(snd_hda_core_on), fp); + } else { + fwrite(snd_hda_intel_off, 1, sizeof(snd_hda_intel_off), fp); + fwrite(snd_hda_core_off, 1, sizeof(snd_hda_core_off), fp); + } + + fclose(fp); +} + + +igt_main +{ + int i, err; + char buf[64]; + + igt_fixture + hda_dynamic_debug(true); + + igt_subtest("basic-reload") { + if ((err = reload(NULL))) + igt_fail(err); + } + + igt_subtest_group { + int fd; + + igt_fixture + fd = __drm_open_driver(DRIVER_INTEL); + + igt_subtest_group { + igt_subtest("basic-gem-info") + if ((err = gem_info(fd))) + igt_fail(err); + igt_subtest_group + if ((err = gem_exec_store(fd))) + igt_fail(err); + } + + igt_fixture + close(fd); + } + + igt_subtest("basic-reload-inject") { + for (i = 0; i < 4; i++) { + memset(buf, 0, sizeof(buf)); + snprintf(buf, sizeof(buf), "inject_load_failure=%d", i); + reload(buf); + } + } + + igt_subtest("basic-reload-final") + if ((err = reload(NULL))) + igt_fail(err); + + igt_fixture + hda_dynamic_debug(false); +} diff --git a/tests/drv_module_reload_basic b/tests/drv_module_reload_basic deleted file mode 100755 index b8cad88..0000000 --- a/tests/drv_module_reload_basic +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -# -# Testcase: Reload the drm module -# -# ... we've broken this way too often :( -# - -SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" -. $SOURCE_DIR/drm_lib.sh - -# no other drm service should be running, so we can just unbind - -# return 0 if module by name $1 is loaded according to lsmod -function mod_loaded() -{ - lsmod | grep -w "^$1" &> /dev/null -} - -function reload() { - local snd_hda_intel_unloaded - - echo Reloading i915.ko with $* - - # we must kick away fbcon (but only fbcon) - for vtcon in /sys/class/vtconsole/vtcon*/ ; do - if grep "frame buffer device" $vtcon/name > /dev/null ; then - echo unbinding $vtcon: `cat $vtcon/name` - echo 0 > $vtcon/bind - fi - done - - # The sound driver uses our power well - pkill alsactl - snd_hda_intel_unloaded=0 - if mod_loaded snd_hda_intel; then - if rmmod snd_hda_intel; then - snd_hda_intel_unloaded=1 - else - lsmod >&2 - fi - fi - - # gen5 only - if mod_loaded intel_ips; then - rmmod intel_ips - fi - - if ! rmmod i915; then - lsmod >&2 - return $IGT_EXIT_SKIP - fi - #ignore errors in intel-gtt, often built-in - rmmod intel-gtt &> /dev/null - # drm may be used by other devices (nouveau, radeon, udl, etc) - rmmod drm_kms_helper &> /dev/null - rmmod drm &> /dev/null - - if mod_loaded i915; then - echo WARNING: i915.ko still loaded! - return $IGT_EXIT_FAILURE - else - echo module successfully unloaded - fi - - modprobe i915 $* - - if [ -f /sys/class/vtconsole/vtcon1/bind ]; then - echo 1 > /sys/class/vtconsole/vtcon1/bind - fi - - modprobe -q snd_hda_intel || return $snd_hda_intel_unloaded -} - -function finish_load() { - # does the device exist? - if $SOURCE_DIR/gem_alive > /dev/null ; then - echo "module successfully loaded again" - else - echo "failed to reload module successfully" - return $IGT_EXIT_FAILURE - fi - - # then try to run something - if ! $SOURCE_DIR/gem_exec_store > /dev/null ; then - echo "failed to execute a simple batch after reload" - return $IGT_EXIT_FAILURE - fi - - return $IGT_EXIT_SUCCESS -} - -hda_dynamic_debug_enable - -reload || exit $? -finish_load || exit $? - -# Repeat the module reload trying to to generate faults -for i in $(seq 1 4); do - reload inject_load_failure=$i -done - -reload || exit $? -finish_load - -exit $? diff --git a/tests/gem_alive.c b/tests/gem_alive.c deleted file mode 100644 index 7544443..0000000 --- a/tests/gem_alive.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "igt.h" -#include -#include -#include -#include -#include -#include - - -int main(void) -{ - struct drm_i915_gem_sw_finish arg = { 0 }; - int fd; - - signal(SIGALRM, SIG_IGN); - - fd = __drm_open_driver(DRIVER_INTEL); - if (fd < 0) - return IGT_EXIT_SKIP; - - alarm(1); - if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0) - return IGT_EXIT_SKIP; - - switch (errno) { - case ENOENT: - return 0; - case EIO: - return 1; - case EINTR: - return 2; - default: - return 3; - } -} diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist index f59ec98..3c516ed 100644 --- a/tests/intel-ci/fast-feedback.testlist +++ b/tests/intel-ci/fast-feedback.testlist @@ -3,7 +3,18 @@ igt@core_prop_blob@basic igt@drv_getparams_basic@basic-eu-total igt@drv_getparams_basic@basic-subslice-total igt@drv_hangman@error-state-basic -igt@drv_module_reload_basic +igt@drv_module_reload@basic-reload +igt@drv_module_reload@basic-gem-info +igt@drv_module_reload@basic-exec-store-default +igt@drv_module_reload@basic-exec-store-render +igt@drv_module_reload@basic-exec-store-bsd +igt@drv_module_reload@basic-exec-store-bsd1 +igt@drv_module_reload@basic-exec-store-bsd2 +igt@drv_module_reload@basic-exec-store-blt +igt@drv_module_reload@basic-exec-store-vebox +igt@drv_module_reload@basic-exec-store-all +igt@drv_module_reload@basic-reload-inject +igt@drv_module_reload@basic-reload-final igt@gem_basic@bad-close igt@gem_basic@create-close igt@gem_basic@create-fd-close diff --git a/tools/Makefile.sources b/tools/Makefile.sources index be58871..e2451ea 100644 --- a/tools/Makefile.sources +++ b/tools/Makefile.sources @@ -29,6 +29,7 @@ tools_prog_lists = \ intel_residency \ intel_stepping \ intel_watermark \ + intel_gem_info \ $(NULL) dist_bin_SCRIPTS = intel_gpu_abrt diff --git a/tools/intel_gem_info.c b/tools/intel_gem_info.c new file mode 100644 index 0000000..7544443 --- /dev/null +++ b/tools/intel_gem_info.c @@ -0,0 +1,35 @@ +#include "igt.h" +#include +#include +#include +#include +#include +#include + + +int main(void) +{ + struct drm_i915_gem_sw_finish arg = { 0 }; + int fd; + + signal(SIGALRM, SIG_IGN); + + fd = __drm_open_driver(DRIVER_INTEL); + if (fd < 0) + return IGT_EXIT_SKIP; + + alarm(1); + if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0) + return IGT_EXIT_SKIP; + + switch (errno) { + case ENOENT: + return 0; + case EIO: + return 1; + case EINTR: + return 2; + default: + return 3; + } +}