summaryrefslogtreecommitdiff
path: root/lib/intel_allocator_simple.c
diff options
context:
space:
mode:
authorAndrzej Turko <andrzej.turko@linux.intel.com>2021-06-17 09:16:43 +0200
committerZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2021-06-18 12:04:02 +0200
commit138a29e30277b1039e9934fca5c782dc1e7a9f99 (patch)
tree79e9b31715154f1cfb9bc5e1a2bbc8ec4d5af188 /lib/intel_allocator_simple.c
parent00060bc519a7ab3b0ee83ea6e4a7b9096aee2913 (diff)
lib/intel_allocator: Move ioctl calls to client processes
When allocator is running in multiprocess mode, all queries are processed in a designated thread in the parent process. However, a child process may request opening the allocator for a gpu using a file descriptor absent in the parent process. Hence, querying available gtt size must be done in the child instead of the parent process. As a consequence of this change creating allocators managing only a given interval of available gtt is now enabled for all allocator implementations. Additionally, this commit sets a universal lower bound on alignment to 4096. Signed-off-by: Andrzej Turko <andrzej.turko@linux.intel.com> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Diffstat (limited to 'lib/intel_allocator_simple.c')
-rw-r--r--lib/intel_allocator_simple.c45
1 files changed, 5 insertions, 40 deletions
diff --git a/lib/intel_allocator_simple.c b/lib/intel_allocator_simple.c
index 963d8d25..0e676396 100644
--- a/lib/intel_allocator_simple.c
+++ b/lib/intel_allocator_simple.c
@@ -11,17 +11,11 @@
#include "intel_bufops.h"
#include "igt_map.h"
-/*
- * We limit allocator space to avoid hang when batch would be
- * pinned in the last page.
- */
-#define RESERVED 4096
/* Avoid compilation warning */
-struct intel_allocator *intel_allocator_simple_create(int fd);
struct intel_allocator *
-intel_allocator_simple_create_full(int fd, uint64_t start, uint64_t end,
- enum allocator_strategy strategy);
+intel_allocator_simple_create(int fd, uint64_t start, uint64_t end,
+ enum allocator_strategy strategy);
struct simple_vma_heap {
struct igt_list_head holes;
@@ -425,7 +419,6 @@ static uint64_t intel_allocator_simple_alloc(struct intel_allocator *ial,
ials = (struct intel_allocator_simple *) ial->priv;
igt_assert(ials);
igt_assert(handle);
- alignment = alignment > 0 ? alignment : 1;
rec = igt_map_search(ials->objects, &handle);
if (rec) {
@@ -734,9 +727,9 @@ static void intel_allocator_simple_print(struct intel_allocator *ial, bool full)
ials->allocated_objects, ials->reserved_areas);
}
-static struct intel_allocator *
-__intel_allocator_simple_create(int fd, uint64_t start, uint64_t end,
- enum allocator_strategy strategy)
+struct intel_allocator *
+intel_allocator_simple_create(int fd, uint64_t start, uint64_t end,
+ enum allocator_strategy strategy)
{
struct intel_allocator *ial;
struct intel_allocator_simple *ials;
@@ -777,31 +770,3 @@ __intel_allocator_simple_create(int fd, uint64_t start, uint64_t end,
return ial;
}
-
-struct intel_allocator *
-intel_allocator_simple_create(int fd)
-{
- uint64_t gtt_size = gem_aperture_size(fd);
-
- if (!gem_uses_full_ppgtt(fd))
- gtt_size /= 2;
- else
- gtt_size -= RESERVED;
-
- return __intel_allocator_simple_create(fd, 0, gtt_size,
- ALLOC_STRATEGY_HIGH_TO_LOW);
-}
-
-struct intel_allocator *
-intel_allocator_simple_create_full(int fd, uint64_t start, uint64_t end,
- enum allocator_strategy strategy)
-{
- uint64_t gtt_size = gem_aperture_size(fd);
-
- igt_assert(end <= gtt_size);
- if (!gem_uses_full_ppgtt(fd))
- gtt_size /= 2;
- igt_assert(end - start <= gtt_size);
-
- return __intel_allocator_simple_create(fd, start, end, strategy);
-}