All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Previn <alan.previn.teres.alexis@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
Subject: [igt-dev] [PATCH i-g-t 15/17] Ensure RESET_STAT reports invalidated protected context
Date: Sat, 15 May 2021 16:01:40 -0700	[thread overview]
Message-ID: <20210515230142.1816456-16-alan.previn.teres.alexis@intel.com> (raw)
In-Reply-To: <20210515230142.1816456-1-alan.previn.teres.alexis@intel.com>

When protected contexts are created but get invalidated
due to PXP session teardown (such as after a suspend-resume
cycle), RESET_STAT ioctl for said context will report it
as I915_CONTEXT_INVALIDATED.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
---
 tests/i915/gem_pxp.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/i915/gem_pxp.c b/tests/i915/gem_pxp.c
index e5f3f2f0..dc89eac2 100644
--- a/tests/i915/gem_pxp.c
+++ b/tests/i915/gem_pxp.c
@@ -783,6 +783,22 @@ static void free_exec_assets(int i915, struct simple_exec_assets *data)
 	buf_ops_destroy(data->bops);
 }
 
+static bool is_context_valid(int i915, uint32_t ctx)
+{
+	struct drm_i915_reset_stats rs;
+	int ret;
+
+	memset(&rs, 0, sizeof(rs));
+	rs.ctx_id = ctx;
+	ret = drmIoctl(i915, DRM_IOCTL_I915_GET_RESET_STATS, &rs);
+	igt_assert(ret == 0);
+
+	if (rs.flags & I915_CONTEXT_INVALIDATED)
+		return false;
+
+	return true;
+}
+
 static void test_pxp_pwrcycle_staleasset_execution(int i915, struct powermgt_data *pm)
 {
 	int ret;
@@ -814,6 +830,7 @@ static void test_pxp_pwrcycle_staleasset_execution(int i915, struct powermgt_dat
 
 	trigger_powermgt_suspend_cycle(i915, pm);
 
+	igt_assert_f(!is_context_valid(i915, data[0].ctx), "RESET_STATS missed stale pxp context\n");
 	ret = gem_execbuf_flush_store_dw(i915, data[0].ibb, data[0].ctx, data[0].fencebuf);
 	igt_assert_f((ret == -EACCES), "Execution with stale pxp context didnt fail with -EACCES\n");
 
@@ -822,6 +839,7 @@ static void test_pxp_pwrcycle_staleasset_execution(int i915, struct powermgt_dat
 	 * reuse the bo to ensure the kernel is catching the
 	 * invalidated bo (not context)
 	 */
+	igt_assert_f(!is_context_valid(i915, data[1].ctx), "RESET_STATS missed stale pxp context\n");
 	ret = create_ctx_with_params(i915, true, true, true, false, &ctx2);
 	igt_assert_eq(ret, 0);
 	igt_assert_eq(get_ctx_protected_param(i915, ctx2), 1);
@@ -832,6 +850,7 @@ static void test_pxp_pwrcycle_staleasset_execution(int i915, struct powermgt_dat
 	ret = gem_execbuf_flush_store_dw(i915, ibb2, ctx2, data[1].fencebuf);
 	igt_assert_f((ret == -ENOEXEC), "Execution with stale pxp buffer didnt fail with -ENOEXEC\n");
 
+	igt_assert_f(is_context_valid(i915, data[2].ctx), "RESET_STATS false-hit on opt-out context\n");
 	ret = gem_execbuf_flush_store_dw(i915, data[2].ibb, data[2].ctx, data[2].fencebuf);
 	igt_assert_f((ret == 0), "Opt-out-execution with stale pxp buffer didnt succeed\n");
 
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2021-05-15 23:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 23:01 [igt-dev] [PATCH i-g-t 00/17] Introduce PXP Test Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 01/17] Sync i915_drm.h UAPI from kernel Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 02/17] Add PXP UAPI support in i915_drm.h Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 03/17] Upadte IOCTL wrapper with DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 04/17] Add basic PXP testing of buffer and context alloc Alan Previn
2021-05-17  3:10   ` Dixit, Ashutosh
2021-05-17 10:26   ` Petri Latvala
2021-05-17 14:42     ` Dixit, Ashutosh
2021-05-17 14:50       ` Petri Latvala
2021-05-17 16:34         ` Teres Alexis, Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 05/17] Perform a regular 3d copy as a control checkpoint Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 06/17] Add PXP attribute support in batchbuffer and buffer_ops libs Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 07/17] Add MI_SET_APPID instruction definition Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 08/17] Enable protected session cmd in gen12_render_copyfunc Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 09/17] Add subtest to copy raw source to protected dest Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 10/17] Add test where both src and dest are protected Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 11/17] Verify PXP teardown occured through suspend-resume Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 12/17] Verify execbuf fails with stale PXP context after teardown Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 13/17] Verify execbuf fails with stale PXP buffer " Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 14/17] Verify execbuf ok with stale prot-buff and regular context Alan Previn
2021-05-15 23:01 ` Alan Previn [this message]
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 16/17] Verify protected surfaces are dma buffer sharable Alan Previn
2021-05-15 23:01 ` [igt-dev] [PATCH i-g-t 17/17] tests/i915_pxp: CRC validation for display tests Alan Previn
2021-05-16  0:07 ` [igt-dev] ✓ Fi.CI.BAT: success for Introduce PXP Test (rev4) Patchwork
2021-05-16  2:13 ` [igt-dev] ✗ Fi.CI.IGT: 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=20210515230142.1816456-16-alan.previn.teres.alexis@intel.com \
    --to=alan.previn.teres.alexis@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 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.