intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] igt/pm_rpm: Close local fd before trying to unload module
@ 2018-08-15 20:59 Chris Wilson
  2018-08-15 20:59 ` [PATCH i-g-t 2/2] igt/pm_rpm: Avoid at_exit_drm_fd Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2018-08-15 20:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

Make sure everything we open in setup_environment() is paired to
teardown_environment().

Fixes: d8e78990aa2b ("igt/pm_rpm: Test reaquisition of runtime-pm after module reload")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/pm_rpm.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 65489bcdb..c0212ed70 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -717,21 +717,23 @@ out:
 	return wait_for_suspended();
 }
 
-static void restore_environment(void)
+static void teardown_environment(void)
 {
+	close(msr_fd);
+	if (has_pc8)
+		close(pc8_status_fd);
+
+	igt_restore_runtime_pm();
+
 	igt_pm_restore_sata_link_power_management(pm_data);
 	free(pm_data);
-}
 
-static void teardown_environment(void)
-{
-	restore_environment();
 	fini_mode_set_data(&ms_data);
+
 	close(debugfs);
-	drmClose(drm_fd);
-	close(msr_fd);
-	if (has_pc8)
-		close(pc8_status_fd);
+	close(drm_fd);
+
+	has_runtime_pm = false;
 }
 
 static void basic_subtest(void)
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH i-g-t 2/2] igt/pm_rpm: Avoid at_exit_drm_fd
  2018-08-15 20:59 [PATCH i-g-t 1/2] igt/pm_rpm: Close local fd before trying to unload module Chris Wilson
@ 2018-08-15 20:59 ` Chris Wilson
  2018-08-17 17:42   ` [igt-dev] " Antonio Argenziano
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2018-08-15 20:59 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

Keep the drm_fd owned by pm_rpm as we need to relinquish all ownership
of the device in order to unload the module.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/pm_rpm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index c0212ed70..f0781617c 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -697,7 +697,10 @@ static bool setup_environment(void)
 	if (has_runtime_pm)
 		goto out;
 
-	drm_fd = drm_open_driver_master(DRIVER_INTEL);
+	drm_fd = __drm_open_driver(DRIVER_INTEL);
+	igt_require(drm_fd != -1);
+	igt_device_set_master(drm_fd);
+
 	debugfs = igt_debugfs_dir(drm_fd);
 	igt_require(debugfs != -1);
 
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/2] igt/pm_rpm: Avoid at_exit_drm_fd
  2018-08-15 20:59 ` [PATCH i-g-t 2/2] igt/pm_rpm: Avoid at_exit_drm_fd Chris Wilson
@ 2018-08-17 17:42   ` Antonio Argenziano
  0 siblings, 0 replies; 3+ messages in thread
From: Antonio Argenziano @ 2018-08-17 17:42 UTC (permalink / raw)
  To: Chris Wilson, igt-dev; +Cc: intel-gfx



On 15/08/18 13:59, Chris Wilson wrote:
> Keep the drm_fd owned by pm_rpm as we need to relinquish all ownership
> of the device in order to unload the module.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

LGTM.
Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>

> ---
>   tests/pm_rpm.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
> index c0212ed70..f0781617c 100644
> --- a/tests/pm_rpm.c
> +++ b/tests/pm_rpm.c
> @@ -697,7 +697,10 @@ static bool setup_environment(void)
>   	if (has_runtime_pm)
>   		goto out;
>   
> -	drm_fd = drm_open_driver_master(DRIVER_INTEL);
> +	drm_fd = __drm_open_driver(DRIVER_INTEL);
> +	igt_require(drm_fd != -1);
> +	igt_device_set_master(drm_fd);
> +
>   	debugfs = igt_debugfs_dir(drm_fd);
>   	igt_require(debugfs != -1);
>   
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-17 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-15 20:59 [PATCH i-g-t 1/2] igt/pm_rpm: Close local fd before trying to unload module Chris Wilson
2018-08-15 20:59 ` [PATCH i-g-t 2/2] igt/pm_rpm: Avoid at_exit_drm_fd Chris Wilson
2018-08-17 17:42   ` [igt-dev] " Antonio Argenziano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).