drm/i915/selftests: Fix live_requests for all engines
Subsystems (2)
PATCH v2 1/1 drm/i915/selftests: Fix live_requests for all engines
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
v3(Tejas):
- Fix dim checkpatch warnings
--- 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 (rev2)
== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Fix live_requests for all engines (rev2)
URL : https://patchwork.freedesktop.org/series/114393/
State : warning
== Summary ==
Error: dim checkpatch failed3342b504f81b drm/i915/selftests: Fix live_requests for all engines
-:213: 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 #213: FILE: drivers/gpu/drm/i915/selftests/i915_request.c:1234:
+ GEM_BUG_ON(request[idx]->context->vm != batch->vm);
-:275: 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 #275: FILE: drivers/gpu/drm/i915/selftests/i915_request.c:1288:
+ GEM_BUG_ON(!i915_request_completed(rq));
-:318: 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 #318: FILE: drivers/gpu/drm/i915/selftests/i915_request.c:1364:
+ GEM_BUG_ON(request[idx]->context->vm != batch->vm);
total: 0 errors, 3 warnings, 0 checks, 293 lines checked
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/selftests: Fix live_requests for all engines (rev2)
In reply to Tejas Upadhyay== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Fix live_requests for all engines (rev2)
URL : https://patchwork.freedesktop.org/series/114393/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_12789 -> Patchwork_114393v2
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/index.html
Participating hosts (38 -> 37)
------------------------------
Missing (1): fi-snb-2520m
Changes
-------
No changes found
Build changes
-------------
* Linux: CI_DRM_12789 -> Patchwork_114393v2
CI-20190529: 20190529
CI_DRM_12789: 8589fd9227ca62484e8599cbd62216230c2c9a64 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7174: 55642b7805d6fc5b987b396c2bbfa46db654db4f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114393v2: 8589fd9227ca62484e8599cbd62216230c2c9a64 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
a536b651f81f drm/i915/selftests: Fix live_requests for all engines
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/index.html
Patchwork
CI[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/selftests: Fix live_requests for all engines (rev2)
In reply to Tejas Upadhyay== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Fix live_requests for all engines (rev2)
URL : https://patchwork.freedesktop.org/series/114393/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_12789_full -> Patchwork_114393v2_full
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_114393v2_full absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_114393v2_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
Participating hosts (8 -> 8)
------------------------------
No changes in participating hosts
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_114393v2_full:
### IGT changes ###
#### Possible regressions ####
* igt@vgem_basic@unload:
- shard-apl: NOTRUN -> [ABORT][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/shard-apl6/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_114393v2_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_lmem_swapping@smem-oom:
- shard-apl: NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#4613])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/shard-apl6/igt@[email protected]
* igt@gem_pxp@create-regular-context-2:
- shard-apl: NOTRUN -> [SKIP][3] ([fdo#109271]) +14 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/shard-apl6/igt@[email protected]
* igt@gem_ringfill@basic-all:
- shard-apl: NOTRUN -> [ABORT][4] ([i915#8233])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/shard-apl6/igt@[email protected]
* igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc:
- shard-glk: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#3886]) +2 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/shard-glk7/igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc.html
* igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
- shard-apl: NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#3886])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/shard-apl6/igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_mc_ccs.html
* igt@kms_cursor_crc@cursor-random-max-size:
- shard-glk: NOTRUN -> [SKIP][7] ([fdo#109271]) +2 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/shard-glk7/igt@[email protected]
* igt@prime_vgem@basic-fence-read:
- shard-glk: NOTRUN -> [ABORT][8] ([i915#8233])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/shard-glk7/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3361]: https://gitlab.freedesktop.org/drm/intel/issues/3361
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#8233]: https://gitlab.freedesktop.org/drm/intel/issues/8233
Build changes
-------------
* Linux: CI_DRM_12789 -> Patchwork_114393v2
CI-20190529: 20190529
CI_DRM_12789: 8589fd9227ca62484e8599cbd62216230c2c9a64 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7174: 55642b7805d6fc5b987b396c2bbfa46db654db4f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114393v2: 8589fd9227ca62484e8599cbd62216230c2c9a64 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114393v2/index.html
Hi Tejas,
Quoted 13 lines · Tejas Upadhyay
From: Tvrtko Ursulin <[email protected]>
After the abandonment of
i915->kernel_contextand since we have started to create per-gtengine->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
- AddBUG_ONto match vm
v3(Tejas):
- Fix dim checkpatch warnings
Quoted 3 lines
Acked-by Andi Shyti <[email protected]>Signed-off-by Tvrtko Ursulin <[email protected]>Signed-off-by Tejas Upadhyay <[email protected]>
Thanks Tejas,
Andi
Hi Tejas,
Quoted 13 lines · Tejas Upadhyay
From: Tvrtko Ursulin <[email protected]>
After the abandonment of
i915->kernel_contextand since we have started to create per-gtengine->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
- AddBUG_ONto match vm
v3(Tejas):
- Fix dim checkpatch warnings
Quoted 3 lines
Acked-by Andi Shyti <[email protected]>Signed-off-by Tvrtko Ursulin <[email protected]>Signed-off-by Tejas Upadhyay <[email protected]>
pushed in drm-intel-gt-next.
Thanks,
Andi