From: Tvrtko Ursulin <tursulin@ursulin.net> To: igt-dev@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Subject: [PATCH i-g-t 3/4] lib/igt_pm: Export function to restore runtime PM status Date: Mon, 23 Jul 2018 12:46:57 +0100 [thread overview] Message-ID: <20180723114658.13025-3-tvrtko.ursulin@linux.intel.com> (raw) In-Reply-To: <20180723114658.13025-1-tvrtko.ursulin@linux.intel.com> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> In cases when runtime PM is enabled only from individual subtests and not whole tests it is usable to be able to restore the old runtime PM config and so avoid running subsequent subtests in an unexpected environment. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/igt_pm.c | 41 +++++++++++++++++++++++++++++++++++++++++ lib/igt_pm.h | 1 + 2 files changed, 42 insertions(+) diff --git a/lib/igt_pm.c b/lib/igt_pm.c index a4c0cf335f6d..a861055d382b 100644 --- a/lib/igt_pm.c +++ b/lib/igt_pm.c @@ -106,6 +106,23 @@ static int __igt_pm_audio_restore_runtime_pm(void) return 0; } +static void igt_pm_audio_restore_runtime_pm(void) +{ + int ret; + + if (!__igt_pm_audio_runtime_power_save[0]) + return; + + igt_debug("Restoring audio power management to '%s' and '%s'\n", + __igt_pm_audio_runtime_power_save, + __igt_pm_audio_runtime_control); + + ret = __igt_pm_audio_restore_runtime_pm(); + if (ret) + igt_warn("Failed to restore runtime audio PM! (errno=%d)\n", + ret); +} + static void __igt_pm_audio_runtime_exit_handler(int sig) { __igt_pm_audio_restore_runtime_pm(); @@ -393,6 +410,30 @@ static int __igt_restore_runtime_pm(void) return 0; } +/** + * igt_restore_runtime_pm: + * + * Restores the runtime PM configuration as it was before the call to + * igt_setup_runtime_pm. + */ +void igt_restore_runtime_pm(void) +{ + int ret; + + if (pm_status_fd < 0) + return; + + igt_debug("Restoring runtime PM management to '%s' and '%s'\n", + __igt_pm_runtime_autosuspend, + __igt_pm_runtime_control); + + ret = __igt_restore_runtime_pm(); + if (ret) + igt_warn("Failed to restore runtime PM! (errno=%d)\n", ret); + + igt_pm_audio_restore_runtime_pm(); +} + static void __igt_pm_runtime_exit_handler(int sig) { __igt_restore_runtime_pm(); diff --git a/lib/igt_pm.h b/lib/igt_pm.h index eced39f8801a..10cc6794e4e7 100644 --- a/lib/igt_pm.h +++ b/lib/igt_pm.h @@ -47,6 +47,7 @@ enum igt_runtime_pm_status { }; bool igt_setup_runtime_pm(void); +void igt_restore_runtime_pm(void); enum igt_runtime_pm_status igt_get_runtime_pm_status(void); bool igt_wait_for_pm_status(enum igt_runtime_pm_status status); -- 2.17.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tursulin@ursulin.net> To: igt-dev@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, Tvrtko Ursulin <tvrtko.ursulin@intel.com> Subject: [igt-dev] [PATCH i-g-t 3/4] lib/igt_pm: Export function to restore runtime PM status Date: Mon, 23 Jul 2018 12:46:57 +0100 [thread overview] Message-ID: <20180723114658.13025-3-tvrtko.ursulin@linux.intel.com> (raw) In-Reply-To: <20180723114658.13025-1-tvrtko.ursulin@linux.intel.com> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> In cases when runtime PM is enabled only from individual subtests and not whole tests it is usable to be able to restore the old runtime PM config and so avoid running subsequent subtests in an unexpected environment. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/igt_pm.c | 41 +++++++++++++++++++++++++++++++++++++++++ lib/igt_pm.h | 1 + 2 files changed, 42 insertions(+) diff --git a/lib/igt_pm.c b/lib/igt_pm.c index a4c0cf335f6d..a861055d382b 100644 --- a/lib/igt_pm.c +++ b/lib/igt_pm.c @@ -106,6 +106,23 @@ static int __igt_pm_audio_restore_runtime_pm(void) return 0; } +static void igt_pm_audio_restore_runtime_pm(void) +{ + int ret; + + if (!__igt_pm_audio_runtime_power_save[0]) + return; + + igt_debug("Restoring audio power management to '%s' and '%s'\n", + __igt_pm_audio_runtime_power_save, + __igt_pm_audio_runtime_control); + + ret = __igt_pm_audio_restore_runtime_pm(); + if (ret) + igt_warn("Failed to restore runtime audio PM! (errno=%d)\n", + ret); +} + static void __igt_pm_audio_runtime_exit_handler(int sig) { __igt_pm_audio_restore_runtime_pm(); @@ -393,6 +410,30 @@ static int __igt_restore_runtime_pm(void) return 0; } +/** + * igt_restore_runtime_pm: + * + * Restores the runtime PM configuration as it was before the call to + * igt_setup_runtime_pm. + */ +void igt_restore_runtime_pm(void) +{ + int ret; + + if (pm_status_fd < 0) + return; + + igt_debug("Restoring runtime PM management to '%s' and '%s'\n", + __igt_pm_runtime_autosuspend, + __igt_pm_runtime_control); + + ret = __igt_restore_runtime_pm(); + if (ret) + igt_warn("Failed to restore runtime PM! (errno=%d)\n", ret); + + igt_pm_audio_restore_runtime_pm(); +} + static void __igt_pm_runtime_exit_handler(int sig) { __igt_restore_runtime_pm(); diff --git a/lib/igt_pm.h b/lib/igt_pm.h index eced39f8801a..10cc6794e4e7 100644 --- a/lib/igt_pm.h +++ b/lib/igt_pm.h @@ -47,6 +47,7 @@ enum igt_runtime_pm_status { }; bool igt_setup_runtime_pm(void); +void igt_restore_runtime_pm(void); enum igt_runtime_pm_status igt_get_runtime_pm_status(void); bool igt_wait_for_pm_status(enum igt_runtime_pm_status status); -- 2.17.1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-07-23 11:47 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-23 11:46 [PATCH i-g-t 1/4] lib/igt_pm: Make exit handlers signal safe Tvrtko Ursulin 2018-07-23 11:46 ` [igt-dev] " Tvrtko Ursulin 2018-07-23 11:46 ` [PATCH i-g-t 2/4] lib/igt_pm: Find HDA device when attempting to enable runtime PM Tvrtko Ursulin 2018-07-23 11:46 ` [Intel-gfx] " Tvrtko Ursulin 2018-07-23 12:46 ` [PATCH i-g-t v2 " Tvrtko Ursulin 2018-07-23 12:46 ` [Intel-gfx] " Tvrtko Ursulin 2018-07-23 12:54 ` [igt-dev] " Chris Wilson 2018-07-23 12:54 ` [Intel-gfx] " Chris Wilson 2018-07-23 15:31 ` [PATCH i-g-t v3 " Tvrtko Ursulin 2018-07-23 15:31 ` [igt-dev] " Tvrtko Ursulin 2018-07-24 9:59 ` [PATCH i-g-t v4 " Tvrtko Ursulin 2018-07-24 9:59 ` [igt-dev] " Tvrtko Ursulin 2018-07-24 10:08 ` [PATCH i-g-t v5 " Tvrtko Ursulin 2018-07-24 10:08 ` [igt-dev] " Tvrtko Ursulin 2018-07-24 10:29 ` [PATCH i-g-t v6 " Tvrtko Ursulin 2018-07-24 10:29 ` [Intel-gfx] " Tvrtko Ursulin 2018-07-24 12:27 ` [igt-dev] " Chris Wilson 2018-07-24 12:27 ` [Intel-gfx] " Chris Wilson 2018-07-23 11:46 ` Tvrtko Ursulin [this message] 2018-07-23 11:46 ` [igt-dev] [PATCH i-g-t 3/4] lib/igt_pm: Export function to restore runtime PM status Tvrtko Ursulin 2018-07-23 11:46 ` [PATCH i-g-t 4/4] tests/perf_pmu: Restore runtime PM status at rc6 test exit Tvrtko Ursulin 2018-07-23 11:46 ` [igt-dev] " Tvrtko Ursulin 2018-07-23 12:37 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe Patchwork 2018-07-23 13:12 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe (rev2) Patchwork 2018-07-23 13:58 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe Patchwork 2018-07-23 15:20 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe (rev2) Patchwork 2018-07-23 15:54 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe (rev3) Patchwork 2018-07-23 16:35 ` Tvrtko Ursulin 2018-07-24 10:34 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe (rev5) Patchwork 2018-07-24 10:50 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe (rev6) Patchwork 2018-07-24 11:27 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe (rev5) Patchwork 2018-07-24 12:07 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,1/4] lib/igt_pm: Make exit handlers signal safe (rev6) Patchwork 2018-07-26 17:08 ` [igt-dev] ✓ Fi.CI.BAT: success " 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=20180723114658.13025-3-tvrtko.ursulin@linux.intel.com \ --to=tursulin@ursulin.net \ --cc=igt-dev@lists.freedesktop.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.