All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [RFC PATCH i-g-t 4/6] tests/core_hotunplug: Add 'userptr GEM object' variants
Date: Thu,  1 Apr 2021 16:36:41 +0200	[thread overview]
Message-ID: <20210401143643.7867-4-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20210401143643.7867-1-janusz.krzysztofik@linux.intel.com>

Verify if userptr GM objects are cleaned up equally well as regular
GEM objects on device hotunbind / hotunplug.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 tests/core_hotunplug.c | 90 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index 7f61b4446..6f3b3b3d3 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -716,6 +716,72 @@ static void gem_hotunplug_lateclose(struct hotunplug *priv)
 	igt_assert_eq(priv->fd.drm, -1);
 }
 
+static void userptr_hotunbind_lateclose(struct hotunplug *priv)
+{
+	uint32_t handle;
+	void *ptr;
+
+	igt_require(priv->fd.drm = -1);
+	priv->fd.drm = local_drm_open_driver(false, "pre-", " for prerequisites check");
+
+	igt_require_intel(priv->fd.drm);
+	igt_require_gem(priv->fd.drm);
+	igt_assert_eq(posix_memalign(&ptr, 4096, 4096), 0);
+	igt_require(!__gem_userptr(priv->fd.drm, ptr, 4096, 0, 0, &handle));
+	gem_close(priv->fd.drm, handle);
+	priv->fd.drm = close_device(priv->fd.drm, "", "pre-checked ");
+
+	pre_check(priv);
+
+	priv->fd.drm = local_drm_open_driver(false, "", " for hot unbind");
+
+	local_debug("%s\n", "creating a userptr GEM object");
+	gem_userptr(priv->fd.drm, ptr, 4096, 0, 0, &handle);
+
+	driver_unbind(priv, "hot ", 0);
+
+	local_debug("%s\n", "trying to late remove the object");
+	igt_assert_eq(local_gem_close(priv->fd.drm, handle), -ENODEV);
+
+	priv->fd.drm = close_device(priv->fd.drm, "late ", "unbound ");
+	igt_assert_eq(priv->fd.drm, -1);
+
+	igt_fail_on_f(munmap(ptr, 4096), "Userptr unmap failure!");
+}
+
+static void userptr_hotunplug_lateclose(struct hotunplug *priv)
+{
+	uint32_t handle;
+	void *ptr;
+
+	igt_require(priv->fd.drm = -1);
+	priv->fd.drm = local_drm_open_driver(false, "pre-", " for prerequisites check");
+
+	igt_require_intel(priv->fd.drm);
+	igt_require_gem(priv->fd.drm);
+	igt_assert_eq(posix_memalign(&ptr, 4096, 4096), 0);
+	igt_require(!__gem_userptr(priv->fd.drm, ptr, 4096, 0, 0, &handle));
+	gem_close(priv->fd.drm, handle);
+	priv->fd.drm = close_device(priv->fd.drm, "", "pre-checked ");
+
+	pre_check(priv);
+
+	priv->fd.drm = local_drm_open_driver(false, "", " for hot unplug");
+
+	local_debug("%s\n", "creating a userptr GEM object");
+	gem_userptr(priv->fd.drm, ptr, 4096, 0, 0, &handle);
+
+	device_unplug(priv, "hot ", 0);
+
+	local_debug("%s\n", "trying to late remove the object");
+	igt_assert_eq(local_gem_close(priv->fd.drm, handle), -ENODEV);
+
+	priv->fd.drm = close_device(priv->fd.drm, "late ", "removed ");
+	igt_assert_eq(priv->fd.drm, -1);
+
+	igt_fail_on_f(munmap(ptr, 4096), "Userptr unmap failure!");
+}
+
 /* Main */
 
 igt_main
@@ -925,6 +991,30 @@ igt_main
 			recover(&priv);
 	}
 
+	igt_fixture
+		post_healthcheck(&priv);
+
+	igt_subtest_group {
+		igt_describe("Check if the driver can be cleanly unbound from a device with a still open userptr GEM object, then released");
+		igt_subtest("userptr-hotunbind-lateclose")
+			userptr_hotunbind_lateclose(&priv);
+
+		igt_fixture
+			recover(&priv);
+	}
+
+	igt_fixture
+		post_healthcheck(&priv);
+
+	igt_subtest_group {
+		igt_describe("Check if a device with a still open userptr GEM object can be cleanly unplugged, then released");
+		igt_subtest("userptr-hotunplug-lateclose")
+			userptr_hotunplug_lateclose(&priv);
+
+		igt_fixture
+			recover(&priv);
+	}
+
 	igt_fixture {
 		post_healthcheck(&priv);
 
-- 
2.25.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [igt-dev] [RFC PATCH i-g-t 4/6] tests/core_hotunplug: Add 'userptr GEM object' variants
Date: Thu,  1 Apr 2021 16:36:41 +0200	[thread overview]
Message-ID: <20210401143643.7867-4-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20210401143643.7867-1-janusz.krzysztofik@linux.intel.com>

Verify if userptr GM objects are cleaned up equally well as regular
GEM objects on device hotunbind / hotunplug.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 tests/core_hotunplug.c | 90 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index 7f61b4446..6f3b3b3d3 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -716,6 +716,72 @@ static void gem_hotunplug_lateclose(struct hotunplug *priv)
 	igt_assert_eq(priv->fd.drm, -1);
 }
 
+static void userptr_hotunbind_lateclose(struct hotunplug *priv)
+{
+	uint32_t handle;
+	void *ptr;
+
+	igt_require(priv->fd.drm = -1);
+	priv->fd.drm = local_drm_open_driver(false, "pre-", " for prerequisites check");
+
+	igt_require_intel(priv->fd.drm);
+	igt_require_gem(priv->fd.drm);
+	igt_assert_eq(posix_memalign(&ptr, 4096, 4096), 0);
+	igt_require(!__gem_userptr(priv->fd.drm, ptr, 4096, 0, 0, &handle));
+	gem_close(priv->fd.drm, handle);
+	priv->fd.drm = close_device(priv->fd.drm, "", "pre-checked ");
+
+	pre_check(priv);
+
+	priv->fd.drm = local_drm_open_driver(false, "", " for hot unbind");
+
+	local_debug("%s\n", "creating a userptr GEM object");
+	gem_userptr(priv->fd.drm, ptr, 4096, 0, 0, &handle);
+
+	driver_unbind(priv, "hot ", 0);
+
+	local_debug("%s\n", "trying to late remove the object");
+	igt_assert_eq(local_gem_close(priv->fd.drm, handle), -ENODEV);
+
+	priv->fd.drm = close_device(priv->fd.drm, "late ", "unbound ");
+	igt_assert_eq(priv->fd.drm, -1);
+
+	igt_fail_on_f(munmap(ptr, 4096), "Userptr unmap failure!");
+}
+
+static void userptr_hotunplug_lateclose(struct hotunplug *priv)
+{
+	uint32_t handle;
+	void *ptr;
+
+	igt_require(priv->fd.drm = -1);
+	priv->fd.drm = local_drm_open_driver(false, "pre-", " for prerequisites check");
+
+	igt_require_intel(priv->fd.drm);
+	igt_require_gem(priv->fd.drm);
+	igt_assert_eq(posix_memalign(&ptr, 4096, 4096), 0);
+	igt_require(!__gem_userptr(priv->fd.drm, ptr, 4096, 0, 0, &handle));
+	gem_close(priv->fd.drm, handle);
+	priv->fd.drm = close_device(priv->fd.drm, "", "pre-checked ");
+
+	pre_check(priv);
+
+	priv->fd.drm = local_drm_open_driver(false, "", " for hot unplug");
+
+	local_debug("%s\n", "creating a userptr GEM object");
+	gem_userptr(priv->fd.drm, ptr, 4096, 0, 0, &handle);
+
+	device_unplug(priv, "hot ", 0);
+
+	local_debug("%s\n", "trying to late remove the object");
+	igt_assert_eq(local_gem_close(priv->fd.drm, handle), -ENODEV);
+
+	priv->fd.drm = close_device(priv->fd.drm, "late ", "removed ");
+	igt_assert_eq(priv->fd.drm, -1);
+
+	igt_fail_on_f(munmap(ptr, 4096), "Userptr unmap failure!");
+}
+
 /* Main */
 
 igt_main
@@ -925,6 +991,30 @@ igt_main
 			recover(&priv);
 	}
 
+	igt_fixture
+		post_healthcheck(&priv);
+
+	igt_subtest_group {
+		igt_describe("Check if the driver can be cleanly unbound from a device with a still open userptr GEM object, then released");
+		igt_subtest("userptr-hotunbind-lateclose")
+			userptr_hotunbind_lateclose(&priv);
+
+		igt_fixture
+			recover(&priv);
+	}
+
+	igt_fixture
+		post_healthcheck(&priv);
+
+	igt_subtest_group {
+		igt_describe("Check if a device with a still open userptr GEM object can be cleanly unplugged, then released");
+		igt_subtest("userptr-hotunplug-lateclose")
+			userptr_hotunplug_lateclose(&priv);
+
+		igt_fixture
+			recover(&priv);
+	}
+
 	igt_fixture {
 		post_healthcheck(&priv);
 
-- 
2.25.1

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

  parent reply	other threads:[~2021-04-01 14:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01 14:36 [Intel-gfx] [RFC PATCH i-g-t 1/6] tests/core_hotunplug: Add 'GEM context' variants Janusz Krzysztofik
2021-04-01 14:36 ` [igt-dev] " Janusz Krzysztofik
2021-04-01 14:36 ` [Intel-gfx] [RFC PATCH i-g-t 2/6] tests/core_hotunplug: Add 'GEM address space' variants Janusz Krzysztofik
2021-04-01 14:36   ` [igt-dev] " Janusz Krzysztofik
2021-04-01 14:36 ` [Intel-gfx] [RFC PATCH i-g-t 3/6] tests/core_hotunplug: Add 'GEM object' variants Janusz Krzysztofik
2021-04-01 14:36   ` [igt-dev] " Janusz Krzysztofik
2021-04-01 14:36 ` Janusz Krzysztofik [this message]
2021-04-01 14:36   ` [igt-dev] [RFC PATCH i-g-t 4/6] tests/core_hotunplug: Add 'userptr GEM " Janusz Krzysztofik
2021-04-01 14:36 ` [Intel-gfx] [RFC PATCH i-g-t 5/6] tests/core_hotunplug: Add 'PRIME handle' variants Janusz Krzysztofik
2021-04-01 14:36   ` [igt-dev] " Janusz Krzysztofik
2021-04-01 14:36 ` [Intel-gfx] [RFC PATCH i-g-t 6/6] tests/core_hotunplug: Add 'GEM spin' variants Janusz Krzysztofik
2021-04-01 14:36   ` [igt-dev] " Janusz Krzysztofik
2021-04-01 17:24 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [RFC,i-g-t,1/6] tests/core_hotunplug: Add 'GEM context' variants Patchwork
2021-04-01 21:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210401143643.7867-4-janusz.krzysztofik@linux.intel.com \
    --to=janusz.krzysztofik@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.