Re: [igt-dev] [PATCH i-g-t] tests/drv_suspend: Suspend under memory pressure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 24/05/18 05:42, Chris Wilson wrote:
Recently we discovered that we have a race between swapping and
suspend in our resume path (we might be trying to page in an object
after disabling the block devices). Let's try to exercise that by
exhausting all of system memory before suspend.

References: https://bugs.freedesktop.org/show_bug.cgi?id=106640
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Tomi Sarvela <tomi.p.sarvela@xxxxxxxxx>

LGTM:
Reviewed-by: Antonio Argenziano <antonio.argenziano@xxxxxxxxx>

---
  lib/igt_core.c      | 34 ++++++++++++++++++++--------------
  lib/igt_core.h      |  1 +
  tests/drv_suspend.c | 42 ++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 63 insertions(+), 14 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index e292ca24c..804ce4578 100644

+static void
+test_shrink(int fd, unsigned int mode)
+{
+	uint64_t *can_mlock;
+	void *locked;
+	uint64_t pin;
+
+	gem_quiescent_gpu(fd);
+	intel_purge_vm_caches(fd);
+
+	can_mlock = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	igt_assert(can_mlock != MAP_FAILED);
+
+	pin = intel_get_total_ram_mb() << 20;
+
+	igt_debug("Locking %'"PRIu64" MiB\n", pin >> 20);
+	locked = malloc(pin);
+	igt_assert(locked);

Shouldn't this^ be a require as well?

+
+	/* Lock all the system memory, forcing the driver into swap and OOM */

+
  static void
  test_forcewake(int fd, bool hibernate)
  {
@@ -199,6 +238,9 @@ igt_main
  	igt_subtest("sysfs-reader")
  		test_sysfs_reader(false);
+ igt_subtest("shrink")
+		test_shrink(fd, SUSPEND_STATE_MEM);

I am assuming you plan to have tests for other suspend modes.

Thanks,
Antonio

+
  	igt_subtest("forcewake")
  		test_forcewake(fd, false);
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux