drm/i915/selftests: Add a GuC doorbells selftest
Subsystems (2)
PATCH 1/1 drm/i915/selftests: Add a GuC doorbells selftest
Try to create multiple clients (one of each kind) 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").
--- 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 | 132 +++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 drivers/gpu/drm/i915/selftests/intel_guc.c
drivers/gpu/drm/i915/i915_guc_submission.c +4 -0
@@ -1280,3 +1280,7 @@ void i915_guc_submission_disable(struct drm_i915_private *dev_priv)guc_client_free (guc->execbuf_client); guc->execbuf_client =NULL ; } + +#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST ) +#include "selftests/intel_guc.c" +#endif
drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1 -0
@@ -19,3 +19,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 +132 -0
132 lines not on this page · raw message
Signature · 6 lines
2.14.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Michel Thierry (2017-10-25 21:53:44)
Quoted 14 lines
Try to create multiple clients (one of each kind) 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").Signed-off-by Michel Thierry <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Michal Winiarski <[email protected]>---
drivers/gpu/drm/i915/selftests/intel_guc.c line 47
Quoted 6 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +6
-0+/* create a client of each type and their doorbells */ +static int igt_guc_doorbells (void *arg) +{ +struct drm_i915_private *dev_priv = arg; +struct intel_guc *guc; +struct i915_guc_client *clients[GUC_CLIENT_PRIORITY_NUM ];
Don't you actually want to test up to GUC_NUM_DOORBELLS? (-reserved?) And check failure when full?
I'm thinking an idr for the clients, that will give you an universal -EEXISTS test as well for a repeated id, as well as an easy structure to cleanup.
Quoted 11 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +11
-0+int i, err =0 ; + +DRM_INFO ("GuC Doorbells selftest\n" ); +GEM_BUG_ON (!HAS_GUC (dev_priv)); +mutex_lock (&dev_priv->drm.struct_mutex); + + guc = &dev_priv->guc; +if (!guc) { +pr_err ("No guc object!\n" ); + err = -EINVAL ; + goto unlock;
drivers/gpu/drm/i915/selftests/intel_guc.c line 68
Quoted 10 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +10
-0+ } + + err =check_all_doorbells (guc); +if (err) + goto unlock; + +for (i =0 ; i <GUC_CLIENT_PRIORITY_NUM ; i++) { + clients[i] = guc_client_alloc(dev_priv, + INTEL_INFO(dev_priv)->ring_mask, + i % GUC_CLIENT_PRIORITY_NUM,
Definitely says to me you want a larger loop :)
Quoted 1 line
+
dev_priv->kernel_context);
Is there any sanity check you want to do on the return client? Matches requested priority, ring, context? I know that seems very superficial.
Quoted 31 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +31
-0+if (!clients[i]) { +pr_err ("[%d] No guc client!\n" , i); + err = -EINVAL ; + goto out; + } + +if (i >0 && + clients[i -1 ]->doorbell_id == clients[i]->doorbell_id) { +pr_err ("doorbell ids must be unique!\n" ); + err = -EINVAL ; + goto out; + } + +/* +* Client alloc gives us a doorbell, but we want to exercise +* this ourselves. +*/ +destroy_doorbell (clients[i]); +if (clients[i]->doorbell_id !=GUC_DOORBELL_INVALID ) { +pr_err ("[%d] destroy db did not work!\n" , i); + err = -EINVAL ; + goto out; + } + + err =__reserve_doorbell (clients[i]); +if (err) { +pr_err ("Failed to reserve a doorbell\n" ); + goto out; + } + +__update_doorbell_desc (clients[i], clients[i]->doorbell_id);
drivers/gpu/drm/i915/selftests/intel_guc.c line 111
Quoted 10 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +10
-0+ err =__create_doorbell (clients[i]); +if (err) { +pr_err ("Failed to create a doorbell\n" ); + goto out; + } + + err =check_all_doorbells (guc); +if (err) + goto out; + }
I would love for something to test guc_init_doorbell_hw() to be worked into here. That function scares me :)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 44 lines · Chris Wilson
Quoting Michel Thierry (2017-10-25 21:53:44)
Quoted 14 lines
Try to create multiple clients (one of each kind) 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").Signed-off-by Michel Thierry <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Michal Winiarski <[email protected]>---
drivers/gpu/drm/i915/selftests/intel_guc.c line 47
Quoted 6 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +6
-0+/* create a client of each type and their doorbells */ +static int igt_guc_doorbells (void *arg) +{ +struct drm_i915_private *dev_priv = arg; +struct intel_guc *guc; +struct i915_guc_client *clients[GUC_CLIENT_PRIORITY_NUM ];Don't you actually want to test up to
GUC_NUM_DOORBELLS? (-reserved?) And check failure when full?I'm thinking an idr for the clients, that will give you an universal
-EEXISTStest as well for a repeated id, as well as an easy structure to cleanup.Quoted 15 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +15
-0+int i, err =0 ; + +DRM_INFO ("GuC Doorbells selftest\n" ); +GEM_BUG_ON (!HAS_GUC (dev_priv)); +mutex_lock (&dev_priv->drm.struct_mutex); + + guc = &dev_priv->guc; +if (!guc) { +pr_err ("No guc object!\n" ); + err = -EINVAL ; + goto unlock; + } + + err =check_all_doorbells (guc); +if (err)
Quoted 9 lines
drivers/gpu/drm/i915/selftests/intel_guc.c line 68
Quoted 6 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +6
-0+ goto unlock; + +for (i =0 ; i <GUC_CLIENT_PRIORITY_NUM ; i++) { + clients[i] = guc_client_alloc(dev_priv, + INTEL_INFO(dev_priv)->ring_mask, + i % GUC_CLIENT_PRIORITY_NUM,Definitely says to me you want a larger loop :)
I was trying to test doorbells not clients, but I'll expand it as you suggest.
Quoted 41 lines
Quoted 1 line
+
dev_priv->kernel_context);Is there any sanity check you want to do on the return client? Matches requested priority, ring, context? I know that seems very superficial.
Quoted 36 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +36
-0+if (!clients[i]) { +pr_err ("[%d] No guc client!\n" , i); + err = -EINVAL ; + goto out; + } + +if (i >0 && + clients[i -1 ]->doorbell_id == clients[i]->doorbell_id) { +pr_err ("doorbell ids must be unique!\n" ); + err = -EINVAL ; + goto out; + } + +/* +* Client alloc gives us a doorbell, but we want to exercise +* this ourselves. +*/ +destroy_doorbell (clients[i]); +if (clients[i]->doorbell_id !=GUC_DOORBELL_INVALID ) { +pr_err ("[%d] destroy db did not work!\n" , i); + err = -EINVAL ; + goto out; + } + + err =__reserve_doorbell (clients[i]); +if (err) { +pr_err ("Failed to reserve a doorbell\n" ); + goto out; + } + +__update_doorbell_desc (clients[i], clients[i]->doorbell_id); + err =__create_doorbell (clients[i]); +if (err) { +pr_err ("Failed to create a doorbell\n" ); + goto out; + }
Quoted 8 lines
drivers/gpu/drm/i915/selftests/intel_guc.c line 75
Quoted 5 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +5
-0+ + err =check_all_doorbells (guc); +if (err) + goto out; + }I would love for something to test
guc_init_doorbell_hw()to be worked into here. That function scares me :)
You noticed this is more less a copy of guc_init_doorbell_hw, I'll try to use it directly.
Thanks
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 26 lines · Michel Thierry
Quoted 25 lines · Chris Wilson
Quoting Michel Thierry (2017-10-25 21:53:44)
Quoted 14 lines
Try to create multiple clients (one of each kind) 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").Signed-off-by Michel Thierry <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Michal Winiarski <[email protected]>---
drivers/gpu/drm/i915/selftests/intel_guc.c line 47
Quoted 6 lines
drivers/gpu/drm/i915/selftests/intel_guc.c new file +6
-0+/* create a client of each type and their doorbells */ +static int igt_guc_doorbells (void *arg) +{ + struct drm_i915_private *dev_priv = arg; + struct intel_guc *guc; + struct i915_guc_client *clients[GUC_CLIENT_PRIORITY_NUM];Don't you actually want to test up to
GUC_NUM_DOORBELLS? (-reserved?) And check failure when full?
Quoted 4 lines
Quoted 4 lines
I'm thinking an idr for the clients, that will give you an universal
-EEXISTStest as well for a repeated id, as well as an easy structure to cleanup.
cc-ing people that may be interested,
There is already an idr for the clients, guc->stage_ids, but its max range is GUC_MAX_STAGE_DESCRIPTORS, not GUC_NUM_DOORBELLS (this is because other drivers support the idea of 'leasing doorbells' and you could have more clients than doorbells).
But we don't support that, and right now any client after GUC_NUM_DOORBELLS would be allocated but then get a -ENOSPC while creating/reserving its doorbell.
I could change the limit of guc->stage_ids idr and reject earlier, any comments?
-Michel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915/selftests: Add a GuC doorbells selftest
In reply to Michel Thierry== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Add a GuC doorbells selftest
URL : https://patchwork.freedesktop.org/series/32655/
State : failure
== Summary ==
Series 32655v1 drm/i915/selftests: Add a GuC doorbells selftest
https://patchwork.freedesktop.org/api/1.0/series/32655/revisions/1/mbox/
Test chamelium:
Subgroup dp-crc-fast:
fail -> PASS (fi-kbl-7500u) fdo#102514
Test gem_exec_suspend:
Subgroup basic-s3:
pass -> INCOMPLETE (fi-elk-e7500)
Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
fail -> PASS (fi-skl-6770hq)fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:442s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:459s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:370s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:520s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:263s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:501s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:493s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:493s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:486s fi-cfl-s total:289 pass:253 dwarn:4 dfail:0 fail:0 skip:32 time:554s fi-elk-e7500 total:118 pass:81 dwarn:0 dfail:0 fail:0 skip:36 fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:252s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:585s fi-glk-dsi total:289 pass:258 dwarn:0 dfail:0 fail:1 skip:30 time:483s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:427s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:428s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:434s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:492s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:458s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:488s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:572s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:476s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:586s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:542s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:451s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:589s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:649s 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:457s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:572s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:416s
fi-cnl-y failed to connect after reboot
be67da218126edb88de92c391a48964c89219c11 drm-tip: 2017y-10m-25d-17h-36m-48s UTC integration manifest b26366ed8b14 drm/i915/selftests: Add a GuC doorbells selftest
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6193/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915/selftests: Add a GuC doorbells selftest
In reply to Michel ThierryTry 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).
--- drivers/gpu/drm/i915/i915_guc_submission.c | 15 +- .../gpu/drm/i915/selftests/i915_live_selftests.h | 1 + drivers/gpu/drm/i915/selftests/intel_guc.c | 186 +++++++++++++++++++++ 3 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/i915/selftests/intel_guc.c
drivers/gpu/drm/i915/i915_guc_submission.c +12 -3
@@ -725,10 +725,15 @@ static int __reset_doorbell(struct i915_guc_client* client, u16 db_id)* client. Also, tell GuC about all the doorbells in use by all clients. * We do this because the KMD, the GuC and the doorbell HW can easily go out of * sync (e.g. we can reset the GuC, but not the doorbel HW). +* +* The optional test_client is a hook to use this function with multiple +* clients in the guc selftest. */ -static int guc_init_doorbell_hw (struct intel_guc *guc) +static int guc_init_doorbell_hw (struct intel_guc *guc, +struct i915_guc_client *test_client) { -struct i915_guc_client *client = guc->execbuf_client; +struct i915_guc_client *client = !test_client ? guc->execbuf_client : + test_client;bool recreate_first_client = false;u16 db_id;int ret;
@@ -1244,7 +1249,7 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)guc_reset_wq (client); - err =guc_init_doorbell_hw (guc); + err =guc_init_doorbell_hw (guc,NULL );if (err) goto err_execbuf_client;
@@ -1280,3 +1285,7 @@ void i915_guc_submission_disable(struct drm_i915_private *dev_priv)guc_client_free (guc->execbuf_client); guc->execbuf_client =NULL ; } + +#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST ) +#include "selftests/intel_guc.c" +#endif
drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1 -0
@@ -19,3 +19,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 +186 -0
186 lines not on this page · raw message
Signature · 6 lines
2.14.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Michel Thierry
Try 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.
Quoted 6 lines
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).
This will conflict with Michal's patch ("Add a second client, to be used for preemption") but I want to get feedback about reusing guc_init_doorbell_hw in the selftest.
Thanks,
Quoted 256 lines
Signed-off-by Michel Thierry <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Michal Winiarski <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/i915_guc_submission.c | 15 +- .../gpu/drm/i915/selftests/i915_live_selftests.h | 1 + drivers/gpu/drm/i915/selftests/intel_guc.c | 186 +++++++++++++++++++++ 3 files changed, 199 insertions(+), 3 deletions(-)create mode 100644
drivers/gpu/drm/i915/selftests/intel_guc.cdrivers/gpu/drm/i915/i915_guc_submission.c +12
-3@@ -725,10 +725,15 @@ static int __reset_doorbell(struct i915_guc_client* client, u16 db_id)* client. Also, tell GuC about all the doorbells in use by all clients. * We do this because the KMD, the GuC and the doorbell HW can easily go out of * sync (e.g. we can reset the GuC, but not the doorbel HW). +* +* The optional test_client is a hook to use this function with multiple +* clients in the guc selftest. */ -static int guc_init_doorbell_hw (struct intel_guc *guc) +static int guc_init_doorbell_hw (struct intel_guc *guc, +struct i915_guc_client *test_client) { -struct i915_guc_client *client = guc->execbuf_client; +struct i915_guc_client *client = !test_client ? guc->execbuf_client : + test_client;bool recreate_first_client = false;u16 db_id;int ret;@@ -1244,7 +1249,7 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)guc_reset_wq (client); - err =guc_init_doorbell_hw (guc); + err =guc_init_doorbell_hw (guc,NULL );if (err) goto err_execbuf_client;@@ -1280,3 +1285,7 @@ void i915_guc_submission_disable(struct drm_i915_private *dev_priv)guc_client_free (guc->execbuf_client); guc->execbuf_client =NULL ; } + +#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST ) +#include "selftests/intel_guc.c" +#endif drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1
-0@@ -19,3 +19,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 +186
-1@@ -0,0 +1,186 @@ +/* +* Copyright © 2017 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. +* +*/ + +#include "../i915_selftest.h" + +/* max doorbell number + negative test for each client type */ +#define ATTEMPTS (GUC_NUM_DOORBELLS + GUC_CLIENT_PRIORITY_NUM) + +struct i915_guc_client *clients[ATTEMPTS ]; + +static bool available_dbs (struct intel_guc *guc,u32 priority) +{ +unsigned long offset; +unsigned long end; +u16 id; + +/* first hal is used for normal priority, second half for high */ + offset =0 ; + end =GUC_NUM_DOORBELLS /2 ; +if (priority <=GUC_CLIENT_PRIORITY_HIGH ) { + offset = end; + end += offset; + } + + id =find_next_zero_bit (guc->doorbell_bitmap, end, offset); +if (id < end) +return true; + +return false; +} + +static int check_all_doorbells (struct intel_guc *guc) +{ +u16 db_id; + +pr_info_once ("Max number of doorbells: %d" ,GUC_NUM_DOORBELLS ); +for (db_id =0 ; db_id <GUC_NUM_DOORBELLS ; ++db_id) { +if (!doorbell_ok (guc, db_id)) { +pr_err ("doorbell %d, not ok\n" , db_id); +return -EIO ; + } + } + +return 0 ; +} + +/* +* Create as many clients as number of doorbells (note that there's already +* one client/db created during driver load). +*/ +static int igt_guc_doorbells (void *arg) +{ +struct drm_i915_private *dev_priv = arg; +struct intel_guc *guc; +int i, err =0 ; +u16 db_id; + +DRM_INFO ("GuC Doorbells selftest\n" ); +GEM_BUG_ON (!HAS_GUC (dev_priv)); +mutex_lock (&dev_priv->drm.struct_mutex); + + guc = &dev_priv->guc; +if (!guc) { +pr_err ("No guc object!\n" ); + err = -EINVAL ; + goto unlock; + } + + err =check_all_doorbells (guc); +if (err) + goto unlock; + +for (i =0 ; i <ATTEMPTS ; i++) { + clients[i] =guc_client_alloc (dev_priv, +INTEL_INFO (dev_priv)->ring_mask, + i %GUC_CLIENT_PRIORITY_NUM , + dev_priv->kernel_context); + +if (!clients[i]) { +pr_err ("[%d] No guc client\n" , i); + err = -EINVAL ; + goto out; + } + +if (IS_ERR (clients[i])) { +if (PTR_ERR (clients[i]) != -ENOSPC ) { +pr_err ("[%d] unexpected error\n" , i); + err =PTR_ERR (clients[i]); + goto out; + } + +if (available_dbs (guc, i %GUC_CLIENT_PRIORITY_NUM )) { +pr_err ("unexpected client alloc failure\n" ); + err = -EINVAL ; + goto out; + } + +/* expected, ran out of dbs for this client type */ +continue ; + } + +/* +* The check below is only valid while we keep a doorbell +* assigned during the whole life of the client. +*/ +if (clients[i]->stage_id >=GUC_NUM_DOORBELLS ) { +pr_err ("more clients than doorbells (%d >= %d)\n" , + clients[i]->id,GUC_NUM_DOORBELLS ); + err = -EINVAL ; + goto out; + } + +/* basic client sanity check */ +if (clients[i]->owner != dev_priv->kernel_context || + clients[i]->engines !=INTEL_INFO (dev_priv)->ring_mask || + clients[i]->priority != (i %GUC_CLIENT_PRIORITY_NUM ) || + clients[i]->doorbell_id ==GUC_DOORBELL_INVALID ) { +pr_err ("[%d] client_alloc sanity check failed!\n" , i); + err = -EINVAL ; + goto out; + } + + db_id = clients[i]->doorbell_id; + +/* recreate client's doorbell using existing code */ + err =guc_init_doorbell_hw (guc, clients[i]); +if (err) { +pr_err ("Failed to create a doorbell\n" ); + goto out; + } + +/* doorbell id shouldn't change, we are holding the mutex */ +if (db_id != clients[i]->doorbell_id) { +pr_err ("doorbell id changed (%d - %d)\n" , + db_id, clients[i]->doorbell_id); + err = -EINVAL ; + goto out; + } + +/* guc_init_doorbell_hw already did this, but don't trust it */ + err =check_all_doorbells (guc); +if (err) + goto out; + } + +out: +for (i =0 ; i <ATTEMPTS ; i++) +if (!IS_ERR_OR_NULL (clients[i])) +guc_client_free (clients[i]); +unlock: +mutex_unlock (&dev_priv->drm.struct_mutex); +return err; +} + +int intel_guc_live_selftest (struct drm_i915_private *dev_priv) +{ +static const struct i915_subtest tests[] = { +SUBTEST (igt_guc_doorbells), + }; + +if (!i915_modparams.enable_guc_submission) +return 0 ; + +return i915_subtests (tests, dev_priv); +} --2.14.2
Quoted 5 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Michel Thierry (2017-10-26 19:54:06)
Quoted 11 lines · Michel Thierry
Quoted 10 lines
Try 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").
Quoted 7 lines
Quoted 3 lines
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).This will conflict with Michal's patch ("Add a second client, to be used for preemption") but I want to get feedback about reusing
guc_init_doorbell_hwin the selftest.
It's more work, but I think you basically want both. You want unittests for the individual lowlevel functions, plus you want to unittest init_hw as it will typically be called after reset so a failure there may be hard to disentangle from the cause of the reset.
In essence, we want to treat the doorbell data struct as a library api and so exercise its contract (if it was easy enough, I would suggest mocking the hw interactions). And then similar at the next level, we want to look at the interface guc exposes to the driver and check that behaves as expected (that is more akin to live testing with hw).
As such, they are probably two different subtests. :) -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/1 drm/i915/selftests: Add a GuC doorbells selftest
In reply to Michel ThierryThe 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.
--- 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 | 345 +++++++++++++++++++++ 3 files changed, 350 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 +345 -0
345 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
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915/selftests: Add a GuC doorbells selftest (rev2)
In reply to Michel Thierry== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Add a GuC doorbells selftest (rev2)
URL : https://patchwork.freedesktop.org/series/32655/
State : failure
== Summary ==
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CHK scripts/mod/devicetable-offsets.h
CHK include/generated/compile.h
CHK kernel/config_data.h
CC [M] drivers/gpu/drm/i915/i915_guc_submission.o
In file included from ./include/linux/kernel.h:13:0,
from ./include/linux/list.h:8,
from ./include/linux/smp.h:11,
from ./include/linux/tracepoint.h:17,
from ./include/trace/events/dma_fence.h:7,
from drivers/gpu/drm/i915/i915_guc_submission.c:26:
drivers/gpu/drm/i915/selftests/intel_guc.c: In function ‘igt_guc_doorbells’:
drivers/gpu/drm/i915/selftests/intel_guc.c:129:21: error: ‘struct i915_guc_client’ has no member named ‘id’
clients[i]->id, GUC_NUM_DOORBELLS);
^
./include/linux/printk.h:301:33: note: in definition of macro ‘pr_err’
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~scripts/Makefile.build:313: recipe for target 'drivers/gpu/drm/i915/i915_guc_submission.o' failed make[4]: *** [drivers/gpu/drm/i915/i915_guc_submission.o] Error 1 scripts/Makefile.build:572: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:572: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:572: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1023: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/selftests: Add a GuC doorbells selftest (rev3)
In reply to Michel Thierry== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Add a GuC doorbells selftest (rev3)
URL : https://patchwork.freedesktop.org/series/32655/
State : success
== Summary ==
Series 32655v3 drm/i915/selftests: Add a GuC doorbells selftest
https://patchwork.freedesktop.org/api/1.0/series/32655/revisions/3/mbox/
Test chamelium:
Subgroup dp-crc-fast:
pass -> FAIL (fi-kbl-7500u) fdo#102514
Test gem_exec_reloc:
Subgroup basic-cpu-read-active:
pass -> FAIL (fi-gdg-551) fdo#102582 +2
Test gem_exec_suspend:
Subgroup basic-s3:
dmesg-fail -> PASS (fi-kbl-7560u) fdo#103039
Subgroup basic-s4-devices:
dmesg-fail -> PASS (fi-kbl-7560u) fdo#102846 +1
Test gem_flink_basic:
Subgroup bad-flink:
dmesg-warn -> PASS (fi-kbl-7560u) fdo#103049 +4
Test gem_linear_blits:
Subgroup basic:
incomplete -> PASS (fi-kbl-7560u) fdo#103163
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
fail -> PASS (fi-gdg-551) fdo#102618fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fdo#103039 https://bugs.freedesktop.org/show_bug.cgi?id=103039
fdo#102846 https://bugs.freedesktop.org/show_bug.cgi?id=102846
fdo#103049 https://bugs.freedesktop.org/show_bug.cgi?id=103049
fdo#103163 https://bugs.freedesktop.org/show_bug.cgi?id=103163
fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:444s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:456s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:382s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:533s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:276s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:508s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:511s fi-byt-j1900 total:289 pass:254 dwarn:0 dfail:0 fail:0 skip:35 time:496s fi-byt-n2820 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:492s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:437s fi-gdg-551 total:289 pass:175 dwarn:1 dfail:0 fail:4 skip:109 time:262s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:541s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:429s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:439s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:423s 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:469s fi-kbl-7500u total:289 pass:263 dwarn:1 dfail:0 fail:1 skip:24 time:474s fi-kbl-7560u total:245 pass:228 dwarn:0 dfail:0 fail:0 skip:16 fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:475s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:531s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:564s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:451s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:541s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:564s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:523s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:492s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:462s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:564s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:422s Blacklisted hosts: fi-cfl-s total:289 pass:254 dwarn:3 dfail:0 fail:0 skip:32 time:524s fi-cnl-y total:248 pass:223 dwarn:0 dfail:0 fail:0 skip:24 fi-glk-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:490s
6f3dca38f7a939db9658bd11d9c37357089cabef drm-tip: 2017y-11m-10d-12h-56m-44s UTC integration manifest 5628e40419c3 drm/i915/selftests: Add a GuC doorbells selftest
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7068/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for drm/i915/selftests: Add a GuC doorbells selftest (rev3)
In reply to Michel Thierry== Series Details ==
== Series Details ==
Series: drm/i915/selftests: Add a GuC doorbells selftest (rev3)
URL : https://patchwork.freedesktop.org/series/32655/
State : success
== Summary ==
Test kms_frontbuffer_tracking:
Subgroup fbc-farfromfence:
skip -> PASS (shard-hsw)
Test perf:
Subgroup blocking:
fail -> PASS (shard-hsw) fdo#102252
Test kms_flip:
Subgroup modeset-vs-vblank-race-interruptible:
fail -> PASS (shard-hsw) fdo#103060
Test kms_busy:
Subgroup extended-modeset-hang-oldfb-with-reset-render-c:
pass -> DMESG-WARN (shard-hsw) fdo#102249fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
shard-hsw total:2585 pass:1472 dwarn:3 dfail:1 fail:10 skip:1099 time:9508s
Blacklisted hosts:
shard-apl total:2585 pass:1623 dwarn:4 dfail:1 fail:21 skip:936 time:13226s shard-kbl total:2556 pass:1696 dwarn:10 dfail:0 fail:24 skip:824 time:9905s shard-snb total:2585 pass:1216 dwarn:2 dfail:1 fail:11 skip:1355 time:7908s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7068/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx