public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH v2 1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
@ 2019-04-16 19:25 Caz Yokoyama
  2019-04-16 20:17 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v2,1/1] " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Caz Yokoyama @ 2019-04-16 19:25 UTC (permalink / raw)
  To: igt-dev

As its comment says, _intel_require_memory() will 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/igt_aux.h                |  1 +
 lib/intel_os.c               | 42 ++++++++++++++++++++++++++++++++++++
 tests/i915/gem_cs_prefetch.c | 21 ++++++++++++++----
 3 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 55392790..9cb41d41 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -199,6 +199,7 @@ void *intel_get_total_pinnable_mem(size_t *pinned);
 int __intel_check_memory(uint64_t count, uint64_t size, unsigned mode,
 			 uint64_t *out_required, uint64_t *out_total);
 void intel_require_memory(uint64_t count, uint64_t size, unsigned mode);
+void _intel_require_memory(uint64_t count, uint64_t size, unsigned mode);
 void intel_require_files(uint64_t count);
 #define CHECK_RAM 0x1
 #define CHECK_SWAP 0x2
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] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v2,1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
  2019-04-16 19:25 [igt-dev] [PATCH v2 1/1] lib/gem_cs_prefetch: enable on Simics Simulator Caz Yokoyama
@ 2019-04-16 20:17 ` Patchwork
  2019-04-17  5:16 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2019-04-17 15:32 ` [igt-dev] [PATCH v2 1/1] " Caz Yokoyama
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-04-16 20:17 UTC (permalink / raw)
  To: Caz Yokoyama; +Cc: igt-dev

== Series Details ==

Series: series starting with [v2,1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
URL   : https://patchwork.freedesktop.org/series/59608/
State : success

== Summary ==

CI Bug Log - changes from IGT_4953 -> IGTPW_2876
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/59608/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2876 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@cs-compute:
    - fi-kbl-8809g:       NOTRUN -> FAIL [fdo#108094]

  * igt@amdgpu/amd_basic@query-info:
    - fi-bsw-kefka:       NOTRUN -> SKIP [fdo#109271] +50

  * igt@amdgpu/amd_basic@semaphore:
    - fi-bdw-5557u:       NOTRUN -> SKIP [fdo#109271] +38

  * igt@gem_exec_basic@basic-bsd2:
    - fi-kbl-7500u:       NOTRUN -> SKIP [fdo#109271] +9

  * igt@gem_exec_basic@gtt-bsd2:
    - fi-byt-clapper:     NOTRUN -> SKIP [fdo#109271] +52

  * igt@gem_exec_basic@readonly-bsd2:
    - fi-pnv-d510:        NOTRUN -> SKIP [fdo#109271] +71

  * igt@i915_selftest@live_contexts:
    - fi-icl-y:           PASS -> INCOMPLETE [fdo#108569]

  * igt@kms_busy@basic-flip-c:
    - fi-byt-clapper:     NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
    - fi-bsw-kefka:       NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
    - fi-pnv-d510:        NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_chamelium@dp-crc-fast:
    - fi-kbl-7500u:       NOTRUN -> DMESG-WARN [fdo#103841]

  * igt@kms_chamelium@hdmi-edid-read:
    - fi-hsw-peppy:       NOTRUN -> SKIP [fdo#109271] +46
    - fi-kbl-8809g:       NOTRUN -> SKIP [fdo#109271] +54

  * igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size:
    - fi-glk-dsi:         PASS -> INCOMPLETE [fdo#103359] / [k.org#198133]

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-u3:          PASS -> FAIL [fdo#103167]
    - fi-hsw-peppy:       NOTRUN -> DMESG-FAIL [fdo#102614] / [fdo#107814]
    - fi-byt-clapper:     NOTRUN -> FAIL [fdo#103167]

  * igt@kms_psr@primary_page_flip:
    - fi-apl-guc:         NOTRUN -> SKIP [fdo#109271] +48

  * igt@runner@aborted:
    - fi-kbl-7500u:       NOTRUN -> FAIL [fdo#103841]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#103841]: https://bugs.freedesktop.org/show_bug.cgi?id=103841
  [fdo#107814]: https://bugs.freedesktop.org/show_bug.cgi?id=107814
  [fdo#108094]: https://bugs.freedesktop.org/show_bug.cgi?id=108094
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109316]: https://bugs.freedesktop.org/show_bug.cgi?id=109316
  [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133


Participating hosts (42 -> 44)
------------------------------

  Additional (9): fi-bdw-5557u fi-hsw-peppy fi-icl-u2 fi-apl-guc fi-kbl-7500u fi-kbl-8809g fi-pnv-d510 fi-bsw-kefka fi-byt-clapper 
  Missing    (7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus fi-kbl-r 


Build changes
-------------

    * IGT: IGT_4953 -> IGTPW_2876

  CI_DRM_5939: 757f5370dc4baed0475b6e28efd67ecc267e8745 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2876: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2876/
  IGT_4953: e03d0030391689cfd0fbca293d44d83dd7d9e356 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2876/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [v2,1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
  2019-04-16 19:25 [igt-dev] [PATCH v2 1/1] lib/gem_cs_prefetch: enable on Simics Simulator Caz Yokoyama
  2019-04-16 20:17 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v2,1/1] " Patchwork
@ 2019-04-17  5:16 ` Patchwork
  2019-04-17 15:32 ` [igt-dev] [PATCH v2 1/1] " Caz Yokoyama
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-04-17  5:16 UTC (permalink / raw)
  To: Caz Yokoyama; +Cc: igt-dev

== Series Details ==

Series: series starting with [v2,1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
URL   : https://patchwork.freedesktop.org/series/59608/
State : success

== Summary ==

CI Bug Log - changes from IGT_4953_full -> IGTPW_2876_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/59608/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2876_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_schedule@preemptive-hang-bsd2:
    - shard-hsw:          NOTRUN -> SKIP [fdo#109271] +24

  * igt@gem_pread@stolen-uncached:
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] +20

  * igt@gem_tiled_swapping@non-threaded:
    - shard-hsw:          PASS -> FAIL [fdo#108686]

  * igt@i915_selftest@live_workarounds:
    - shard-iclb:         PASS -> DMESG-FAIL [fdo#108954]

  * igt@kms_atomic_transition@5x-modeset-transitions-fencing:
    - shard-hsw:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +2
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1

  * igt@kms_busy@extended-modeset-hang-oldfb-render-e:
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +6

  * igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-d:
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_content_protection@atomic-dpms:
    - shard-kbl:          NOTRUN -> FAIL [fdo#110321] / [fdo#110336]

  * igt@kms_cursor_crc@cursor-256x256-suspend:
    - shard-glk:          NOTRUN -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-256x85-sliding:
    - shard-kbl:          PASS -> FAIL [fdo#103232]
    - shard-apl:          PASS -> FAIL [fdo#103232]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-onoff:
    - shard-apl:          PASS -> FAIL [fdo#103167]
    - shard-kbl:          PASS -> FAIL [fdo#103167]

  * igt@kms_frontbuffer_tracking@fbc-suspend:
    - shard-apl:          PASS -> DMESG-WARN [fdo#108566] +3

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-pwrite:
    - shard-iclb:         PASS -> FAIL [fdo#109247] +14

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-pri-indfb-multidraw:
    - shard-iclb:         PASS -> FAIL [fdo#103167] +1

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-indfb-pgflip-blt:
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] +20

  * igt@kms_lease@page_flip_implicit_plane:
    - shard-apl:          NOTRUN -> FAIL [fdo#110281]

  * igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
    - shard-kbl:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
    - shard-glk:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_lowres@pipe-a-tiling-x:
    - shard-iclb:         PASS -> FAIL [fdo#103166]

  * igt@kms_plane_scaling@pipe-b-scaler-with-pixel-format:
    - shard-glk:          PASS -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_psr@psr2_no_drrs:
    - shard-iclb:         PASS -> SKIP [fdo#109441] +1

  * igt@kms_psr@sprite_plane_onoff:
    - shard-iclb:         PASS -> FAIL [fdo#107383] / [fdo#110215] +1

  * igt@kms_rotation_crc@multiplane-rotation:
    - shard-kbl:          PASS -> INCOMPLETE [fdo#103665]

  * igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
    - shard-kbl:          PASS -> DMESG-FAIL [fdo#105763]

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-kbl:          PASS -> FAIL [fdo#109016]

  * igt@kms_setmode@basic:
    - shard-hsw:          PASS -> FAIL [fdo#99912]
    - shard-kbl:          PASS -> FAIL [fdo#99912]

  * igt@kms_universal_plane@universal-plane-gen9-features-pipe-f:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1

  * igt@perf@sysctl-defaults:
    - shard-apl:          PASS -> INCOMPLETE [fdo#103927] +1

  * igt@perf_pmu@busy-accuracy-2-rcs0:
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] +39

  * igt@prime_nv_pcopy@test3_5:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] +23

  
#### Possible fixes ####

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-cpu:
    - shard-glk:          FAIL [fdo#103167] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-tilingchange:
    - shard-iclb:         FAIL [fdo#103167] -> PASS +5

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-pwrite:
    - shard-iclb:         FAIL [fdo#109247] -> PASS +10

  * igt@kms_plane_scaling@pipe-a-scaler-with-pixel-format:
    - shard-glk:          SKIP [fdo#109271] / [fdo#109278] -> PASS

  * igt@kms_psr@cursor_mmap_gtt:
    - shard-iclb:         FAIL [fdo#107383] / [fdo#110215] -> PASS +1

  * igt@kms_psr@no_drrs:
    - shard-iclb:         FAIL [fdo#108341] -> PASS

  * igt@kms_psr@psr2_sprite_blt:
    - shard-iclb:         SKIP [fdo#109441] -> PASS +1

  * igt@kms_setmode@basic:
    - shard-apl:          FAIL [fdo#99912] -> PASS

  * igt@kms_sysfs_edid_timing:
    - shard-iclb:         FAIL [fdo#100047] -> PASS

  * igt@kms_vblank@pipe-c-ts-continuation-suspend:
    - shard-apl:          DMESG-WARN [fdo#108566] -> PASS +3

  
  [fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
  [fdo#107383]: https://bugs.freedesktop.org/show_bug.cgi?id=107383
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
  [fdo#108954]: https://bugs.freedesktop.org/show_bug.cgi?id=108954
  [fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
  [fdo#109247]: https://bugs.freedesktop.org/show_bug.cgi?id=109247
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#110215]: https://bugs.freedesktop.org/show_bug.cgi?id=110215
  [fdo#110281]: https://bugs.freedesktop.org/show_bug.cgi?id=110281
  [fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321
  [fdo#110336]: https://bugs.freedesktop.org/show_bug.cgi?id=110336
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 6)
------------------------------

  Missing    (1): shard-skl 


Build changes
-------------

    * IGT: IGT_4953 -> IGTPW_2876

  CI_DRM_5939: 757f5370dc4baed0475b6e28efd67ecc267e8745 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2876: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2876/
  IGT_4953: e03d0030391689cfd0fbca293d44d83dd7d9e356 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2876/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH v2 1/1] lib/gem_cs_prefetch: enable on Simics Simulator.
  2019-04-16 19:25 [igt-dev] [PATCH v2 1/1] lib/gem_cs_prefetch: enable on Simics Simulator Caz Yokoyama
  2019-04-16 20:17 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v2,1/1] " Patchwork
  2019-04-17  5:16 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2019-04-17 15:32 ` Caz Yokoyama
  2 siblings, 0 replies; 4+ messages in thread
From: Caz Yokoyama @ 2019-04-17 15:32 UTC (permalink / raw)
  To: igt-dev

Drop the patch. Will re-work.
-caz

On Tue, 2019-04-16 at 12:25 -0700, Caz Yokoyama wrote:
> As its comment says, _intel_require_memory() will 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/igt_aux.h                |  1 +
>  lib/intel_os.c               | 42
> ++++++++++++++++++++++++++++++++++++
>  tests/i915/gem_cs_prefetch.c | 21 ++++++++++++++----
>  3 files changed, 60 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index 55392790..9cb41d41 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -199,6 +199,7 @@ void *intel_get_total_pinnable_mem(size_t
> *pinned);
>  int __intel_check_memory(uint64_t count, uint64_t size, unsigned
> mode,
>  			 uint64_t *out_required, uint64_t *out_total);
>  void intel_require_memory(uint64_t count, uint64_t size, unsigned
> mode);
> +void _intel_require_memory(uint64_t count, uint64_t size, unsigned
> mode);
>  void intel_require_files(uint64_t count);
>  #define CHECK_RAM 0x1
>  #define CHECK_SWAP 0x2
> 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);

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

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-16 19:25 [igt-dev] [PATCH v2 1/1] lib/gem_cs_prefetch: enable on Simics Simulator Caz Yokoyama
2019-04-16 20:17 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v2,1/1] " Patchwork
2019-04-17  5:16 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-17 15:32 ` [igt-dev] [PATCH v2 1/1] " Caz Yokoyama

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox