public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: jeff.mcgee@intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/4] pm_rps: Add variable load support to load helper
Date: Fri, 31 Jan 2014 10:13:52 -0600	[thread overview]
Message-ID: <1391184833-10973-4-git-send-email-jeff.mcgee@intel.com> (raw)
In-Reply-To: <1391184833-10973-1-git-send-email-jeff.mcgee@intel.com>

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

  parent reply	other threads:[~2014-01-31 16:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=1391184833-10973-4-git-send-email-jeff.mcgee@intel.com \
    --to=jeff.mcgee@intel.com \
    --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