From: "Fiedorowicz, Lukasz" <lukasz.fiedorowicz@intel.com>
To: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>
Subject: Re: [PATCH igt v2] lib: Avoid actually throttling from igt_require_gem()
Date: Thu, 24 Aug 2017 13:09:56 +0000 [thread overview]
Message-ID: <1503580195.31255.3.camel@intel.com> (raw)
In-Reply-To: <20170824124237.8766-1-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
next prev parent reply other threads:[~2017-08-24 13:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1503580195.31255.3.camel@intel.com \
--to=lukasz.fiedorowicz@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).