lib/i915/intel_memory_region: wrappers for memory regions ops
Subsystems (2)
RFC 1/2 lib/i915/intel_memory_region: wrappers for memory regions ops
As of now lmem details are exposed from kernel through debugfs. Wrappers for detecting the lmem and reading it's details are written.
--- lib/Makefile.sources | 2 + lib/i915/intel_memory_region.c | 105 +++++++++++++++++++++++++++++++++ lib/i915/intel_memory_region.h | 30 ++++++++++ lib/meson.build | 1 + 4 files changed, 138 insertions(+) create mode 100644 lib/i915/intel_memory_region.c create mode 100644 lib/i915/intel_memory_region.h
lib/Makefile.sources +2 -0
@@ -17,6 +17,8 @@ lib_source_list = \ i915/gem_mman.h \ i915/gem_vm.c \ i915/gem_vm.h \ + i915/intel_memory_region.c \ + i915/intel_memory_region.h \ i915_3d.h \ i915_reg.h \ i915_pciids.h \
lib/i915/intel_memory_region.c new file +105 -0
105 lines not on this page · raw message
lib/i915/intel_memory_region.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright © 2020 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#ifndef INTEL_MEMORY_REGION_H +#define INTEL_MEMORY_REGION_H + +bool gem_has_lmem (int fd); +uint64_t gem_lmem_total_size (int fd); + +#endif /* INTEL_MEMORY_REGION_H */
lib/meson.build +1 -0
@@ -7,6 +7,7 @@ lib_sources = [ 'i915/gem_ring.c', 'i915/gem_mman.c', 'i915/gem_vm.c', + 'i915/intel_memory_region.c', 'igt_color_encoding.c', 'igt_debugfs.c', 'igt_device.c',
Signature · 6 lines
2.20.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
RFC 2/2 tests/dumb_duffer: extending for lmem coverage.
if lmem is available on intel platforms, dumb buffers are created out of lmem. Hence tests are extended to cover the dumb buffers from lmem.
--- tests/dumb_buffer.c | 80 ++++++++++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 26 deletions(-)
tests/dumb_buffer.c +54 -26
@@ -43,6 +43,9 @@#include <getopt.h> #include <pthread.h> #include <stdatomic.h> +#include <igt_debugfs.h> + +#include <i915/intel_memory_region.h> #include <drm.h>
@@ -52,7 +55,12 @@IGT_TEST_DESCRIPTION ("This is a test for the generic dumb buffer interface." ); -#define PAGE_SIZE 4096 +static struct dumb_buffer_data { +int drm_fd; +bool lmem; + _Atomic(uint64_t) max; +int page_size; +} data;static int __dumb_create (int fd,struct drm_mode_create_dumb *create) {
@@ -212,13 +220,13 @@ static void valid_nonaligned_size(int fd) .height = 24, .bpp = 32, }; -char buf[PAGE_SIZE ]; +char buf[data.page_size];igt_require (is_i915_device (fd));dumb_create (fd, &create); -gem_write (fd, create.handle,PAGE_SIZE /2 , buf,PAGE_SIZE /2 ); +gem_write (fd, create.handle, data.page_size /2 , buf, data.page_size /2 );dumb_destroy (fd, create.handle); }
@@ -235,14 +243,15 @@ static void invalid_nonaligned_size(int fd) .height = 24, .bpp = 32, }; -char buf[PAGE_SIZE ]; +char buf[data.page_size];igt_require (is_i915_device (fd));dumb_create (fd, &create); +/* This should fail. Hence cannot use gem_write. */ igt_assert (__gem_write (fd, create.handle, - create.size - (PAGE_SIZE /2 ), buf,PAGE_SIZE )); + create.size - (data.page_size /2 ), buf, data.page_size));dumb_destroy (fd, create.handle); }
@@ -273,13 +282,15 @@ struct thread_clear {int fd; }; -#define MAX_PAGE_TO_REQUEST 102400 +#define MAX_SMEM_PAGE 102400 +#define MAX_LMEM_PAGE 1024 -static void *thread_clear (void *data) +static void *thread_clear (void *thread_data) { -struct thread_clear *arg = data; +struct thread_clear *arg = thread_data;unsigned long checked =0 ;int fd = arg->fd; +int max_page = data.lmem ?MAX_LMEM_PAGE :MAX_SMEM_PAGE ;void *ptr; igt_until_timeout(arg->timeout) {
@@ -293,16 +304,14 @@ static void *thread_clear(void *data)for (uint64_t _npages = npages; npages >0 ; npages -= _npages) { create.bpp =32 ; - create.width =PAGE_SIZE / (create.bpp /8 ); - _npages = npages <=MAX_PAGE_TO_REQUEST ? npages : -MAX_PAGE_TO_REQUEST ; + create.width = data.page_size / (create.bpp /8 ); + _npages = npages <= max_page ? npages : max_page; create.height = _npages;dumb_create (fd, &create); -igt_assert_eq (PAGE_SIZE * create.height, create.size); +igt_assert_eq (data.page_size * create.height, create.size); - ptr =dumb_map (fd, - create.handle, create.size, + ptr =dumb_map (fd, create.handle, create.size,PROT_WRITE );for (uint64_t page =0 ; page < create.height; page++) {
@@ -330,7 +339,7 @@ static void always_clear(int fd, int timeout)struct thread_clear arg = { .fd = fd, .timeout = timeout, - .max =intel_get_avail_ram_mb () << (20 -12 ),/* in pages */ + .max = data.max,/* in pages */ };const int ncpus =sysconf (_SC_NPROCESSORS_ONLN);unsigned long checked;
@@ -348,35 +357,54 @@ static void always_clear(int fd, int timeout)igt_info ("Checked %'lu page allocations\n" , checked); } -igt_main +static int parse_lmem_details (void ) { -int fd =-1 ; +if (gem_has_lmem (data.drm_fd)) { + data.lmem = true; + data.page_size =65536 ; + data.max =gem_lmem_total_size (data.drm_fd); +igt_assert_f (data.max,"Lmem with 0Bytes\n" ); + data.max = data.max / data.page_size; + } +return 0 ; +} + +igt_main +{ igt_fixture { - fd =drm_open_driver (DRIVER_ANY ); + data.drm_fd =drm_open_driver (DRIVER_ANY ); + data.lmem = false; + data.page_size =4096 ; +if (is_i915_device (data.drm_fd)) { +igt_assert (parse_lmem_details () ==0 ); +if (!data.lmem) +/* In pages */ + data.max =intel_get_avail_ram_mb () <<8 ; + } } igt_subtest("invalid-bpp") -invalid_dimensions_test (fd); +invalid_dimensions_test (data.drm_fd); igt_subtest("create-valid-dumb") -valid_dumb_creation_test (fd); +valid_dumb_creation_test (data.drm_fd); igt_subtest("create-valid-nonaligned") -valid_nonaligned_size (fd); +valid_nonaligned_size (data.drm_fd); igt_subtest("create-invalid-nonaligned") -invalid_nonaligned_size (fd); +invalid_nonaligned_size (data.drm_fd); igt_subtest("map-valid") -valid_map (fd); +valid_map (data.drm_fd); igt_subtest("map-uaf") -uaf_map (fd); +uaf_map (data.drm_fd); igt_subtest("map-invalid-size") -invalid_size_map (fd); +invalid_size_map (data.drm_fd); igt_subtest("create-clear") -always_clear (fd,30 ); +always_clear (data.drm_fd,30 ); }
Signature · 6 lines
2.20.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [RFC 2/2] tests/dumb_duffer: extending for lmem coverage.
Quoting Ramalingam C (2020-01-04 10:08:26)
Quoted 2 lines
if lmem is available on intel platforms, dumb buffers are created out of lmem. Hence tests are extended to cover the dumb buffers from lmem.
Which has what to do with the dumb API?
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [RFC 2/2] tests/dumb_duffer: extending for lmem coverage.
Quoted 5 lines · Chris Wilson
Quoting Ramalingam C (2020-01-04 10:08:26)
Quoted 2 lines
if lmem is available on intel platforms, dumb buffers are created out of lmem. Hence tests are extended to cover the dumb buffers from lmem.
Which has what to do with the dumb API?
Chris,
API is agnostic to memory region agnostic. But the page boundary that needs to be considered for tests are different between LMEM and SMEM. And also we need to get the total local memory available for the create-clear test.
These changes were done in this patch.
-Ram
Quoted 1 line
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [RFC 2/2] tests/dumb_duffer: extending for lmem coverage.
Quoting Ramalingam C (2020-01-06 06:43:04)
Quoted 5 lines · Chris Wilson
Quoted 4 lines
Quoting Ramalingam C (2020-01-04 10:08:26)
Quoted 2 lines
if lmem is available on intel platforms, dumb buffers are created out of lmem. Hence tests are extended to cover the dumb buffers from lmem.
Quoted 7 lines
Quoted 1 line
Which has what to do with the dumb API?
Chris,
API is agnostic to memory region agnostic. But the page boundary that needs to be considered for tests are different between LMEM and SMEM. And also we need to get the total local memory available for the create-clear test.
The changes were not agnostic, ergo the dumb API is not as agnostic as it purports to be.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for series starting with [RFC,1/2] lib/i915/intel_memory_region: wrappers for memory regions ops
In reply to Ramalingam C== Series Details ==
== Series Details ==
Series: series starting with [RFC,1/2] lib/i915/intel_memory_region: wrappers for memory regions ops
URL : https://patchwork.freedesktop.org/series/71618/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7675 -> IGTPW_3898
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_3898 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_3898, 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_3898/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_3898:
### IGT changes ###
#### Possible regressions ####
* igt@gem_ctx_create@basic-files:
- fi-byt-n2820: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-byt-n2820/igt@[email protected]
Known issues
------------
Here are the changes found in IGTPW_3898 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_close_race@basic-threads:
- fi-byt-j1900: [PASS][2] -> [TIMEOUT][3] ([i915#816])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-byt-j1900/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-byt-j1900/igt@[email protected]
* igt@i915_pm_rpm@module-reload:
- fi-skl-guc: [PASS][4] -> [INCOMPLETE][5] ([i915#151])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-skl-guc/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-skl-guc/igt@[email protected]
* igt@i915_selftest@live_blt:
- fi-ivb-3770: [PASS][6] -> [DMESG-FAIL][7] ([i915#725])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-ivb-3770/igt@i915_selftest@live_blt.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-ivb-3770/igt@i915_selftest@live_blt.html
* igt@i915_selftest@live_gem_contexts:
- fi-cfl-8700k: [PASS][8] -> [INCOMPLETE][9] ([i915#424])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-cfl-8700k/igt@i915_selftest@live_gem_contexts.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-cfl-8700k/igt@i915_selftest@live_gem_contexts.html
* igt@kms_chamelium@dp-edid-read:
- fi-icl-u2: [PASS][10] -> [FAIL][11] ([fdo#109635] / [i915#217])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-icl-u2/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-icl-u2/igt@[email protected]
#### Possible fixes ####
* igt@gem_close_race@basic-threads:
- fi-byt-n2820: [TIMEOUT][12] ([i915#816]) -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-byt-n2820/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-byt-n2820/igt@[email protected]
* igt@i915_module_load@reload-with-fault-injection:
- fi-skl-6770hq: [DMESG-WARN][14] ([i915#889]) -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-skl-6770hq/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-skl-6770hq/igt@[email protected]
* igt@i915_selftest@live_blt:
- fi-hsw-4770: [DMESG-FAIL][16] ([i915#553] / [i915#725]) -> [PASS][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-hsw-4770/igt@i915_selftest@live_blt.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-hsw-4770/igt@i915_selftest@live_blt.html
* igt@i915_selftest@live_gem_contexts:
- fi-hsw-peppy: [DMESG-FAIL][18] ([i915#722]) -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-hsw-peppy/igt@i915_selftest@live_gem_contexts.html
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-hsw-peppy/igt@i915_selftest@live_gem_contexts.html
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][20] ([i915#217]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-kbl-7500u/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-kbl-7500u/igt@[email protected]
#### Warnings ####
* igt@i915_selftest@live_blt:
- fi-hsw-4770r: [DMESG-FAIL][22] ([i915#725]) -> [DMESG-FAIL][23] ([i915#553] / [i915#725])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7675/fi-hsw-4770r/igt@i915_selftest@live_blt.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/fi-hsw-4770r/igt@i915_selftest@live_blt.html
[fdo#109635]: https://bugs.freedesktop.org/show_bug.cgi?id=109635
[i915#151]: https://gitlab.freedesktop.org/drm/intel/issues/151
[i915#217]: https://gitlab.freedesktop.org/drm/intel/issues/217
[i915#424]: https://gitlab.freedesktop.org/drm/intel/issues/424
[i915#553]: https://gitlab.freedesktop.org/drm/intel/issues/553
[i915#722]: https://gitlab.freedesktop.org/drm/intel/issues/722
[i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
[i915#816]: https://gitlab.freedesktop.org/drm/intel/issues/816
[i915#889]: https://gitlab.freedesktop.org/drm/intel/issues/889
Participating hosts (52 -> 44)
------------------------------
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-bsw-n3050 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_5357 -> IGTPW_3898
CI-20190529: 20190529
CI_DRM_7675: 9a97e886930c21e976205c47180ab256a6dbc135 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3898: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/index.html
IGT_5357: a555a4b98f90dab655d24bb3d07e9291a8b8dac8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3898/index.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev