Add reset subtest to pm_rps
From: Jeff McGee <[email protected]>
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(-)
Signature · 1 line
1.8.5.2
PATCH 1/4 pm_rps: Add stop rings injection utility
From: Jeff McGee <[email protected]>
--- tests/pm_rps.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
tests/pm_rps.c +37 -0
@@ -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" )
Signature · 1 line
1.8.5.2
PATCH 2/4 pm_rps: Load helper should stall for last write
In reply to [email protected]From: Jeff McGee <[email protected]>
This ensures that gpu is quiescent when load helper exits.
--- tests/pm_rps.c | 4 ++++ 1 file changed, 4 insertions(+)
tests/pm_rps.c +4 -0
@@ -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); } }
Signature · 1 line
1.8.5.2
PATCH 3/4 pm_rps: Add variable load support to load helper
In reply to [email protected]From: Jeff McGee <[email protected]>
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.
--- tests/pm_rps.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-)
tests/pm_rps.c +32 -3
@@ -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 (); }
Signature · 1 line
1.8.5.2
PATCH 4/4 pm_rps: New subtest for gpu reset
In reply to [email protected]From: Jeff McGee <[email protected]>
Test that RPS functions as expected after a gpu reset.
--- tests/pm_rps.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
tests/pm_rps.c +62 -0
@@ -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 (); }
Signature · 1 line
1.8.5.2
Gentle ping on this patch set for igt.
Thanks,
Jeff
Quoted 1 line · Jeff McGee
Gentle ping on this patch set for igt.
Both series pulled in, sorry for slacking off a bit. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 5 lines · Daniel Vetter
Quoted 1 line · Jeff McGee
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