Skip to contentSkip to conversation

test/gem_mocs_settings: Testing MOCS register settings

PATCH Superseded Peter Antoine 2 participants 5 messages Apr 4, 2016 – Apr 5, 2016

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/gem_mocs_settings: Testing MOCS register settings

The MOCS registers were added in Gen9 and define the caching policy. The registers are split into two sets. The first set controls the EDRAM policy and have a set for each engine, the second set controls the L3 policy. The two sets use the same index.

The RCS registers and the L3CC registers are stored in the RCS context.

The test checks that the registers are correct by checking the values by directly reading them via MMIO, then again it tests them by reading them from within a batch buffer. RCS engine is tested last as it programs the registers via a batch buffer and this will invalidate the test for workloads that don't use the render ring or don't run a render batch first.

---
 tests/Makefile.sources    |   1 +
 tests/gem_mocs_settings.c | 408 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 409 insertions(+)
 create mode 100644 tests/gem_mocs_settings.c
tests/Makefile.sources +1 -0
index 43f232f..d483c9e 100644
@@ -148,6 +148,7 @@ TESTS_progs = \
 	gem_lut_handle \
 	gem_mmap_offset_exhaustion \
 	gem_media_fill \
+	gem_mocs_settings \
 	gem_gpgpu_fill \
 	gem_pin \
 	gem_reg_read \
tests/gem_mocs_settings.c new file +408 -0

408 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 11 lines · Peter Antoine
tests/gem_mocs_settings.c new file +11 -0
+static void run_test(int fd, unsigned mode)
+{
+	const int gen = intel_gen(intel_get_drm_devid(fd));
+	const struct intel_execution_engine *e;
+
+	igt_require(gen >= 9);
+
+	test_mocs_values(fd);
+
+	switch(mode) {
+	case NONE:	break;

tests/gem_mocs_settings.c line 364

Quoted 10 lines
tests/gem_mocs_settings.c new file +10 -0
+	case RESET:	igt_force_gpu_reset();	break;
+	case SUSPEND:	igt_system_suspend_autoresume(); break;
+	case HIBERNATE:	igt_system_hibernate_autoresume(); break;
+	};
+
+	/*
+	 * Do render after other engines as older versions of code will
+	 * cause the RCS context to program the registers and the test
+	 * becomes invalid
+	 */

If you defer fd allocation to here, then that is moot, as we can create the fd for each test and be sure that the default context is uninitialised.

tests/gem_mocs_settings.c line 376

Quoted 12 lines
tests/gem_mocs_settings.c new file +12 -0
+	for (e = intel_execution_engines; e->name; e++)
+		if (e->exec_id != I915_EXEC_DEFAULT &&
+		    e->exec_id != I915_EXEC_RENDER &&
+		    gem_has_ring(fd, e->exec_id | e->flags))
+			test_context_mocs_values(fd, e, true);
+
+	for (e = intel_execution_engines; e->name; e++)
+		if (e->exec_id == I915_EXEC_RENDER &&
+		    gem_has_ring(fd, e->exec_id | e->flags)) {
+			test_context_mocs_values(fd, e, true);
+			test_context_mocs_values(fd, e, false);
+		}

As well as checking for creating new contexts after resume, we also need to check that the register values are preserved across suspend (i.e. that the register state is being saved back into the context image and then restored).

If we get truly paranoid (and why not?!) then we can create a pair of contexts, change the register values in one and verify that the second context is unaffected.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Response inline.

Quoted 18 lines · Chris Wilson
Quoted 17 lines · Peter Antoine
tests/gem_mocs_settings.c new file +17 -0
+static void run_test(int fd, unsigned mode)
+{
+	const int gen = intel_gen(intel_get_drm_devid(fd));
+	const struct intel_execution_engine *e;
+
+	igt_require(gen >= 9);
+
+	test_mocs_values(fd);
+
+	switch(mode) {
+	case NONE:	break;
+	case RESET:	igt_force_gpu_reset();	break;
+	case SUSPEND:	igt_system_suspend_autoresume(); break;
+	case HIBERNATE:	igt_system_hibernate_autoresume(); break;
+	};
+
+	/*
Quoted 8 lines

tests/gem_mocs_settings.c line 364

Quoted 4 lines
tests/gem_mocs_settings.c new file +4 -0
+	 * Do render after other engines as older versions of code will
+	 * cause the RCS context to program the registers and the test
+	 * becomes invalid
+	 */

If you defer fd allocation to here, then that is moot, as we can create the fd for each test and be sure that the default context is uninitialised.

Ok, will wrap each test within an fd of it's own.

Quoted 10 lines
Quoted 10 lines
tests/gem_mocs_settings.c new file +9 -0
+	for (e = intel_execution_engines; e->name; e++)
+		if (e->exec_id != I915_EXEC_DEFAULT &&
+		    e->exec_id != I915_EXEC_RENDER &&
+		    gem_has_ring(fd, e->exec_id | e->flags))
+			test_context_mocs_values(fd, e, true);
+
+	for (e = intel_execution_engines; e->name; e++)
+		if (e->exec_id == I915_EXEC_RENDER &&
+		    gem_has_ring(fd, e->exec_id | e->flags)) {
Quoted 8 lines

tests/gem_mocs_settings.c line 376

Quoted 3 lines
tests/gem_mocs_settings.c new file +3 -0
+			test_context_mocs_values(fd, e, true);
+			test_context_mocs_values(fd, e, false);
+		}

As well as checking for creating new contexts after resume, we also need to check that the register values are preserved across suspend (i.e. that the register state is being saved back into the context image and then restored).

Ok, I'll add another test case that does this for the render engine (the only one that is effected (at the moment) by context save and resume.

I might as well move the render engine context tests to a new testcase. As it is the only engine that uses the context registers.

Quoted 4 lines

If we get truly paranoid (and why not?!) then we can create a pair of contexts, change the register values in one and verify that the second context is unaffected.

Might as well, can add a test case that dirties the RCS context registers and see if they are the same after resume and if a new context is created afterwards that it has the correct values.

Peter.

Quoted 3 lines

-Chris

--
Peter Antoine (Android Graphics Driver Software Engineer)
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 8 lines · Peter Antoine
Quoted 4 lines

As well as checking for creating new contexts after resume, we also need to check that the register values are preserved across suspend (i.e. that the register state is being saved back into the context image and then restored).

Ok, I'll add another test case that does this for the render engine (the only one that is effected (at the moment) by context save and resume.

We do expect that the mocs values for other rings to be preserved across suspend. Or did I misunderstand you? i.e create-context; bcs; suspend; bcs should^W must work.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Others should be preserved across suspend. BUT they are not context saved (I Know!) so any sort of dirty test won't work. The current test will check the other engines values as they are programmed on start-up (with the new patches) and should be preserved (or be reprogrammed) when coming out of *C6/Suspend/Hibernate.

So context save/resume only needs to be tested for the RCS engine. For Now.

Peter.

Quoted 6 lines · Chris Wilson
Quoted 5 lines · Peter Antoine
Quoted 4 lines

As well as checking for creating new contexts after resume, we also need to check that the register values are preserved across suspend (i.e. that the register state is being saved back into the context image and then restored).

Quoted 10 lines
Quoted 3 lines

Ok, I'll add another test case that does this for the render engine (the only one that is effected (at the moment) by context save and resume.

We do expect that the mocs values for other rings to be preserved across suspend. Or did I misunderstand you? i.e create-context; bcs; suspend; bcs should^W must work.
-Chris

--
Peter Antoine (Android Graphics Driver Software Engineer)
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx