[Intel-gfx] [PATCH i-g-t v2] tests/pm_rps: Move some test logic out of boost function
Moving code out of the boost function will allow its usage in other/new test scenarios. Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenb...@intel.com> --- tests/pm_rps.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 89f3e31c..fa548260 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -583,11 +583,6 @@ static void boost_freq(int fd, int *boost_freqs) int64_t timeout = 1; igt_spin_t *load; unsigned int engine; - int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2; - - fmid = get_hw_rounded_freq(fmid); - /* Set max freq to less then boost freq */ - writeval(sysfs_files[MAX].filp, fmid); /* Put boost on the same engine as low load */ engine = I915_EXEC_RENDER; @@ -604,9 +599,6 @@ static void boost_freq(int fd, int *boost_freqs) igt_spin_batch_end(load); gem_sync(fd, load->handle); igt_spin_batch_free(fd, load); - - /* Set max freq to original softmax */ - writeval(sysfs_files[MAX].filp, origfreqs[MAX]); } static void waitboost(int fd, bool reset) @@ -615,6 +607,9 @@ static void waitboost(int fd, bool reset) int boost_freqs[NUMFREQ]; int post_freqs[NUMFREQ]; + int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2; + fmid = get_hw_rounded_freq(fmid); + load_helper_run(LOW); igt_debug("Apply low load...\n"); @@ -627,11 +622,17 @@ static void waitboost(int fd, bool reset) sleep(1); } + /* Set max freq to less than boost freq */ + writeval(sysfs_files[MAX].filp, fmid); + /* When we wait upon the GPU, we want to temporarily boost it * to maximum. */ boost_freq(fd, boost_freqs); + /* Set max freq to original softmax */ + writeval(sysfs_files[MAX].filp, origfreqs[MAX]); + igt_debug("Apply low load again...\n"); sleep(1); stabilize_check(post_freqs); @@ -643,7 +644,6 @@ static void waitboost(int fd, bool reset) igt_assert_lt(pre_freqs[CUR], pre_freqs[MAX]); igt_assert_eq(boost_freqs[CUR], boost_freqs[BOOST]); igt_assert_lt(post_freqs[CUR], post_freqs[MAX]); - } static void pm_rps_exit_handler(int sig) -- 2.13.5 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t] tests/pm_rps: Move some test logic out of boost function
Moving code out of the boost function will allow its usage in other/new test scenarios. Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenb...@intel.com> Cc: Sagar Arun Kamble <sagar.a.kam...@intel.com> --- tests/pm_rps.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 89f3e31c..dad87646 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -583,11 +583,6 @@ static void boost_freq(int fd, int *boost_freqs) int64_t timeout = 1; igt_spin_t *load; unsigned int engine; - int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2; - - fmid = get_hw_rounded_freq(fmid); - /* Set max freq to less then boost freq */ - writeval(sysfs_files[MAX].filp, fmid); /* Put boost on the same engine as low load */ engine = I915_EXEC_RENDER; @@ -604,9 +599,6 @@ static void boost_freq(int fd, int *boost_freqs) igt_spin_batch_end(load); gem_sync(fd, load->handle); igt_spin_batch_free(fd, load); - - /* Set max freq to original softmax */ - writeval(sysfs_files[MAX].filp, origfreqs[MAX]); } static void waitboost(int fd, bool reset) @@ -615,6 +607,9 @@ static void waitboost(int fd, bool reset) int boost_freqs[NUMFREQ]; int post_freqs[NUMFREQ]; + int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2; + fmid = get_hw_rounded_freq(fmid); + load_helper_run(LOW); igt_debug("Apply low load...\n"); @@ -627,11 +622,17 @@ static void waitboost(int fd, bool reset) sleep(1); } + /* Set max freq to less than boost freq */ + writeval(sysfs_files[MAX].filp, fmid); + /* When we wait upon the GPU, we want to temporarily boost it * to maximum. */ boost_freq(fd, boost_freqs); + /* Set max freq to original softmax */ + writeval(sysfs_files[MAX].filp, origfreqs[MAX]); + igt_debug("Apply low load again...\n"); sleep(1); stabilize_check(post_freqs); @@ -643,7 +644,6 @@ static void waitboost(int fd, bool reset) igt_assert_lt(pre_freqs[CUR], pre_freqs[MAX]); igt_assert_eq(boost_freqs[CUR], boost_freqs[BOOST]); igt_assert_lt(post_freqs[CUR], post_freqs[MAX]); - } static void pm_rps_exit_handler(int sig) @@ -656,6 +656,7 @@ static void pm_rps_exit_handler(int sig) writeval(sysfs_files[MAX].filp, origfreqs[MAX]); } + writeval(sysfs_files[BOOST].filp, origfreqs[BOOST]); load_helper_deinit(); close(drm_fd); } -- 2.13.5 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t v2] lib/ioctl_wrappers: Fix function descriptions
Function description incorrectly stated that gem_context_get_param and gem_context_set_param were freeing hw context. v2: removed additional incorrect information Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenb...@intel.com> --- lib/ioctl_wrappers.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 0816a7b..8e5ec88 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -977,10 +977,8 @@ int __gem_context_get_param(int fd, struct local_i915_gem_context_param *p) * @fd: open i915 drm file descriptor * @p: i915 hw context parameter * - * This is a wraps the CONTEXT_GET_PARAM ioctl, which is used to free a hardware - * context. Not that similarly to gem_set_caching() this wrapper calls - * igt_require() internally to correctly skip on kernels and platforms where hw - * context parameter support is not available. + * This is a wraps the CONTEXT_GET_PARAM ioctl, which is used to get a context + * parameter. */ void gem_context_get_param(int fd, struct local_i915_gem_context_param *p) { @@ -1003,10 +1001,8 @@ int __gem_context_set_param(int fd, struct local_i915_gem_context_param *p) * @fd: open i915 drm file descriptor * @p: i915 hw context parameter * - * This is a wraps the CONTEXT_SET_PARAM ioctl, which is used to free a hardware - * context. Not that similarly to gem_set_caching() this wrapper calls - * igt_require() internally to correctly skip on kernels and platforms where hw - * context parameter support is not available. + * This is a wraps the CONTEXT_SET_PARAM ioctl, which is used to set a context + * parameter. */ void gem_context_set_param(int fd, struct local_i915_gem_context_param *p) { -- 2.9.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t] lib/ioctl_wrappers: Fix function descriptions
Function description incorrectly stated that gem_context_get_param and gem_context_set_param were freeing hw context. Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenb...@intel.com> --- lib/ioctl_wrappers.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 0816a7b..a78ff47 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -977,8 +977,8 @@ int __gem_context_get_param(int fd, struct local_i915_gem_context_param *p) * @fd: open i915 drm file descriptor * @p: i915 hw context parameter * - * This is a wraps the CONTEXT_GET_PARAM ioctl, which is used to free a hardware - * context. Not that similarly to gem_set_caching() this wrapper calls + * This is a wraps the CONTEXT_GET_PARAM ioctl, which is used to get a context + * parameter. Not that similarly to gem_set_caching() this wrapper calls * igt_require() internally to correctly skip on kernels and platforms where hw * context parameter support is not available. */ @@ -1003,8 +1003,8 @@ int __gem_context_set_param(int fd, struct local_i915_gem_context_param *p) * @fd: open i915 drm file descriptor * @p: i915 hw context parameter * - * This is a wraps the CONTEXT_SET_PARAM ioctl, which is used to free a hardware - * context. Not that similarly to gem_set_caching() this wrapper calls + * This is a wraps the CONTEXT_SET_PARAM ioctl, which is used to set a context + * parameter. Not that similarly to gem_set_caching() this wrapper calls * igt_require() internally to correctly skip on kernels and platforms where hw * context parameter support is not available. */ -- 2.9.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t] tests/pm_rps: Replace custom load function with dummy load
Replaced custom load implementation with lib counterpart. Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenb...@intel.com> Cc: Chris Wilson <ch...@chris-wilson.co.uk> Cc: Arkadiusz Hiler <arkadiusz.hi...@intel.com> --- tests/pm_rps.c | 80 -- 1 file changed, 16 insertions(+), 64 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 4a21de4..f0455e7 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -560,58 +560,21 @@ static void reset_gpu(void) close(fd); } -static uint32_t *make_busy(int fd, uint32_t handle) +static void boost_freq(int fd, int *boost_freqs) { - const int gen = intel_gen(intel_get_drm_devid(fd)); - struct drm_i915_gem_exec_object2 obj; - struct drm_i915_gem_relocation_entry reloc; - struct drm_i915_gem_execbuffer2 execbuf; - uint32_t *batch; - int i; + int64_t timeout = 1; + int ring = -1; + igt_spin_t *load; - memset(, 0, sizeof(execbuf)); - execbuf.buffers_ptr = (uintptr_t) - execbuf.buffer_count = 1; - - memset(, 0, sizeof(obj)); - obj.handle = handle; - - obj.relocs_ptr = (uintptr_t) - obj.relocation_count = 1; - memset(, 0, sizeof(reloc)); - - batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); - gem_set_domain(fd, obj.handle, - I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); - - reloc.target_handle = obj.handle; /* recurse */ - reloc.presumed_offset = 0; - reloc.offset = sizeof(uint32_t); - reloc.delta = 0; - reloc.read_domains = I915_GEM_DOMAIN_COMMAND; - reloc.write_domain = 0; - - i = 0; - batch[i] = MI_BATCH_BUFFER_START; - if (gen >= 8) { - batch[i] |= 1 << 8 | 1; - batch[++i] = 0; - batch[++i] = 0; - } else if (gen >= 6) { - batch[i] |= 1 << 8; - batch[++i] = 0; - } else { - batch[i] |= 2 << 6; - batch[++i] = 0; - if (gen < 4) { - batch[i] |= 1; - reloc.delta = 1; - } - } - i++; + load = igt_spin_batch_new(fd, ring, 0); - gem_execbuf(fd, ); - return batch; + /* Waiting will grant us a boost to maximum */ + gem_wait(fd, load->handle, ); + + read_freqs(boost_freqs); + dump(boost_freqs); + + igt_spin_batch_free(fd, load); } static void waitboost(bool reset) @@ -619,15 +582,9 @@ static void waitboost(bool reset) int pre_freqs[NUMFREQ]; int boost_freqs[NUMFREQ]; int post_freqs[NUMFREQ]; - uint32_t *batch, handle; - int64_t timeout = 1; int fd = drm_open_driver(DRIVER_INTEL); - /* When we wait upon the GPU, we want to temporarily boost it -* to maximum. -*/ - load_helper_run(LOW); igt_debug("Apply low load...\n"); @@ -640,15 +597,10 @@ static void waitboost(bool reset) sleep(1); } - igt_debug("Wait for gpu...\n"); - handle = gem_create(fd, 4096); - batch = make_busy(fd, handle); - gem_wait(fd, handle, ); - read_freqs(boost_freqs); - dump(boost_freqs); - *batch = MI_BATCH_BUFFER_END; - munmap(batch, 4096); - gem_close(fd, handle); + /* When we wait upon the GPU, we want to temporarily boost it +* to maximum. +*/ + boost_freq(fd, boost_freqs); igt_debug("Apply low load again...\n"); sleep(1); -- 2.9.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t 1/2] tests/pm_rps: Replace custom load function with dummy load
There is no point in using custom function if there lib counterpart. Cc: Arkadiusz Hiler <arkadiusz.hi...@intel.com> Cc: Michal Winiarski <michal.winiar...@intel.com> Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenb...@intel.com> --- tests/pm_rps.c | 79 +++--- 1 file changed, 14 insertions(+), 65 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 5a54d9d..7aa66a8 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -560,58 +560,18 @@ static void reset_gpu(void) close(fd); } -static uint32_t *make_busy(int fd, uint32_t handle) +static void boost_freq(int fd, int *boost_freqs) { - const int gen = intel_gen(intel_get_drm_devid(fd)); - struct drm_i915_gem_exec_object2 obj; - struct drm_i915_gem_relocation_entry reloc; - struct drm_i915_gem_execbuffer2 execbuf; - uint32_t *batch; - int i; - - memset(, 0, sizeof(execbuf)); - execbuf.buffers_ptr = (uintptr_t) - execbuf.buffer_count = 1; - - memset(, 0, sizeof(obj)); - obj.handle = handle; - - obj.relocs_ptr = (uintptr_t) - obj.relocation_count = 1; - memset(, 0, sizeof(reloc)); - - batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); - gem_set_domain(fd, obj.handle, - I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); - - reloc.target_handle = obj.handle; /* recurse */ - reloc.presumed_offset = 0; - reloc.offset = sizeof(uint32_t); - reloc.delta = 0; - reloc.read_domains = I915_GEM_DOMAIN_COMMAND; - reloc.write_domain = 0; - - i = 0; - batch[i] = MI_BATCH_BUFFER_START; - if (gen >= 8) { - batch[i] |= 1 << 8 | 1; - batch[++i] = 0; - batch[++i] = 0; - } else if (gen >= 6) { - batch[i] |= 1 << 8; - batch[++i] = 0; - } else { - batch[i] |= 2 << 6; - batch[++i] = 0; - if (gen < 4) { - batch[i] |= 1; - reloc.delta = 1; - } - } - i++; + int64_t timeout = 1; + int ring = -1; + igt_spin_t *load; - gem_execbuf(fd, ); - return batch; + load = igt_spin_batch_new(fd, ring, 0); + gem_wait(fd, load->handle, ); + read_freqs(boost_freqs); + dump(boost_freqs); + igt_spin_batch_end(load); + igt_spin_batch_free(fd, load); } static void waitboost(bool reset) @@ -619,15 +579,9 @@ static void waitboost(bool reset) int pre_freqs[NUMFREQ]; int boost_freqs[NUMFREQ]; int post_freqs[NUMFREQ]; - uint32_t *batch, handle; - int64_t timeout = 1; int fd = drm_open_driver(DRIVER_INTEL); - /* When we wait upon the GPU, we want to temporarily boost it -* to maximum. -*/ - load_helper_run(LOW); igt_debug("Apply low load...\n"); @@ -640,15 +594,10 @@ static void waitboost(bool reset) sleep(1); } - igt_debug("Wait for gpu...\n"); - handle = gem_create(fd, 4096); - batch = make_busy(fd, handle); - gem_wait(fd, handle, ); - read_freqs(boost_freqs); - dump(boost_freqs); - *batch = MI_BATCH_BUFFER_END; - munmap(batch, 4096); - gem_close(fd, handle); + /* When we wait upon the GPU, we want to temporarily boost it +* to maximum. +*/ + boost_freq(fd, boost_freqs); igt_debug("Apply low load again...\n"); sleep(1); -- 2.9.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t 2/2] tests/pm_rps: Add waitboost-softlimit test
Test verifies that frequency gets boosted to gt_boost_freq_mhz even though gt_max_freq_mhz is lower than gt_boost_freq_mhz. Cc: Arkadiusz Hiler <arkadiusz.hi...@intel.com> Cc: Michal Winiarski <michal.winiar...@intel.com> Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenb...@intel.com> --- tests/pm_rps.c | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 7aa66a8..3cbbeeb 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -50,6 +50,7 @@ enum { RP0, RP1, RPn, + BOOST, NUMFREQ }; @@ -60,7 +61,14 @@ struct junk { const char *mode; FILE *filp; } stuff[] = { - { "cur", "r", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL } + { "cur", "r", NULL }, + { "min", "rb+", NULL }, + { "max", "rb+", NULL }, + { "RP0", "r", NULL }, + { "RP1", "r", NULL }, + { "RPn", "r", NULL }, + {"boost", "rb+", NULL }, + { NULL, NULL, NULL } }; static int readval(FILE *filp) @@ -614,6 +622,27 @@ static void waitboost(bool reset) close(fd); } +static void waitboost_softlimit(void) +{ + int boost_freqs[NUMFREQ]; + int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2; + int fd = drm_open_driver(DRIVER_INTEL); + fmid = get_hw_rounded_freq(fmid); + + igt_debug("Set min and max to midpoint\n"); + writeval(stuff[MIN].filp, fmid); + writeval(stuff[MAX].filp, fmid); + + /* When we wait upon the GPU, we want to temporarily boost it +* to maximum. +*/ + boost_freq(fd, boost_freqs); + + igt_assert_eq(boost_freqs[CUR], boost_freqs[BOOST]); + + close(fd); +} + static void pm_rps_exit_handler(int sig) { if (origfreqs[MIN] > readval(stuff[MAX].filp)) { @@ -679,4 +708,6 @@ igt_main igt_subtest("reset") waitboost(true); + igt_subtest("waitboost-softlimit") + waitboost_softlimit(); } -- 2.9.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx