[PATCH i-g-t 1/8] tests/i915/gem_ppgtt: Temporary meminfo log dump for Sandybridge

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Sat Jul 9 06:52:08 UTC 2022


On Sandybridge we observe -ENOMEM with page cache which takes almost
whole memory. It is weird especially drop caches is called immediate
before test.

Patch is not a fix but I need more information to debug this issue.
It adds /proc/meminfo lines to igt log (not debug) triple times for
Sandybridge machines - before drop caches, after that and just before
test completes.

Unfortunately repro path is not predictive and occurs rare so merging
this code and revert in the future will be necessary.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
---
 tests/i915/gem_ppgtt.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/tests/i915/gem_ppgtt.c b/tests/i915/gem_ppgtt.c
index 0a06e9ec8f..9147b33a99 100644
--- a/tests/i915/gem_ppgtt.c
+++ b/tests/i915/gem_ppgtt.c
@@ -45,6 +45,23 @@
 #define HEIGHT 512
 #define SIZE (HEIGHT*STRIDE)
 
+static void dump_meminfo(const char *info, int lines)
+{
+	FILE *file;
+	size_t n = 0;
+	char *line = NULL;
+
+	file = fopen("/proc/meminfo", "r");
+	igt_assert(file);
+
+	igt_info("[meminfo - %s]\n", info);
+	while (getline(&line, &n, file) >= 0 && lines--)
+		igt_info("%s", line);
+
+	free(line);
+	fclose(file);
+}
+
 static struct intel_buf *create_bo(struct buf_ops *bops, uint32_t pixel)
 {
 	uint64_t value = (uint64_t)pixel << 32 | pixel, *v;
@@ -270,9 +287,15 @@ static bool has_contexts(void)
 igt_main
 {
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
+	bool is_sandybridge = false;
 
 	igt_fixture {
 		int fd = drm_open_driver(DRIVER_INTEL);
+		uint32_t devid = intel_get_drm_devid(fd);
+
+		if (IS_SANDYBRIDGE(devid))
+			is_sandybridge = true;
+
 		igt_require_gem(fd);
 		gem_require_blitter(fd);
 		close(fd);
@@ -283,9 +306,17 @@ igt_main
 		int nchild = ncpus + 1;
 		uint64_t mem_per_test;
 
+		/* Temporary meminfo dump for SNB */
+		if (is_sandybridge)
+			dump_meminfo("before drop-caches", 16);
+
 		mem_per_test = SIZE;
 		igt_require_memory(nchild + 1, mem_per_test, CHECK_RAM);
 
+		/* SNB */
+		if (is_sandybridge)
+			dump_meminfo("after drop-caches", 16);
+
 		rcs = calloc(sizeof(*rcs), nchild);
 		igt_assert(rcs);
 
@@ -300,6 +331,10 @@ igt_main
 		cleanup_bufs(bcs, 1);
 		cleanup_bufs(rcs, nchild);
 		free(rcs);
+
+		/* SNB */
+		if (is_sandybridge)
+			dump_meminfo("finish", 16);
 	}
 
 	igt_subtest("blt-vs-render-ctxN") {
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list