* [igt-dev] [PATCH i-g-t v3] lib/xe_query: add helper getting available VRAM
@ 2023-08-04 7:39 Lukasz Laguna
2023-08-04 8:44 ` Zbigniew Kempczyński
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Lukasz Laguna @ 2023-08-04 7:39 UTC (permalink / raw)
To: igt-dev; +Cc: mauro.chehab
Helper allows to read available VRAM of a specified device and GT.
v2:
- Query for current memory usage instead of using cached one (Zbigniew)
v3:
- Reacquire mem_region pointer (Zbigniew)
Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
lib/xe/xe_query.c | 31 +++++++++++++++++++++++++++++++
lib/xe/xe_query.h | 1 +
2 files changed, 32 insertions(+)
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 8963c7b06..e1fe6139c 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -630,6 +630,37 @@ uint64_t xe_visible_vram_size(int fd, int gt)
return visible_size;
}
+/**
+ * xe_vram_available:
+ * @fd: xe device fd
+ * @gt: gt
+ *
+ * Returns available vram of xe device @fd and @gt.
+ */
+uint64_t xe_vram_available(int fd, int gt)
+{
+ struct xe_device *xe_dev;
+ int region_idx;
+ struct drm_xe_query_mem_region *mem_region;
+
+ xe_dev = find_in_cache(fd);
+ igt_assert(xe_dev);
+
+ region_idx = ffs(native_region_for_gt(xe_dev->gts, gt)) - 1;
+ mem_region = &xe_dev->mem_usage->regions[region_idx];
+
+ if (XE_IS_CLASS_VRAM(mem_region)) {
+ pthread_mutex_lock(&cache.cache_mutex);
+ free(xe_dev->mem_usage);
+ xe_dev->mem_usage = xe_query_mem_usage_new(fd);
+ pthread_mutex_unlock(&cache.cache_mutex);
+ mem_region = &xe_dev->mem_usage->regions[region_idx];
+
+ return mem_region->total_size - mem_region->used;
+ }
+
+ return 0;
+}
/**
* xe_get_default_alignment:
diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index 1b74c58ab..20dbfa12c 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -97,6 +97,7 @@ 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);
+uint64_t xe_vram_available(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.40.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v3] lib/xe_query: add helper getting available VRAM
2023-08-04 7:39 [igt-dev] [PATCH i-g-t v3] lib/xe_query: add helper getting available VRAM Lukasz Laguna
@ 2023-08-04 8:44 ` Zbigniew Kempczyński
2023-08-04 9:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/xe_query: add helper getting available VRAM (rev3) Patchwork
2023-08-04 9:46 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Zbigniew Kempczyński @ 2023-08-04 8:44 UTC (permalink / raw)
To: Lukasz Laguna; +Cc: igt-dev, mauro.chehab
On Fri, Aug 04, 2023 at 09:39:39AM +0200, Lukasz Laguna wrote:
> Helper allows to read available VRAM of a specified device and GT.
>
> v2:
> - Query for current memory usage instead of using cached one (Zbigniew)
> v3:
> - Reacquire mem_region pointer (Zbigniew)
>
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
> lib/xe/xe_query.c | 31 +++++++++++++++++++++++++++++++
> lib/xe/xe_query.h | 1 +
> 2 files changed, 32 insertions(+)
>
> diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
> index 8963c7b06..e1fe6139c 100644
> --- a/lib/xe/xe_query.c
> +++ b/lib/xe/xe_query.c
> @@ -630,6 +630,37 @@ uint64_t xe_visible_vram_size(int fd, int gt)
>
> return visible_size;
> }
> +/**
> + * xe_vram_available:
> + * @fd: xe device fd
> + * @gt: gt
> + *
> + * Returns available vram of xe device @fd and @gt.
> + */
> +uint64_t xe_vram_available(int fd, int gt)
> +{
> + struct xe_device *xe_dev;
> + int region_idx;
> + struct drm_xe_query_mem_region *mem_region;
> +
> + xe_dev = find_in_cache(fd);
> + igt_assert(xe_dev);
> +
> + region_idx = ffs(native_region_for_gt(xe_dev->gts, gt)) - 1;
> + mem_region = &xe_dev->mem_usage->regions[region_idx];
> +
> + if (XE_IS_CLASS_VRAM(mem_region)) {
> + pthread_mutex_lock(&cache.cache_mutex);
> + free(xe_dev->mem_usage);
> + xe_dev->mem_usage = xe_query_mem_usage_new(fd);
> + pthread_mutex_unlock(&cache.cache_mutex);
> + mem_region = &xe_dev->mem_usage->regions[region_idx];
What if other thread in the meantime will call xe_vram_available()?
xe_dev->mem_usage might be not valid pointer at the moment.
I think reacquiring and mem_region->total_size - mem_region->used
should also be protected in this critical section. Likely you
need to introduce additional variable which contain this subtraction
when you'll leave this section.
--
Zbigniew
> +
> + return mem_region->total_size - mem_region->used;
> + }
> +
> + return 0;
> +}
>
> /**
> * xe_get_default_alignment:
> diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
> index 1b74c58ab..20dbfa12c 100644
> --- a/lib/xe/xe_query.h
> +++ b/lib/xe/xe_query.h
> @@ -97,6 +97,7 @@ 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);
> +uint64_t xe_vram_available(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.40.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for lib/xe_query: add helper getting available VRAM (rev3)
2023-08-04 7:39 [igt-dev] [PATCH i-g-t v3] lib/xe_query: add helper getting available VRAM Lukasz Laguna
2023-08-04 8:44 ` Zbigniew Kempczyński
@ 2023-08-04 9:08 ` Patchwork
2023-08-04 9:46 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2023-08-04 9:08 UTC (permalink / raw)
To: Lukasz Laguna; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 5495 bytes --]
== Series Details ==
Series: lib/xe_query: add helper getting available VRAM (rev3)
URL : https://patchwork.freedesktop.org/series/121704/
State : failure
== Summary ==
CI Bug Log - changes from IGT_7414 -> IGTPW_9514
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_9514 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in IGTPW_9514, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/index.html
Participating hosts (42 -> 42)
------------------------------
Additional (1): fi-kbl-soraka
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_9514:
### IGT changes ###
#### Possible regressions ####
* igt@kms_flip@basic-flip-vs-dpms:
- fi-kbl-soraka: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/fi-kbl-soraka/igt@kms_flip@basic-flip-vs-dpms.html
#### Warnings ####
* igt@i915_pm_rpm@basic-pci-d3-state:
- bat-adlp-9: [FAIL][2] ([i915#7940]) -> [FAIL][3]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7414/bat-adlp-9/igt@i915_pm_rpm@basic-pci-d3-state.html
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/bat-adlp-9/igt@i915_pm_rpm@basic-pci-d3-state.html
Known issues
------------
Here are the changes found in IGTPW_9514 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/fi-kbl-soraka/igt@gem_huc_copy@huc-copy.html
* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/fi-kbl-soraka/igt@gem_lmem_swapping@basic.html
* igt@i915_pm_rpm@module-reload:
- fi-rkl-11600: [PASS][6] -> [FAIL][7] ([i915#7940])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7414/fi-rkl-11600/igt@i915_pm_rpm@module-reload.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/fi-rkl-11600/igt@i915_pm_rpm@module-reload.html
* igt@i915_selftest@live@gt_mocs:
- bat-mtlp-8: [PASS][8] -> [DMESG-FAIL][9] ([i915#7059])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7414/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][10] ([i915#1886] / [i915#7913])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
* igt@i915_selftest@live@slpc:
- bat-rpls-2: [PASS][11] -> [DMESG-WARN][12] ([i915#6367])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7414/bat-rpls-2/igt@i915_selftest@live@slpc.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/bat-rpls-2/igt@i915_selftest@live@slpc.html
- bat-mtlp-8: [PASS][13] -> [DMESG-WARN][14] ([i915#6367])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7414/bat-mtlp-8/igt@i915_selftest@live@slpc.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/bat-mtlp-8/igt@i915_selftest@live@slpc.html
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-kbl-soraka: NOTRUN -> [SKIP][15] ([fdo#109271]) +16 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/fi-kbl-soraka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html
#### Warnings ####
* igt@kms_psr@cursor_plane_move:
- bat-rplp-1: [SKIP][16] ([i915#1072]) -> [ABORT][17] ([i915#8434] / [i915#8668])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7414/bat-rplp-1/igt@kms_psr@cursor_plane_move.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/bat-rplp-1/igt@kms_psr@cursor_plane_move.html
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#7059]: https://gitlab.freedesktop.org/drm/intel/issues/7059
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7940]: https://gitlab.freedesktop.org/drm/intel/issues/7940
[i915#8434]: https://gitlab.freedesktop.org/drm/intel/issues/8434
[i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7414 -> IGTPW_9514
CI-20190529: 20190529
CI_DRM_13472: 9f699732195d9d8071692f7981e8fe58d51cd024 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_9514: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/index.html
IGT_7414: 056c9d7f2a63dd6d0b9b6462b4ab1b096178dcc6 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9514/index.html
[-- Attachment #2: Type: text/html, Size: 6619 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [igt-dev] ○ CI.xeBAT: info for lib/xe_query: add helper getting available VRAM (rev3)
2023-08-04 7:39 [igt-dev] [PATCH i-g-t v3] lib/xe_query: add helper getting available VRAM Lukasz Laguna
2023-08-04 8:44 ` Zbigniew Kempczyński
2023-08-04 9:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/xe_query: add helper getting available VRAM (rev3) Patchwork
@ 2023-08-04 9:46 ` Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2023-08-04 9:46 UTC (permalink / raw)
To: Lukasz Laguna; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 352 bytes --]
== Series Details ==
Series: lib/xe_query: add helper getting available VRAM (rev3)
URL : https://patchwork.freedesktop.org/series/121704/
State : info
== Summary ==
Participating hosts:
bat-pvc-2
bat-atsm-2
bat-dg2-oem2
bat-adlp-7
Missing hosts results[0]:
Results: [IGTPW_9514](https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9514/index.html)
[-- Attachment #2: Type: text/html, Size: 868 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-04 9:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-04 7:39 [igt-dev] [PATCH i-g-t v3] lib/xe_query: add helper getting available VRAM Lukasz Laguna
2023-08-04 8:44 ` Zbigniew Kempczyński
2023-08-04 9:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/xe_query: add helper getting available VRAM (rev3) Patchwork
2023-08-04 9:46 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox