intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH igt] lib: Avoid actually throttling from igt_require_gem()
@ 2017-08-18 10:46 Chris Wilson
  2017-08-18 10:51 ` Chris Wilson
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Chris Wilson @ 2017-08-18 10:46 UTC (permalink / raw)
  To: intel-gfx

igt_require_gem() checks whether we can use the i915 fd for submitting
requests by detecting a wedged driver. It was intended to be used just
after opening DRIVER_INTEL for a gem test to provide an early skip if
the device was unusable. However, it is also used at the start of
library functions like igt_spin_batch_new() which may be called after
the test has setup some state, and importantly submitted some batches.
igt_require_gem() has the risk of then waiting on those batches, unless
we tell it to use a clean fd.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
 lib/drmtest.c        | 37 +++++++++++++++++++++++++++++++++++++
 lib/ioctl_wrappers.c |  8 ++++++++
 2 files changed, 45 insertions(+)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 158af682..0f8bd604 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -318,6 +318,43 @@ static int __drm_open_driver_render(int chipset)
 	return fd;
 }
 
+int __drm_reopen_driver(int fd)
+{
+	struct stat target;
+	const char *base;
+	int offset;
+
+	if (fstat(fd, &target))
+		return -errno;
+
+	if (target.st_rdev & 0x80) { /* render node */
+		base = "/dev/dri/renderD%d";
+		offset = 0x80;
+	} else {
+		base = "/dev/dri/card%d";
+		offset = 0;
+	}
+
+	for (int i = 0; i < 16; i++) {
+		struct stat st;
+		char buf[256];
+
+		snprintf(buf, sizeof(buf), base, i + offset);
+		fd = open(buf, O_RDWR);
+		if (fd < 0)
+			continue;
+
+		if (fstat(fd, &st) == 0 &&
+		    st.st_mode == target.st_mode &&
+		    st.st_rdev == target.st_rdev)
+			return fd;
+
+		close(fd);
+	}
+
+	return -ENOENT;
+}
+
 static int at_exit_drm_fd = -1;
 static int at_exit_drm_render_fd = -1;
 
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 51000bac..948b8f0c 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1602,9 +1602,17 @@ void igt_require_gem(int fd)
 
 	igt_require_intel(fd);
 
+	/* We only want to use the throttle-ioctl for its -EIO reporting
+	 * of a wedged device, not for actually waiting on outstanding
+	 * requests! So create a new drm_file for the device that is clean.
+	 */
+	fd = __drm_reopen_driver(fd);
+	igt_assert_lte(0, fd);
+
 	err = 0;
 	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
 		err = -errno;
+	close(fd);
 
 	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
 }
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH igt] lib: Avoid actually throttling from igt_require_gem()
  2017-08-18 10:46 [PATCH igt] lib: Avoid actually throttling from igt_require_gem() Chris Wilson
@ 2017-08-18 10:51 ` Chris Wilson
  2017-08-18 10:53 ` Chris Wilson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Chris Wilson @ 2017-08-18 10:51 UTC (permalink / raw)
  To: intel-gfx

Quoting Chris Wilson (2017-08-18 11:46:19)
> igt_require_gem() checks whether we can use the i915 fd for submitting
> requests by detecting a wedged driver. It was intended to be used just
> after opening DRIVER_INTEL for a gem test to provide an early skip if
> the device was unusable. However, it is also used at the start of
> library functions like igt_spin_batch_new() which may be called after
> the test has setup some state, and importantly submitted some batches.
> igt_require_gem() has the risk of then waiting on those batches, unless
> we tell it to use a clean fd.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>  lib/drmtest.c        | 37 +++++++++++++++++++++++++++++++++++++
>  lib/ioctl_wrappers.c |  8 ++++++++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 158af682..0f8bd604 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -318,6 +318,43 @@ static int __drm_open_driver_render(int chipset)
>         return fd;
>  }
>  
> +int __drm_reopen_driver(int fd)

Might be better if I remember to send the one with the declaration in
the header.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH igt] lib: Avoid actually throttling from igt_require_gem()
  2017-08-18 10:46 [PATCH igt] lib: Avoid actually throttling from igt_require_gem() Chris Wilson
  2017-08-18 10:51 ` Chris Wilson
@ 2017-08-18 10:53 ` Chris Wilson
  2017-08-18 11:46   ` Michal Wajdeczko
  2017-08-18 12:52   ` Michał Winiarski
  2017-08-18 13:05 ` ✗ Fi.CI.BAT: failure for " Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: Chris Wilson @ 2017-08-18 10:53 UTC (permalink / raw)
  To: intel-gfx

Quoting Chris Wilson (2017-08-18 11:46:19)
> igt_require_gem() checks whether we can use the i915 fd for submitting
> requests by detecting a wedged driver. It was intended to be used just
> after opening DRIVER_INTEL for a gem test to provide an early skip if
> the device was unusable. However, it is also used at the start of
> library functions like igt_spin_batch_new() which may be called after
> the test has setup some state, and importantly submitted some batches.
> igt_require_gem() has the risk of then waiting on those batches, unless
> we tell it to use a clean fd.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>  lib/drmtest.c        | 37 +++++++++++++++++++++++++++++++++++++
>  lib/ioctl_wrappers.c |  8 ++++++++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 158af682..0f8bd604 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -318,6 +318,43 @@ static int __drm_open_driver_render(int chipset)
>         return fd;
>  }
>  
> +int __drm_reopen_driver(int fd)
> +{
> +       struct stat target;
> +       const char *base;
> +       int offset;
> +
> +       if (fstat(fd, &target))
> +               return -errno;
> +
> +       if (target.st_rdev & 0x80) { /* render node */
> +               base = "/dev/dri/renderD%d";
> +               offset = 0x80;
> +       } else {
> +               base = "/dev/dri/card%d";
> +               offset = 0;
> +       }
> +
> +       for (int i = 0; i < 16; i++) {
> +               struct stat st;
> +               char buf[256];
> +
> +               snprintf(buf, sizeof(buf), base, i + offset);
> +               fd = open(buf, O_RDWR);
> +               if (fd < 0)
> +                       continue;
> +
> +               if (fstat(fd, &st) == 0 &&
> +                   st.st_mode == target.st_mode &&
> +                   st.st_rdev == target.st_rdev)
> +                       return fd;

Or should we try a readlink of /proc/self/fd/$fd?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH igt] lib: Avoid actually throttling from igt_require_gem()
  2017-08-18 10:53 ` Chris Wilson
@ 2017-08-18 11:46   ` Michal Wajdeczko
  2017-08-18 13:04     ` Michał Winiarski
  2017-08-18 12:52   ` Michał Winiarski
  1 sibling, 1 reply; 14+ messages in thread
From: Michal Wajdeczko @ 2017-08-18 11:46 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Fri, Aug 18, 2017 at 11:53:22AM +0100, Chris Wilson wrote:
> Quoting Chris Wilson (2017-08-18 11:46:19)
> > igt_require_gem() checks whether we can use the i915 fd for submitting
> > requests by detecting a wedged driver. It was intended to be used just
> > after opening DRIVER_INTEL for a gem test to provide an early skip if
> > the device was unusable. However, it is also used at the start of
> > library functions like igt_spin_batch_new() which may be called after
> > the test has setup some state, and importantly submitted some batches.
> > igt_require_gem() has the risk of then waiting on those batches, unless
> > we tell it to use a clean fd.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>

You probably wanted to Cc: other Michal ;)

<snip>

+/* We only want to use the throttle-ioctl for its -EIO reporting
+ * of a wedged device, not for actually waiting on outstanding
+ * requests! So create a new drm_file for the device that is clean.
+ */

But while here: if you just need -EIO, why not read "i915_wedged" from debugfs ?

Michal

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH igt] lib: Avoid actually throttling from igt_require_gem()
  2017-08-18 10:53 ` Chris Wilson
  2017-08-18 11:46   ` Michal Wajdeczko
@ 2017-08-18 12:52   ` Michał Winiarski
  1 sibling, 0 replies; 14+ messages in thread
From: Michał Winiarski @ 2017-08-18 12:52 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Fri, Aug 18, 2017 at 11:53:22AM +0100, Chris Wilson wrote:
> Quoting Chris Wilson (2017-08-18 11:46:19)
> > igt_require_gem() checks whether we can use the i915 fd for submitting
> > requests by detecting a wedged driver. It was intended to be used just
> > after opening DRIVER_INTEL for a gem test to provide an early skip if
> > the device was unusable. However, it is also used at the start of
> > library functions like igt_spin_batch_new() which may be called after
> > the test has setup some state, and importantly submitted some batches.
> > igt_require_gem() has the risk of then waiting on those batches, unless
> > we tell it to use a clean fd.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > ---
> >  lib/drmtest.c        | 37 +++++++++++++++++++++++++++++++++++++
> >  lib/ioctl_wrappers.c |  8 ++++++++
> >  2 files changed, 45 insertions(+)
> > 
> > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > index 158af682..0f8bd604 100644
> > --- a/lib/drmtest.c
> > +++ b/lib/drmtest.c
> > @@ -318,6 +318,43 @@ static int __drm_open_driver_render(int chipset)
> >         return fd;
> >  }
> >  
> > +int __drm_reopen_driver(int fd)
> > +{
> > +       struct stat target;
> > +       const char *base;
> > +       int offset;
> > +
> > +       if (fstat(fd, &target))
> > +               return -errno;
> > +
> > +       if (target.st_rdev & 0x80) { /* render node */
> > +               base = "/dev/dri/renderD%d";
> > +               offset = 0x80;
> > +       } else {
> > +               base = "/dev/dri/card%d";
> > +               offset = 0;
> > +       }
> > +
> > +       for (int i = 0; i < 16; i++) {
> > +               struct stat st;
> > +               char buf[256];
> > +
> > +               snprintf(buf, sizeof(buf), base, i + offset);
> > +               fd = open(buf, O_RDWR);
> > +               if (fd < 0)
> > +                       continue;
> > +
> > +               if (fstat(fd, &st) == 0 &&
> > +                   st.st_mode == target.st_mode &&
> > +                   st.st_rdev == target.st_rdev)
> > +                       return fd;
> 
> Or should we try a readlink of /proc/self/fd/$fd?
> -Chris

Seems simpler - we won't need to "duplicate" drm_open_driver.

-Michał
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH igt] lib: Avoid actually throttling from igt_require_gem()
  2017-08-18 11:46   ` Michal Wajdeczko
@ 2017-08-18 13:04     ` Michał Winiarski
  0 siblings, 0 replies; 14+ messages in thread
From: Michał Winiarski @ 2017-08-18 13:04 UTC (permalink / raw)
  To: Michal Wajdeczko; +Cc: intel-gfx

On Fri, Aug 18, 2017 at 01:46:12PM +0200, Michal Wajdeczko wrote:
> On Fri, Aug 18, 2017 at 11:53:22AM +0100, Chris Wilson wrote:
> > Quoting Chris Wilson (2017-08-18 11:46:19)
> > > igt_require_gem() checks whether we can use the i915 fd for submitting
> > > requests by detecting a wedged driver. It was intended to be used just
> > > after opening DRIVER_INTEL for a gem test to provide an early skip if
> > > the device was unusable. However, it is also used at the start of
> > > library functions like igt_spin_batch_new() which may be called after
> > > the test has setup some state, and importantly submitted some batches.
> > > igt_require_gem() has the risk of then waiting on those batches, unless
> > > we tell it to use a clean fd.
> > > 
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> 
> You probably wanted to Cc: other Michal ;)
> 
> <snip>
> 
> +/* We only want to use the throttle-ioctl for its -EIO reporting
> + * of a wedged device, not for actually waiting on outstanding
> + * requests! So create a new drm_file for the device that is clean.
> + */
> 
> But while here: if you just need -EIO, why not read "i915_wedged" from debugfs ?
> 
> Michal

We're trying to excercise the ABI rather than reading files from debugfs
whenever possible (in this case it doesn't matter... in general case it's a good
guideline to follow).

-Michał
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling from igt_require_gem()
  2017-08-18 10:46 [PATCH igt] lib: Avoid actually throttling from igt_require_gem() Chris Wilson
  2017-08-18 10:51 ` Chris Wilson
  2017-08-18 10:53 ` Chris Wilson
@ 2017-08-18 13:05 ` Patchwork
  2017-08-24 12:42 ` [PATCH igt v2] " Chris Wilson
  2017-08-24 13:22 ` ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling from igt_require_gem() (rev2) Patchwork
  4 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2017-08-18 13:05 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: lib: Avoid actually throttling from igt_require_gem()
URL   : https://patchwork.freedesktop.org/series/28983/
State : failure

== Summary ==

IGT patchset build failed on latest successful build
5a17ee2c8f9013f5db852d27564b837f9f2c5a9f tools/intel_vbt_decode: Fix decoding of child device structure

make  all-recursive
Making all in lib
make  all-recursive
Making all in .
  CC       ioctl_wrappers.lo
Makefile:693: recipe for target 'ioctl_wrappers.lo' failed
Makefile:715: recipe for target 'all-recursive' failed
Makefile:555: recipe for target 'all' failed
Makefile:528: recipe for target 'all-recursive' failed
Makefile:460: recipe for target 'all' failed
====================================================
   intel-gpu-tools 1.19: lib/tests/test-suite.log
====================================================

# TOTAL: 17
# PASS:  11
# SKIP:  0
# XFAIL: 6
# FAIL:  0
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

XFAIL: igt_no_exit
==================

IGT-Version: 1.19-g22f63943 (x86_64) (Linux: 4.10.0-28-generic x86_64)
Subtest A: SUCCESS (0.000s)
igt_no_exit: igt_core.c:573: common_exit_handler: Assertion `sig != 0 || igt_exit_called' failed.
XFAIL igt_no_exit (exit status: 134)

XFAIL: igt_no_exit_list_only
============================

igt_no_exit_list_only: igt_core.c:573: common_exit_handler: Assertion `sig != 0 || igt_exit_called' failed.
A
XFAIL igt_no_exit_list_only (exit status: 134)

XFAIL: igt_no_subtest
=====================

igt_no_subtest: igt_core.c:1474: igt_exit: Assertion `!test_with_subtests || skipped_one || succeeded_one || failed_one' failed.
IGT-Version: 1.19-g22f63943 (x86_64) (Linux: 4.10.0-28-generic x86_64)
Received signal SIGABRT.
XFAIL igt_no_subtest (exit status: 134)

XFAIL: igt_simple_test_subtests
===============================

igt_simple_test_subtests: igt_core.c:949: __igt_run_subtest: Assertion `test_with_subtests' failed.
IGT-Version: 1.19-g22f63943 (x86_64) (Linux: 4.10.0-28-generic x86_64)
Received signal SIGABRT.
XFAIL igt_simple_test_subtests (exit status: 134)

XFAIL: igt_timeout
==================

Test igt_timeout failed.
**** DEBUG ****
(igt_timeout:33499) igt-core-INFO: Timed out: Testcase
****  END  ****
IGT-Version: 1.19-g22f63943 (x86_64) (Linux: 4.10.0-28-generic x86_64)
Timed out: Testcase
FAIL (1.000s)
XFAIL igt_timeout (exit status: 99)

XFAIL: igt_invalid_subtest_name
===============================

IGT-Version: 1.19-g22f63943 (x86_64) (Linux: 4.10.0-28-generic x86_64)
(igt_invalid_subtest_name:33505) igt-core-CRITICAL: Invalid subtest name "# invalid name !".
igt_invalid_subtest_name: igt_core.c:1474: igt_exit: Assertion `!test_with_subtests || skipped_one || succeeded_one || failed_one' failed.
Received signal SIGABRT.
XFAIL igt_invalid_subtest_name (exit status: 134)

====================================================
   intel-gpu-tools 1.19: assembler/test-suite.log
====================================================

# TOTAL: 10
# PASS:  10
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

================================================
   intel-gpu-tools 1.19: tests/test-suite.log
================================================

# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH igt v2] lib: Avoid actually throttling from igt_require_gem()
  2017-08-18 10:46 [PATCH igt] lib: Avoid actually throttling from igt_require_gem() Chris Wilson
                   ` (2 preceding siblings ...)
  2017-08-18 13:05 ` ✗ Fi.CI.BAT: failure for " Patchwork
@ 2017-08-24 12:42 ` Chris Wilson
  2017-08-24 13:08   ` Michał Winiarski
  2017-08-24 13:09   ` Fiedorowicz, Lukasz
  2017-08-24 13:22 ` ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling from igt_require_gem() (rev2) Patchwork
  4 siblings, 2 replies; 14+ messages in thread
From: Chris Wilson @ 2017-08-24 12:42 UTC (permalink / raw)
  To: intel-gfx

igt_require_gem() checks whether we can use the i915 fd for submitting
requests by detecting a wedged driver. It was intended to be used just
after opening DRIVER_INTEL for a gem test to provide an early skip if
the device was unusable. However, it is also used at the start of
library functions like igt_spin_batch_new() which may be called after
the test has setup some state, and importantly submitted some batches.
igt_require_gem() has the risk of then waiting on those batches, unless
we tell it to use a clean fd.

v2: Chase the /proc/self/fd/$fd link

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michał Winiarski <michal.winiarski@intel.com>
---
 lib/ioctl_wrappers.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 51000bac..d91f29c8 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1598,13 +1598,23 @@ void gem_require_caching(int fd)
 
 void igt_require_gem(int fd)
 {
+	char path[256];
 	int err;
 
 	igt_require_intel(fd);
 
+	/* We only want to use the throttle-ioctl for its -EIO reporting
+	 * of a wedged device, not for actually waiting on outstanding
+	 * requests! So create a new drm_file for the device that is clean.
+	 */
+	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
+	fd = open(path, O_RDWR);
+	igt_assert_lte(0, fd);
+
 	err = 0;
 	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
 		err = -errno;
+	close(fd);
 
 	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
 }
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH igt v2] lib: Avoid actually throttling from igt_require_gem()
  2017-08-24 12:42 ` [PATCH igt v2] " Chris Wilson
@ 2017-08-24 13:08   ` Michał Winiarski
  2017-08-24 13:09   ` Fiedorowicz, Lukasz
  1 sibling, 0 replies; 14+ messages in thread
From: Michał Winiarski @ 2017-08-24 13:08 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Thu, Aug 24, 2017 at 01:42:37PM +0100, Chris Wilson wrote:
> igt_require_gem() checks whether we can use the i915 fd for submitting
> requests by detecting a wedged driver. It was intended to be used just
> after opening DRIVER_INTEL for a gem test to provide an early skip if
> the device was unusable. However, it is also used at the start of
> library functions like igt_spin_batch_new() which may be called after
> the test has setup some state, and importantly submitted some batches.
> igt_require_gem() has the risk of then waiting on those batches, unless
> we tell it to use a clean fd.
> 
> v2: Chase the /proc/self/fd/$fd link
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michał Winiarski <michal.winiarski@intel.com>

Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>

-Michał

> ---
>  lib/ioctl_wrappers.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 51000bac..d91f29c8 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1598,13 +1598,23 @@ void gem_require_caching(int fd)
>  
>  void igt_require_gem(int fd)
>  {
> +	char path[256];
>  	int err;
>  
>  	igt_require_intel(fd);
>  
> +	/* We only want to use the throttle-ioctl for its -EIO reporting
> +	 * of a wedged device, not for actually waiting on outstanding
> +	 * requests! So create a new drm_file for the device that is clean.
> +	 */
> +	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
> +	fd = open(path, O_RDWR);
> +	igt_assert_lte(0, fd);
> +
>  	err = 0;
>  	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
>  		err = -errno;
> +	close(fd);
>  
>  	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
>  }
> -- 
> 2.14.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH igt v2] lib: Avoid actually throttling from igt_require_gem()
  2017-08-24 12:42 ` [PATCH igt v2] " Chris Wilson
  2017-08-24 13:08   ` Michał Winiarski
@ 2017-08-24 13:09   ` Fiedorowicz, Lukasz
  1 sibling, 0 replies; 14+ messages in thread
From: Fiedorowicz, Lukasz @ 2017-08-24 13:09 UTC (permalink / raw)
  To: intel-gfx@lists.freedesktop.org, chris@chris-wilson.co.uk

On Thu, 2017-08-24 at 13:42 +0100, Chris Wilson wrote:
> igt_require_gem() checks whether we can use the i915 fd for
> submitting
> requests by detecting a wedged driver. It was intended to be used
> just
> after opening DRIVER_INTEL for a gem test to provide an early skip if
> the device was unusable. However, it is also used at the start of
> library functions like igt_spin_batch_new() which may be called after
> the test has setup some state, and importantly submitted some
> batches.
> igt_require_gem() has the risk of then waiting on those batches,
> unless
> we tell it to use a clean fd.
> 
> v2: Chase the /proc/self/fd/$fd link
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michał Winiarski <michal.winiarski@intel.com>
> ---
>  lib/ioctl_wrappers.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 51000bac..d91f29c8 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1598,13 +1598,23 @@ void gem_require_caching(int fd)
>  
>  void igt_require_gem(int fd)
>  {
> +	char path[256];
>  	int err;
>  
>  	igt_require_intel(fd);
>  
> +	/* We only want to use the throttle-ioctl for its -EIO
> reporting
> +	 * of a wedged device, not for actually waiting on
> outstanding
> +	 * requests! So create a new drm_file for the device that is
> clean.
> +	 */
> +	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
> +	fd = open(path, O_RDWR);
> +	igt_assert_lte(0, fd);
> +
>  	err = 0;
>  	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
>  		err = -errno;
> +	close(fd);
>  
>  	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
>  }

I would use PATH_MAX but other than this:
Reviewed-by: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling from igt_require_gem() (rev2)
  2017-08-18 10:46 [PATCH igt] lib: Avoid actually throttling from igt_require_gem() Chris Wilson
                   ` (3 preceding siblings ...)
  2017-08-24 12:42 ` [PATCH igt v2] " Chris Wilson
@ 2017-08-24 13:22 ` Patchwork
  2017-08-25 17:11   ` Daniel Vetter
  4 siblings, 1 reply; 14+ messages in thread
From: Patchwork @ 2017-08-24 13:22 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: lib: Avoid actually throttling from igt_require_gem() (rev2)
URL   : https://patchwork.freedesktop.org/series/28983/
State : failure

== Summary ==

IGT patchset tested on top of latest successful build
80cc54023e198165eca34450e9cc75c9cffcb072 lib/core: Use igt_info instead of printf

with latest DRM-Tip kernel build CI_DRM_2998
3adc9e3cacef drm-tip: 2017y-08m-23d-21h-35m-35s UTC integration manifest

Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-snb-2600) fdo#100215
Test kms_flip:
        Subgroup basic-flip-vs-modeset:
                skip       -> PASS       (fi-skl-x1585l) fdo#101781
                pass       -> INCOMPLETE (fi-kbl-7560u)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-byt-n2820) fdo#101705
        Subgroup suspend-read-crc-pipe-c:
                fail       -> PASS       (fi-skl-6700k) fdo#100367

fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705
fdo#100367 https://bugs.freedesktop.org/show_bug.cgi?id=100367

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:450s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:448s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:366s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:560s
fi-bwr-2160      total:279  pass:184  dwarn:0   dfail:0   fail:0   skip:95  time:254s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:530s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:530s
fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:516s
fi-elk-e7500     total:279  pass:230  dwarn:0   dfail:0   fail:0   skip:49  time:435s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:613s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:449s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:424s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:427s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:510s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:475s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:479s
fi-kbl-7560u     total:209  pass:205  dwarn:0   dfail:0   fail:0   skip:3  
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:602s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:524s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:474s
fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:479s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:494s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:443s
fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:509s
fi-snb-2600      total:279  pass:249  dwarn:0   dfail:0   fail:1   skip:29  time:405s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_94/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling from igt_require_gem() (rev2)
  2017-08-24 13:22 ` ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling from igt_require_gem() (rev2) Patchwork
@ 2017-08-25 17:11   ` Daniel Vetter
  2017-08-25 17:39     ` Chris Wilson
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Vetter @ 2017-08-25 17:11 UTC (permalink / raw)
  To: intel-gfx

On Thu, Aug 24, 2017 at 01:22:40PM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: lib: Avoid actually throttling from igt_require_gem() (rev2)
> URL   : https://patchwork.freedesktop.org/series/28983/
> State : failure

2 r-b tags and no comment on why it failed CI?

Smells like review not entirely done ... tsk.

Most likely this is the dp-mst hang right when there wasn't a cibuglog
entry. Chris, can you pls resend so we can get a full igt run on this too?

Thanks, Daniel
> 
> == Summary ==
> 
> IGT patchset tested on top of latest successful build
> 80cc54023e198165eca34450e9cc75c9cffcb072 lib/core: Use igt_info instead of printf
> 
> with latest DRM-Tip kernel build CI_DRM_2998
> 3adc9e3cacef drm-tip: 2017y-08m-23d-21h-35m-35s UTC integration manifest
> 
> Test kms_cursor_legacy:
>         Subgroup basic-busy-flip-before-cursor-atomic:
>                 pass       -> FAIL       (fi-snb-2600) fdo#100215
> Test kms_flip:
>         Subgroup basic-flip-vs-modeset:
>                 skip       -> PASS       (fi-skl-x1585l) fdo#101781
>                 pass       -> INCOMPLETE (fi-kbl-7560u)
> Test kms_pipe_crc_basic:
>         Subgroup suspend-read-crc-pipe-b:
>                 pass       -> DMESG-WARN (fi-byt-n2820) fdo#101705
>         Subgroup suspend-read-crc-pipe-c:
>                 fail       -> PASS       (fi-skl-6700k) fdo#100367
> 
> fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
> fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781
> fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705
> fdo#100367 https://bugs.freedesktop.org/show_bug.cgi?id=100367
> 
> fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:450s
> fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:448s
> fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:366s
> fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:560s
> fi-bwr-2160      total:279  pass:184  dwarn:0   dfail:0   fail:0   skip:95  time:254s
> fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:530s
> fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:530s
> fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:516s
> fi-elk-e7500     total:279  pass:230  dwarn:0   dfail:0   fail:0   skip:49  time:435s
> fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:613s
> fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:449s
> fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:424s
> fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:427s
> fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:510s
> fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:475s
> fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:479s
> fi-kbl-7560u     total:209  pass:205  dwarn:0   dfail:0   fail:0   skip:3  
> fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:602s
> fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:524s
> fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:474s
> fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:479s
> fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:494s
> fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:443s
> fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:509s
> fi-snb-2600      total:279  pass:249  dwarn:0   dfail:0   fail:1   skip:29  time:405s
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_94/
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling  from igt_require_gem() (rev2)
  2017-08-25 17:11   ` Daniel Vetter
@ 2017-08-25 17:39     ` Chris Wilson
  2017-08-25 18:45       ` Daniel Vetter
  0 siblings, 1 reply; 14+ messages in thread
From: Chris Wilson @ 2017-08-25 17:39 UTC (permalink / raw)
  To: Daniel Vetter, intel-gfx

Quoting Daniel Vetter (2017-08-25 18:11:56)
> On Thu, Aug 24, 2017 at 01:22:40PM -0000, Patchwork wrote:
> > == Series Details ==
> > 
> > Series: lib: Avoid actually throttling from igt_require_gem() (rev2)
> > URL   : https://patchwork.freedesktop.org/series/28983/
> > State : failure
> 
> 2 r-b tags and no comment on why it failed CI?

It failed CI? CI failed it and gave no reason. It looks like the network
gave up in the middle of a transfer.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling  from igt_require_gem() (rev2)
  2017-08-25 17:39     ` Chris Wilson
@ 2017-08-25 18:45       ` Daniel Vetter
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2017-08-25 18:45 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Fri, Aug 25, 2017 at 06:39:01PM +0100, Chris Wilson wrote:
> Quoting Daniel Vetter (2017-08-25 18:11:56)
> > On Thu, Aug 24, 2017 at 01:22:40PM -0000, Patchwork wrote:
> > > == Series Details ==
> > > 
> > > Series: lib: Avoid actually throttling from igt_require_gem() (rev2)
> > > URL   : https://patchwork.freedesktop.org/series/28983/
> > > State : failure
> > 
> > 2 r-b tags and no comment on why it failed CI?
> 
> It failed CI? CI failed it and gave no reason. It looks like the network
> gave up in the middle of a transfer.

We've had a few runs where kbl-7560u died due to dp mst plugged in, which
haven't been handled. And if you fail BAT it won't run the more complete
IGT set, so you pretty much have to resend either way.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-08-25 18:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-18 10:46 [PATCH igt] lib: Avoid actually throttling from igt_require_gem() Chris Wilson
2017-08-18 10:51 ` Chris Wilson
2017-08-18 10:53 ` Chris Wilson
2017-08-18 11:46   ` Michal Wajdeczko
2017-08-18 13:04     ` Michał Winiarski
2017-08-18 12:52   ` Michał Winiarski
2017-08-18 13:05 ` ✗ Fi.CI.BAT: failure for " Patchwork
2017-08-24 12:42 ` [PATCH igt v2] " Chris Wilson
2017-08-24 13:08   ` Michał Winiarski
2017-08-24 13:09   ` Fiedorowicz, Lukasz
2017-08-24 13:22 ` ✗ Fi.CI.BAT: failure for lib: Avoid actually throttling from igt_require_gem() (rev2) Patchwork
2017-08-25 17:11   ` Daniel Vetter
2017-08-25 17:39     ` Chris Wilson
2017-08-25 18:45       ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).