All of lore.kernel.org
 help / color / mirror / Atom feed
* Add reset subtest to pm_rps
@ 2014-01-31 16:13 jeff.mcgee
  2014-01-31 16:13 ` [PATCH 1/4] pm_rps: Add stop rings injection utility jeff.mcgee
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: jeff.mcgee @ 2014-01-31 16:13 UTC (permalink / raw)
  To: intel-gfx

From: Jeff McGee <jeff.mcgee@intel.com>

This patch set is dependent on set "Add two new subtests to pm_rps".

Jeff McGee (4):
  pm_rps: Add stop rings injection utility
  pm_rps: Load helper should stall for last write
  pm_rps: Add variable load support to load helper
  pm_rps: New subtest for gpu reset

 tests/pm_rps.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 135 insertions(+), 3 deletions(-)

-- 
1.8.5.2

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

* [PATCH 1/4] pm_rps: Add stop rings injection utility
  2014-01-31 16:13 Add reset subtest to pm_rps jeff.mcgee
@ 2014-01-31 16:13 ` jeff.mcgee
  2014-01-31 16:13 ` [PATCH 2/4] pm_rps: Load helper should stall for last write jeff.mcgee
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: jeff.mcgee @ 2014-01-31 16:13 UTC (permalink / raw)
  To: intel-gfx

From: Jeff McGee <jeff.mcgee@intel.com>

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 tests/pm_rps.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 709e341..a6807d2 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -32,10 +32,12 @@
 #include <string.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <fcntl.h>
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "igt_debugfs.h"
 
 static bool verbose = false;
 
@@ -62,6 +64,8 @@ struct junk {
 	{ "cur", "r", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL }
 };
 
+static igt_debugfs_t dfs;
+
 static int readval(FILE *filp)
 {
 	int val;
@@ -267,6 +271,37 @@ static void load_helper_deinit(void)
 		drm_intel_bufmgr_destroy(lh.bufmgr);
 }
 
+static void stop_rings(void)
+{
+	int fd;
+	static const char data[] = "0xf";
+
+	fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_WRONLY);
+	igt_assert(fd >= 0);
+
+	log("injecting ring stop\n");
+	igt_assert(write(fd, data, sizeof(data)) == sizeof(data));
+
+	close(fd);
+}
+
+static bool rings_stopped(void)
+{
+	int fd;
+	static char buf[128];
+	unsigned long long val;
+
+	fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_RDONLY);
+	igt_assert(fd >= 0);
+
+	igt_assert(read(fd, buf, sizeof(buf)) > 0);
+	close(fd);
+
+	sscanf(buf, "%llx", &val);
+
+	return (bool)val;
+}
+
 static void min_max_config(void (*check)(void))
 {
 	int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2;
@@ -471,6 +506,8 @@ int main(int argc, char **argv)
 		igt_install_exit_handler(pm_rps_exit_handler);
 
 		load_helper_init();
+
+		igt_debugfs_init(&dfs);
 	}
 
 	igt_subtest("basic-api")
-- 
1.8.5.2

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

* [PATCH 2/4] pm_rps: Load helper should stall for last write
  2014-01-31 16:13 Add reset subtest to pm_rps jeff.mcgee
  2014-01-31 16:13 ` [PATCH 1/4] pm_rps: Add stop rings injection utility jeff.mcgee
@ 2014-01-31 16:13 ` jeff.mcgee
  2014-01-31 16:13 ` [PATCH 3/4] pm_rps: Add variable load support to load helper jeff.mcgee
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: jeff.mcgee @ 2014-01-31 16:13 UTC (permalink / raw)
  To: intel-gfx

From: Jeff McGee <jeff.mcgee@intel.com>

This ensures that gpu is quiescent when load helper exits.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 tests/pm_rps.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index a6807d2..9277196 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -207,6 +207,10 @@ static void load_helper_run(void)
 			val++;
 		}
 
+		/* Map buffer to stall for write completion */
+		drm_intel_bo_map(lh.target_buffer, 0);
+		drm_intel_bo_unmap(lh.target_buffer);
+
 		log("load helper sent %u dword writes\n", val);
 	}
 }
-- 
1.8.5.2

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

* [PATCH 3/4] pm_rps: Add variable load support to load helper
  2014-01-31 16:13 Add reset subtest to pm_rps jeff.mcgee
  2014-01-31 16:13 ` [PATCH 1/4] pm_rps: Add stop rings injection utility jeff.mcgee
  2014-01-31 16:13 ` [PATCH 2/4] pm_rps: Load helper should stall for last write jeff.mcgee
@ 2014-01-31 16:13 ` jeff.mcgee
  2014-01-31 16:13 ` [PATCH 4/4] pm_rps: New subtest for gpu reset jeff.mcgee
  2014-02-05 19:21 ` Add reset subtest to pm_rps Jeff McGee
  4 siblings, 0 replies; 8+ messages in thread
From: jeff.mcgee @ 2014-01-31 16:13 UTC (permalink / raw)
  To: intel-gfx

From: Jeff McGee <jeff.mcgee@intel.com>

The load helper can be set to HIGH or LOW. HIGH is the original mode
of sending continuous dword store commands. LOW adds a pause between
each command to reduce throughput.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 tests/pm_rps.c | 35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 9277196..05b859c 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -146,6 +146,11 @@ static void dumpit(const int *freqs)
 #define dump(x) if (verbose) dumpit(x)
 #define log(...) if (verbose) printf(__VA_ARGS__)
 
+enum load {
+	LOW,
+	HIGH
+};
+
 static struct load_helper {
 	int devid;
 	int has_ppgtt;
@@ -153,13 +158,17 @@ static struct load_helper {
 	struct intel_batchbuffer *batch;
 	drm_intel_bo *target_buffer;
 	bool ready;
+	enum load load;
 	bool exit;
 	struct igt_helper_process igt_proc;
 } lh;
 
 static void load_helper_signal_handler(int sig)
 {
-	lh.exit = true;
+	if (sig == SIGUSR2)
+		lh.load = lh.load == LOW ? HIGH : LOW;
+	else
+		lh.exit = true;
 }
 
 static void emit_store_dword_imm(uint32_t val)
@@ -190,21 +199,30 @@ static void emit_store_dword_imm(uint32_t val)
 	}
 }
 
-static void load_helper_run(void)
+#define LOAD_HELPER_PAUSE_USEC 500
+static void load_helper_run(enum load load)
 {
 	assert(!lh.igt_proc.running);
 
 	igt_require(lh.ready == true);
 
+	lh.load = load;
+
 	igt_fork_helper(&lh.igt_proc) {
 		uint32_t val = 0;
 
 		signal(SIGUSR1, load_helper_signal_handler);
+		signal(SIGUSR2, load_helper_signal_handler);
 
 		while (!lh.exit) {
 			emit_store_dword_imm(val);
 			intel_batchbuffer_flush_on_ring(lh.batch, 0);
 			val++;
+
+			/* Lower the load by pausing after every submitted
+			 * write. */
+			if (lh.load == LOW)
+				usleep(LOAD_HELPER_PAUSE_USEC);
 		}
 
 		/* Map buffer to stall for write completion */
@@ -215,6 +233,17 @@ static void load_helper_run(void)
 	}
 }
 
+static void load_helper_set_load(enum load load)
+{
+	assert(lh.igt_proc.running);
+
+	if (lh.load == load)
+		return;
+
+	lh.load = load;
+	kill(lh.igt_proc.pid, SIGUSR2);
+}
+
 static void load_helper_stop(void)
 {
 	assert(lh.igt_proc.running);
@@ -521,7 +550,7 @@ int main(int argc, char **argv)
 		min_max_config(idle_check);
 
 	igt_subtest("min-max-config-loaded") {
-		load_helper_run();
+		load_helper_run(HIGH);
 		min_max_config(loaded_check);
 		load_helper_stop();
 	}
-- 
1.8.5.2

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

* [PATCH 4/4] pm_rps: New subtest for gpu reset
  2014-01-31 16:13 Add reset subtest to pm_rps jeff.mcgee
                   ` (2 preceding siblings ...)
  2014-01-31 16:13 ` [PATCH 3/4] pm_rps: Add variable load support to load helper jeff.mcgee
@ 2014-01-31 16:13 ` jeff.mcgee
  2014-02-05 19:21 ` Add reset subtest to pm_rps Jeff McGee
  4 siblings, 0 replies; 8+ messages in thread
From: jeff.mcgee @ 2014-01-31 16:13 UTC (permalink / raw)
  To: intel-gfx

From: Jeff McGee <jeff.mcgee@intel.com>

Test that RPS functions as expected after a gpu reset.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 tests/pm_rps.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 05b859c..846abe6 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -133,6 +133,16 @@ static void checkit(const int *freqs)
 	igt_assert(freqs[RP1] != 0);
 }
 
+static void matchit(const int *freqs1, const int *freqs2)
+{
+	igt_assert(freqs1[CUR] == freqs2[CUR]);
+	igt_assert(freqs1[MIN] == freqs2[MIN]);
+	igt_assert(freqs1[MAX] == freqs2[MAX]);
+	igt_assert(freqs1[RP0] == freqs2[RP0]);
+	igt_assert(freqs1[RP1] == freqs2[RP1]);
+	igt_assert(freqs1[RPn] == freqs2[RPn]);
+}
+
 static void dumpit(const int *freqs)
 {
 	int i;
@@ -462,6 +472,55 @@ static void loaded_check(void)
 	log("Required %d msec to reach cur=max\n", wait);
 }
 
+#define STABILIZE_WAIT_TIMESTEP_MSEC 100
+#define STABILIZE_WAIT_TIMEOUT_MSEC 2000
+static void stabilize_check(int *freqs)
+{
+	int wait = 0;
+
+	do {
+		read_freqs(freqs);
+		dump(freqs);
+		usleep(1000 * STABILIZE_WAIT_TIMESTEP_MSEC);
+		wait += STABILIZE_WAIT_TIMESTEP_MSEC;
+	} while (wait < STABILIZE_WAIT_TIMEOUT_MSEC);
+
+	log("Waited %d msec to stabilize cur\n", wait);
+}
+
+static void reset(void)
+{
+	int pre_freqs[NUMFREQ];
+	int post_freqs[NUMFREQ];
+
+	log("Apply low load...\n");
+	load_helper_run(LOW);
+	stabilize_check(pre_freqs);
+
+	log("Stop rings...\n");
+	stop_rings();
+	while (rings_stopped())
+		usleep(1000 * 100);
+	log("Ring stop cleared\n");
+
+	log("Apply high load...\n");
+	load_helper_set_load(HIGH);
+	loaded_check();
+
+	log("Apply low load...\n");
+	load_helper_set_load(LOW);
+	stabilize_check(post_freqs);
+	matchit(pre_freqs, post_freqs);
+
+	log("Apply high load...\n");
+	load_helper_set_load(HIGH);
+	loaded_check();
+
+	log("Removing load...\n");
+	load_helper_stop();
+	idle_check();
+}
+
 static void pm_rps_exit_handler(int sig)
 {
 	if (origfreqs[MIN] > readval(stuff[MAX].filp)) {
@@ -555,5 +614,8 @@ int main(int argc, char **argv)
 		load_helper_stop();
 	}
 
+	igt_subtest("reset")
+		reset();
+
 	igt_exit();
 }
-- 
1.8.5.2

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

* Re: Add reset subtest to pm_rps
  2014-01-31 16:13 Add reset subtest to pm_rps jeff.mcgee
                   ` (3 preceding siblings ...)
  2014-01-31 16:13 ` [PATCH 4/4] pm_rps: New subtest for gpu reset jeff.mcgee
@ 2014-02-05 19:21 ` Jeff McGee
  2014-02-06  6:48   ` Daniel Vetter
  4 siblings, 1 reply; 8+ messages in thread
From: Jeff McGee @ 2014-02-05 19:21 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter.ffwll.ch

Gentle ping on this patch set for igt.

Thanks,
Jeff

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

* Re: Add reset subtest to pm_rps
  2014-02-05 19:21 ` Add reset subtest to pm_rps Jeff McGee
@ 2014-02-06  6:48   ` Daniel Vetter
  2014-02-06 14:59     ` Jeff McGee
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2014-02-06  6:48 UTC (permalink / raw)
  To: intel-gfx, daniel.vetter.ffwll.ch

On Wed, Feb 05, 2014 at 01:21:34PM -0600, Jeff McGee wrote:
> Gentle ping on this patch set for igt.

Both series pulled in, sorry for slacking off a bit.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

* Re: Add reset subtest to pm_rps
  2014-02-06  6:48   ` Daniel Vetter
@ 2014-02-06 14:59     ` Jeff McGee
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff McGee @ 2014-02-06 14:59 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

On Thu, Feb 06, 2014 at 07:48:18AM +0100, Daniel Vetter wrote:
> On Wed, Feb 05, 2014 at 01:21:34PM -0600, Jeff McGee wrote:
> > Gentle ping on this patch set for igt.
> 
> Both series pulled in, sorry for slacking off a bit.
> -Daniel

Thanks, Daniel. The two driver patches to fix the failing subtests have
been updated and sent to the list. I suppose the process is for QA to
confirm the failures and then the patches are considered. I'll be out
for the next 4 weeks, but I'll let my teammates know to support any
future requests on this topic.
-Jeff

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

end of thread, other threads:[~2014-02-06 14:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-31 16:13 Add reset subtest to pm_rps jeff.mcgee
2014-01-31 16:13 ` [PATCH 1/4] pm_rps: Add stop rings injection utility jeff.mcgee
2014-01-31 16:13 ` [PATCH 2/4] pm_rps: Load helper should stall for last write jeff.mcgee
2014-01-31 16:13 ` [PATCH 3/4] pm_rps: Add variable load support to load helper jeff.mcgee
2014-01-31 16:13 ` [PATCH 4/4] pm_rps: New subtest for gpu reset jeff.mcgee
2014-02-05 19:21 ` Add reset subtest to pm_rps Jeff McGee
2014-02-06  6:48   ` Daniel Vetter
2014-02-06 14:59     ` Jeff McGee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.