From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Anshuman Gupta <anshuman.gupta@intel.com>
Cc: igt-dev@lists.freedesktop.org, badal.nilawar@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t 7/9] i915_pm_rpm: Test D3Cold with gem_exec_stress
Date: Fri, 22 Apr 2022 08:03:04 -0400 [thread overview]
Message-ID: <YmKZeDB9C4jzCq1o@intel.com> (raw)
In-Reply-To: <20220418125048.7969-8-anshuman.gupta@intel.com>
On Mon, Apr 18, 2022 at 06:20:46PM +0530, Anshuman Gupta wrote:
> Added d3cold dynamic subtest to gem_exec_stress with device class
> memory region. It test both D3Cold-{VRAM_SR, Off} by using
> d3cold_sr_lmem_threshold i915_params debugfs.
>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
> tests/i915/i915_pm_rpm.c | 95 +++++++++++++++++++++++++++++++++-------
> 1 file changed, 78 insertions(+), 17 deletions(-)
>
> diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
> index c30862dc4..8e9ff56ec 100644
> --- a/tests/i915/i915_pm_rpm.c
> +++ b/tests/i915/i915_pm_rpm.c
> @@ -85,6 +85,7 @@ enum plane_type {
> #define WAIT_PC8_RES 2
> #define WAIT_EXTRA 4
> #define USE_DPMS 8
> +#define WAIT_D3COLD 16
>
> int drm_fd, msr_fd, pc8_status_fd;
> int debugfs;
> @@ -215,6 +216,21 @@ static bool wait_for_suspended(void)
> }
> }
>
> +static bool wait_for_d3cold(struct pci_device *root)
> +{
> + bool d3colded;
> +
> + d3colded = igt_wait(igt_pm_get_acpi_real_d_state(root) == IGT_ACPI_D3Cold, 10000, 500);
> +
> + if (!d3colded) {
> + igt_info("D3Cold not achieved for root port %04x:%02x:%02x.%01x\n",
> + root->domain, root->bus, root->dev, root->func);
> + igt_pm_print_pci_card_runtime_status();
> + }
> +
> + return d3colded;
> +}
> +
> static bool wait_for_active(void)
> {
> if (has_pc8 && !has_runtime_pm)
> @@ -744,6 +760,30 @@ static void test_i2c(struct mode_set_data *data)
> "There is an EDID mismatch between i2c and DRM!\n");
> }
>
> +static int get_d3cold_sr_lmem_threshold(int dir)
> +{
> + int param_dir, lmem_threshold, ret;
> +
> + param_dir = openat(dir, "i915_params", O_RDONLY);
> + ret = igt_sysfs_scanf(param_dir, "d3cold_sr_lmem_threshold", "%d", &lmem_threshold);
> + igt_assert(ret >= 0);
> +
> + close(param_dir);
> + return lmem_threshold;
> +}
> +
> +static int set_d3cold_sr_lmem_threshold(int dir, int val)
> +{
> + int param_dir, ret;
> +
> + param_dir = openat(dir, "i915_params", O_RDONLY);
> + ret = igt_sysfs_printf(param_dir, "d3cold_sr_lmem_threshold", "%d", val);
> + igt_assert(ret > 0);
> +
> + close(param_dir);
> + return ret;
> +}
> +
> static void setup_pc8(void)
> {
> has_pc8 = false;
> @@ -1069,6 +1109,19 @@ static void debugfs_forcewake_user_subtest(void)
> igt_assert(wait_for_suspended());
> }
>
> +static struct pci_device *setup_d3cold_and_get_root_port(void)
> +{
> + struct pci_device *root;
> +
> + /* igfx does not support d3cold */
> + igt_require(IS_DGFX(ms_data.devid));
> + root = igt_device_get_pci_root_port(drm_fd);
> + igt_require(igt_pm_acpi_d3cold_supported(root));
> + igt_pm_setup_pci_card_runtime_pm(root);
> +
> + return root;
> +}
> +
> static void gem_mmap_args(const struct mmap_offset *t,
> struct drm_i915_gem_memory_class_instance *mem_regions)
> {
> @@ -1392,6 +1445,7 @@ gem_execbuf_stress_subtest(int rounds, int wait_flags,
> int i;
> int batch_size = 4 * sizeof(uint32_t);
> uint32_t batch_buf[batch_size];
> + struct pci_device *root;
> uint32_t handle;
> struct drm_i915_gem_execbuffer2 execbuf = {};
> struct drm_i915_gem_exec_object2 objs[1] = {{}};
> @@ -1408,6 +1462,9 @@ gem_execbuf_stress_subtest(int rounds, int wait_flags,
> batch_buf[i++] = MI_NOOP;
> igt_assert(i * sizeof(uint32_t) == batch_size);
>
> + if (wait_flags & WAIT_D3COLD)
> + root = setup_d3cold_and_get_root_port();
> +
> disable_all_screens_and_wait(&ms_data);
>
> /* PC8 test is only applicable to igfx */
> @@ -1433,6 +1490,9 @@ gem_execbuf_stress_subtest(int rounds, int wait_flags,
> /* clean up idle work */
> igt_drop_caches_set(drm_fd, DROP_IDLE);
> igt_assert(wait_for_suspended());
> + if (wait_flags & WAIT_D3COLD)
> + igt_assert(wait_for_d3cold(root));
> +
> }
> if (wait_flags & WAIT_PC8_RES)
> igt_assert(pc8_plus_residency_changed(30));
> @@ -1440,6 +1500,9 @@ gem_execbuf_stress_subtest(int rounds, int wait_flags,
> sleep(5);
> }
>
> + if (wait_flags & WAIT_D3COLD)
> + igt_pm_restore_pci_card_runtime_pm();
> +
> gem_close(drm_fd, handle);
> }
>
> @@ -1537,25 +1600,10 @@ __noreturn static void stay_subtest(void)
> static void d3cold_basic_subtest(void)
> {
> struct pci_device *root;
> - bool result;
>
> - /* igfx does not support d3cold */
> - igt_require(IS_DGFX(ms_data.devid));
> -
> - root = igt_device_get_pci_root_port(drm_fd);
> + root = setup_d3cold_and_get_root_port();
> disable_all_screens_and_wait(&ms_data);
> - igt_require(igt_pm_acpi_d3cold_supported(root));
> - igt_pm_setup_pci_card_runtime_pm(root);
> -
> - result = igt_wait(igt_pm_get_acpi_real_d_state(root) == IGT_ACPI_D3Cold, 10000, 500);
> -
> - if (!result) {
> - igt_info("D3Cold not achieved for root port %04x:%02x:%02x.%01x\n",
> - root->domain, root->bus, root->dev, root->func);
> - igt_pm_print_pci_card_runtime_status();
> - }
> -
> - igt_assert(result);
> + igt_assert(wait_for_d3cold(root));
> igt_pm_restore_pci_card_runtime_pm();
> }
>
> @@ -2213,6 +2261,19 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
> gem_execbuf_stress_subtest(rounds, WAIT_STATUS, &r->ci);
> igt_dynamic_f("%s-%s", "extra-wait", r->name)
> gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_EXTRA, &r->ci);
> + if (r->ci.memory_class == I915_MEMORY_CLASS_SYSTEM)
> + continue;
> + igt_dynamic_f("%s-%s", "d3cold", r->name) {
> + int lmem_threshold;
> +
> + lmem_threshold = get_d3cold_sr_lmem_threshold(debugfs);
> + /* Test D3Cold-Off */
> + gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_D3COLD, &r->ci);
> + /* Test D3Cold-VRAM_SR */
I believe it deserves 2 subtests:
igt_dynamic_f("%s-%s", "d3cold-off", r->name) ...
igt_dynamic_f("%s-%s", "d3cold-sr", r->name) ...
> + set_d3cold_sr_lmem_threshold(debugfs, 0);
> + gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_D3COLD, &r->ci);
> + set_d3cold_sr_lmem_threshold(debugfs, lmem_threshold);
> + }
> }
> }
>
> --
> 2.26.2
>
next prev parent reply other threads:[~2022-04-22 12:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 12:50 [igt-dev] [PATCH i-g-t 0/9] D3Cold Tool & IGT Anshuman Gupta
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 1/9] test/i915_pm_rpm: Add placement to gem-{mmap-type, execbuf} Anshuman Gupta
2022-04-22 9:26 ` Rodrigo Vivi
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 2/9] lib/igt_device: Get gfx PCI card root port Anshuman Gupta
2022-04-22 9:29 ` Rodrigo Vivi
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 3/9] lib/igt_pm: D3Cold runtime pm infrastructure Anshuman Gupta
2022-04-22 10:16 ` Rodrigo Vivi
2022-04-26 12:23 ` Gupta, Anshuman
2022-04-26 13:22 ` Rodrigo Vivi
2022-04-26 16:06 ` Kamil Konieczny
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 4/9] lib/intel_device_info: Add IS_DGFX() support Anshuman Gupta
2022-04-22 10:17 ` Rodrigo Vivi
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 5/9] tools: Add intel_pm_rpm tool Anshuman Gupta
2022-04-22 10:22 ` Rodrigo Vivi
2022-04-22 12:07 ` Rodrigo Vivi
2022-04-28 6:59 ` Gupta, Anshuman
2022-04-28 8:38 ` Vivi, Rodrigo
2022-04-29 8:58 ` Gupta, Anshuman
2022-04-22 12:08 ` Gupta, Anshuman
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 6/9] i915_pm_rpm: Add D3Cold basic subtest Anshuman Gupta
2022-04-22 12:01 ` Rodrigo Vivi
2022-04-22 14:22 ` Kamil Konieczny
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 7/9] i915_pm_rpm: Test D3Cold with gem_exec_stress Anshuman Gupta
2022-04-22 12:03 ` Rodrigo Vivi [this message]
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 8/9] i915_pm_rpm: Extend gem_execbuf test with D3Cold Anshuman Gupta
2022-04-22 12:04 ` Rodrigo Vivi
2022-04-18 12:50 ` [igt-dev] [PATCH i-g-t 9/9] i915_pm_rpm: Extend gem-mmap-type " Anshuman Gupta
2022-04-22 12:05 ` Rodrigo Vivi
2022-04-18 13:01 ` [igt-dev] ✗ GitLab.Pipeline: warning for D3Cold Tool & IGT Patchwork
2022-04-22 9:35 ` Rodrigo Vivi
2022-04-22 11:19 ` Petri Latvala
2022-04-18 13:34 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
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=YmKZeDB9C4jzCq1o@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=igt-dev@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