drm/i915/selftests: Fix live_requests for all engines
Subsystems (2)
From: Tvrtko Ursulin <[email protected]>
After the abandonment of i915->kernel_context and since we have started to create per-gt engine->kernel_context, these tests need to be updated to instantiate the batch buffer VMA in the correct PPGTT for the context used to execute each spinner.
v2(Tejas):
- Clean commit message - Matt
- Add BUG_ON to match vm
--- drivers/gpu/drm/i915/selftests/i915_request.c | 133 ++++++++++-------- 1 file changed, 77 insertions(+), 56 deletions(-)
drivers/gpu/drm/i915/selftests/i915_request.c +77 -56
@@ -957,18 +957,18 @@ static int live_cancel_request(void *arg)return 0 ; } -static struct i915_vma *empty_batch (struct drm_i915_private *i915) +static struct i915_vma *empty_batch (struct intel_gt *gt) {struct drm_i915_gem_object *obj;struct i915_vma *vma;u32 *cmd;int err; - obj =i915_gem_object_create_internal (i915,PAGE_SIZE ); + obj =i915_gem_object_create_internal (gt->i915,PAGE_SIZE );if (IS_ERR (obj))return ERR_CAST (obj); - cmd =i915_gem_object_pin_map_unlocked (obj,I915_MAP_WB ); + cmd =i915_gem_object_pin_map_unlocked (obj,I915_MAP_WC );if (IS_ERR (cmd)) { err =PTR_ERR (cmd); goto err;
@@ -979,15 +979,15 @@ static struct i915_vma *empty_batch(struct drm_i915_private *i915)__i915_gem_object_flush_map (obj,0 ,64 );i915_gem_object_unpin_map (obj); -intel_gt_chipset_flush (to_gt (i915)); +intel_gt_chipset_flush (gt); - vma =i915_vma_instance (obj, &to_gt (i915)->ggtt->vm,NULL ); + vma =i915_vma_instance (obj, gt->vm,NULL );if (IS_ERR (vma)) { err =PTR_ERR (vma); goto err; } - err =i915_vma_pin (vma,0 ,0 ,PIN_USER |PIN_GLOBAL ); + err =i915_vma_pin (vma,0 ,0 ,PIN_USER );if (err) goto err;
@@ -1005,6 +1005,14 @@ static struct i915_vma *empty_batch(struct drm_i915_private *i915)return ERR_PTR (err); } +static int emit_bb_start (struct i915_request *rq,struct i915_vma *batch) +{ +return rq->engine->emit_bb_start (rq, +i915_vma_offset (batch), +i915_vma_size (batch), +0 ); +} +static struct i915_request *empty_request (struct intel_engine_cs *engine,struct i915_vma *batch)
@@ -1016,10 +1024,7 @@ empty_request(struct intel_engine_cs *engine,if (IS_ERR (request))return request; - err = engine->emit_bb_start (request, -i915_vma_offset (batch), -i915_vma_size (batch), -I915_DISPATCH_SECURE ); + err =emit_bb_start (request, batch);if (err) goto out_request;
@@ -1034,8 +1039,7 @@ static int live_empty_request(void *arg)struct drm_i915_private *i915 = arg;struct intel_engine_cs *engine;struct igt_live_test t; -struct i915_vma *batch; -int err =0 ; +int err;/* * Submit various sized batches of empty requests, to each engine
@@ -1043,16 +1047,17 @@ static int live_empty_request(void *arg)* the overhead of submitting requests to the hardware. */ - batch =empty_batch (i915); -if (IS_ERR (batch)) -return PTR_ERR (batch); -for_each_uabi_engine (engine, i915) {IGT_TIMEOUT (end_time);struct i915_request *request; +struct i915_vma *batch;unsigned long n, prime;ktime_t times[2 ] = {}; + batch =empty_batch (engine->gt); +if (IS_ERR (batch)) +return PTR_ERR (batch); + err =igt_live_test_begin (&t, i915, __func__, engine->name);if (err) goto out_batch;
@@ -1100,27 +1105,30 @@ static int live_empty_request(void *arg) engine->name,ktime_to_ns (times[0 ]), prime, div64_u64(ktime_to_ns(times[1]), prime)); +out_batch: +i915_vma_unpin (batch); +i915_vma_put (batch); +if (err) +break ; } -out_batch: -i915_vma_unpin (batch); -i915_vma_put (batch);return err; } -static struct i915_vma *recursive_batch (struct drm_i915_private *i915) +static struct i915_vma *recursive_batch (struct intel_gt *gt) { +struct drm_i915_private *i915 = gt->i915;struct drm_i915_gem_object *obj;const int ver =GRAPHICS_VER (i915);struct i915_vma *vma;u32 *cmd;int err; - obj =i915_gem_object_create_internal (i915,PAGE_SIZE ); + obj =i915_gem_object_create_internal (gt->i915,PAGE_SIZE );if (IS_ERR (obj))return ERR_CAST (obj); - vma =i915_vma_instance (obj,to_gt (i915)->vm,NULL ); + vma =i915_vma_instance (obj, gt->vm,NULL );if (IS_ERR (vma)) { err =PTR_ERR (vma); goto err;
@@ -1152,7 +1160,7 @@ static struct i915_vma *recursive_batch(struct drm_i915_private *i915)__i915_gem_object_flush_map (obj,0 ,64 );i915_gem_object_unpin_map (obj); -intel_gt_chipset_flush (to_gt (i915)); +intel_gt_chipset_flush (gt);return vma;
@@ -1186,7 +1194,6 @@ static int live_all_engines(void *arg)struct intel_engine_cs *engine;struct i915_request **request;struct igt_live_test t; -struct i915_vma *batch;unsigned int idx;int err;
@@ -1204,42 +1211,44 @@ static int live_all_engines(void *arg)if (err) goto out_free; - batch =recursive_batch (i915); -if (IS_ERR (batch)) { - err =PTR_ERR (batch); -pr_err ("%s: Unable to create batch, err=%d\n" , __func__, err); - goto out_free; - } - -i915_vma_lock (batch); - idx =0 ;for_each_uabi_engine (engine, i915) { +struct i915_vma *batch; + + batch =recursive_batch (engine->gt); +if (IS_ERR (batch)) { + err =PTR_ERR (batch); +pr_err ("%s: Unable to create batch, err=%d\n" , + __func__, err); + goto out_free; + } + +i915_vma_lock (batch); request[idx] =intel_engine_create_kernel_request (engine);if (IS_ERR (request[idx])) { err =PTR_ERR (request[idx]);pr_err ("%s: Request allocation failed with err=%d\n" , __func__, err); - goto out_request; + goto out_unlock; } +GEM_BUG_ON (request[idx]->context->vm != batch->vm); err =i915_vma_move_to_active (batch, request[idx],0 );GEM_BUG_ON (err); - err = engine->emit_bb_start (request[idx], -i915_vma_offset (batch), -i915_vma_size (batch), -0 ); + err =emit_bb_start (request[idx], batch);GEM_BUG_ON (err); request[idx]->batch = batch;i915_request_get (request[idx]);i915_request_add (request[idx]); idx++; +out_unlock: +i915_vma_unlock (batch); +if (err) + goto out_request; } -i915_vma_unlock (batch); - idx =0 ;for_each_uabi_engine (engine, i915) {if (i915_request_completed (request[idx])) {
@@ -1251,17 +1260,23 @@ static int live_all_engines(void *arg) idx++; } - err =recursive_batch_resolve (batch); -if (err) { -pr_err ("%s: failed to resolve batch, err=%d\n" , __func__, err); - goto out_request; + idx =0 ; +for_each_uabi_engine (engine, i915) { + err =recursive_batch_resolve (request[idx]->batch); +if (err) { +pr_err ("%s: failed to resolve batch, err=%d\n" , + __func__, err); + goto out_request; + } + idx++; } idx =0 ;for_each_uabi_engine (engine, i915) { +struct i915_request *rq = request[idx];long timeout; - timeout =i915_request_wait (request[idx],0 , + timeout =i915_request_wait (rq,0 ,MAX_SCHEDULE_TIMEOUT );if (timeout <0 ) { err = timeout;
@@ -1270,8 +1285,10 @@ static int live_all_engines(void *arg) goto out_request; } -GEM_BUG_ON (!i915_request_completed (request[idx])); -i915_request_put (request[idx]); +GEM_BUG_ON (!i915_request_completed (rq)); +i915_vma_unpin (rq->batch); +i915_vma_put (rq->batch); +i915_request_put (rq); request[idx] =NULL ; idx++; }
@@ -1281,12 +1298,18 @@ static int live_all_engines(void *arg) out_request: idx =0 ;for_each_uabi_engine (engine, i915) { -if (request[idx]) -i915_request_put (request[idx]); +struct i915_request *rq = request[idx]; + +if (!rq) +continue ; + +if (rq->batch) { +i915_vma_unpin (rq->batch); +i915_vma_put (rq->batch); + } +i915_request_put (rq); idx++; } -i915_vma_unpin (batch); -i915_vma_put (batch); out_free:kfree (request);return err;
@@ -1322,7 +1345,7 @@ static int live_sequential_engines(void *arg)for_each_uabi_engine (engine, i915) {struct i915_vma *batch; - batch =recursive_batch (i915); + batch =recursive_batch (engine->gt);if (IS_ERR (batch)) { err =PTR_ERR (batch); pr_err("%s: Unable to create batch for %s, err=%d\n",
@@ -1338,6 +1361,7 @@ static int live_sequential_engines(void *arg) __func__, engine->name, err); goto out_unlock; } +GEM_BUG_ON (request[idx]->context->vm != batch->vm);if (prev) { err = i915_request_await_dma_fence(request[idx],
@@ -1353,10 +1377,7 @@ static int live_sequential_engines(void *arg) err =i915_vma_move_to_active (batch, request[idx],0 );GEM_BUG_ON (err); - err = engine->emit_bb_start (request[idx], -i915_vma_offset (batch), -i915_vma_size (batch), -0 ); + err =emit_bb_start (request[idx], batch);GEM_BUG_ON (err); request[idx]->batch = batch;
Signature · 1 line
2.25.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/selftests: Fix live_requests for all engines
== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Fix live_requests for all engines
URL : https://patchwork.freedesktop.org/series/114393/
State : warning
== Summary ==
Error: dim checkpatch failed323deaeadb3e drm/i915/selftests: Fix live_requests for all engines -:198: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #198: FILE: drivers/gpu/drm/i915/selftests/i915_request.c:1222:
+ pr_err("%s: Unable to create batch, err=%d\n",
+ __func__, err);
-:211: WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants #211: FILE: drivers/gpu/drm/i915/selftests/i915_request.c:1234:
+ GEM_BUG_ON(request[idx]->context->vm != batch->vm);
-:251: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #251: FILE: drivers/gpu/drm/i915/selftests/i915_request.c:1268:
+ pr_err("%s: failed to resolve batch, err=%d\n",
+ __func__, err);
-:273: WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants #273: FILE: drivers/gpu/drm/i915/selftests/i915_request.c:1288:
+ GEM_BUG_ON(!i915_request_completed(rq));
-:316: WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants #316: FILE: drivers/gpu/drm/i915/selftests/i915_request.c:1364:
+ GEM_BUG_ON(request[idx]->context->vm != batch->vm);
total: 0 errors, 3 warnings, 2 checks, 293 lines checked
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/selftests: Fix live_requests for all engines
In reply to Tejas Upadhyay== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Fix live_requests for all engines
URL : https://patchwork.freedesktop.org/series/114393/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_12779 -> Patchwork_114393v1
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_114393v1 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_114393v1, 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/Patchwork_114393v1/index.html
Participating hosts (38 -> 37)
------------------------------
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_114393v1:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@migrate:
- fi-kbl-x1275: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12779/fi-kbl-x1275/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/fi-kbl-x1275/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in Patchwork_114393v1 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_suspend@basic-s3@smem:
- bat-rpls-1: [PASS][3] -> [ABORT][4] ([i915#6687] / [i915#7978])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12779/bat-rpls-1/igt@gem_exec_suspend@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-rpls-1/igt@gem_exec_suspend@[email protected]
* igt@gem_lmem_swapping@random-engines:
- bat-adlp-6: NOTRUN -> [SKIP][5] ([i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-adlp-6/igt@[email protected]
* igt@i915_pm_rps@basic-api:
- bat-adlp-6: NOTRUN -> [SKIP][6] ([i915#6621])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-adlp-6/igt@[email protected]
* igt@i915_selftest@live@hangcheck:
- bat-dg2-9: [PASS][7] -> [DMESG-FAIL][8] ([i915#6998])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12779/bat-dg2-9/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-dg2-9/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][9] ([i915#6997])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-rpls-2/igt@i915_selftest@[email protected]
* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-rpls-2: NOTRUN -> [SKIP][10] ([i915#7828])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-rpls-2/igt@[email protected]
- bat-adlp-6: NOTRUN -> [SKIP][11] ([i915#7828])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-adlp-6/igt@[email protected]
* igt@kms_pipe_crc_basic@read-crc:
- bat-adlp-9: NOTRUN -> [SKIP][12] ([i915#3546]) +1 similar issue
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-adlp-9/igt@[email protected]
* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-rpls-2: NOTRUN -> [SKIP][13] ([i915#1845])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-rpls-2/igt@[email protected]
* igt@prime_vgem@basic-fence-read:
- bat-adlp-6: NOTRUN -> [SKIP][14] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-adlp-6/igt@[email protected]
* igt@prime_vgem@basic-userptr:
- bat-adlp-6: NOTRUN -> [SKIP][15] ([fdo#109295] / [i915#3301] / [i915#3708])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-adlp-6/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_gttfill@basic:
- fi-pnv-d510: [FAIL][16] ([i915#7229]) -> [PASS][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12779/fi-pnv-d510/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/fi-pnv-d510/igt@[email protected]
* igt@i915_pm_rpm@basic-rte:
- bat-adlp-6: [ABORT][18] ([i915#7977]) -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12779/bat-adlp-6/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-adlp-6/igt@[email protected]
* igt@i915_pm_rpm@module-reload:
- fi-bsw-n3050: [DMESG-WARN][20] ([i915#1982]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12779/fi-bsw-n3050/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/fi-bsw-n3050/igt@[email protected]
* igt@i915_selftest@live@reset:
- bat-rpls-2: [ABORT][22] ([i915#4983]) -> [PASS][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12779/bat-rpls-2/igt@i915_selftest@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-rpls-2/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@slpc:
- bat-rpls-1: [DMESG-FAIL][24] ([i915#6367] / [i915#7996]) -> [PASS][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12779/bat-rpls-1/igt@i915_selftest@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/bat-rpls-1/igt@i915_selftest@[email protected]
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
[i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
[i915#6998]: https://gitlab.freedesktop.org/drm/intel/issues/6998
[i915#7229]: https://gitlab.freedesktop.org/drm/intel/issues/7229
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7977]: https://gitlab.freedesktop.org/drm/intel/issues/7977
[i915#7978]: https://gitlab.freedesktop.org/drm/intel/issues/7978
[i915#7996]: https://gitlab.freedesktop.org/drm/intel/issues/7996
Build changes
-------------
* Linux: CI_DRM_12779 -> Patchwork_114393v1
CI-20190529: 20190529
CI_DRM_12779: c9e864cbde25141a868d6bbbb5aa6f44186bbc7f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7173: deab4e0bdf5a9366b67d0a44f478f3da3c9a943b @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114393v1: c9e864cbde25141a868d6bbbb5aa6f44186bbc7f @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
b2b22191db11 drm/i915/selftests: Fix live_requests for all engines
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v1/index.html