All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH v4 i-g-t 0/3] Fix the multiprocess mode of intel allocator
@ 2021-06-09 12:59 Andrzej Turko
  2021-06-09 12:59 ` [igt-dev] [PATCH i-g-t 1/3] tests/i915/api_intel_allocator: Exercise allocator in multiprocess mode Andrzej Turko
  0 siblings, 1 reply; 3+ messages in thread
From: Andrzej Turko @ 2021-06-09 12:59 UTC (permalink / raw)
  To: igt-dev

In the multiprocess mode all requests to the allocator are
processed in the parent. However, in certain scenarios
(for example gem_exec_capture@pi), a child process may want
to create an allocator instance using its own private file
desriptor.  Thus all ioctls used to determine available gtt size
must be called in the child process and not in the parent.

This patch implements the above change.

v2: Test allocators for private and shared contexts in
    multiprocess mode.

v3: Prepare all allocator implementations for supporting
    region-based memory management.

Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>


Andrzej Turko (3):
  tests/i915/api_intel_allocator: Exercise allocator in multiprocess
    mode
  lib/intel_allocator: Move the ioctl calls to client processes
  lib/intel_allocator: Add support for regions of allocation

 lib/intel_allocator.c            | 54 +++++++++++++++++++++++---------
 lib/intel_allocator_random.c     | 44 +++++++++++++-------------
 lib/intel_allocator_reloc.c      | 35 +++++++++------------
 lib/intel_allocator_simple.c     | 45 +++-----------------------
 tests/i915/api_intel_allocator.c | 47 +++++++++++++++++++++++++++
 5 files changed, 129 insertions(+), 96 deletions(-)

-- 
2.25.1

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

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

* [igt-dev] [PATCH i-g-t 1/3] tests/i915/api_intel_allocator: Exercise allocator in multiprocess mode
  2021-06-09 12:59 [igt-dev] [PATCH v4 i-g-t 0/3] Fix the multiprocess mode of intel allocator Andrzej Turko
@ 2021-06-09 12:59 ` Andrzej Turko
  0 siblings, 0 replies; 3+ messages in thread
From: Andrzej Turko @ 2021-06-09 12:59 UTC (permalink / raw)
  To: igt-dev

Test creation and usage of allocators in multiprocess mode
for contexts shared with the parent process as well as
private for the child.

This new test discovers a bug in the allocator implementation:
allocator is not correctly initialized if it is opened by
a child process using its private file descriptor.

Signed-off-by: Andrzej Turko <andrzej.turko@linux.intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 tests/i915/api_intel_allocator.c | 47 ++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/tests/i915/api_intel_allocator.c b/tests/i915/api_intel_allocator.c
index ea4ba8bb1..b43467a33 100644
--- a/tests/i915/api_intel_allocator.c
+++ b/tests/i915/api_intel_allocator.c
@@ -621,6 +621,50 @@ static void execbuf_with_allocator(int fd)
 	igt_assert(intel_allocator_close(ahnd) == true);
 }
 
+static void multiprocess(int fd, uint8_t type) {
+	uint64_t p_ahnd, sh_ahnd, fd_ahnd, ctx_ahnd;
+	uint64_t sh_left, sh_right, fd_left, fd_right;
+	uint64_t offset;
+
+	intel_allocator_multiprocess_start();
+
+	p_ahnd = intel_allocator_open(fd, 0, type);
+	offset = intel_allocator_alloc(p_ahnd, 1, 123, 0);
+	if (type == INTEL_ALLOCATOR_SIMPLE)
+		igt_assert(intel_allocator_is_allocated(p_ahnd, 1, 123, offset));
+
+	igt_fork(child, 1) {
+
+		sh_ahnd = intel_allocator_open(fd, 0, type);
+		if (type == INTEL_ALLOCATOR_SIMPLE)
+			igt_assert(intel_allocator_is_allocated(sh_ahnd, 1, 123, offset));
+
+		ctx_ahnd = intel_allocator_open(fd, 1, type);
+		igt_assert(!intel_allocator_is_allocated(ctx_ahnd, 1, 123, offset));
+		intel_allocator_alloc(ctx_ahnd, 2, 123, 0);
+
+		fd = gem_reopen_driver(fd);
+		fd_ahnd = intel_allocator_open(fd, 0, type);
+		igt_assert(!intel_allocator_is_allocated(fd_ahnd, 1, 123, offset));
+		intel_allocator_alloc(fd_ahnd, 2, 123, 0);
+
+
+		intel_allocator_get_address_range(sh_ahnd, &sh_left, &sh_right);
+		intel_allocator_get_address_range(fd_ahnd, &fd_left, &fd_right);
+		igt_assert(sh_left == fd_left && sh_right == fd_right);
+
+		intel_allocator_close(sh_ahnd);
+		intel_allocator_close(ctx_ahnd);
+		intel_allocator_close(fd_ahnd);
+
+	}
+
+	igt_waitchildren();
+	intel_allocator_close(p_ahnd);
+
+	intel_allocator_multiprocess_stop();
+}
+
 struct allocators {
 	const char *name;
 	uint8_t type;
@@ -672,6 +716,9 @@ igt_main
 				igt_dynamic("reserve")
 					reserve(fd, a->type);
 			}
+
+			igt_dynamic("multiprocess")
+					multiprocess(fd, a->type);
 		}
 	}
 
-- 
2.25.1

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

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

* [igt-dev] [PATCH v4 i-g-t 0/3] Fix the multiprocess mode of intel allocator
@ 2021-06-09 13:15 Andrzej Turko
  0 siblings, 0 replies; 3+ messages in thread
From: Andrzej Turko @ 2021-06-09 13:15 UTC (permalink / raw)
  To: igt-dev

In the multiprocess mode all requests to the allocator are
processed in the parent. However, in certain scenarios
(for example gem_exec_capture@pi), a child process may want
to create an allocator instance using its own private file
desriptor.  Thus all ioctls used to determine available gtt size
must be called in the child process and not in the parent.

This patch implements the above change.

v2: Test allocators for private and shared contexts in
    multiprocess mode.

v3: Prepare all allocator implementations for supporting
    region-based memory management.

Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>


Andrzej Turko (3):
  tests/i915/api_intel_allocator: Exercise allocator in multiprocess
    mode
  lib/intel_allocator: Move the ioctl calls to client processes
  lib/intel_allocator: Add support for regions of allocation

 lib/intel_allocator.c            | 54 +++++++++++++++++++++++---------
 lib/intel_allocator_random.c     | 44 +++++++++++++-------------
 lib/intel_allocator_reloc.c      | 35 +++++++++------------
 lib/intel_allocator_simple.c     | 45 +++-----------------------
 tests/i915/api_intel_allocator.c | 47 +++++++++++++++++++++++++++
 5 files changed, 129 insertions(+), 96 deletions(-)

-- 
2.25.1

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

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

end of thread, other threads:[~2021-06-09 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 12:59 [igt-dev] [PATCH v4 i-g-t 0/3] Fix the multiprocess mode of intel allocator Andrzej Turko
2021-06-09 12:59 ` [igt-dev] [PATCH i-g-t 1/3] tests/i915/api_intel_allocator: Exercise allocator in multiprocess mode Andrzej Turko
2021-06-09 13:15 [igt-dev] [PATCH v4 i-g-t 0/3] Fix the multiprocess mode of intel allocator Andrzej Turko

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.