intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t] i915/perf: Instantiate a local drm_fd for the unprivileged helper
@ 2020-07-02 12:39 Chris Wilson
  2020-07-02 13:05 ` Lionel Landwerlin
  2020-07-02 17:46 ` Chris Wilson
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2020-07-02 12:39 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Chris Wilson

While the test is blocked, we keep trying the gen12_single_ctx_helper().
As this is using the parent's drm_fd, all of our context allocations are
persistent. Reopen the device in the child so that when we exit, our
allocations are freed along with the process -- avoiding a total memory
leak if the test is stuck.

This does not explain why the test was stuck, it just prevents us from
exacerbating the error condition. Hopefully leaving the system in a more
debuggable state.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/2126
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 tests/i915/perf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/i915/perf.c b/tests/i915/perf.c
index d4ebae30d..dbf7e3497 100644
--- a/tests/i915/perf.c
+++ b/tests/i915/perf.c
@@ -3845,6 +3845,7 @@ static void gen12_single_ctx_helper(void)
 		.format = test_set->perf_oa_format
 	};
 
+	drm_fd = gem_reopen_driver(drm_fd);
 	bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
 	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 
@@ -4107,6 +4108,7 @@ static void gen12_single_ctx_helper(void)
 	drm_intel_gem_context_destroy(context1);
 	drm_intel_bufmgr_destroy(bufmgr);
 	__perf_close(stream_fd);
+	close(drm_fd);
 }
 
 static void
-- 
2.27.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: [Intel-gfx] [PATCH i-g-t] i915/perf: Instantiate a local drm_fd for the unprivileged helper
  2020-07-02 12:39 [Intel-gfx] [PATCH i-g-t] i915/perf: Instantiate a local drm_fd for the unprivileged helper Chris Wilson
@ 2020-07-02 13:05 ` Lionel Landwerlin
  2020-07-02 17:46 ` Chris Wilson
  1 sibling, 0 replies; 3+ messages in thread
From: Lionel Landwerlin @ 2020-07-02 13:05 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: igt-dev

Could be a particularly slow PIPE_CONTROL instruction on TGL.
We assumed that in a sequence of instructions : PC0, MI_RPC0, PC1, MI_RPC1

The delta of time PC1 - PC0 would be with 500ns of MI_RPC1 - MI_RPC0.
That does sound a bit broken tbf...

Patch looks good :

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

Thanks,

-Lionel

On 02/07/2020 15:39, Chris Wilson wrote:
> While the test is blocked, we keep trying the gen12_single_ctx_helper().
> As this is using the parent's drm_fd, all of our context allocations are
> persistent. Reopen the device in the child so that when we exit, our
> allocations are freed along with the process -- avoiding a total memory
> leak if the test is stuck.
>
> This does not explain why the test was stuck, it just prevents us from
> exacerbating the error condition. Hopefully leaving the system in a more
> debuggable state.
>
> References: https://gitlab.freedesktop.org/drm/intel/-/issues/2126
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
>   tests/i915/perf.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/tests/i915/perf.c b/tests/i915/perf.c
> index d4ebae30d..dbf7e3497 100644
> --- a/tests/i915/perf.c
> +++ b/tests/i915/perf.c
> @@ -3845,6 +3845,7 @@ static void gen12_single_ctx_helper(void)
>   		.format = test_set->perf_oa_format
>   	};
>   
> +	drm_fd = gem_reopen_driver(drm_fd);
>   	bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
>   	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
>   
> @@ -4107,6 +4108,7 @@ static void gen12_single_ctx_helper(void)
>   	drm_intel_gem_context_destroy(context1);
>   	drm_intel_bufmgr_destroy(bufmgr);
>   	__perf_close(stream_fd);
> +	close(drm_fd);
>   }
>   
>   static void


_______________________________________________
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

* [Intel-gfx] [PATCH i-g-t] i915/perf: Instantiate a local drm_fd for the unprivileged helper
  2020-07-02 12:39 [Intel-gfx] [PATCH i-g-t] i915/perf: Instantiate a local drm_fd for the unprivileged helper Chris Wilson
  2020-07-02 13:05 ` Lionel Landwerlin
@ 2020-07-02 17:46 ` Chris Wilson
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Wilson @ 2020-07-02 17:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Chris Wilson

While the test is blocked, we keep trying the gen12_single_ctx_helper().
As this is using the parent's drm_fd, all of our context allocations are
persistent. Reopen the device in the child so that when we exit, our
allocations are freed along with the process -- avoiding a total memory
leak if the test is stuck.

This does not explain why the test was stuck, it just prevents us from
exacerbating the error condition. Hopefully leaving the system in a more
debuggable state.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/2126
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 tests/i915/perf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/i915/perf.c b/tests/i915/perf.c
index d4ebae30d..92edc9f1f 100644
--- a/tests/i915/perf.c
+++ b/tests/i915/perf.c
@@ -4120,8 +4120,13 @@ gen12_test_single_ctx_render_target_writes_a_counter(void)
 
 	do {
 		igt_fork_helper(&child) {
+			/* A local device for local resources. */
+			drm_fd = gem_reopen_driver(drm_fd);
+
 			igt_drop_root();
 			gen12_single_ctx_helper();
+
+			close(drm_fd);
 		}
 		child_ret = igt_wait_helper(&child);
 		igt_assert(WEXITSTATUS(child_ret) == EAGAIN ||
-- 
2.27.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

end of thread, other threads:[~2020-07-02 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 12:39 [Intel-gfx] [PATCH i-g-t] i915/perf: Instantiate a local drm_fd for the unprivileged helper Chris Wilson
2020-07-02 13:05 ` Lionel Landwerlin
2020-07-02 17:46 ` Chris Wilson

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).