igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] gem_wsim: Refactor how we sleep in period mode
@ 2018-09-14 13:34 Tvrtko Ursulin
  2018-09-14 15:29 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
  0 siblings, 1 reply; 2+ messages in thread
From: Tvrtko Ursulin @ 2018-09-14 13:34 UTC (permalink / raw)
  To: igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Period mode tries to execute every workload iteration with a given
frequency.

Up to now code used to calculate the relative sleep needed to hit the
required start of the next iteration, but we can do conceptually better
if we use clock_nanosleep in absolute mode and tell it to simply wake us
up at the exact time the next iteration should start.

This shouldn't have a huge effect on accuracy today (we do nothing to
account for any drift across iterations), but is conceptually cleaner and,
if we start dealing with signals in the future, will be much better.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
Just churn at this point?
---
 benchmarks/gem_wsim.c | 43 +++++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index e0709487897b..4ce1e80d0241 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -1847,6 +1847,15 @@ static bool sync_deps(struct workload *wrk, struct w_step *w)
 	return synced;
 }
 
+static void
+timespec_add_us(struct timespec *ts, unsigned int us)
+{
+	uint64_t ns = ts->tv_sec * NSEC_PER_SEC + ts->tv_nsec + us * 1000;
+
+	ts->tv_sec = ns / NSEC_PER_SEC;
+	ts->tv_nsec = ns % NSEC_PER_SEC;
+}
+
 static void *run_workload(void *data)
 {
 	struct workload *wrk = (struct workload *)data;
@@ -1873,20 +1882,21 @@ static void *run_workload(void *data)
 		for (i = 0, w = wrk->steps; wrk->run && (i < wrk->nr_steps);
 		     i++, w++) {
 			enum intel_engine_id engine = w->engine;
-			int do_sleep = 0;
+			struct timespec now;
 
 			if (w->type == DELAY) {
-				do_sleep = w->delay;
+				clock_gettime(CLOCK_MONOTONIC, &now);
 			} else if (w->type == PERIOD) {
-				struct timespec now;
+				int remain_us;
 
 				clock_gettime(CLOCK_MONOTONIC, &now);
-				do_sleep = w->period -
-					   elapsed_us(&wrk->repeat_start, &now);
-				if (do_sleep < 0) {
+				remain_us = w->period -
+					    elapsed_us(&wrk->repeat_start,
+						       &now);
+				if (remain_us < 0) {
 					if (verbose > 1)
-						printf("%u: Dropped period @ %u/%u (%dus late)!\n",
-						       wrk->id, count, i, do_sleep);
+						printf("%u: Missed period @ %u/%u (%dus late)!\n",
+						       wrk->id, count, i, -remain_us);
 					continue;
 				}
 			} else if (w->type == SYNC) {
@@ -1936,8 +1946,21 @@ static void *run_workload(void *data)
 				continue;
 			}
 
-			if (do_sleep || w->type == PERIOD) {
-				usleep(do_sleep);
+			if (w->type == DELAY || w->type == PERIOD) {
+				struct timespec end;
+				unsigned int us;
+
+				if (w->type == PERIOD) {
+					end = wrk->repeat_start;
+					us = w->period;
+				} else {
+					end = now;
+					us = w->delay;
+				}
+
+				timespec_add_us(&end, us);
+				clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME,
+						&end, NULL);
 				continue;
 			}
 
-- 
2.17.1

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

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

* [igt-dev] ✗ Fi.CI.BAT: failure for gem_wsim: Refactor how we sleep in period mode
  2018-09-14 13:34 [igt-dev] [PATCH i-g-t] gem_wsim: Refactor how we sleep in period mode Tvrtko Ursulin
@ 2018-09-14 15:29 ` Patchwork
  0 siblings, 0 replies; 2+ messages in thread
From: Patchwork @ 2018-09-14 15:29 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev

== Series Details ==

Series: gem_wsim: Refactor how we sleep in period mode
URL   : https://patchwork.freedesktop.org/series/49713/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4825 -> IGTPW_1843 =

== Summary - FAILURE ==

  Serious unknown changes coming with IGTPW_1843 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1843, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/49713/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1843:

  === IGT changes ===

    ==== Possible regressions ====

    igt@drv_selftest@live_contexts:
      fi-bsw-n3050:       PASS -> DMESG-WARN

    
== Known issues ==

  Here are the changes found in IGTPW_1843 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@amdgpu/amd_cs_nop@sync-fork-gfx0:
      fi-kbl-8809g:       PASS -> DMESG-WARN (fdo#107762) +1

    igt@drv_module_reload@basic-reload:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    igt@drv_selftest@live_coherency:
      fi-gdg-551:         PASS -> DMESG-FAIL (fdo#107164)

    igt@kms_psr@primary_page_flip:
      fi-skl-6600u:       PASS -> FAIL (fdo#107336)

    
    ==== Possible fixes ====

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#103191, fdo#107362) -> PASS

    igt@kms_pipe_crc_basic@read-crc-pipe-a:
      fi-byt-clapper:     FAIL (fdo#107362) -> PASS

    igt@kms_psr@primary_page_flip:
      fi-kbl-7560u:       FAIL (fdo#107336) -> PASS

    
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
  fdo#107336 https://bugs.freedesktop.org/show_bug.cgi?id=107336
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
  fdo#107762 https://bugs.freedesktop.org/show_bug.cgi?id=107762


== Participating hosts (47 -> 44) ==

  Additional (1): fi-hsw-4770r 
  Missing    (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * IGT: IGT_4641 -> IGTPW_1843

  CI_DRM_4825: b42528aaa961c0d469f381b4a5c3830fe46aedfa @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1843: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1843/
  IGT_4641: 468febc4c746f168e885e0d662ec3adb0cca60f6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1843/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2018-09-14 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-14 13:34 [igt-dev] [PATCH i-g-t] gem_wsim: Refactor how we sleep in period mode Tvrtko Ursulin
2018-09-14 15:29 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork

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).