All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH 1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
@ 2019-04-16 19:12 Caz Yokoyama
  2019-04-16 19:28 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/1] " Patchwork
  2019-04-16 19:43 ` [igt-dev] [PATCH 1/1] " Chris Wilson
  0 siblings, 2 replies; 6+ messages in thread
From: Caz Yokoyama @ 2019-04-16 19:12 UTC (permalink / raw
  To: igt-dev

As its comment says, _intel_require_memory() wll be removed when all test
calls _intel_require_memory().

Signed-off-by: Caz Yokoyama <caz.yokoyama@intel.com>
Cc: Stuart Summers <stuart.summers@intel.com>
---
 lib/intel_os.c               | 42 ++++++++++++++++++++++++++++++++++++
 tests/i915/gem_cs_prefetch.c | 21 ++++++++++++++----
 2 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/lib/intel_os.c b/lib/intel_os.c
index dd93bea1..c1aab19a 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -414,6 +414,48 @@ void intel_require_memory(uint64_t count, uint64_t size, unsigned mode)
 		      (long long)vfs_file_max());
 }
 
+/*
+ * same as intel_require_memory() except for no igt_skip_on_simulation()
+ * Will be removed when all test calls _intel_require_memory().
+ */
+void _intel_require_memory(uint64_t count, uint64_t size, unsigned mode)
+{
+	uint64_t required, total;
+	bool sufficient_memory;
+
+	sufficient_memory = __intel_check_memory(count, size, mode,
+						 &required, &total);
+	if (!sufficient_memory) {
+		int dir = open("/proc", O_RDONLY);
+		char *info;
+
+		info = igt_sysfs_get(dir, "meminfo");
+		if (info) {
+			igt_warn("Insufficient free memory; /proc/meminfo:\n%s",
+				 info);
+			free(info);
+		}
+
+		info = igt_sysfs_get(dir, "slabinfo");
+		if (info) {
+			igt_warn("Insufficient free memory; /proc/slabinfo:\n%s",
+				 info);
+			free(info);
+		}
+
+		close(dir);
+	}
+
+	igt_require_f(sufficient_memory,
+		      "Estimated that we need %'llu objects and %'llu MiB for the test, but only have %'llu MiB available (%s%s) and a maximum of %'llu objects\n",
+		      (long long)count,
+		      (long long)((required + ((1<<20) - 1)) >> 20),
+		      (long long)(total >> 20),
+		      mode & (CHECK_RAM | CHECK_SWAP) ? "RAM" : "",
+		      mode & CHECK_SWAP ? " + swap": "",
+		      (long long)vfs_file_max());
+}
+
 void intel_purge_vm_caches(int drm_fd)
 {
 	int fd;
diff --git a/tests/i915/gem_cs_prefetch.c b/tests/i915/gem_cs_prefetch.c
index 2b865368..26ff1bc2 100644
--- a/tests/i915/gem_cs_prefetch.c
+++ b/tests/i915/gem_cs_prefetch.c
@@ -92,13 +92,20 @@ static void can_test_ring(unsigned ring)
 	close(fd);
 }
 
+/*
+ * Following number is calculated from actual execution in Simics, i.e.
+ * __intel_check_memory() reports 7948206080 byte of main memory in total
+ * gem_create() reports ENOMEM on 14279th execution.
+ */
+#define KERNEL_BO_OVERHEAD_SIMICS (7948206080 / 14279-1 - BATCH_SIZE)
 static void test_ring(unsigned ring)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 obj[2];
 	struct shadow shadow;
-	uint64_t i, count;
+	uint64_t i, count, required, total;
 	int fd, gen;
+	bool sufficient_memory;
 
 	can_test_ring(ring);
 
@@ -107,7 +114,15 @@ static void test_ring(unsigned ring)
 	setup(fd, gen, &shadow);
 
 	count = gem_aperture_size(fd) / BATCH_SIZE;
-	intel_require_memory(count, BATCH_SIZE, CHECK_RAM);
+	if (igt_run_in_simulation()) {
+		sufficient_memory = __intel_check_memory(count, BATCH_SIZE,
+							 CHECK_RAM, &required,
+							 &total);
+		if (!sufficient_memory)
+			count = total /
+			  (BATCH_SIZE + KERNEL_BO_OVERHEAD_SIMICS);
+	}
+	_intel_require_memory(count, BATCH_SIZE, CHECK_RAM);
 	/* Fill the entire gart with batches and run them. */
 	memset(obj, 0, sizeof(obj));
 	obj[1].handle = shadow.handle;
@@ -141,8 +156,6 @@ igt_main
 {
 	const struct intel_execution_engine *e;
 
-	igt_skip_on_simulation();
-
 	for (e = intel_execution_engines; e->name; e++)
 		igt_subtest_f("%s", e->name)
 			test_ring(e->exec_id | e->flags);
-- 
2.17.1

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

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

* [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
  2019-04-16 19:12 [igt-dev] [PATCH 1/1] lib/gem_cs_prefetch: enable on Simics Simulator Caz Yokoyama
@ 2019-04-16 19:28 ` Patchwork
  2019-04-16 19:43 ` [igt-dev] [PATCH 1/1] " Chris Wilson
  1 sibling, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-04-16 19:28 UTC (permalink / raw
  To: Caz Yokoyama; +Cc: igt-dev

== Series Details ==

Series: series starting with [1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
URL   : https://patchwork.freedesktop.org/series/59607/
State : failure

== Summary ==

IGT patchset build failed on latest successful build
e03d0030391689cfd0fbca293d44d83dd7d9e356 lib/igt_fb: Don't leak the bufmgr and batch for converted surfaces

[212/452] Linking target tests/perf.
[213/452] Linking target tests/prime_busy.
[214/452] Linking target tests/prime_mmap.
[215/452] Linking target tests/prime_mmap_coherency.
[216/452] Linking target tests/prime_self_import.
[217/452] Linking target tests/prime_udl.
[218/452] Linking target tests/prime_vgem.
[219/452] Linking target tests/sw_sync.
[220/452] Linking target tests/syncobj_basic.
[221/452] Linking target tests/syncobj_wait.
[222/452] Linking target tests/v3d_get_param.
[223/452] Linking target tests/template.
[224/452] Linking target tests/tools_test.
[225/452] Linking target tests/v3d_get_bo_offset.
[226/452] Linking target tests/v3d_mmap.
[227/452] Linking target tests/vc4_create_bo.
[228/452] Linking target tests/vc4_label_bo.
[229/452] Linking target tests/vc4_dmabuf_poll.
[230/452] Linking target tests/vc4_tiling.
[231/452] Linking target tests/vc4_purgeable_bo.
[232/452] Linking target tests/vc4_lookup_fail.
[233/452] Linking target tests/vc4_wait_bo.
[234/452] Linking target tests/vc4_wait_seqno.
[235/452] Linking target tests/prime_nv_pcopy.
[236/452] Linking target tests/vgem_basic.
[237/452] Linking target tests/vgem_slow.
[238/452] Linking target tests/prime_nv_api.
[239/452] Linking target tests/gen3_mixed_blits.
[240/452] Linking target tests/prime_nv_test.
[241/452] Linking target tests/kms_chamelium.
[242/452] Linking target tests/gen3_render_linear_blits.
[243/452] Linking target tests/gem_basic.
[244/452] Linking target tests/gen3_render_mixed_blits.
[245/452] Linking target tests/gen3_render_tiledx_blits.
[246/452] Linking target tests/gen3_render_tiledy_blits.
[247/452] Linking target tests/gem_bad_reloc.
[248/452] Linking target tests/gem_busy.
[249/452] Linking target tests/gem_close.
[250/452] Linking target tests/gem_caching.
[251/452] Compiling C object 'tests/tests@@gem_cs_prefetch@exe/i915_gem_cs_prefetch.c.o'.
FAILED: tests/tests@@gem_cs_prefetch@exe/i915_gem_cs_prefetch.c.o 
ccache cc -Itests/tests@@gem_cs_prefetch@exe -Itests -I../tests -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/igt/include -I/opt/igt/include/libdrm -I/usr/include/x86_64-linux-gnu -I/usr/include -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/home/cidrm/kernel_headers/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -D_GNU_SOURCE -include config.h -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -pthread  -MD -MQ 'tests/tests@@gem_cs_prefetch@exe/i915_gem_cs_prefetch.c.o' -MF 'tests/tests@@gem_cs_prefetch@exe/i915_gem_cs_prefetch.c.o.d' -o 'tests/tests@@gem_cs_prefetch@exe/i915_gem_cs_prefetch.c.o' -c ../tests/i915/gem_cs_prefetch.c
../tests/i915/gem_cs_prefetch.c: In function ‘test_ring’:
../tests/i915/gem_cs_prefetch.c:125:2: error: implicit declaration of function ‘_intel_require_memory’; did you mean ‘intel_require_memory’? [-Werror=implicit-function-declaration]
  _intel_require_memory(count, BATCH_SIZE, CHECK_RAM);
  ^~~~~~~~~~~~~~~~~~~~~
  intel_require_memory
../tests/i915/gem_cs_prefetch.c:125:2: warning: nested extern declaration of ‘_intel_require_memory’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.

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

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

* Re: [igt-dev] [PATCH 1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
  2019-04-16 19:12 [igt-dev] [PATCH 1/1] lib/gem_cs_prefetch: enable on Simics Simulator Caz Yokoyama
  2019-04-16 19:28 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/1] " Patchwork
@ 2019-04-16 19:43 ` Chris Wilson
  2019-04-16 20:45   ` Caz Yokoyama
  1 sibling, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2019-04-16 19:43 UTC (permalink / raw
  To: Caz Yokoyama, igt-dev

Quoting Caz Yokoyama (2019-04-16 20:12:52)
> As its comment says, _intel_require_memory() wll be removed when all test
> calls _intel_require_memory().

You can replace this with a single buffer located at the end of GTT (and
other boundaries of presumed relevance) + softpin. Or this is just the
selftests we already should already be doing for live_gtt, since this is
an internal detail.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH 1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
  2019-04-16 19:43 ` [igt-dev] [PATCH 1/1] " Chris Wilson
@ 2019-04-16 20:45   ` Caz Yokoyama
  2019-04-16 20:47     ` Chris Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Caz Yokoyama @ 2019-04-16 20:45 UTC (permalink / raw
  To: Chris Wilson, igt-dev

Chris,
I am not clear what you says. What "this" refers
to?_intel_require_memory()?, whole this patch?
Also what live_gtt refers to? Nothing [live_gtt | live-gtt] matches.
-caz

On Tue, 2019-04-16 at 20:43 +0100, Chris Wilson wrote:
> Quoting Caz Yokoyama (2019-04-16 20:12:52)
> > As its comment says, _intel_require_memory() wll be removed when
> > all test
> > calls _intel_require_memory().
> 
> You can replace this with a single buffer located at the end of GTT
> (and
> other boundaries of presumed relevance) + softpin. Or this is just
> the
> selftests we already should already be doing for live_gtt, since this
> is
> an internal detail.
> -Chris

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

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

* Re: [igt-dev] [PATCH 1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
  2019-04-16 20:45   ` Caz Yokoyama
@ 2019-04-16 20:47     ` Chris Wilson
  2019-04-17 15:32       ` Caz Yokoyama
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2019-04-16 20:47 UTC (permalink / raw
  To: Caz Yokoyama, igt-dev

Quoting Caz Yokoyama (2019-04-16 21:45:34)
> Chris,
> I am not clear what you says. What "this" refers
> to?_intel_require_memory()?, whole this patch?

gem_cs_prefetch can be written as an extremely simple test that doesn't
belong in userspace...

> Also what live_gtt refers to? Nothing [live_gtt | live-gtt] matches.

...as it is part of the kernel's selftests since it's an implementation
detail.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH 1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
  2019-04-16 20:47     ` Chris Wilson
@ 2019-04-17 15:32       ` Caz Yokoyama
  0 siblings, 0 replies; 6+ messages in thread
From: Caz Yokoyama @ 2019-04-17 15:32 UTC (permalink / raw
  To: Chris Wilson, igt-dev

Drop the patch. Will re-work.
-caz

On Tue, 2019-04-16 at 21:47 +0100, Chris Wilson wrote:
> Quoting Caz Yokoyama (2019-04-16 21:45:34)
> > Chris,
> > I am not clear what you says. What "this" refers
> > to?_intel_require_memory()?, whole this patch?
> 
> gem_cs_prefetch can be written as an extremely simple test that
> doesn't
> belong in userspace...
> 
> > Also what live_gtt refers to? Nothing [live_gtt | live-gtt]
> > matches.
> 
> ...as it is part of the kernel's selftests since it's an
> implementation
> detail.
> -Chris

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

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

end of thread, other threads:[~2019-04-17 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-16 19:12 [igt-dev] [PATCH 1/1] lib/gem_cs_prefetch: enable on Simics Simulator Caz Yokoyama
2019-04-16 19:28 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/1] " Patchwork
2019-04-16 19:43 ` [igt-dev] [PATCH 1/1] " Chris Wilson
2019-04-16 20:45   ` Caz Yokoyama
2019-04-16 20:47     ` Chris Wilson
2019-04-17 15:32       ` Caz Yokoyama

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.