Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/1] lib/intel_allocator: Limit last page if not reserved
@ 2023-09-19 17:02 Jonathan Cavitt
  2023-09-19 17:02 ` [igt-dev] [PATCH i-g-t 1/1] " Jonathan Cavitt
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jonathan Cavitt @ 2023-09-19 17:02 UTC (permalink / raw)
  To: igt-dev; +Cc: jonathan.cavitt, nirmoy.das

We currently limit the last page of the allocator space to avoid a hang
on some platforms when a batch would be pinned in the last page.
However, in the future, we may already be reserving the last page of the
ppgtt in kernel space, so we would not need to limit the last page
because gem_aperture_size would not report its existence in
__intel_allocator_open_full when this is the case.

Check the gtt_size and only limit the last page if it's not already
reserved by kernel space.  This is generalized to if the reported page
count is even.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
CC: Nirmoy Das <nirmoy.das@intel.com>
CC: Zbigniew Kempczynski <zbigniew.kempczynski@intel.com>

Jonathan Cavitt (1):
  lib/intel_allocator: Limit last page if not reserved

 lib/intel_allocator.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

-- 
2.25.1

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

* [igt-dev] [PATCH i-g-t 1/1] lib/intel_allocator: Limit last page if not reserved
  2023-09-19 17:02 [igt-dev] [PATCH i-g-t 0/1] lib/intel_allocator: Limit last page if not reserved Jonathan Cavitt
@ 2023-09-19 17:02 ` Jonathan Cavitt
  2023-09-19 19:06   ` Zbigniew Kempczyński
  2023-09-19 18:07 ` [igt-dev] ✓ CI.xeBAT: success for " Patchwork
  2023-09-19 18:17 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
  2 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cavitt @ 2023-09-19 17:02 UTC (permalink / raw)
  To: igt-dev; +Cc: jonathan.cavitt, nirmoy.das

We currently limit the last page of the allocator space to avoid a hang
on some platforms when a batch would be pinned in the last page.
However, in the future, we may already be reserving the last page of the
ppgtt in kernel space, so we would not need to limit the last page
because gem_aperture_size would not report its existence in
__intel_allocator_open_full when this is the case.

Check the gtt_size and only limit the last page if it's not already
reserved by kernel space.  This is generalized to if the reported page
count is even.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 lib/intel_allocator.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c
index f0a9b7fb53..fc7836dcee 100644
--- a/lib/intel_allocator.c
+++ b/lib/intel_allocator.c
@@ -53,12 +53,6 @@ static inline const char *reqstr(enum reqtype request_type)
 #define bind_debug(...) {}
 #endif
 
-/*
- * We limit allocator space to avoid hang when batch would be
- * pinned in the last page.
- */
-#define RESERVED 4096
-
 struct allocator {
 	int fd;
 	uint32_t ctx;
@@ -941,11 +935,21 @@ static uint64_t __intel_allocator_open_full(int fd, uint32_t ctx,
 		if (!end) {
 			igt_assert_f(can_report_gtt_size(fd), "Invalid fd\n");
 			gtt_size = gem_aperture_size(fd);
-			if (!gem_uses_full_ppgtt(fd))
+			if (!gem_uses_full_ppgtt(fd)) {
 				gtt_size /= 2;
-			else
-				gtt_size -= RESERVED;
-
+			} else {
+				/*
+				 * We limit allocator space to avoid hang when batch would be
+				 * pinned in the last page.
+				 *
+				 * The last page is reserved when the gtt_size is aligned
+				 * with an odd number of pages.
+				 */
+				uint64_t align = gtt_size % (SZ_4K * 2);
+				align += SZ_4K;
+				align %= (SZ_4K * 2);
+				gtt_size -= align;
+			}
 			req.open.end = gtt_size;
 		}
 
-- 
2.25.1

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

* [igt-dev] ✓ CI.xeBAT: success for lib/intel_allocator: Limit last page if not reserved
  2023-09-19 17:02 [igt-dev] [PATCH i-g-t 0/1] lib/intel_allocator: Limit last page if not reserved Jonathan Cavitt
  2023-09-19 17:02 ` [igt-dev] [PATCH i-g-t 1/1] " Jonathan Cavitt
@ 2023-09-19 18:07 ` Patchwork
  2023-09-19 18:17 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2023-09-19 18:07 UTC (permalink / raw)
  To: Jonathan Cavitt; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 6719 bytes --]

== Series Details ==

Series: lib/intel_allocator: Limit last page if not reserved
URL   : https://patchwork.freedesktop.org/series/123924/
State : success

== Summary ==

CI Bug Log - changes from XEIGT_7493_BAT -> XEIGTPW_9828_BAT
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Participating hosts (4 -> 4)
------------------------------

  No changes in participating hosts

Known issues
------------

  Here are the changes found in XEIGTPW_9828_BAT that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@kms_addfb_basic@addfb25-x-tiled-legacy:
    - bat-pvc-2:          NOTRUN -> [SKIP][1] ([Intel XE#538]) +33 other tests skip
   [1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@kms_addfb_basic@addfb25-x-tiled-legacy.html

  * igt@kms_cursor_legacy@basic-flip-after-cursor-atomic:
    - bat-pvc-2:          NOTRUN -> [SKIP][2] ([Intel XE#539]) +7 other tests skip
   [2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@kms_cursor_legacy@basic-flip-after-cursor-atomic.html

  * igt@kms_flip@basic-flip-vs-dpms:
    - bat-pvc-2:          NOTRUN -> [SKIP][3] ([Intel XE#275] / [Intel XE#541]) +3 other tests skip
   [3]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@kms_flip@basic-flip-vs-dpms.html

  * igt@kms_flip@basic-flip-vs-wf_vblank@d-edp1:
    - bat-adlp-7:         [PASS][4] -> [FAIL][5] ([Intel XE#480]) +1 other test fail
   [4]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7493/bat-adlp-7/igt@kms_flip@basic-flip-vs-wf_vblank@d-edp1.html
   [5]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-adlp-7/igt@kms_flip@basic-flip-vs-wf_vblank@d-edp1.html

  * igt@kms_force_connector_basic@force-connector-state:
    - bat-pvc-2:          NOTRUN -> [SKIP][6] ([Intel XE#540]) +3 other tests skip
   [6]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@kms_force_connector_basic@force-connector-state.html

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
    - bat-pvc-2:          NOTRUN -> [SKIP][7] ([Intel XE#537]) +6 other tests skip
   [7]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence.html

  * igt@kms_prop_blob@basic:
    - bat-pvc-2:          NOTRUN -> [SKIP][8] ([Intel XE#536])
   [8]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@kms_prop_blob@basic.html

  * igt@kms_psr@primary_page_flip:
    - bat-pvc-2:          NOTRUN -> [SKIP][9] ([Intel XE#535]) +2 other tests skip
   [9]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@kms_psr@primary_page_flip.html

  * igt@xe_evict@evict-beng-small-external:
    - bat-pvc-2:          NOTRUN -> [FAIL][10] ([Intel XE#389]) +3 other tests fail
   [10]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_evict@evict-beng-small-external.html

  * igt@xe_evict@evict-small-cm:
    - bat-pvc-2:          NOTRUN -> [DMESG-FAIL][11] ([Intel XE#482]) +3 other tests dmesg-fail
   [11]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_evict@evict-small-cm.html

  * igt@xe_exec_reset@virtual-close-fd-no-exec:
    - bat-pvc-2:          NOTRUN -> [DMESG-WARN][12] ([Intel XE#696])
   [12]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_exec_reset@virtual-close-fd-no-exec.html

  * igt@xe_guc_pc@freq_range_idle:
    - bat-pvc-2:          NOTRUN -> [SKIP][13] ([Intel XE#533]) +1 other test skip
   [13]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_guc_pc@freq_range_idle.html

  * igt@xe_huc_copy@huc_copy:
    - bat-pvc-2:          NOTRUN -> [SKIP][14] ([Intel XE#255])
   [14]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_huc_copy@huc_copy.html

  * igt@xe_intel_bb@render:
    - bat-pvc-2:          NOTRUN -> [SKIP][15] ([Intel XE#532])
   [15]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_intel_bb@render.html

  * igt@xe_live_ktest@migrate:
    - bat-pvc-2:          NOTRUN -> [SKIP][16] ([Intel XE#483]) +1 other test skip
   [16]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_live_ktest@migrate.html

  * igt@xe_pm_residency@gt-c6-on-idle:
    - bat-pvc-2:          NOTRUN -> [SKIP][17] ([Intel XE#531])
   [17]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_pm_residency@gt-c6-on-idle.html

  
#### Possible fixes ####

  * igt@xe_module_load@load:
    - bat-pvc-2:          [INCOMPLETE][18] ([Intel XE#597]) -> [PASS][19]
   [18]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_7493/bat-pvc-2/igt@xe_module_load@load.html
   [19]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/bat-pvc-2/igt@xe_module_load@load.html

  
  [Intel XE#255]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/255
  [Intel XE#275]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/275
  [Intel XE#389]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/389
  [Intel XE#480]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/480
  [Intel XE#482]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/482
  [Intel XE#483]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/483
  [Intel XE#531]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/531
  [Intel XE#532]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/532
  [Intel XE#533]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/533
  [Intel XE#535]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/535
  [Intel XE#536]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/536
  [Intel XE#537]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/537
  [Intel XE#538]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/538
  [Intel XE#539]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/539
  [Intel XE#540]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/540
  [Intel XE#541]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/541
  [Intel XE#597]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/597
  [Intel XE#696]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/696


Build changes
-------------

  * IGT: IGT_7493 -> IGTPW_9828
  * Linux: xe-376-9da40abcc0ccdf8fdfed4e21d76060bfcd35fe7d -> xe-383-fac2e20c785bd790c250e4f4799dfa28e44e7082

  IGTPW_9828: 9828
  IGT_7493: 2517e42d612e0c1ca096acf8b5f6177f7ef4bce7 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  xe-376-9da40abcc0ccdf8fdfed4e21d76060bfcd35fe7d: 9da40abcc0ccdf8fdfed4e21d76060bfcd35fe7d
  xe-383-fac2e20c785bd790c250e4f4799dfa28e44e7082: fac2e20c785bd790c250e4f4799dfa28e44e7082

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9828/index.html

[-- Attachment #2: Type: text/html, Size: 7676 bytes --]

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

* [igt-dev] ✗ Fi.CI.BAT: failure for lib/intel_allocator: Limit last page if not reserved
  2023-09-19 17:02 [igt-dev] [PATCH i-g-t 0/1] lib/intel_allocator: Limit last page if not reserved Jonathan Cavitt
  2023-09-19 17:02 ` [igt-dev] [PATCH i-g-t 1/1] " Jonathan Cavitt
  2023-09-19 18:07 ` [igt-dev] ✓ CI.xeBAT: success for " Patchwork
@ 2023-09-19 18:17 ` Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2023-09-19 18:17 UTC (permalink / raw)
  To: Jonathan Cavitt; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 6257 bytes --]

== Series Details ==

Series: lib/intel_allocator: Limit last page if not reserved
URL   : https://patchwork.freedesktop.org/series/123924/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13651 -> IGTPW_9828
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_9828 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_9828, please notify your bug team (lgci.bug.filing@intel.com) 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_9828/index.html

Participating hosts (38 -> 35)
------------------------------

  Additional (1): bat-rpls-2 
  Missing    (4): bat-adlm-1 bat-atsm-1 fi-snb-2520m fi-pnv-d510 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_9828:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_module_load@load:
    - bat-mtlp-8:         [PASS][1] -> [INCOMPLETE][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/bat-mtlp-8/igt@i915_module_load@load.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9828/bat-mtlp-8/igt@i915_module_load@load.html

  * igt@runner@aborted:
    - bat-rpls-2:         NOTRUN -> [FAIL][3]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9828/bat-rpls-2/igt@runner@aborted.html

  
Known issues
------------

  Here are the changes found in IGTPW_9828 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_parallel@engines@fds:
    - bat-mtlp-6:         [PASS][4] -> [ABORT][5] ([i915#9262])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/bat-mtlp-6/igt@gem_exec_parallel@engines@fds.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9828/bat-mtlp-6/igt@gem_exec_parallel@engines@fds.html

  * igt@gem_exec_suspend@basic-s0@smem:
    - bat-dg2-9:          [PASS][6] -> [INCOMPLETE][7] ([i915#8797] / [i915#9275])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/bat-dg2-9/igt@gem_exec_suspend@basic-s0@smem.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9828/bat-dg2-9/igt@gem_exec_suspend@basic-s0@smem.html

  * igt@i915_selftest@live@gt_heartbeat:
    - fi-apl-guc:         [PASS][8] -> [DMESG-FAIL][9] ([i915#5334])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9828/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@execlists:
    - fi-bsw-n3050:       [ABORT][10] ([i915#7913]) -> [PASS][11]
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/fi-bsw-n3050/igt@i915_selftest@live@execlists.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9828/fi-bsw-n3050/igt@i915_selftest@live@execlists.html

  * igt@kms_chamelium_edid@hdmi-edid-read:
    - {bat-dg2-13}:       [DMESG-WARN][12] ([i915#7952]) -> [PASS][13]
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/bat-dg2-13/igt@kms_chamelium_edid@hdmi-edid-read.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9828/bat-dg2-13/igt@kms_chamelium_edid@hdmi-edid-read.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
  [i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
  [i915#7952]: https://gitlab.freedesktop.org/drm/intel/issues/7952
  [i915#8797]: https://gitlab.freedesktop.org/drm/intel/issues/8797
  [i915#9262]: https://gitlab.freedesktop.org/drm/intel/issues/9262
  [i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7493 -> IGTPW_9828

  CI-20190529: 20190529
  CI_DRM_13651: 61b71c3f061a44a6ab1dcf756918886aa03a5480 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_9828: 9828
  IGT_7493: 2517e42d612e0c1ca096acf8b5f6177f7ef4bce7 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git


Testlist changes
----------------

+igt@xe_mmio@mmio-invalid
+igt@xe_mmio@mmio-timestamp
+igt@xe_query@query-gts
-igt@xe_exec_balancer@many-cm-parallel-basic
-igt@xe_exec_balancer@many-cm-parallel-rebind
-igt@xe_exec_balancer@many-cm-parallel-userptr
-igt@xe_exec_balancer@many-cm-parallel-userptr-invalidate
-igt@xe_exec_balancer@many-cm-parallel-userptr-invalidate-race
-igt@xe_exec_balancer@many-cm-parallel-userptr-rebind
-igt@xe_exec_balancer@many-execqueues-cm-parallel-basic
-igt@xe_exec_balancer@many-execqueues-cm-parallel-rebind
-igt@xe_exec_balancer@many-execqueues-cm-parallel-userptr
-igt@xe_exec_balancer@many-execqueues-cm-parallel-userptr-invalidate
-igt@xe_exec_balancer@many-execqueues-cm-parallel-userptr-invalidate-race
-igt@xe_exec_balancer@many-execqueues-cm-parallel-userptr-rebind
-igt@xe_exec_balancer@no-exec-cm-parallel-basic
-igt@xe_exec_balancer@no-exec-cm-parallel-rebind
-igt@xe_exec_balancer@no-exec-cm-parallel-userptr
-igt@xe_exec_balancer@no-exec-cm-parallel-userptr-invalidate
-igt@xe_exec_balancer@no-exec-cm-parallel-userptr-invalidate-race
-igt@xe_exec_balancer@no-exec-cm-parallel-userptr-rebind
-igt@xe_exec_balancer@once-cm-parallel-basic
-igt@xe_exec_balancer@once-cm-parallel-rebind
-igt@xe_exec_balancer@once-cm-parallel-userptr
-igt@xe_exec_balancer@once-cm-parallel-userptr-invalidate
-igt@xe_exec_balancer@once-cm-parallel-userptr-invalidate-race
-igt@xe_exec_balancer@once-cm-parallel-userptr-rebind
-igt@xe_exec_balancer@twice-cm-parallel-basic
-igt@xe_exec_balancer@twice-cm-parallel-rebind
-igt@xe_exec_balancer@twice-cm-parallel-userptr
-igt@xe_exec_balancer@twice-cm-parallel-userptr-invalidate
-igt@xe_exec_balancer@twice-cm-parallel-userptr-invalidate-race
-igt@xe_exec_balancer@twice-cm-parallel-userptr-rebind
-igt@xe_query@query-cs-cycles
-igt@xe_query@query-gt-list
-igt@xe_query@query-invalid-cs-cycles

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9828/index.html

[-- Attachment #2: Type: text/html, Size: 7266 bytes --]

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

* Re: [igt-dev] [PATCH i-g-t 1/1] lib/intel_allocator: Limit last page if not reserved
  2023-09-19 17:02 ` [igt-dev] [PATCH i-g-t 1/1] " Jonathan Cavitt
@ 2023-09-19 19:06   ` Zbigniew Kempczyński
  0 siblings, 0 replies; 5+ messages in thread
From: Zbigniew Kempczyński @ 2023-09-19 19:06 UTC (permalink / raw)
  To: Jonathan Cavitt; +Cc: igt-dev, nirmoy.das

On Tue, Sep 19, 2023 at 10:02:30AM -0700, Jonathan Cavitt wrote:
> We currently limit the last page of the allocator space to avoid a hang
> on some platforms when a batch would be pinned in the last page.
> However, in the future, we may already be reserving the last page of the
> ppgtt in kernel space, so we would not need to limit the last page
> because gem_aperture_size would not report its existence in
> __intel_allocator_open_full when this is the case.
> 
> Check the gtt_size and only limit the last page if it's not already
> reserved by kernel space.  This is generalized to if the reported page
> count is even.
> 
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> ---
>  lib/intel_allocator.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c
> index f0a9b7fb53..fc7836dcee 100644
> --- a/lib/intel_allocator.c
> +++ b/lib/intel_allocator.c
> @@ -53,12 +53,6 @@ static inline const char *reqstr(enum reqtype request_type)
>  #define bind_debug(...) {}
>  #endif
>  
> -/*
> - * We limit allocator space to avoid hang when batch would be
> - * pinned in the last page.
> - */
> -#define RESERVED 4096
> -
>  struct allocator {
>  	int fd;
>  	uint32_t ctx;
> @@ -941,11 +935,21 @@ static uint64_t __intel_allocator_open_full(int fd, uint32_t ctx,
>  		if (!end) {
>  			igt_assert_f(can_report_gtt_size(fd), "Invalid fd\n");
>  			gtt_size = gem_aperture_size(fd);
> -			if (!gem_uses_full_ppgtt(fd))
> +			if (!gem_uses_full_ppgtt(fd)) {
>  				gtt_size /= 2;
> -			else
> -				gtt_size -= RESERVED;
> -
> +			} else {
> +				/*
> +				 * We limit allocator space to avoid hang when batch would be
> +				 * pinned in the last page.
> +				 *
> +				 * The last page is reserved when the gtt_size is aligned
> +				 * with an odd number of pages.
> +				 */
> +				uint64_t align = gtt_size % (SZ_4K * 2);
> +				align += SZ_4K;
> +				align %= (SZ_4K * 2);
> +				gtt_size -= align;
> +			}

If you're afraid you're entering danger zone from ppgtt perspective
from IGTs just increase RESERVED to 8K/16K/32K/... (pick appropriate).
Most IGTs don't care where's the limit of vm. If test will need to
exercise those offsets it has api to increase end to real gtt size
and play with those offsets.

--
Zbigniew

>  			req.open.end = gtt_size;
>  		}
>  
> -- 
> 2.25.1
> 

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

end of thread, other threads:[~2023-09-19 19:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19 17:02 [igt-dev] [PATCH i-g-t 0/1] lib/intel_allocator: Limit last page if not reserved Jonathan Cavitt
2023-09-19 17:02 ` [igt-dev] [PATCH i-g-t 1/1] " Jonathan Cavitt
2023-09-19 19:06   ` Zbigniew Kempczyński
2023-09-19 18:07 ` [igt-dev] ✓ CI.xeBAT: success for " Patchwork
2023-09-19 18:17 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox