* [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar
@ 2023-07-21 15:15 Matthew Auld
2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 1/5] lib/xe: add visible vram helpers Matthew Auld
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Matthew Auld @ 2023-07-21 15:15 UTC (permalink / raw)
To: igt-dev
small-bar IGT changes for Xe.
v2: Rebase on latest IGT, plus various improvements
v3: Rebase + some small fixes
v4: A few more missing annotations
Kernel: https://patchwork.freedesktop.org/series/115515/
--
2.41.0
^ permalink raw reply [flat|nested] 11+ messages in thread* [igt-dev] [PATCH i-g-t v4 1/5] lib/xe: add visible vram helpers 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld @ 2023-07-21 15:15 ` Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 2/5] lib/xe: handle small-bar systems Matthew Auld ` (7 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Matthew Auld @ 2023-07-21 15:15 UTC (permalink / raw) To: igt-dev Add helpers for object creation and querying the cpu_visible related bits. Keep it backwards compat to ensure IGT can be merged in any order. At some later point we can remove the compat layer. v2: Make it backwards compat with older kernels v3 (José): Add TODO for removing backwards compat layer Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> --- lib/xe/xe_query.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++- lib/xe/xe_query.h | 6 +++ 2 files changed, 103 insertions(+), 1 deletion(-) diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c index f535ad853..8963c7b06 100644 --- a/lib/xe/xe_query.c +++ b/lib/xe/xe_query.c @@ -140,6 +140,17 @@ static uint64_t gt_vram_size(const struct drm_xe_query_mem_usage *mem_usage, return 0; } +static uint64_t gt_visible_vram_size(const struct drm_xe_query_mem_usage *mem_usage, + const struct drm_xe_query_gts *gts, int gt) +{ + int region_idx = ffs(native_region_for_gt(gts, gt)) - 1; + + if (XE_IS_CLASS_VRAM(&mem_usage->regions[region_idx])) + return mem_usage->regions[region_idx].cpu_visible_size; + + return 0; +} + static bool __mem_has_vram(struct drm_xe_query_mem_usage *mem_usage) { for (int i = 0; i < mem_usage->num_regions; i++) @@ -246,9 +257,14 @@ struct xe_device *xe_device_get(int fd) xe_dev->hw_engines = xe_query_engines_new(fd, &xe_dev->number_hw_engines); xe_dev->mem_usage = xe_query_mem_usage_new(fd); xe_dev->vram_size = calloc(xe_dev->number_gt, sizeof(*xe_dev->vram_size)); - for (int gt = 0; gt < xe_dev->number_gt; gt++) + xe_dev->visible_vram_size = calloc(xe_dev->number_gt, sizeof(*xe_dev->visible_vram_size)); + for (int gt = 0; gt < xe_dev->number_gt; gt++) { xe_dev->vram_size[gt] = gt_vram_size(xe_dev->mem_usage, xe_dev->gts, gt); + xe_dev->visible_vram_size[gt] = + gt_visible_vram_size(xe_dev->mem_usage, + xe_dev->gts, gt); + } xe_dev->default_alignment = __mem_default_alignment(xe_dev->mem_usage); xe_dev->has_vram = __mem_has_vram(xe_dev->mem_usage); @@ -383,6 +399,37 @@ uint64_t vram_memory(int fd, int gt) return xe_has_vram(fd) ? native_region_for_gt(xe_dev->gts, gt) : 0; } +static uint64_t __xe_visible_vram_size(int fd, int gt) +{ + struct xe_device *xe_dev; + + xe_dev = find_in_cache(fd); + igt_assert(xe_dev); + + return xe_dev->visible_vram_size[gt]; +} + +/** + * visible_vram_memory: + * @fd: xe device fd + * @gt: gt id + * + * Returns vram memory bitmask for xe device @fd and @gt id, with + * XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM also set, to ensure that CPU access is + * possible. + */ +uint64_t visible_vram_memory(int fd, int gt) +{ + /* + * TODO: Keep it backwards compat for now. Fixup once the kernel side + * has landed. + */ + if (__xe_visible_vram_size(fd, gt)) + return vram_memory(fd, gt) | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM; + else + return vram_memory(fd, gt); /* older kernel */ +} + /** * vram_if_possible: * @fd: xe device fd @@ -396,6 +443,32 @@ uint64_t vram_if_possible(int fd, int gt) return vram_memory(fd, gt) ?: system_memory(fd); } +/** + * visible_vram_if_possible: + * @fd: xe device fd + * @gt: gt id + * + * Returns vram memory bitmask for xe device @fd and @gt id or system memory if + * there's no vram memory available for @gt. Also attaches the + * XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM to ensure that CPU access is possible + * when using vram. + */ +uint64_t visible_vram_if_possible(int fd, int gt) +{ + uint64_t regions = all_memory_regions(fd); + uint64_t system_memory = regions & 0x1; + uint64_t vram = regions & (0x2 << gt); + + /* + * TODO: Keep it backwards compat for now. Fixup once the kernel side + * has landed. + */ + if (__xe_visible_vram_size(fd, gt)) + return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; + else + return vram ? vram : system_memory; /* older kernel */ +} + /** * xe_hw_engines: * @fd: xe device fd @@ -536,6 +609,28 @@ uint64_t xe_vram_size(int fd, int gt) return xe_dev->vram_size[gt]; } +/** + * xe_visible_vram_size: + * @fd: xe device fd + * @gt: gt + * + * Returns size of visible vram of xe device @fd. + */ +uint64_t xe_visible_vram_size(int fd, int gt) +{ + uint64_t visible_size; + + /* + * TODO: Keep it backwards compat for now. Fixup once the kernel side + * has landed. + */ + visible_size = __xe_visible_vram_size(fd, gt); + if (!visible_size) /* older kernel */ + visible_size = xe_vram_size(fd, gt); + + return visible_size; +} + /** * xe_get_default_alignment: * @fd: xe device fd @@ -552,6 +647,7 @@ xe_dev_FN(xe_get_default_alignment, default_alignment, uint32_t); */ xe_dev_FN(xe_va_bits, va_bits, uint32_t); + /** * xe_dev_id: * @fd: xe device fd diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h index 68ca5a680..1b74c58ab 100644 --- a/lib/xe/xe_query.h +++ b/lib/xe/xe_query.h @@ -47,6 +47,9 @@ struct xe_device { /** @vram_size: array of vram sizes for all gts */ uint64_t *vram_size; + /** @visible_vram_size: array of visible vram sizes for all gts */ + uint64_t *visible_vram_size; + /** @default_alignment: safe alignment regardless region location */ uint32_t default_alignment; @@ -80,7 +83,9 @@ unsigned int xe_number_gt(int fd); uint64_t all_memory_regions(int fd); uint64_t system_memory(int fd); uint64_t vram_memory(int fd, int gt); +uint64_t visible_vram_memory(int fd, int gt); uint64_t vram_if_possible(int fd, int gt); +uint64_t visible_vram_if_possible(int fd, int gt); struct drm_xe_engine_class_instance *xe_hw_engines(int fd); struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx); struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region); @@ -91,6 +96,7 @@ struct drm_xe_query_config *xe_config(int fd); unsigned int xe_number_hw_engines(int fd); bool xe_has_vram(int fd); uint64_t xe_vram_size(int fd, int gt); +uint64_t xe_visible_vram_size(int fd, int gt); uint32_t xe_get_default_alignment(int fd); uint32_t xe_va_bits(int fd); uint16_t xe_dev_id(int fd); -- 2.41.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v4 2/5] lib/xe: handle small-bar systems 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 1/5] lib/xe: add visible vram helpers Matthew Auld @ 2023-07-21 15:15 ` Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 3/5] tests/xe: " Matthew Auld ` (6 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Matthew Auld @ 2023-07-21 15:15 UTC (permalink / raw) To: igt-dev The spinner stuff wants to use mmap. The fb related stuff might want to CPU access the buffer, so just always ask for it. And the batch buffer stuff is pretty much always going to need to CPU access the buffer. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> --- lib/igt_draw.c | 2 +- lib/igt_fb.c | 2 +- lib/intel_batchbuffer.c | 4 ++-- lib/xe/xe_spin.c | 6 ++++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/igt_draw.c b/lib/igt_draw.c index 1f814bfc8..13b90702c 100644 --- a/lib/igt_draw.c +++ b/lib/igt_draw.c @@ -794,7 +794,7 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data, else tmp.handle = xe_bo_create_flags(fd, 0, ALIGN(tmp.size, xe_get_default_alignment(fd)), - vram_if_possible(fd, 0)); + visible_vram_if_possible(fd, 0)); tmp.stride = rect->w * pixel_size; tmp.bpp = buf->bpp; diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 1814e8db1..17738d7f1 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1194,7 +1194,7 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem) igt_assert(err == 0 || err == -EOPNOTSUPP); } else if (is_xe_device(fd)) { fb->gem_handle = xe_bo_create_flags(fd, 0, fb->size, - vram_if_possible(fd, 0)); + visible_vram_if_possible(fd, 0)); } else if (is_vc4_device(fd)) { fb->gem_handle = igt_vc4_create_bo(fd, fb->size); diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index 0408d62ba..163d39d6b 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -943,7 +943,7 @@ __intel_bb_create(int fd, uint32_t ctx, uint32_t vm, const intel_ctx_cfg_t *cfg, ibb->alignment = xe_get_default_alignment(fd); size = ALIGN(size, ibb->alignment); - ibb->handle = xe_bo_create_flags(fd, 0, size, vram_if_possible(fd, 0)); + ibb->handle = xe_bo_create_flags(fd, 0, size, visible_vram_if_possible(fd, 0)); /* Limit to 48-bit due to MI_* address limitation */ ibb->gtt_size = 1ull << min_t(uint32_t, xe_va_bits(fd), 48); @@ -1399,7 +1399,7 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) ibb->handle = gem_create(ibb->fd, ibb->size); else ibb->handle = xe_bo_create_flags(ibb->fd, 0, ibb->size, - vram_if_possible(ibb->fd, 0)); + visible_vram_if_possible(ibb->fd, 0)); /* Reacquire offset for RELOC and SIMPLE */ if (ibb->allocator_type == INTEL_ALLOCATOR_SIMPLE || diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c index 529b76844..e799fcfc5 100644 --- a/lib/xe/xe_spin.c +++ b/lib/xe/xe_spin.c @@ -126,7 +126,8 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt) spin->engine = xe_engine_create_class(fd, spin->vm, DRM_XE_ENGINE_CLASS_COPY); } - spin->handle = xe_bo_create(fd, 0, spin->vm, bo_size); + spin->handle = xe_bo_create_flags(fd, spin->vm, bo_size, + visible_vram_if_possible(fd, 0)); xe_spin = xe_bo_map(fd, spin->handle, bo_size); addr = intel_allocator_alloc_with_strategy(ahnd, spin->handle, bo_size, 0, ALLOC_STRATEGY_LOW_TO_HIGH); xe_vm_bind_sync(fd, spin->vm, spin->handle, 0, addr, bo_size); @@ -201,7 +202,8 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *hwe, vm = xe_vm_create(fd, 0, 0); - bo = xe_bo_create(fd, hwe->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, hwe->gt_id)); spin = xe_bo_map(fd, bo, 0x1000); xe_vm_bind_sync(fd, vm, bo, 0, addr, bo_size); -- 2.41.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v4 3/5] tests/xe: handle small-bar systems 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 1/5] lib/xe: add visible vram helpers Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 2/5] lib/xe: handle small-bar systems Matthew Auld @ 2023-07-21 15:15 ` Matthew Auld 2023-07-21 19:10 ` Souza, Jose 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 4/5] tests/xe/query: extend for CPU visible accounting Matthew Auld ` (5 subsequent siblings) 8 siblings, 1 reply; 11+ messages in thread From: Matthew Auld @ 2023-07-21 15:15 UTC (permalink / raw) To: igt-dev Convert all the existing tests that require CPU access. v2: - Split out the lib changes - Prefer SZ_256M and SZ_1G in xe_evict - Simplify and fix the bo_flags handling in test_exec v3: - Small fix in xe_evict conversion (missing system_memory(fd)) v4 (José): - Add a few more missing annotations. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> --- tests/xe/xe_dma_buf_sync.c | 3 ++- tests/xe/xe_evict.c | 34 +++++++++++++++++++++------------ tests/xe/xe_exec_balancer.c | 6 +++--- tests/xe/xe_exec_basic.c | 17 ++++++++--------- tests/xe/xe_exec_compute_mode.c | 4 ++-- tests/xe/xe_exec_fault_mode.c | 12 ++++++++---- tests/xe/xe_exec_reset.c | 13 ++++++++----- tests/xe/xe_exec_store.c | 6 ++++-- tests/xe/xe_exec_threads.c | 9 ++++++--- tests/xe/xe_guc_pc.c | 3 ++- tests/xe/xe_mmap.c | 13 ++++++++----- tests/xe/xe_pm.c | 3 ++- tests/xe/xe_prime_self_import.c | 23 +++++++++++++--------- tests/xe/xe_vm.c | 23 +++++++++++++++------- 14 files changed, 105 insertions(+), 64 deletions(-) diff --git a/tests/xe/xe_dma_buf_sync.c b/tests/xe/xe_dma_buf_sync.c index c08f8ac18..4e76d85ab 100644 --- a/tests/xe/xe_dma_buf_sync.c +++ b/tests/xe/xe_dma_buf_sync.c @@ -120,7 +120,8 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0, bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd[0]), xe_get_default_alignment(fd[0])); for (i = 0; i < n_bo; ++i) { - bo[i] = xe_bo_create(fd[0], hwe0->gt_id, 0, bo_size); + bo[i] = xe_bo_create_flags(fd[0], 0, bo_size, + visible_vram_if_possible(fd[0], hwe0->gt_id)); dma_buf_fd[i] = prime_handle_to_fd(fd[0], bo[i]); import_bo[i] = prime_fd_to_handle(fd[1], dma_buf_fd[i]); diff --git a/tests/xe/xe_evict.c b/tests/xe/xe_evict.c index 1a70f1b45..c44cb80dc 100644 --- a/tests/xe/xe_evict.c +++ b/tests/xe/xe_evict.c @@ -97,15 +97,17 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci, i < n_execs / 8 ? 0 : vm; if (flags & MULTI_VM) { - __bo = bo[i] = xe_bo_create(fd, eci->gt_id, 0, - bo_size); + __bo = bo[i] = xe_bo_create_flags(fd, 0, + bo_size, + visible_vram_memory(fd, eci->gt_id)); } else if (flags & THREADED) { - __bo = bo[i] = xe_bo_create(fd, eci->gt_id, vm, - bo_size); + __bo = bo[i] = xe_bo_create_flags(fd, vm, + bo_size, + visible_vram_memory(fd, eci->gt_id)); } else { __bo = bo[i] = xe_bo_create_flags(fd, _vm, bo_size, - vram_memory(fd, eci->gt_id) | + visible_vram_memory(fd, eci->gt_id) | system_memory(fd)); } } else { @@ -278,15 +280,17 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci, i < n_execs / 8 ? 0 : vm; if (flags & MULTI_VM) { - __bo = bo[i] = xe_bo_create(fd, eci->gt_id, - 0, bo_size); + __bo = bo[i] = xe_bo_create_flags(fd, 0, + bo_size, + visible_vram_memory(fd, eci->gt_id)); } else if (flags & THREADED) { - __bo = bo[i] = xe_bo_create(fd, eci->gt_id, - vm, bo_size); + __bo = bo[i] = xe_bo_create_flags(fd, vm, + bo_size, + visible_vram_memory(fd, eci->gt_id)); } else { __bo = bo[i] = xe_bo_create_flags(fd, _vm, bo_size, - vram_memory(fd, eci->gt_id) | + visible_vram_memory(fd, eci->gt_id) | system_memory(fd)); } } else { @@ -449,9 +453,15 @@ threads(int fd, struct drm_xe_engine_class_instance *eci, pthread_join(threads_data[i].thread, NULL); } +#define SZ_256M 0x10000000 +#define SZ_1G 0x40000000 + static uint64_t calc_bo_size(uint64_t vram_size, int mul, int div) { - return (ALIGN(vram_size, 0x40000000) * mul) / div; + if (vram_size >= SZ_1G) + return (ALIGN(vram_size, SZ_1G) * mul) / div; + else + return (ALIGN(vram_size, SZ_256M) * mul) / div; /* small-bar */ } /** @@ -664,7 +674,7 @@ igt_main igt_fixture { fd = drm_open_driver(DRIVER_XE); igt_require(xe_has_vram(fd)); - vram_size = xe_vram_size(fd, 0); + vram_size = xe_visible_vram_size(fd, 0); igt_assert(vram_size); xe_for_each_hw_engine(fd, hwe) diff --git a/tests/xe/xe_exec_balancer.c b/tests/xe/xe_exec_balancer.c index 8df6ceba8..0b00d93de 100644 --- a/tests/xe/xe_exec_balancer.c +++ b/tests/xe/xe_exec_balancer.c @@ -69,7 +69,7 @@ static void test_all_active(int fd, int gt, int class) bo_size = sizeof(*data) * num_placements; bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, gt, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt)); data = xe_bo_map(fd, bo, bo_size); for (i = 0; i < num_placements; i++) { @@ -225,7 +225,7 @@ test_exec(int fd, int gt, int class, int n_engines, int n_execs, } memset(data, 0, bo_size); } else { - bo = xe_bo_create(fd, gt, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt)); data = xe_bo_map(fd, bo, bo_size); } @@ -447,7 +447,7 @@ test_cm(int fd, int gt, int class, int n_engines, int n_execs, igt_assert(data); } } else { - bo = xe_bo_create(fd, gt, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt)); data = xe_bo_map(fd, bo, bo_size); } memset(data, 0, bo_size); diff --git a/tests/xe/xe_exec_basic.c b/tests/xe/xe_exec_basic.c index af581c327..a4bae93f0 100644 --- a/tests/xe/xe_exec_basic.c +++ b/tests/xe/xe_exec_basic.c @@ -126,15 +126,14 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, } memset(data, 0, bo_size); } else { - if (flags & DEFER_ALLOC) { - bo = xe_bo_create_flags(fd, n_vm == 1 ? vm[0] : 0, - bo_size, - vram_if_possible(fd, eci->gt_id) | - XE_GEM_CREATE_FLAG_DEFER_BACKING); - } else { - bo = xe_bo_create(fd, eci->gt_id, n_vm == 1 ? vm[0] : 0, - bo_size); - } + uint32_t bo_flags; + + bo_flags = visible_vram_if_possible(fd, eci->gt_id); + if (flags & DEFER_ALLOC) + bo_flags |= XE_GEM_CREATE_FLAG_DEFER_BACKING; + + bo = xe_bo_create_flags(fd, n_vm == 1 ? vm[0] : 0, + bo_size, bo_flags); if (!(flags & DEFER_BIND)) data = xe_bo_map(fd, bo, bo_size); } diff --git a/tests/xe/xe_exec_compute_mode.c b/tests/xe/xe_exec_compute_mode.c index 27b538414..ee9756c21 100644 --- a/tests/xe/xe_exec_compute_mode.c +++ b/tests/xe/xe_exec_compute_mode.c @@ -150,8 +150,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, igt_assert(data); } } else { - bo = xe_bo_create(fd, eci->gt_id, flags & VM_FOR_BO ? vm : 0, - bo_size); + bo = xe_bo_create_flags(fd, flags & VM_FOR_BO ? vm : 0, + bo_size, visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); } memset(data, 0, bo_size); diff --git a/tests/xe/xe_exec_fault_mode.c b/tests/xe/xe_exec_fault_mode.c index bf7230c5a..7dcbb3c45 100644 --- a/tests/xe/xe_exec_fault_mode.c +++ b/tests/xe/xe_exec_fault_mode.c @@ -153,9 +153,11 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, } else { if (flags & PREFETCH) bo = xe_bo_create_flags(fd, 0, bo_size, - all_memory_regions(fd)); + all_memory_regions(fd) | + visible_vram_if_possible(fd, 0)); else - bo = xe_bo_create(fd, eci->gt_id, 0, bo_size); + bo = xe_bo_create_flags(fd, 0, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); } memset(data, 0, bo_size); @@ -382,8 +384,10 @@ test_atomic(int fd, struct drm_xe_engine_class_instance *eci, addr_wait = addr + bo_size; bo = xe_bo_create_flags(fd, vm, bo_size, - all_memory_regions(fd)); - bo_wait = xe_bo_create(fd, eci->gt_id, vm, bo_size); + all_memory_regions(fd) | + visible_vram_if_possible(fd, 0)); + bo_wait = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); wait = xe_bo_map(fd, bo_wait, bo_size); ptr = &data[0].data; diff --git a/tests/xe/xe_exec_reset.c b/tests/xe/xe_exec_reset.c index 6ca1cd769..dfbaa6035 100644 --- a/tests/xe/xe_exec_reset.c +++ b/tests/xe/xe_exec_reset.c @@ -50,7 +50,8 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci) bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); spin = xe_bo_map(fd, bo, bo_size); engine = xe_engine_create(fd, vm, eci, 0); @@ -187,7 +188,7 @@ test_balancer(int fd, int gt, int class, int n_engines, int n_execs, bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, gt, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt)); data = xe_bo_map(fd, bo, bo_size); for (i = 0; i < n_engines; i++) { @@ -379,7 +380,8 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci, bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); for (i = 0; i < n_engines; i++) { @@ -550,7 +552,8 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci, bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); memset(data, 0, bo_size); @@ -682,7 +685,7 @@ static void submit_jobs(struct gt_thread_data *t) uint32_t bo; uint32_t *data; - bo = xe_bo_create(fd, 0, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, 0)); data = xe_bo_map(fd, bo, bo_size); data[0] = MI_BATCH_BUFFER_END; diff --git a/tests/xe/xe_exec_store.c b/tests/xe/xe_exec_store.c index 9640b1567..ab1bde36e 100644 --- a/tests/xe/xe_exec_store.c +++ b/tests/xe/xe_exec_store.c @@ -82,7 +82,8 @@ static void store(int fd) xe_get_default_alignment(fd)); hw_engine = xe_hw_engine(fd, 1); - bo = xe_bo_create(fd, hw_engine->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, hw_engine->gt_id)); xe_vm_bind_async(fd, vm, hw_engine->gt_id, bo, 0, addr, bo_size, &sync, 1); data = xe_bo_map(fd, bo, bo_size); @@ -138,7 +139,8 @@ static void store_all(int fd, int gt, int class) bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, 0, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, 0)); data = xe_bo_map(fd, bo, bo_size); xe_for_each_hw_engine(fd, hwe) { diff --git a/tests/xe/xe_exec_threads.c b/tests/xe/xe_exec_threads.c index 414d8ee9a..396398984 100644 --- a/tests/xe/xe_exec_threads.c +++ b/tests/xe/xe_exec_threads.c @@ -106,7 +106,8 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr, igt_assert(data); } } else { - bo = xe_bo_create(fd, gt, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, gt)); data = xe_bo_map(fd, bo, bo_size); } memset(data, 0, bo_size); @@ -306,7 +307,8 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, igt_assert(data); } } else { - bo = xe_bo_create(fd, eci->gt_id, 0, bo_size); + bo = xe_bo_create_flags(fd, 0, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); } memset(data, 0, bo_size); @@ -516,7 +518,8 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, igt_assert(data); } } else { - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); } memset(data, 0, bo_size); diff --git a/tests/xe/xe_guc_pc.c b/tests/xe/xe_guc_pc.c index cb52a7520..8cdd8ba74 100644 --- a/tests/xe/xe_guc_pc.c +++ b/tests/xe/xe_guc_pc.c @@ -65,7 +65,8 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci, bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); for (i = 0; i < n_engines; i++) { diff --git a/tests/xe/xe_mmap.c b/tests/xe/xe_mmap.c index 798facca9..b268158ab 100644 --- a/tests/xe/xe_mmap.c +++ b/tests/xe/xe_mmap.c @@ -63,7 +63,8 @@ static void test_bad_flags(int fd) { uint64_t size = xe_get_default_alignment(fd); struct drm_xe_gem_mmap_offset mmo = { - .handle = xe_bo_create(fd, 0, 0, size), + .handle = xe_bo_create_flags(fd, 0, size, + visible_vram_if_possible(fd, 0)), .flags = -1u, }; @@ -81,7 +82,8 @@ static void test_bad_extensions(int fd) uint64_t size = xe_get_default_alignment(fd); struct xe_user_extension ext; struct drm_xe_gem_mmap_offset mmo = { - .handle = xe_bo_create(fd, 0, 0, size), + .handle = xe_bo_create_flags(fd, 0, size, + visible_vram_if_possible(fd, 0)), }; mmo.extensions = to_user_pointer(&ext); @@ -100,7 +102,8 @@ static void test_bad_object(int fd) { uint64_t size = xe_get_default_alignment(fd); struct drm_xe_gem_mmap_offset mmo = { - .handle = xe_bo_create(fd, 0, 0, size), + .handle = xe_bo_create_flags(fd, 0, size, + visible_vram_if_possible(fd, 0)), }; mmo.handle = 0xdeadbeef; @@ -118,10 +121,10 @@ igt_main test_mmap(fd, system_memory(fd)); igt_subtest("vram") - test_mmap(fd, vram_memory(fd, 0)); + test_mmap(fd, visible_vram_memory(fd, 0)); igt_subtest("vram-system") - test_mmap(fd, vram_memory(fd, 0) | system_memory(fd)); + test_mmap(fd, visible_vram_memory(fd, 0) | system_memory(fd)); igt_subtest("bad-flags") test_bad_flags(fd); diff --git a/tests/xe/xe_pm.c b/tests/xe/xe_pm.c index a7f73c4e6..559eccdeb 100644 --- a/tests/xe/xe_pm.c +++ b/tests/xe/xe_pm.c @@ -254,7 +254,8 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci, if (check_rpm && runtime_usage_available(device.pci_xe)) rpm_usage = igt_pm_get_runtime_usage(device.pci_xe); - bo = xe_bo_create(device.fd_xe, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(device.fd_xe, vm, bo_size, + visible_vram_if_possible(device.fd_xe, eci->gt_id)); data = xe_bo_map(device.fd_xe, bo, bo_size); for (i = 0; i < n_engines; i++) { diff --git a/tests/xe/xe_prime_self_import.c b/tests/xe/xe_prime_self_import.c index 0fd79f704..bfa0d5e34 100644 --- a/tests/xe/xe_prime_self_import.c +++ b/tests/xe/xe_prime_self_import.c @@ -107,7 +107,7 @@ static void test_with_fd_dup(void) fd1 = drm_open_driver(DRIVER_XE); fd2 = drm_open_driver(DRIVER_XE); - handle = xe_bo_create(fd1, 0, 0, BO_SIZE); + handle = xe_bo_create_flags(fd1, 0, BO_SIZE, visible_vram_if_possible(fd1, 0)); dma_buf_fd1 = prime_handle_to_fd(fd1, handle); gem_close(fd1, handle); @@ -141,8 +141,8 @@ static void test_with_two_bos(void) fd1 = drm_open_driver(DRIVER_XE); fd2 = drm_open_driver(DRIVER_XE); - handle1 = xe_bo_create(fd1, 0, 0, BO_SIZE); - handle2 = xe_bo_create(fd1, 0, 0, BO_SIZE); + handle1 = xe_bo_create_flags(fd1, 0, BO_SIZE, visible_vram_if_possible(fd1, 0)); + handle2 = xe_bo_create_flags(fd1, 0, BO_SIZE, visible_vram_if_possible(fd1, 0)); dma_buf_fd = prime_handle_to_fd(fd1, handle1); handle_import = prime_fd_to_handle(fd2, dma_buf_fd); @@ -178,7 +178,8 @@ static void test_with_one_bo_two_files(void) fd1 = drm_open_driver(DRIVER_XE); fd2 = drm_open_driver(DRIVER_XE); - handle_orig = xe_bo_create(fd1, 0, 0, BO_SIZE); + handle_orig = xe_bo_create_flags(fd1, 0, BO_SIZE, + visible_vram_if_possible(fd1, 0)); dma_buf_fd1 = prime_handle_to_fd(fd1, handle_orig); flink_name = gem_flink(fd1, handle_orig); @@ -211,7 +212,7 @@ static void test_with_one_bo(void) fd1 = drm_open_driver(DRIVER_XE); fd2 = drm_open_driver(DRIVER_XE); - handle = xe_bo_create(fd1, 0, 0, BO_SIZE); + handle = xe_bo_create_flags(fd1, 0, BO_SIZE, visible_vram_if_possible(fd1, 0)); dma_buf_fd = prime_handle_to_fd(fd1, handle); handle_import1 = prime_fd_to_handle(fd2, dma_buf_fd); @@ -298,7 +299,8 @@ static void *thread_fn_reimport_vs_close(void *p) fds[0] = drm_open_driver(DRIVER_XE); - handle = xe_bo_create(fds[0], 0, 0, BO_SIZE); + handle = xe_bo_create_flags(fds[0], 0, BO_SIZE, + visible_vram_if_possible(fds[0], 0)); fds[1] = prime_handle_to_fd(fds[0], handle); pthread_barrier_init(&g_barrier, NULL, num_threads); @@ -340,7 +342,8 @@ static void *thread_fn_export_vs_close(void *p) igt_until_timeout(g_time_out) { /* We want to race gem close against prime export on handle one.*/ - handle = xe_bo_create(fd, 0, 0, 4096); + handle = xe_bo_create_flags(fd, 0, 4096, + visible_vram_if_possible(fd, 0)); if (handle != 1) gem_close(fd, handle); @@ -438,7 +441,8 @@ static void test_llseek_size(void) for (i = 0; i < 10; i++) { int bufsz = xe_get_default_alignment(fd) << i; - handle = xe_bo_create(fd, 0, 0, bufsz); + handle = xe_bo_create_flags(fd, 0, bufsz, + visible_vram_if_possible(fd, 0)); dma_buf_fd = prime_handle_to_fd(fd, handle); gem_close(fd, handle); @@ -467,7 +471,8 @@ static void test_llseek_bad(void) fd = drm_open_driver(DRIVER_XE); - handle = xe_bo_create(fd, 0, 0, BO_SIZE); + handle = xe_bo_create_flags(fd, 0, BO_SIZE, + visible_vram_if_possible(fd, 0)); dma_buf_fd = prime_handle_to_fd(fd, handle); gem_close(fd, handle); diff --git a/tests/xe/xe_vm.c b/tests/xe/xe_vm.c index 04d6c3956..982c50f6d 100644 --- a/tests/xe/xe_vm.c +++ b/tests/xe/xe_vm.c @@ -52,7 +52,8 @@ write_dwords(int fd, uint32_t vm, int n_dwords, uint64_t *addrs) batch_size = (n_dwords * 4 + 1) * sizeof(uint32_t); batch_size = ALIGN(batch_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - batch_bo = xe_bo_create(fd, 0, vm, batch_size); + batch_bo = xe_bo_create_flags(fd, vm, batch_size, + visible_vram_if_possible(fd, 0)); batch_map = xe_bo_map(fd, batch_bo, batch_size); for (i = 0; i < n_dwords; i++) { @@ -116,7 +117,7 @@ __test_bind_one_bo(int fd, uint32_t vm, int n_addrs, uint64_t *addrs) vms = malloc(sizeof(*vms) * n_addrs); igt_assert(vms); } - bo = xe_bo_create(fd, 0, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, 0)); map = xe_bo_map(fd, bo, bo_size); memset(map, 0, bo_size); @@ -554,7 +555,8 @@ shared_pte_page(int fd, struct drm_xe_engine_class_instance *eci, int n_bo, xe_get_default_alignment(fd)); for (i = 0; i < n_bo; ++i) { - bo[i] = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo[i] = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data[i] = xe_bo_map(fd, bo[i], bo_size); } @@ -723,7 +725,8 @@ test_bind_engines_independent(int fd, struct drm_xe_engine_class_instance *eci) bo_size = sizeof(*data) * N_ENGINES; bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); for (i = 0; i < N_ENGINES; i++) { @@ -880,7 +883,8 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs, bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); data = xe_bo_map(fd, bo, bo_size); if (flags & BIND_ARRAY_BIND_ENGINE_FLAG) @@ -1072,7 +1076,11 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci, map = aligned_alloc(xe_get_default_alignment(fd), bo_size); igt_assert(map); } else { - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + igt_skip_on(xe_visible_vram_size(fd, 0) && bo_size > + xe_visible_vram_size(fd, 0)); + + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); map = xe_bo_map(fd, bo, bo_size); } @@ -1350,7 +1358,8 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci, MAP_ANONYMOUS, -1, 0); igt_assert(map != MAP_FAILED); } else { - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); + bo = xe_bo_create_flags(fd, vm, bo_size, + visible_vram_if_possible(fd, eci->gt_id)); map = xe_bo_map(fd, bo, bo_size); } memset(map, 0, bo_size); -- 2.41.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v4 3/5] tests/xe: handle small-bar systems 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 3/5] tests/xe: " Matthew Auld @ 2023-07-21 19:10 ` Souza, Jose 0 siblings, 0 replies; 11+ messages in thread From: Souza, Jose @ 2023-07-21 19:10 UTC (permalink / raw) To: igt-dev@lists.freedesktop.org, Auld, Matthew On Fri, 2023-07-21 at 16:15 +0100, Matthew Auld wrote: > Convert all the existing tests that require CPU access. > > v2: > - Split out the lib changes > - Prefer SZ_256M and SZ_1G in xe_evict > - Simplify and fix the bo_flags handling in test_exec > v3: > - Small fix in xe_evict conversion (missing system_memory(fd)) > v4 (José): > - Add a few more missing annotations. > Reviewed-by: José Roberto de Souza <jose.souza@intel.com> > Signed-off-by: Matthew Auld <matthew.auld@intel.com> > Cc: José Roberto de Souza <jose.souza@intel.com> > Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com> > Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> > --- > tests/xe/xe_dma_buf_sync.c | 3 ++- > tests/xe/xe_evict.c | 34 +++++++++++++++++++++------------ > tests/xe/xe_exec_balancer.c | 6 +++--- > tests/xe/xe_exec_basic.c | 17 ++++++++--------- > tests/xe/xe_exec_compute_mode.c | 4 ++-- > tests/xe/xe_exec_fault_mode.c | 12 ++++++++---- > tests/xe/xe_exec_reset.c | 13 ++++++++----- > tests/xe/xe_exec_store.c | 6 ++++-- > tests/xe/xe_exec_threads.c | 9 ++++++--- > tests/xe/xe_guc_pc.c | 3 ++- > tests/xe/xe_mmap.c | 13 ++++++++----- > tests/xe/xe_pm.c | 3 ++- > tests/xe/xe_prime_self_import.c | 23 +++++++++++++--------- > tests/xe/xe_vm.c | 23 +++++++++++++++------- > 14 files changed, 105 insertions(+), 64 deletions(-) > > diff --git a/tests/xe/xe_dma_buf_sync.c b/tests/xe/xe_dma_buf_sync.c > index c08f8ac18..4e76d85ab 100644 > --- a/tests/xe/xe_dma_buf_sync.c > +++ b/tests/xe/xe_dma_buf_sync.c > @@ -120,7 +120,8 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0, > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd[0]), > xe_get_default_alignment(fd[0])); > for (i = 0; i < n_bo; ++i) { > - bo[i] = xe_bo_create(fd[0], hwe0->gt_id, 0, bo_size); > + bo[i] = xe_bo_create_flags(fd[0], 0, bo_size, > + visible_vram_if_possible(fd[0], hwe0->gt_id)); > dma_buf_fd[i] = prime_handle_to_fd(fd[0], bo[i]); > import_bo[i] = prime_fd_to_handle(fd[1], dma_buf_fd[i]); > > diff --git a/tests/xe/xe_evict.c b/tests/xe/xe_evict.c > index 1a70f1b45..c44cb80dc 100644 > --- a/tests/xe/xe_evict.c > +++ b/tests/xe/xe_evict.c > @@ -97,15 +97,17 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci, > i < n_execs / 8 ? 0 : vm; > > if (flags & MULTI_VM) { > - __bo = bo[i] = xe_bo_create(fd, eci->gt_id, 0, > - bo_size); > + __bo = bo[i] = xe_bo_create_flags(fd, 0, > + bo_size, > + visible_vram_memory(fd, eci->gt_id)); > } else if (flags & THREADED) { > - __bo = bo[i] = xe_bo_create(fd, eci->gt_id, vm, > - bo_size); > + __bo = bo[i] = xe_bo_create_flags(fd, vm, > + bo_size, > + visible_vram_memory(fd, eci->gt_id)); > } else { > __bo = bo[i] = xe_bo_create_flags(fd, _vm, > bo_size, > - vram_memory(fd, eci->gt_id) | > + visible_vram_memory(fd, eci->gt_id) | > system_memory(fd)); > } > } else { > @@ -278,15 +280,17 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci, > i < n_execs / 8 ? 0 : vm; > > if (flags & MULTI_VM) { > - __bo = bo[i] = xe_bo_create(fd, eci->gt_id, > - 0, bo_size); > + __bo = bo[i] = xe_bo_create_flags(fd, 0, > + bo_size, > + visible_vram_memory(fd, eci->gt_id)); > } else if (flags & THREADED) { > - __bo = bo[i] = xe_bo_create(fd, eci->gt_id, > - vm, bo_size); > + __bo = bo[i] = xe_bo_create_flags(fd, vm, > + bo_size, > + visible_vram_memory(fd, eci->gt_id)); > } else { > __bo = bo[i] = xe_bo_create_flags(fd, _vm, > bo_size, > - vram_memory(fd, eci->gt_id) | > + visible_vram_memory(fd, eci->gt_id) | > system_memory(fd)); > } > } else { > @@ -449,9 +453,15 @@ threads(int fd, struct drm_xe_engine_class_instance *eci, > pthread_join(threads_data[i].thread, NULL); > } > > +#define SZ_256M 0x10000000 > +#define SZ_1G 0x40000000 > + > static uint64_t calc_bo_size(uint64_t vram_size, int mul, int div) > { > - return (ALIGN(vram_size, 0x40000000) * mul) / div; > + if (vram_size >= SZ_1G) > + return (ALIGN(vram_size, SZ_1G) * mul) / div; > + else > + return (ALIGN(vram_size, SZ_256M) * mul) / div; /* small-bar */ > } > > /** > @@ -664,7 +674,7 @@ igt_main > igt_fixture { > fd = drm_open_driver(DRIVER_XE); > igt_require(xe_has_vram(fd)); > - vram_size = xe_vram_size(fd, 0); > + vram_size = xe_visible_vram_size(fd, 0); > igt_assert(vram_size); > > xe_for_each_hw_engine(fd, hwe) > diff --git a/tests/xe/xe_exec_balancer.c b/tests/xe/xe_exec_balancer.c > index 8df6ceba8..0b00d93de 100644 > --- a/tests/xe/xe_exec_balancer.c > +++ b/tests/xe/xe_exec_balancer.c > @@ -69,7 +69,7 @@ static void test_all_active(int fd, int gt, int class) > bo_size = sizeof(*data) * num_placements; > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd)); > > - bo = xe_bo_create(fd, gt, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt)); > data = xe_bo_map(fd, bo, bo_size); > > for (i = 0; i < num_placements; i++) { > @@ -225,7 +225,7 @@ test_exec(int fd, int gt, int class, int n_engines, int n_execs, > } > memset(data, 0, bo_size); > } else { > - bo = xe_bo_create(fd, gt, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt)); > data = xe_bo_map(fd, bo, bo_size); > } > > @@ -447,7 +447,7 @@ test_cm(int fd, int gt, int class, int n_engines, int n_execs, > igt_assert(data); > } > } else { > - bo = xe_bo_create(fd, gt, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt)); > data = xe_bo_map(fd, bo, bo_size); > } > memset(data, 0, bo_size); > diff --git a/tests/xe/xe_exec_basic.c b/tests/xe/xe_exec_basic.c > index af581c327..a4bae93f0 100644 > --- a/tests/xe/xe_exec_basic.c > +++ b/tests/xe/xe_exec_basic.c > @@ -126,15 +126,14 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, > } > memset(data, 0, bo_size); > } else { > - if (flags & DEFER_ALLOC) { > - bo = xe_bo_create_flags(fd, n_vm == 1 ? vm[0] : 0, > - bo_size, > - vram_if_possible(fd, eci->gt_id) | > - XE_GEM_CREATE_FLAG_DEFER_BACKING); > - } else { > - bo = xe_bo_create(fd, eci->gt_id, n_vm == 1 ? vm[0] : 0, > - bo_size); > - } > + uint32_t bo_flags; > + > + bo_flags = visible_vram_if_possible(fd, eci->gt_id); > + if (flags & DEFER_ALLOC) > + bo_flags |= XE_GEM_CREATE_FLAG_DEFER_BACKING; > + > + bo = xe_bo_create_flags(fd, n_vm == 1 ? vm[0] : 0, > + bo_size, bo_flags); > if (!(flags & DEFER_BIND)) > data = xe_bo_map(fd, bo, bo_size); > } > diff --git a/tests/xe/xe_exec_compute_mode.c b/tests/xe/xe_exec_compute_mode.c > index 27b538414..ee9756c21 100644 > --- a/tests/xe/xe_exec_compute_mode.c > +++ b/tests/xe/xe_exec_compute_mode.c > @@ -150,8 +150,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, > igt_assert(data); > } > } else { > - bo = xe_bo_create(fd, eci->gt_id, flags & VM_FOR_BO ? vm : 0, > - bo_size); > + bo = xe_bo_create_flags(fd, flags & VM_FOR_BO ? vm : 0, > + bo_size, visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > } > memset(data, 0, bo_size); > diff --git a/tests/xe/xe_exec_fault_mode.c b/tests/xe/xe_exec_fault_mode.c > index bf7230c5a..7dcbb3c45 100644 > --- a/tests/xe/xe_exec_fault_mode.c > +++ b/tests/xe/xe_exec_fault_mode.c > @@ -153,9 +153,11 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, > } else { > if (flags & PREFETCH) > bo = xe_bo_create_flags(fd, 0, bo_size, > - all_memory_regions(fd)); > + all_memory_regions(fd) | > + visible_vram_if_possible(fd, 0)); > else > - bo = xe_bo_create(fd, eci->gt_id, 0, bo_size); > + bo = xe_bo_create_flags(fd, 0, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > } > memset(data, 0, bo_size); > @@ -382,8 +384,10 @@ test_atomic(int fd, struct drm_xe_engine_class_instance *eci, > addr_wait = addr + bo_size; > > bo = xe_bo_create_flags(fd, vm, bo_size, > - all_memory_regions(fd)); > - bo_wait = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + all_memory_regions(fd) | > + visible_vram_if_possible(fd, 0)); > + bo_wait = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > wait = xe_bo_map(fd, bo_wait, bo_size); > ptr = &data[0].data; > diff --git a/tests/xe/xe_exec_reset.c b/tests/xe/xe_exec_reset.c > index 6ca1cd769..dfbaa6035 100644 > --- a/tests/xe/xe_exec_reset.c > +++ b/tests/xe/xe_exec_reset.c > @@ -50,7 +50,8 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci) > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > spin = xe_bo_map(fd, bo, bo_size); > > engine = xe_engine_create(fd, vm, eci, 0); > @@ -187,7 +188,7 @@ test_balancer(int fd, int gt, int class, int n_engines, int n_execs, > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > > - bo = xe_bo_create(fd, gt, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt)); > data = xe_bo_map(fd, bo, bo_size); > > for (i = 0; i < n_engines; i++) { > @@ -379,7 +380,8 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci, > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > > for (i = 0; i < n_engines; i++) { > @@ -550,7 +552,8 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci, > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > memset(data, 0, bo_size); > > @@ -682,7 +685,7 @@ static void submit_jobs(struct gt_thread_data *t) > uint32_t bo; > uint32_t *data; > > - bo = xe_bo_create(fd, 0, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, 0)); > data = xe_bo_map(fd, bo, bo_size); > data[0] = MI_BATCH_BUFFER_END; > > diff --git a/tests/xe/xe_exec_store.c b/tests/xe/xe_exec_store.c > index 9640b1567..ab1bde36e 100644 > --- a/tests/xe/xe_exec_store.c > +++ b/tests/xe/xe_exec_store.c > @@ -82,7 +82,8 @@ static void store(int fd) > xe_get_default_alignment(fd)); > > hw_engine = xe_hw_engine(fd, 1); > - bo = xe_bo_create(fd, hw_engine->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, hw_engine->gt_id)); > > xe_vm_bind_async(fd, vm, hw_engine->gt_id, bo, 0, addr, bo_size, &sync, 1); > data = xe_bo_map(fd, bo, bo_size); > @@ -138,7 +139,8 @@ static void store_all(int fd, int gt, int class) > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > > - bo = xe_bo_create(fd, 0, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, 0)); > data = xe_bo_map(fd, bo, bo_size); > > xe_for_each_hw_engine(fd, hwe) { > diff --git a/tests/xe/xe_exec_threads.c b/tests/xe/xe_exec_threads.c > index 414d8ee9a..396398984 100644 > --- a/tests/xe/xe_exec_threads.c > +++ b/tests/xe/xe_exec_threads.c > @@ -106,7 +106,8 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr, > igt_assert(data); > } > } else { > - bo = xe_bo_create(fd, gt, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, gt)); > data = xe_bo_map(fd, bo, bo_size); > } > memset(data, 0, bo_size); > @@ -306,7 +307,8 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, > igt_assert(data); > } > } else { > - bo = xe_bo_create(fd, eci->gt_id, 0, bo_size); > + bo = xe_bo_create_flags(fd, 0, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > } > memset(data, 0, bo_size); > @@ -516,7 +518,8 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, > igt_assert(data); > } > } else { > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > } > memset(data, 0, bo_size); > diff --git a/tests/xe/xe_guc_pc.c b/tests/xe/xe_guc_pc.c > index cb52a7520..8cdd8ba74 100644 > --- a/tests/xe/xe_guc_pc.c > +++ b/tests/xe/xe_guc_pc.c > @@ -65,7 +65,8 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci, > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > > for (i = 0; i < n_engines; i++) { > diff --git a/tests/xe/xe_mmap.c b/tests/xe/xe_mmap.c > index 798facca9..b268158ab 100644 > --- a/tests/xe/xe_mmap.c > +++ b/tests/xe/xe_mmap.c > @@ -63,7 +63,8 @@ static void test_bad_flags(int fd) > { > uint64_t size = xe_get_default_alignment(fd); > struct drm_xe_gem_mmap_offset mmo = { > - .handle = xe_bo_create(fd, 0, 0, size), > + .handle = xe_bo_create_flags(fd, 0, size, > + visible_vram_if_possible(fd, 0)), > .flags = -1u, > }; > > @@ -81,7 +82,8 @@ static void test_bad_extensions(int fd) > uint64_t size = xe_get_default_alignment(fd); > struct xe_user_extension ext; > struct drm_xe_gem_mmap_offset mmo = { > - .handle = xe_bo_create(fd, 0, 0, size), > + .handle = xe_bo_create_flags(fd, 0, size, > + visible_vram_if_possible(fd, 0)), > }; > > mmo.extensions = to_user_pointer(&ext); > @@ -100,7 +102,8 @@ static void test_bad_object(int fd) > { > uint64_t size = xe_get_default_alignment(fd); > struct drm_xe_gem_mmap_offset mmo = { > - .handle = xe_bo_create(fd, 0, 0, size), > + .handle = xe_bo_create_flags(fd, 0, size, > + visible_vram_if_possible(fd, 0)), > }; > > mmo.handle = 0xdeadbeef; > @@ -118,10 +121,10 @@ igt_main > test_mmap(fd, system_memory(fd)); > > igt_subtest("vram") > - test_mmap(fd, vram_memory(fd, 0)); > + test_mmap(fd, visible_vram_memory(fd, 0)); > > igt_subtest("vram-system") > - test_mmap(fd, vram_memory(fd, 0) | system_memory(fd)); > + test_mmap(fd, visible_vram_memory(fd, 0) | system_memory(fd)); > > igt_subtest("bad-flags") > test_bad_flags(fd); > diff --git a/tests/xe/xe_pm.c b/tests/xe/xe_pm.c > index a7f73c4e6..559eccdeb 100644 > --- a/tests/xe/xe_pm.c > +++ b/tests/xe/xe_pm.c > @@ -254,7 +254,8 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci, > if (check_rpm && runtime_usage_available(device.pci_xe)) > rpm_usage = igt_pm_get_runtime_usage(device.pci_xe); > > - bo = xe_bo_create(device.fd_xe, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(device.fd_xe, vm, bo_size, > + visible_vram_if_possible(device.fd_xe, eci->gt_id)); > data = xe_bo_map(device.fd_xe, bo, bo_size); > > for (i = 0; i < n_engines; i++) { > diff --git a/tests/xe/xe_prime_self_import.c b/tests/xe/xe_prime_self_import.c > index 0fd79f704..bfa0d5e34 100644 > --- a/tests/xe/xe_prime_self_import.c > +++ b/tests/xe/xe_prime_self_import.c > @@ -107,7 +107,7 @@ static void test_with_fd_dup(void) > fd1 = drm_open_driver(DRIVER_XE); > fd2 = drm_open_driver(DRIVER_XE); > > - handle = xe_bo_create(fd1, 0, 0, BO_SIZE); > + handle = xe_bo_create_flags(fd1, 0, BO_SIZE, visible_vram_if_possible(fd1, 0)); > > dma_buf_fd1 = prime_handle_to_fd(fd1, handle); > gem_close(fd1, handle); > @@ -141,8 +141,8 @@ static void test_with_two_bos(void) > fd1 = drm_open_driver(DRIVER_XE); > fd2 = drm_open_driver(DRIVER_XE); > > - handle1 = xe_bo_create(fd1, 0, 0, BO_SIZE); > - handle2 = xe_bo_create(fd1, 0, 0, BO_SIZE); > + handle1 = xe_bo_create_flags(fd1, 0, BO_SIZE, visible_vram_if_possible(fd1, 0)); > + handle2 = xe_bo_create_flags(fd1, 0, BO_SIZE, visible_vram_if_possible(fd1, 0)); > > dma_buf_fd = prime_handle_to_fd(fd1, handle1); > handle_import = prime_fd_to_handle(fd2, dma_buf_fd); > @@ -178,7 +178,8 @@ static void test_with_one_bo_two_files(void) > fd1 = drm_open_driver(DRIVER_XE); > fd2 = drm_open_driver(DRIVER_XE); > > - handle_orig = xe_bo_create(fd1, 0, 0, BO_SIZE); > + handle_orig = xe_bo_create_flags(fd1, 0, BO_SIZE, > + visible_vram_if_possible(fd1, 0)); > dma_buf_fd1 = prime_handle_to_fd(fd1, handle_orig); > > flink_name = gem_flink(fd1, handle_orig); > @@ -211,7 +212,7 @@ static void test_with_one_bo(void) > fd1 = drm_open_driver(DRIVER_XE); > fd2 = drm_open_driver(DRIVER_XE); > > - handle = xe_bo_create(fd1, 0, 0, BO_SIZE); > + handle = xe_bo_create_flags(fd1, 0, BO_SIZE, visible_vram_if_possible(fd1, 0)); > > dma_buf_fd = prime_handle_to_fd(fd1, handle); > handle_import1 = prime_fd_to_handle(fd2, dma_buf_fd); > @@ -298,7 +299,8 @@ static void *thread_fn_reimport_vs_close(void *p) > > fds[0] = drm_open_driver(DRIVER_XE); > > - handle = xe_bo_create(fds[0], 0, 0, BO_SIZE); > + handle = xe_bo_create_flags(fds[0], 0, BO_SIZE, > + visible_vram_if_possible(fds[0], 0)); > > fds[1] = prime_handle_to_fd(fds[0], handle); > pthread_barrier_init(&g_barrier, NULL, num_threads); > @@ -340,7 +342,8 @@ static void *thread_fn_export_vs_close(void *p) > > igt_until_timeout(g_time_out) { > /* We want to race gem close against prime export on handle one.*/ > - handle = xe_bo_create(fd, 0, 0, 4096); > + handle = xe_bo_create_flags(fd, 0, 4096, > + visible_vram_if_possible(fd, 0)); > if (handle != 1) > gem_close(fd, handle); > > @@ -438,7 +441,8 @@ static void test_llseek_size(void) > for (i = 0; i < 10; i++) { > int bufsz = xe_get_default_alignment(fd) << i; > > - handle = xe_bo_create(fd, 0, 0, bufsz); > + handle = xe_bo_create_flags(fd, 0, bufsz, > + visible_vram_if_possible(fd, 0)); > dma_buf_fd = prime_handle_to_fd(fd, handle); > > gem_close(fd, handle); > @@ -467,7 +471,8 @@ static void test_llseek_bad(void) > > fd = drm_open_driver(DRIVER_XE); > > - handle = xe_bo_create(fd, 0, 0, BO_SIZE); > + handle = xe_bo_create_flags(fd, 0, BO_SIZE, > + visible_vram_if_possible(fd, 0)); > dma_buf_fd = prime_handle_to_fd(fd, handle); > > gem_close(fd, handle); > diff --git a/tests/xe/xe_vm.c b/tests/xe/xe_vm.c > index 04d6c3956..982c50f6d 100644 > --- a/tests/xe/xe_vm.c > +++ b/tests/xe/xe_vm.c > @@ -52,7 +52,8 @@ write_dwords(int fd, uint32_t vm, int n_dwords, uint64_t *addrs) > batch_size = (n_dwords * 4 + 1) * sizeof(uint32_t); > batch_size = ALIGN(batch_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > - batch_bo = xe_bo_create(fd, 0, vm, batch_size); > + batch_bo = xe_bo_create_flags(fd, vm, batch_size, > + visible_vram_if_possible(fd, 0)); > batch_map = xe_bo_map(fd, batch_bo, batch_size); > > for (i = 0; i < n_dwords; i++) { > @@ -116,7 +117,7 @@ __test_bind_one_bo(int fd, uint32_t vm, int n_addrs, uint64_t *addrs) > vms = malloc(sizeof(*vms) * n_addrs); > igt_assert(vms); > } > - bo = xe_bo_create(fd, 0, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, 0)); > map = xe_bo_map(fd, bo, bo_size); > memset(map, 0, bo_size); > > @@ -554,7 +555,8 @@ shared_pte_page(int fd, struct drm_xe_engine_class_instance *eci, int n_bo, > xe_get_default_alignment(fd)); > > for (i = 0; i < n_bo; ++i) { > - bo[i] = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo[i] = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data[i] = xe_bo_map(fd, bo[i], bo_size); > } > > @@ -723,7 +725,8 @@ test_bind_engines_independent(int fd, struct drm_xe_engine_class_instance *eci) > bo_size = sizeof(*data) * N_ENGINES; > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > > for (i = 0; i < N_ENGINES; i++) { > @@ -880,7 +883,8 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs, > bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), > xe_get_default_alignment(fd)); > > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > data = xe_bo_map(fd, bo, bo_size); > > if (flags & BIND_ARRAY_BIND_ENGINE_FLAG) > @@ -1072,7 +1076,11 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci, > map = aligned_alloc(xe_get_default_alignment(fd), bo_size); > igt_assert(map); > } else { > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + igt_skip_on(xe_visible_vram_size(fd, 0) && bo_size > > + xe_visible_vram_size(fd, 0)); > + > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > map = xe_bo_map(fd, bo, bo_size); > } > > @@ -1350,7 +1358,8 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci, > MAP_ANONYMOUS, -1, 0); > igt_assert(map != MAP_FAILED); > } else { > - bo = xe_bo_create(fd, eci->gt_id, vm, bo_size); > + bo = xe_bo_create_flags(fd, vm, bo_size, > + visible_vram_if_possible(fd, eci->gt_id)); > map = xe_bo_map(fd, bo, bo_size); > } > memset(map, 0, bo_size); ^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v4 4/5] tests/xe/query: extend for CPU visible accounting 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld ` (2 preceding siblings ...) 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 3/5] tests/xe: " Matthew Auld @ 2023-07-21 15:15 ` Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 5/5] tests/xe/mmap: sanity check small-bar Matthew Auld ` (4 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Matthew Auld @ 2023-07-21 15:15 UTC (permalink / raw) To: igt-dev Print the visible size and how much is used. Also sanity check the values. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> --- tests/xe/xe_query.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/xe/xe_query.c b/tests/xe/xe_query.c index beee12ef9..47aa98a8f 100644 --- a/tests/xe/xe_query.c +++ b/tests/xe/xe_query.c @@ -230,6 +230,23 @@ test_query_mem_usage(int fd) igt_info("min_page_size=0x%x, max_page_size=0x%x\n", mem_usage->regions[i].min_page_size, mem_usage->regions[i].max_page_size); + + igt_info("visible size=%lluMiB\n", + mem_usage->regions[i].cpu_visible_size >> 20); + igt_info("visible used=%lluMiB\n", + mem_usage->regions[i].cpu_visible_used >> 20); + + igt_assert_lte_u64(mem_usage->regions[i].cpu_visible_size, + mem_usage->regions[i].total_size); + igt_assert_lte_u64(mem_usage->regions[i].cpu_visible_used, + mem_usage->regions[i].cpu_visible_size); + igt_assert_lte_u64(mem_usage->regions[i].cpu_visible_used, + mem_usage->regions[i].used); + igt_assert_lte_u64(mem_usage->regions[i].used, + mem_usage->regions[i].total_size); + igt_assert_lte_u64(mem_usage->regions[i].used - + mem_usage->regions[i].cpu_visible_used, + mem_usage->regions[i].total_size); } dump_hex_debug(mem_usage, query.size); free(mem_usage); -- 2.41.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v4 5/5] tests/xe/mmap: sanity check small-bar 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld ` (3 preceding siblings ...) 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 4/5] tests/xe/query: extend for CPU visible accounting Matthew Auld @ 2023-07-21 15:15 ` Matthew Auld 2023-07-21 17:02 ` [igt-dev] ✗ Fi.CI.BUILD: failure for IGT bits for small-bar (rev6) Patchwork ` (3 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Matthew Auld @ 2023-07-21 15:15 UTC (permalink / raw) To: igt-dev Some basic sanity checks. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> --- lib/xe/xe_ioctl.c | 28 ++++++++++---- lib/xe/xe_ioctl.h | 2 + tests/xe/xe_mmap.c | 92 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 114 insertions(+), 8 deletions(-) diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c index 0b5c7a4fc..f9f722335 100644 --- a/lib/xe/xe_ioctl.c +++ b/lib/xe/xe_ioctl.c @@ -233,17 +233,31 @@ void xe_vm_destroy(int fd, uint32_t vm) igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_VM_DESTROY, &destroy), 0); } +uint32_t __xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags, + uint32_t *handle) +{ + struct drm_xe_gem_create create = { + .vm_id = vm, + .size = size, + .flags = flags, + }; + int err; + + err = igt_ioctl(fd, DRM_IOCTL_XE_GEM_CREATE, &create); + if (err) + return err; + + *handle = create.handle; + return 0; +} + uint32_t xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags) { - struct drm_xe_gem_create create = { - .vm_id = vm, - .size = size, - .flags = flags, - }; + uint32_t handle; - igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_GEM_CREATE, &create), 0); + igt_assert_eq(__xe_bo_create_flags(fd, vm, size, flags, &handle), 0); - return create.handle; + return handle; } uint32_t xe_bo_create(int fd, int gt, uint32_t vm, uint64_t size) diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h index 320e0f9f6..f9c3acb4a 100644 --- a/lib/xe/xe_ioctl.h +++ b/lib/xe/xe_ioctl.h @@ -64,6 +64,8 @@ void xe_vm_unbind_all_async(int fd, uint32_t vm, uint32_t engine, uint32_t bo, struct drm_xe_sync *sync, uint32_t num_syncs); void xe_vm_destroy(int fd, uint32_t vm); +uint32_t __xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags, + uint32_t *handle); uint32_t xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags); uint32_t xe_bo_create(int fd, int gt, uint32_t vm, uint64_t size); uint32_t xe_engine_create(int fd, uint32_t vm, diff --git a/tests/xe/xe_mmap.c b/tests/xe/xe_mmap.c index b268158ab..8a70a5c35 100644 --- a/tests/xe/xe_mmap.c +++ b/tests/xe/xe_mmap.c @@ -18,14 +18,21 @@ #include "xe/xe_ioctl.h" #include "xe/xe_query.h" +#include <setjmp.h> +#include <signal.h> #include <string.h> - /** * SUBTEST: system * Description: Test mmap on system memory */ +/** + * SUBTEST: small-bar + * Description: Sanity check mmap behaviour on small-bar systems + * GPU requirements: GPU needs to have dedicated VRAM and using small-bar + */ + /** * SUBTEST: %s * Description: Test mmap on %arg[1] memory @@ -110,6 +117,83 @@ static void test_bad_object(int fd) do_ioctl_err(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo, ENOENT); } +static jmp_buf jmp; + +__noreturn static void sigtrap(int sig) +{ + siglongjmp(jmp, sig); +} + +static void trap_sigbus(uint32_t *ptr) +{ + sighandler_t old_sigbus; + + old_sigbus = signal(SIGBUS, sigtrap); + switch (sigsetjmp(jmp, SIGBUS)) { + case SIGBUS: + break; + case 0: + *ptr = 0xdeadbeaf; + default: + igt_assert(!"reached"); + break; + } + signal(SIGBUS, old_sigbus); +} + +/** + * SUBTEST: small-bar + * Description: Test mmap behaviour on small-bar systems. + * + */ +static void test_small_bar(int fd) +{ + uint32_t visible_size = xe_visible_vram_size(fd, 0); + uint32_t bo; + uint64_t mmo; + uint32_t *map; + + /* 2BIG invalid case */ + igt_assert_neq(__xe_bo_create_flags(fd, 0, visible_size + 4096, + visible_vram_memory(fd, 0), &bo), + 0); + + /* Normal operation */ + bo = xe_bo_create_flags(fd, 0, visible_size / 4, + visible_vram_memory(fd, 0)); + mmo = xe_bo_mmap_offset(fd, bo); + map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo); + igt_assert(map != MAP_FAILED); + + map[0] = 0xdeadbeaf; + + munmap(map, 4096); + gem_close(fd, bo); + + /* Normal operation with system memory spilling */ + bo = xe_bo_create_flags(fd, 0, visible_size, + visible_vram_memory(fd, 0) | + system_memory(fd)); + mmo = xe_bo_mmap_offset(fd, bo); + map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo); + igt_assert(map != MAP_FAILED); + + map[0] = 0xdeadbeaf; + + munmap(map, 4096); + gem_close(fd, bo); + + /* Bogus operation with SIGBUS */ + bo = xe_bo_create_flags(fd, 0, visible_size + 4096, + vram_memory(fd, 0)); + mmo = xe_bo_mmap_offset(fd, bo); + map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo); + igt_assert(map != MAP_FAILED); + + trap_sigbus(map); + gem_close(fd, bo); +} + igt_main { int fd; @@ -135,6 +219,12 @@ igt_main igt_subtest("bad-object") test_bad_object(fd); + igt_subtest("small-bar") { + igt_require(xe_visible_vram_size(fd, 0)); + igt_require(xe_visible_vram_size(fd, 0) < xe_vram_size(fd, 0)); + test_small_bar(fd); + } + igt_fixture drm_close_driver(fd); } -- 2.41.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] ✗ Fi.CI.BUILD: failure for IGT bits for small-bar (rev6) 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld ` (4 preceding siblings ...) 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 5/5] tests/xe/mmap: sanity check small-bar Matthew Auld @ 2023-07-21 17:02 ` Patchwork 2023-07-21 17:07 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork ` (2 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Patchwork @ 2023-07-21 17:02 UTC (permalink / raw) To: Matthew Auld; +Cc: igt-dev == Series Details == Series: IGT bits for small-bar (rev6) URL : https://patchwork.freedesktop.org/series/115786/ State : failure == Summary == IGT patchset build failed on latest successful build 602cdd3c87fad86cab8b15fe4242f2a119ce48df lib: Make igt_while_interruptible() thread-safe Tail of build.log: [310/1616] Compiling C object 'lib/76b5a35@@igt-xe_xe_compute_c@sta/xe_xe_compute.c.o'. [311/1616] Compiling C object 'lib/76b5a35@@igt-igt_device_scan_c@sta/igt_device_scan.c.o'. [312/1616] Compiling C object 'lib/76b5a35@@igt-igt_frame_c@sta/igt_frame.c.o'. [313/1616] Compiling C object 'lib/76b5a35@@igt-igt_draw_c@sta/igt_draw.c.o'. [314/1616] Compiling C object 'tests/59830eb@@kms_selftest@exe/kms_selftest.c.o'. [315/1616] Compiling C object 'lib/76b5a35@@igt-igt_v3d_c@sta/igt_v3d.c.o'. [316/1616] Compiling C object 'tests/59830eb@@kms_scaling_modes@exe/kms_scaling_modes.c.o'. [317/1616] Compiling C object 'tests/59830eb@@kms_sysfs_edid_timing@exe/kms_sysfs_edid_timing.c.o'. [318/1616] Compiling C object 'lib/76b5a35@@igt-gpu_cmds_c@sta/gpu_cmds.c.o'. [319/1616] Compiling C object 'lib/76b5a35@@igt-igt_chamelium_stream_c@sta/igt_chamelium_stream.c.o'. [320/1616] Compiling C object 'lib/76b5a35@@igt-igt_alsa_c@sta/igt_alsa.c.o'. [321/1616] Compiling C object 'tests/59830eb@@kms_rmfb@exe/kms_rmfb.c.o'. [322/1616] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen7_c@sta/rendercopy_gen7.c.o'. [323/1616] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen6_c@sta/rendercopy_gen6.c.o'. [324/1616] Compiling C object 'tests/59830eb@@kms_plane_lowres@exe/kms_plane_lowres.c.o'. [325/1616] Compiling C object 'lib/76b5a35@@igt-igt_audio_c@sta/igt_audio.c.o'. [326/1616] Compiling C object 'tests/59830eb@@kms_tv_load_detect@exe/kms_tv_load_detect.c.o'. [327/1616] Compiling C object 'lib/76b5a35@@igt-intel_bufops_c@sta/intel_bufops.c.o'. [328/1616] Compiling C object 'tests/59830eb@@panfrost_prime@exe/panfrost_prime.c.o'. [329/1616] Compiling C object 'lib/76b5a35@@igt-intel_blt_c@sta/intel_blt.c.o'. [330/1616] Compiling C object 'tests/59830eb@@kms_sequence@exe/kms_sequence.c.o'. [331/1616] Compiling C object 'tests/59830eb@@kms_flip@exe/kms_flip.c.o'. [332/1616] Compiling C object 'lib/76b5a35@@igt-igt_pm_c@sta/igt_pm.c.o'. [333/1616] Compiling C object 'lib/76b5a35@@igt-igt_amd_c@sta/igt_amd.c.o'. [334/1616] Compiling C object 'tests/59830eb@@kms_prop_blob@exe/kms_prop_blob.c.o'. [335/1616] Compiling C object 'lib/76b5a35@@igt-igt_vmwgfx_c@sta/igt_vmwgfx.c.o'. [336/1616] Compiling C object 'tests/59830eb@@kms_vrr@exe/kms_vrr.c.o'. [337/1616] Compiling C object 'tests/59830eb@@kms_prime@exe/kms_prime.c.o'. [338/1616] Generating i915-perf-registers-acmgt3 with a custom command. [339/1616] Compiling C object 'tests/59830eb@@kms_vblank@exe/kms_vblank.c.o'. [340/1616] Compiling C object 'tests/59830eb@@kms_writeback@exe/kms_writeback.c.o'. [341/1616] Compiling C object 'tests/59830eb@@kms_plane_alpha_blend@exe/kms_plane_alpha_blend.c.o'. [342/1616] Compiling C object 'tests/59830eb@@kms_tiled_display@exe/kms_tiled_display.c.o'. [343/1616] Compiling C object 'tests/59830eb@@kms_setmode@exe/kms_setmode.c.o'. [344/1616] Compiling C object 'tests/59830eb@@kms_properties@exe/kms_properties.c.o'. [345/1616] Compiling C object 'tests/59830eb@@kms_rotation_crc@exe/kms_rotation_crc.c.o'. [346/1616] Compiling C object 'tests/59830eb@@kms_cursor_legacy@exe/kms_cursor_legacy.c.o'. [347/1616] Compiling C object 'tests/59830eb@@kms_universal_plane@exe/kms_universal_plane.c.o'. [348/1616] Generating i915-perf-metrics-acmgt3 with a custom command. [349/1616] Compiling C object 'lib/76b5a35@@igt-igt_core_c@sta/igt_core.c.o'. [350/1616] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen8_c@sta/rendercopy_gen8.c.o'. [351/1616] Compiling C object 'lib/76b5a35@@igt-intel_batchbuffer_c@sta/intel_batchbuffer.c.o'. [352/1616] Compiling C object 'tests/59830eb@@kms_plane_scaling@exe/kms_plane_scaling.c.o'. [353/1616] Compiling C object 'lib/76b5a35@@igt-igt_chamelium_c@sta/igt_chamelium.c.o'. [354/1616] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen9_c@sta/rendercopy_gen9.c.o'. [355/1616] Compiling C object 'lib/76b5a35@@igt-i915_intel_decode_c@sta/i915_intel_decode.c.o'. [356/1616] Compiling C object 'lib/76b5a35@@igt-igt_fb_c@sta/igt_fb.c.o'. [357/1616] Compiling C object 'lib/76b5a35@@igt-igt_kms_c@sta/igt_kms.c.o'. [358/1616] Generating i915-perf-equations with a custom command. ninja: build stopped: subcommand failed. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] ✗ GitLab.Pipeline: warning for IGT bits for small-bar (rev6) 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld ` (5 preceding siblings ...) 2023-07-21 17:02 ` [igt-dev] ✗ Fi.CI.BUILD: failure for IGT bits for small-bar (rev6) Patchwork @ 2023-07-21 17:07 ` Patchwork 2023-07-24 13:28 ` [igt-dev] ✗ Fi.CI.BUILD: failure for IGT bits for small-bar (rev7) Patchwork 2023-07-24 13:33 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork 8 siblings, 0 replies; 11+ messages in thread From: Patchwork @ 2023-07-21 17:07 UTC (permalink / raw) To: Matthew Auld; +Cc: igt-dev == Series Details == Series: IGT bits for small-bar (rev6) URL : https://patchwork.freedesktop.org/series/115786/ State : warning == Summary == Pipeline status: FAILED. see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/941636 for the overview. build-containers:build-debian has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/45944581): time="2023-07-21T17:02:24Z" level=fatal msg="Error determining repository tags: Invalid status code returned when fetching tags list 500 (Internal Server Error)" Building! STEP 1: FROM debian:buster Getting image source signatures Copying blob sha256:8eb6dba554cffc072c7a6c696c8a23fc311e543399d84ab3ebc55c07ab54414f Copying config sha256:1de12428f6f470169eba22c18e53addae00d60e92ebe96b2c3bdd99c17c34010 Writing manifest to image destination Storing signatures STEP 2: RUN apt-get update error running container: error creating container for [/bin/sh -c apt-get update]: time="2023-07-21T17:02:28Z" level=warning msg="signal: killed" time="2023-07-21T17:02:28Z" level=error msg="container_linux.go:346: starting container process caused \"process_linux.go:297: applying cgroup configuration for process caused \\\"mountpoint for cgroup not found\\\"\"\n" container_linux.go:346: starting container process caused "process_linux.go:297: applying cgroup configuration for process caused \"mountpoint for cgroup not found\"" : exit status 1 Error: error building at STEP "RUN apt-get update": error while running runtime: exit status 1 section_end:1689958949:step_script section_start:1689958949:cleanup_file_variables Cleaning up project directory and file based variables section_end:1689958949:cleanup_file_variables ERROR: Job failed: exit code 1 build-containers:build-debian-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/45944583): time="2023-07-21T17:02:23Z" level=fatal msg="Invalid status code returned when fetching blob 500 (Internal Server Error)" Building! STEP 1: FROM debian:buster Getting image source signatures Copying blob sha256:8eb6dba554cffc072c7a6c696c8a23fc311e543399d84ab3ebc55c07ab54414f Copying config sha256:1de12428f6f470169eba22c18e53addae00d60e92ebe96b2c3bdd99c17c34010 Writing manifest to image destination Storing signatures STEP 2: RUN apt-get update error running container: error creating container for [/bin/sh -c apt-get update]: time="2023-07-21T17:02:26Z" level=warning msg="signal: killed" time="2023-07-21T17:02:26Z" level=error msg="container_linux.go:346: starting container process caused \"process_linux.go:297: applying cgroup configuration for process caused \\\"mountpoint for cgroup not found\\\"\"\n" container_linux.go:346: starting container process caused "process_linux.go:297: applying cgroup configuration for process caused \"mountpoint for cgroup not found\"" : exit status 1 Error: error building at STEP "RUN apt-get update": error while running runtime: exit status 1 section_end:1689958947:step_script section_start:1689958947:cleanup_file_variables Cleaning up project directory and file based variables section_end:1689958949:cleanup_file_variables ERROR: Job failed: exit code 1 build-containers:build-debian-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/45944584): ], "Created": "2021-01-22T08:26:53.390348642Z", "DockerVersion": "", "Labels": {}, "Architecture": "amd64", "Os": "linux", "Layers": [ "sha256:04854e5e3796b945522a085073b5a49cadad51bd1c5414c91654fa3d63d8db4d" ] } Skipping, already built Getting image source signatures Copying blob sha256:04854e5e3796b945522a085073b5a49cadad51bd1c5414c91654fa3d63d8db4d time="2023-07-21T17:02:25Z" level=fatal msg="Error reading config blob sha256:cc55efdc667be826910d414a562c76ce1130a9c15255a0dd115431bc42f83448: Invalid status code returned when fetching blob 500 (Internal Server Error)" section_end:1689958946:step_script section_start:1689958946:cleanup_file_variables Cleaning up project directory and file based variables section_end:1689958947:cleanup_file_variables ERROR: Job failed: exit code 1 build-containers:build-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/45944585): "Created": "2019-11-11T12:55:05.209459628Z", "DockerVersion": "", "Labels": { "maintainer": "Clement Verna \u003ccverna@fedoraproject.org\u003e" }, "Architecture": "amd64", "Os": "linux", "Layers": [ "sha256:b39735705e69a2516323755ff4698ea5cd86b08b31d8c8287bc83d76d34c3bfc" ] } Skipping, already built Getting image source signatures time="2023-07-21T17:02:25Z" level=fatal msg="Error trying to reuse blob sha256:b39735705e69a2516323755ff4698ea5cd86b08b31d8c8287bc83d76d34c3bfc at destination: failed to read from destination repository gfx-ci/igt-ci-tags/build-fedora: 500 (Internal Server Error)" section_end:1689958946:step_script section_start:1689958946:cleanup_file_variables Cleaning up project directory and file based variables section_end:1689958950:cleanup_file_variables ERROR: Job failed: exit code 1 == Logs == For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/941636 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] ✗ Fi.CI.BUILD: failure for IGT bits for small-bar (rev7) 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld ` (6 preceding siblings ...) 2023-07-21 17:07 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork @ 2023-07-24 13:28 ` Patchwork 2023-07-24 13:33 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork 8 siblings, 0 replies; 11+ messages in thread From: Patchwork @ 2023-07-24 13:28 UTC (permalink / raw) To: Matthew Auld; +Cc: igt-dev == Series Details == Series: IGT bits for small-bar (rev7) URL : https://patchwork.freedesktop.org/series/115786/ State : failure == Summary == IGT patchset build failed on latest successful build 86fa0e885f8d020eeb046f27fae5729d5962ebd7 tests/intel-ci: move chamelium testlist inside igt Tail of build.log: [311/1616] Compiling C object 'lib/76b5a35@@igt-ioctl_wrappers_c@sta/ioctl_wrappers.c.o'. [312/1616] Compiling C object 'lib/76b5a35@@igt-xe_xe_spin_c@sta/xe_xe_spin.c.o'. [313/1616] Compiling C object 'tests/59830eb@@prime_udl@exe/prime_udl.c.o'. [314/1616] Compiling C object 'tests/59830eb@@meta_test@exe/meta_test.c.o'. [315/1616] Compiling C object 'lib/76b5a35@@igt-igt_chamelium_stream_c@sta/igt_chamelium_stream.c.o'. [316/1616] Compiling C object 'lib/76b5a35@@igt-veboxcopy_gen12_c@sta/veboxcopy_gen12.c.o'. [317/1616] Compiling C object 'lib/76b5a35@@igt-intel_allocator_c@sta/intel_allocator.c.o'. [318/1616] Compiling C object 'lib/76b5a35@@igt-xe_xe_compute_c@sta/xe_xe_compute.c.o'. [319/1616] Compiling C object 'lib/76b5a35@@igt-igt_dummyload_c@sta/igt_dummyload.c.o'. [320/1616] Compiling C object 'lib/76b5a35@@igt-igt_kmod_c@sta/igt_kmod.c.o'. [321/1616] Compiling C object 'tests/59830eb@@panfrost_gem_new@exe/panfrost_gem_new.c.o'. [322/1616] Compiling C object 'lib/76b5a35@@igt-igt_audio_c@sta/igt_audio.c.o'. [323/1616] Compiling C object 'lib/76b5a35@@igt-igt_alsa_c@sta/igt_alsa.c.o'. [324/1616] Compiling C object 'tests/59830eb@@kms_plane_scaling@exe/kms_plane_scaling.c.o'. [325/1616] Compiling C object 'lib/76b5a35@@igt-igt_aux_c@sta/igt_aux.c.o'. [326/1616] Compiling C object 'tests/59830eb@@prime_mmap_kms@exe/prime_mmap_kms.c.o'. [327/1616] Compiling C object 'lib/76b5a35@@igt-igt_device_scan_c@sta/igt_device_scan.c.o'. [328/1616] Compiling C object 'lib/76b5a35@@igt-igt_v3d_c@sta/igt_v3d.c.o'. [329/1616] Compiling C object 'lib/76b5a35@@igt-igt_draw_c@sta/igt_draw.c.o'. [330/1616] Compiling C object 'tests/59830eb@@prime_busy@exe/prime_busy.c.o'. [331/1616] Compiling C object 'tests/59830eb@@kms_flip@exe/kms_flip.c.o'. [332/1616] Compiling C object 'lib/76b5a35@@igt-instdone_c@sta/instdone.c.o'. [333/1616] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen6_c@sta/rendercopy_gen6.c.o'. [334/1616] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen7_c@sta/rendercopy_gen7.c.o'. [335/1616] Compiling C object 'tests/59830eb@@panfrost_submit@exe/panfrost_submit.c.o'. [336/1616] Compiling C object 'lib/76b5a35@@igt-gpu_cmds_c@sta/gpu_cmds.c.o'. [337/1616] Compiling C object 'lib/76b5a35@@igt-intel_bufops_c@sta/intel_bufops.c.o'. [338/1616] Compiling C object 'tests/59830eb@@prime_self_import@exe/prime_self_import.c.o'. [339/1616] Compiling C object 'tests/59830eb@@prime_mmap_coherency@exe/prime_mmap_coherency.c.o'. [340/1616] Compiling C object 'lib/76b5a35@@igt-intel_blt_c@sta/intel_blt.c.o'. [341/1616] Compiling C object 'tests/59830eb@@kms_writeback@exe/kms_writeback.c.o'. [342/1616] Compiling C object 'lib/76b5a35@@igt-igt_pm_c@sta/igt_pm.c.o'. [343/1616] Compiling C object 'tests/59830eb@@kms_vblank@exe/kms_vblank.c.o'. [344/1616] Compiling C object 'lib/76b5a35@@igt-igt_vmwgfx_c@sta/igt_vmwgfx.c.o'. [345/1616] Compiling C object 'tests/59830eb@@prime_mmap@exe/prime_mmap.c.o'. [346/1616] Compiling C object 'lib/76b5a35@@igt-igt_amd_c@sta/igt_amd.c.o'. [347/1616] Generating i915-perf-registers-acmgt3 with a custom command. [348/1616] Generating i915-perf-metrics-acmgt3 with a custom command. [349/1616] Compiling C object 'lib/76b5a35@@igt-intel_batchbuffer_c@sta/intel_batchbuffer.c.o'. [350/1616] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen8_c@sta/rendercopy_gen8.c.o'. [351/1616] Compiling C object 'tests/59830eb@@kms_cursor_legacy@exe/kms_cursor_legacy.c.o'. [352/1616] Compiling C object 'tests/59830eb@@prime_vgem@exe/prime_vgem.c.o'. [353/1616] Compiling C object 'lib/76b5a35@@igt-igt_core_c@sta/igt_core.c.o'. [354/1616] Compiling C object 'lib/76b5a35@@igt-igt_chamelium_c@sta/igt_chamelium.c.o'. [355/1616] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen9_c@sta/rendercopy_gen9.c.o'. [356/1616] Compiling C object 'lib/76b5a35@@igt-i915_intel_decode_c@sta/i915_intel_decode.c.o'. [357/1616] Compiling C object 'lib/76b5a35@@igt-igt_fb_c@sta/igt_fb.c.o'. [358/1616] Compiling C object 'lib/76b5a35@@igt-igt_kms_c@sta/igt_kms.c.o'. [359/1616] Generating i915-perf-equations with a custom command. ninja: build stopped: subcommand failed. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] ✗ GitLab.Pipeline: warning for IGT bits for small-bar (rev7) 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld ` (7 preceding siblings ...) 2023-07-24 13:28 ` [igt-dev] ✗ Fi.CI.BUILD: failure for IGT bits for small-bar (rev7) Patchwork @ 2023-07-24 13:33 ` Patchwork 8 siblings, 0 replies; 11+ messages in thread From: Patchwork @ 2023-07-24 13:33 UTC (permalink / raw) To: Matthew Auld; +Cc: igt-dev == Series Details == Series: IGT bits for small-bar (rev7) URL : https://patchwork.freedesktop.org/series/115786/ State : warning == Summary == Pipeline status: FAILED. see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/943311 for the overview. build:tests-debian-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031988): ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function); did you mean ‘XE_GEM_CREATE_FLAG_DEFER_BACKING’? return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XE_GEM_CREATE_FLAG_DEFER_BACKING ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] } ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205351:step_script section_start:1690205351:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205351:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-debian-meson-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031991): ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function); did you mean ‘XE_GEM_CREATE_FLAG_DEFER_BACKING’? return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XE_GEM_CREATE_FLAG_DEFER_BACKING ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] } ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205350:step_script section_start:1690205350:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205351:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-debian-meson-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031990): ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function); did you mean ‘XE_GEM_CREATE_FLAG_DEFER_BACKING’? return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XE_GEM_CREATE_FLAG_DEFER_BACKING ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] } ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205351:step_script section_start:1690205351:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205353:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-debian-meson-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031992): ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function); did you mean ‘XE_GEM_CREATE_FLAG_DEFER_BACKING’? return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XE_GEM_CREATE_FLAG_DEFER_BACKING ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] } ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205350:step_script section_start:1690205350:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205352:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-debian-minimal has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031989): ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function); did you mean ‘XE_GEM_CREATE_FLAG_DEFER_BACKING’? return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XE_GEM_CREATE_FLAG_DEFER_BACKING ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] } ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205350:step_script section_start:1690205350:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205350:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031983): ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function) 467 | return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] 431 | } | ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] 470 | } | ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205352:step_script section_start:1690205352:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205354:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-fedora-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031987): [6/1398] Compiling C object 'lib/76b5a35@@igt-xe_xe_query_c@sta/xe_xe_query.c.o'. FAILED: lib/76b5a35@@igt-xe_xe_query_c@sta/xe_xe_query.c.o clang -Ilib/76b5a35@@igt-xe_xe_query_c@sta -Ilib -I../lib -I../include -I../include/drm-uapi -I../include/linux-uapi -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fPIC -pthread '-DIGT_DATADIR="/usr/local/share/igt-gpu-tools"' '-DIGT_SRCDIR="/builds/gfx-ci/igt-ci-tags/tests"' '-DIGT_LOG_DOMAIN="xe/xe_query"' -MD -MQ 'lib/76b5a35@@igt-xe_xe_query_c@sta/xe_xe_query.c.o' -MF 'lib/76b5a35@@igt-xe_xe_query_c@sta/xe_xe_query.c.o.d' -o 'lib/76b5a35@@igt-xe_xe_query_c@sta/xe_xe_query.c.o' -c ../lib/xe/xe_query.c ../lib/xe/xe_query.c:149:41: error: no member named 'cpu_visible_size' in 'struct drm_xe_query_mem_region' return mem_usage->regions[region_idx].cpu_visible_size; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ../lib/xe/xe_query.c:428:32: error: use of undeclared identifier 'XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM' return vram_memory(fd, gt) | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM; ^ ../lib/xe/xe_query.c:467:24: error: use of undeclared identifier 'XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM' return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; ^ 3 errors generated. ninja: build stopped: subcommand failed. section_end:1690205356:step_script section_start:1690205356:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205357:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-fedora-no-libdrm-nouveau has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031986): ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function) 467 | return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] 431 | } | ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] 470 | } | ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205350:step_script section_start:1690205350:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205350:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-fedora-no-libunwind has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031984): ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function) 467 | return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] 431 | } | ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] 470 | } | ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205350:step_script section_start:1690205350:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205351:cleanup_file_variables ERROR: Job failed: exit code 1 build:tests-fedora-oldest-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/46031985): ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:467:24: error: ‘XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM’ undeclared (first use in this function) 467 | return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/xe/xe_query.c: In function ‘visible_vram_memory’: ../lib/xe/xe_query.c:431:1: error: control reaches end of non-void function [-Werror=return-type] 431 | } | ^ ../lib/xe/xe_query.c: In function ‘visible_vram_if_possible’: ../lib/xe/xe_query.c:470:1: error: control reaches end of non-void function [-Werror=return-type] 470 | } | ^ cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. section_end:1690205353:step_script section_start:1690205353:cleanup_file_variables Cleaning up project directory and file based variables section_end:1690205355:cleanup_file_variables ERROR: Job failed: exit code 1 == Logs == For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/943311 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-07-24 13:33 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-07-21 15:15 [igt-dev] [PATCH i-g-t v4 0/5] IGT bits for small-bar Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 1/5] lib/xe: add visible vram helpers Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 2/5] lib/xe: handle small-bar systems Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 3/5] tests/xe: " Matthew Auld 2023-07-21 19:10 ` Souza, Jose 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 4/5] tests/xe/query: extend for CPU visible accounting Matthew Auld 2023-07-21 15:15 ` [igt-dev] [PATCH i-g-t v4 5/5] tests/xe/mmap: sanity check small-bar Matthew Auld 2023-07-21 17:02 ` [igt-dev] ✗ Fi.CI.BUILD: failure for IGT bits for small-bar (rev6) Patchwork 2023-07-21 17:07 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork 2023-07-24 13:28 ` [igt-dev] ✗ Fi.CI.BUILD: failure for IGT bits for small-bar (rev7) Patchwork 2023-07-24 13:33 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox