mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-13 02:46:23 +00:00
pm_rps: Add variable load support to load helper
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> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
22dfb0988a
commit
663d758d91
@ -146,6 +146,11 @@ static void dumpit(const int *freqs)
|
|||||||
#define dump(x) if (verbose) dumpit(x)
|
#define dump(x) if (verbose) dumpit(x)
|
||||||
#define log(...) if (verbose) printf(__VA_ARGS__)
|
#define log(...) if (verbose) printf(__VA_ARGS__)
|
||||||
|
|
||||||
|
enum load {
|
||||||
|
LOW,
|
||||||
|
HIGH
|
||||||
|
};
|
||||||
|
|
||||||
static struct load_helper {
|
static struct load_helper {
|
||||||
int devid;
|
int devid;
|
||||||
int has_ppgtt;
|
int has_ppgtt;
|
||||||
@ -153,12 +158,16 @@ static struct load_helper {
|
|||||||
struct intel_batchbuffer *batch;
|
struct intel_batchbuffer *batch;
|
||||||
drm_intel_bo *target_buffer;
|
drm_intel_bo *target_buffer;
|
||||||
bool ready;
|
bool ready;
|
||||||
|
enum load load;
|
||||||
bool exit;
|
bool exit;
|
||||||
struct igt_helper_process igt_proc;
|
struct igt_helper_process igt_proc;
|
||||||
} lh;
|
} lh;
|
||||||
|
|
||||||
static void load_helper_signal_handler(int sig)
|
static void load_helper_signal_handler(int sig)
|
||||||
{
|
{
|
||||||
|
if (sig == SIGUSR2)
|
||||||
|
lh.load = lh.load == LOW ? HIGH : LOW;
|
||||||
|
else
|
||||||
lh.exit = true;
|
lh.exit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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);
|
assert(!lh.igt_proc.running);
|
||||||
|
|
||||||
igt_require(lh.ready == true);
|
igt_require(lh.ready == true);
|
||||||
|
|
||||||
|
lh.load = load;
|
||||||
|
|
||||||
igt_fork_helper(&lh.igt_proc) {
|
igt_fork_helper(&lh.igt_proc) {
|
||||||
uint32_t val = 0;
|
uint32_t val = 0;
|
||||||
|
|
||||||
signal(SIGUSR1, load_helper_signal_handler);
|
signal(SIGUSR1, load_helper_signal_handler);
|
||||||
|
signal(SIGUSR2, load_helper_signal_handler);
|
||||||
|
|
||||||
while (!lh.exit) {
|
while (!lh.exit) {
|
||||||
emit_store_dword_imm(val);
|
emit_store_dword_imm(val);
|
||||||
intel_batchbuffer_flush_on_ring(lh.batch, 0);
|
intel_batchbuffer_flush_on_ring(lh.batch, 0);
|
||||||
val++;
|
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 */
|
/* 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)
|
static void load_helper_stop(void)
|
||||||
{
|
{
|
||||||
assert(lh.igt_proc.running);
|
assert(lh.igt_proc.running);
|
||||||
@ -521,7 +550,7 @@ int main(int argc, char **argv)
|
|||||||
min_max_config(idle_check);
|
min_max_config(idle_check);
|
||||||
|
|
||||||
igt_subtest("min-max-config-loaded") {
|
igt_subtest("min-max-config-loaded") {
|
||||||
load_helper_run();
|
load_helper_run(HIGH);
|
||||||
min_max_config(loaded_check);
|
min_max_config(loaded_check);
|
||||||
load_helper_stop();
|
load_helper_stop();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user