drm/i915/selftests: Add a GuC doorbells selftest
Subsystems (2)
PATCH v4 1/3 drm/i915/selftests: Add a GuC doorbells selftest
The first test aims to check guc_init_doorbell_hw, changing the existing guc clients and doorbells state before calling it.
The second test tries to create as many clients as it is currently possible (currently limited to max number of doorbells) and exercise the doorbell alloc/dealloc code.
Since our usage mode require very few clients/doorbells, this code has been exercised very lightly and it's good to have a simple test for it.
As reference, this test already helped identify the bug fixed by commit 7f1ea2ac3017 ("drm/i915/guc: Fix doorbell id selection").
v2: Extend number of clients; check for client allocation failure when number of doorbells is exceeded; validate client properties; reuse guc_init_doorbell_hw (Chris).
v3: guc_init_doorbell_hw test added per Chris suggestion.
v4: Try to explain why guc_init_doorbell_hw exist and comment some details in the subtest.
--- drivers/gpu/drm/i915/i915_guc_submission.c | 4 + .../gpu/drm/i915/selftests/i915_live_selftests.h | 1 + drivers/gpu/drm/i915/selftests/intel_guc.c | 362 +++++++++++++++++++++ 3 files changed, 367 insertions(+) create mode 100644 drivers/gpu/drm/i915/selftests/intel_guc.c
drivers/gpu/drm/i915/i915_guc_submission.c +4 -0
@@ -1464,3 +1464,7 @@ void i915_guc_submission_disable(struct drm_i915_private *dev_priv)guc_clients_destroy (guc); } + +#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST ) +#include "selftests/intel_guc.c" +#endif
drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1 -0
@@ -20,3 +20,4 @@ selftest(evict, i915_gem_evict_live_selftests) selftest(hugepages, i915_gem_huge_page_live_selftests) selftest(contexts, i915_gem_context_live_selftests) selftest(hangcheck, intel_hangcheck_live_selftests) +selftest (guc, intel_guc_live_selftest)
drivers/gpu/drm/i915/selftests/intel_guc.c new file +362 -0
362 lines not on this page · raw message
Signature · 6 lines
2.15.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 2/3 drm/i915/guc: Omit guc_init_doorbell_hw during driver load
During driver load we create the GuC clients and allocate their doorbells just before executing guc_init_doorbell_hw; but since we just created these doorbells, how can they be out of sync?
This code has had more than enough refactoring (2 more still in progress) so I would not be surprised if calling guc_init_doorbell_hw made sense at some point, but not anymore.
The resume path is different, in this case the driver doesn't recreate clients, and it is still reasonable to validate/reallocate the doorbells in order to confirm that they still belong to the clients.
And probably guc_init_doorbell_hw is no longer the right name, but I'll leave that to someone else.
--- drivers/gpu/drm/i915/i915_guc_submission.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +4 -4
@@ -1424,16 +1424,16 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv) }else {guc_reset_wq (guc->execbuf_client);guc_reset_wq (guc->preempt_client); + + err =guc_init_doorbell_hw (guc); +if (err) + goto err_free_clients; } err =intel_guc_sample_forcewake (guc);if (err) goto err_free_clients; - err =guc_init_doorbell_hw (guc); -if (err) - goto err_free_clients; -/* Take over from manual control of ELSP (execlists) */ guc_interrupts_capture (dev_priv);
Signature · 6 lines
2.15.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 2/3] drm/i915/guc: Omit guc_init_doorbell_hw during driver load
Quoted 7 lines · Michel Thierry
During driver load we create the GuC clients and allocate their doorbells just before executing
guc_init_doorbell_hw; but since we just created these doorbells, how can they be out of sync?
This code has had more than enough refactoring (2 more still in progress) so I would not be surprised if callingguc_init_doorbell_hwmade sense at some point, but not anymore.
I think the idea was to clean up the unallocated doorbells on takeover to be covered in case the previous occupant of the GPU didn't release them when leaving the HW. We do a full gpu reset during i915 load now in i915_gem_sanitize so the doorbell HW should be cleaned up by that, but there is still a possible issue when i915.reset=0. However, with reset=0 this wouldn't be the only thing not sanitized and the only bad consequence would be extra irqs to GuC (which would be ignored), so I don't think it is worth worrying about that case.
Daniele
Quoted 34 lines
The resume path is different, in this case the driver doesn't recreate clients, and it is still reasonable to validate/reallocate the doorbells in order to confirm that they still belong to the clients.
And probably
guc_init_doorbell_hwis no longer the right name, but I'll leave that to someone else.Signed-off-by Michel Thierry <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Sujaritha Sundaresan <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Oscar Mateo <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/i915_guc_submission.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_guc_submission.c +4
-0@@ -1424,16 +1424,16 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv) }else {guc_reset_wq (guc->execbuf_client);guc_reset_wq (guc->preempt_client); + + err =guc_init_doorbell_hw (guc); +if (err) + goto err_free_clients; } err =intel_guc_sample_forcewake (guc);
drivers/gpu/drm/i915/i915_guc_submission.c int i915_guc_submission_enable(struct drm_i915_private *dev_priv) · line 1439
Quoted 10 lines
drivers/gpu/drm/i915/i915_guc_submission.c +0
-4if (err) goto err_free_clients; - err =guc_init_doorbell_hw (guc); -if (err) - goto err_free_clients; -/* Take over from manual control of ELSP (execlists) */ guc_interrupts_capture (dev_priv);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 2/3] drm/i915/guc: Omit guc_init_doorbell_hw during driver load
In reply to Michel ThierryQuoted 10 lines · Michel Thierry
During driver load we create the GuC clients and allocate their doorbells just before executing
guc_init_doorbell_hw; but since we just created these doorbells, how can they be out of sync?
This code has had more than enough refactoring (2 more still in progress) so I would not be surprised if callingguc_init_doorbell_hwmade sense at some point, but not anymore.The resume path is different, in this case the driver doesn't recreate clients, and it is still reasonable to validate/reallocate the doorbells in order to confirm that they still belong to the clients.
Planning to change this in upcoming series (allocate doorbells on resume when not needing uc_init_hw) and then we can do away with this validation. Another problem I see is, this is time consuming and leads to increase in the resume time (we also sanitize on resume hence this is unnecessary for all unused doorbells)
Quoted 4 lines
And probably
guc_init_doorbell_hwis no longer the right name, but I'll leave that to someone else.Signed-off-by Michel Thierry <[email protected]>
Change looks good to me.
Quoted 25 lines
Cc Sagar Arun Kamble <[email protected]>Cc Sujaritha Sundaresan <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Oscar Mateo <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/i915_guc_submission.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_guc_submission.c +4
-0@@ -1424,16 +1424,16 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv) }else {guc_reset_wq (guc->execbuf_client);guc_reset_wq (guc->preempt_client); + + err =guc_init_doorbell_hw (guc); +if (err) + goto err_free_clients; } err =intel_guc_sample_forcewake (guc);
drivers/gpu/drm/i915/i915_guc_submission.c int i915_guc_submission_enable(struct drm_i915_private *dev_priv) · line 1439
Quoted 10 lines
drivers/gpu/drm/i915/i915_guc_submission.c +0
-4if (err) goto err_free_clients; - err =guc_init_doorbell_hw (guc); -if (err) - goto err_free_clients; -/* Take over from manual control of ELSP (execlists) */ guc_interrupts_capture (dev_priv);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 HAX enable GuC submission for CI
In reply to Michel ThierryFrom: Michal Wajdeczko <[email protected]>
Also revert ("drm/i915/guc: Assert that we switch between known ggtt->invalidate functions")
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 8 ++------ drivers/gpu/drm/i915/i915_params.h | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -6
@@ -3590,17 +3590,13 @@ int i915_ggtt_enable_hw(struct drm_i915_private *dev_priv)void i915_ggtt_enable_guc (struct drm_i915_private *i915) { -GEM_BUG_ON (i915->ggtt.invalidate != gen6_ggtt_invalidate); - i915->ggtt.invalidate = guc_ggtt_invalidate; }void i915_ggtt_disable_guc (struct drm_i915_private *i915) { -/* We should only be called after i915_ggtt_enable_guc() */ -GEM_BUG_ON (i915->ggtt.invalidate != guc_ggtt_invalidate); - - i915->ggtt.invalidate = gen6_ggtt_invalidate; +if (i915->ggtt.invalidate == guc_ggtt_invalidate) + i915->ggtt.invalidate = gen6_ggtt_invalidate; }void i915_gem_restore_gtt_mappings (struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_params.h +2 -2
@@ -44,8 +44,8 @@ param(int, disable_power_well, -1) \ param(int, enable_ips, 1) \ param(int, invert_brightness, 0) \ - param(int, enable_guc_loading, 0) \ - param(int, enable_guc_submission, 0) \ + param(int, enable_guc_loading, 1) \ + param(int, enable_guc_submission, 1) \ param(int, guc_log_level, -1) \ param(char *, guc_firmware_path, NULL) \param (char *, huc_firmware_path, NULL) \
Signature · 6 lines
2.15.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [v4,1/3] drm/i915/selftests: Add a GuC doorbells selftest
In reply to Michel Thierry== Series Details ==
== Series Details ==
Series: series starting with [v4,1/3] drm/i915/selftests: Add a GuC doorbells selftest
URL : https://patchwork.freedesktop.org/series/33896/
State : success
== Summary ==
Series 33896v1 series starting with [v4,1/3] drm/i915/selftests: Add a GuC doorbells selftest
https://patchwork.freedesktop.org/api/1.0/series/33896/revisions/1/mbox/
Test gem_exec_reloc:
Subgroup basic-gtt-active:
fail -> PASS (fi-gdg-551) fdo#102582 +1
Test gem_ringfill:
Subgroup basic-default-hang:
pass -> DMESG-WARN (fi-pnv-d510) fdo#101600fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:443s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:462s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:383s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:540s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:279s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:511s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:512s fi-byt-j1900 total:289 pass:254 dwarn:0 dfail:0 fail:0 skip:35 time:497s fi-byt-n2820 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:496s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:434s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:264s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:539s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:428s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:443s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:426s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:488s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:466s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:483s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:529s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:474s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:535s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:574s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:454s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:545s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:571s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:518s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:504s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:458s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:560s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:418s
Blacklisted hosts:
fi-cfl-s total:289 pass:254 dwarn:3 dfail:0 fail:0 skip:32 time:528s
fi-cnl-y failed to connect after reboot
bd5e410d0f036c80ae80e075592ee6dd90c660a8 drm-tip: 2017y-11m-15d-17h-22m-19s UTC integration manifest 9cf074373888 HAX enable GuC submission for CI8edc9934b18d drm/i915/guc: Omit guc_init_doorbell_hw during driver loadb21f9aa34707 drm/i915/selftests: Add a GuC doorbells selftest
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7149/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for series starting with [v4,1/3] drm/i915/selftests: Add a GuC doorbells selftest
In reply to Michel Thierry== Series Details ==
== Series Details ==
Series: series starting with [v4,1/3] drm/i915/selftests: Add a GuC doorbells selftest
URL : https://patchwork.freedesktop.org/series/33896/
State : warning
== Summary ==
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-pri-indfb-draw-pwrite:
pass -> SKIP (shard-hsw)
Test drv_selftest:
Subgroup mock_sanitycheck:
dmesg-warn -> PASS (shard-hsw) fdo#103719fdo#103719 https://bugs.freedesktop.org/show_bug.cgi?id=103719
shard-hsw total:2585 pass:1471 dwarn:4 dfail:1 fail:9 skip:1100 time:9508s
Blacklisted hosts:
shard-apl total:2585 pass:1617 dwarn:5 dfail:2 fail:23 skip:938 time:13553s shard-kbl total:2472 pass:1623 dwarn:7 dfail:2 fail:25 skip:812 time:10105s shard-snb total:2585 pass:1260 dwarn:2 dfail:1 fail:11 skip:1311 time:8083s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7149/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Michel Thierry (2017-11-15 18:30:27)
Quoted 19 lines
The first test aims to check
guc_init_doorbell_hw, changing the existing guc clients and doorbells state before calling it.The second test tries to create as many clients as it is currently possible (currently limited to max number of doorbells) and exercise the doorbell alloc/dealloc code.
Since our usage mode require very few clients/doorbells, this code has been exercised very lightly and it's good to have a simple test for it.
As reference, this test already helped identify the bug fixed by commit
7f1ea2ac3017("drm/i915/guc: Fix doorbell id selection").v2: Extend number of clients; check for client allocation failure when number of doorbells is exceeded; validate client properties; reuse
guc_init_doorbell_hw(Chris).v3:
guc_init_doorbell_hwtest added per Chris suggestion.
Quoted 7 lines
v4: Try to explain why
guc_init_doorbell_hwexist and comment some details in the subtest.Signed-off-by Michel Thierry <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Chris Wilson <[email protected]>
I think this is a good start. The biggest wishlist item I have for this is to mock it and so always run it (as well as then checking the hw interaction in live selftests).
drivers/gpu/drm/i915/selftests/intel_guc.c line 104
Quoted 8 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +8
-0+static int igt_guc_init_doorbell_hw (void *args) +{ +struct drm_i915_private *dev_priv = args; +struct intel_guc *guc; +DECLARE_BITMAP (db_bitmap_bk,GUC_NUM_DOORBELLS ); +int i, err =0 ; + +pr_info ("GuC init_doorbell_hw selftest\n" );
Just prior to this there is a pr_debug("igt_guc_init_doorbell_hw\n"); Hence why I feel these entry pr_info are redundant; enable debugging ;) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Michel Thierry (2017-11-15 18:30:27)
Quoted 19 lines
The first test aims to check
guc_init_doorbell_hw, changing the existing guc clients and doorbells state before calling it.The second test tries to create as many clients as it is currently possible (currently limited to max number of doorbells) and exercise the doorbell alloc/dealloc code.
Since our usage mode require very few clients/doorbells, this code has been exercised very lightly and it's good to have a simple test for it.
As reference, this test already helped identify the bug fixed by commit
7f1ea2ac3017("drm/i915/guc: Fix doorbell id selection").v2: Extend number of clients; check for client allocation failure when number of doorbells is exceeded; validate client properties; reuse
guc_init_doorbell_hw(Chris).v3:
guc_init_doorbell_hwtest added per Chris suggestion.
Quoted 7 lines
v4: Try to explain why
guc_init_doorbell_hwexist and comment some details in the subtest.Signed-off-by Michel Thierry <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Chris Wilson <[email protected]>
Rebase, resend with r-bs and lets land this monster. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 23 lines · Chris Wilson
Quoting Michel Thierry (2017-11-15 18:30:27)
Quoted 22 lines
The first test aims to check
guc_init_doorbell_hw, changing the existing guc clients and doorbells state before calling it.The second test tries to create as many clients as it is currently possible (currently limited to max number of doorbells) and exercise the doorbell alloc/dealloc code.
Since our usage mode require very few clients/doorbells, this code has been exercised very lightly and it's good to have a simple test for it.
As reference, this test already helped identify the bug fixed by commit
7f1ea2ac3017("drm/i915/guc: Fix doorbell id selection").v2: Extend number of clients; check for client allocation failure when number of doorbells is exceeded; validate client properties; reuse
guc_init_doorbell_hw(Chris).v3:
guc_init_doorbell_hwtest added per Chris suggestion.v4: Try to explain why
guc_init_doorbell_hwexist and comment some details in the subtest.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Michel Thierry <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Chris Wilson <[email protected]>Rebase, resend with r-bs and lets land this monster.
Thanks, and I will think about ways to mock this.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx