public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	tvrtko.ursulin@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t] i915: Exercise preemption timeout controls in sysfs
Date: Fri, 18 Oct 2019 17:06:10 +0300	[thread overview]
Message-ID: <20191018140610.GB25209@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <bd989ba8-e1dd-9e2c-baaf-416612aa5c72@linux.intel.com>

On Fri, Oct 18, 2019 at 01:39:37PM +0100, Tvrtko Ursulin wrote:
> 
> On 18/10/2019 13:35, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2019-10-18 13:23:53)
> > > 
> > > On 17/10/2019 15:30, Chris Wilson wrote:
> > > > Dynamic subtests!
> > > 
> > > Ouch! :)
> > > 
> > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > ---
> > > > +static void test_timeout(int i915, int engine)
> > > > +{
> > > > +     int delays[] = { 1, 50, 100, 500 };
> > > > +     unsigned int saved, delay;
> > > > +
> > > > +     igt_assert(igt_sysfs_scanf(engine, "preempt_timeout_ms", "%u", &saved) == 1);
> > > > +     igt_debug("Initial preempt_timeout_ms:%u\n", saved);
> > > > +
> > > > +     gem_quiescent_gpu(i915);
> > > > +     igt_require(enable_hangcheck(i915, false));
> > > > +
> > > > +     for (int i = 0; i < ARRAY_SIZE(delays); i++) {
> > > > +             uint64_t elapsed;
> > > > +
> > > > +             elapsed = __test_timeout(i915, engine, delays[i]);
> > > > +             igt_info("preempt_timeout_ms:%d, elapsed=%.3fms\n",
> > > > +                      delays[i], elapsed * 1e-6);
> > > 
> > > No checking that measured time relates to configured timeout?
> > 
> > Have now. Just needed some soaking to decide on thresholds. I've 50ms
> > but that may change as CI tends to have more scheduling intolerance than
> > local machines.
> > 
> > > > +     }
> > > > +
> > > > +     igt_assert(enable_hangcheck(i915, true));
> > > > +     gem_quiescent_gpu(i915);
> > > > +
> > > > +     igt_sysfs_printf(engine, "preempt_timeout_ms", "%u", saved);
> > > > +     igt_sysfs_scanf(engine, "preempt_timeout_ms", "%u", &delay);
> > > > +     igt_assert_eq(delay, saved);
> > > > +}
> > > > +
> > > > +igt_main
> > > > +{
> > > > +     int i915, sys = -1;
> > > > +     struct dirent *de;
> > > > +     int engines;
> > > > +     DIR *dir;
> > > > +
> > > > +     igt_fixture {
> > > > +             i915 = drm_open_driver(DRIVER_INTEL);
> > > > +             igt_require_gem(i915);
> > > > +
> > > > +             sys = igt_sysfs_open(i915);
> > > > +             igt_require(sys != -1);
> > > 
> > > igt_assert_fd?
> > 
> > Do we guarantee that the sysadmin has mounted sysfs? We don't automount
> > it unlike debugfs.
> > 
> > > > +             igt_subtest_group {
> > > > +                     igt_fixture {
> > > > +                             igt_require(fstatat(engine,
> > > > +                                                 "preempt_timeout_ms",
> > > > +                                                 &st, 0) == 0);
> > > > +                     }
> > > > +
> > > > +                     igt_subtest_f("%s-idempotent", name)
> > > > +                             test_idempotent(i915, engine);
> > > > +                     igt_subtest_f("%s-invalid", name)
> > > > +                             test_invalid(i915, engine);
> > > > +                     igt_subtest_f("%s-timeout", name)
> > > > +                             test_timeout(i915, engine);
> > > > +             }
> > > > +
> > > > +             free(name);
> > > > +             close(engine);
> > > > +     }
> > > 
> > > You probably should use __for_each_static_engine and then open sysfs
> > > nodes based on that. Gets around the dynamic subtests no-no at least.
> > 
> > Defeatist!
> 
> Well I have challenged this status quo a few times and now I am embracing
> it, or should I say disagreeing and committing, so bonus points all round.
> :)


Perhaps next week I'll get around to reshaping the dynamic subtests
series. Watch this space!

(Meanwhile, I hope it goes without saying, dynamic subtests are indeed
a no-no)


-- 
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      reply	other threads:[~2019-10-18 14:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 14:30 [igt-dev] [PATCH i-g-t] i915: Exercise preemption timeout controls in sysfs Chris Wilson
2019-10-17 15:08 ` [igt-dev] ✗ GitLab.Pipeline: warning for " Patchwork
2019-10-18 12:23 ` [igt-dev] [PATCH i-g-t] " Tvrtko Ursulin
2019-10-18 12:35   ` Chris Wilson
2019-10-18 12:39     ` Tvrtko Ursulin
2019-10-18 14:06       ` Petri Latvala [this message]

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=20191018140610.GB25209@platvala-desk.ger.corp.intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@intel.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    /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