GuC submission support
Subsystems (3)
Re: [PATCH 48/51] drm/i915/selftest: Fix hangcheck self test for GuC submission
In reply to Matthew BrostQuoted 23 lines · Matthew Brost
From: John Harrison <[email protected]>
When GuC submission is enabled, the GuC controls engine resets. Rather than explicitly triggering a reset, the driver must submit a hanging context to GuC and wait for the reset to occur.
Conversely, one of the tests specifically sends hanging batches to the engines but wants them to sit around until a manual reset of the full GT (including GuC itself). That means disabling GuC based engine resets to prevent those from killing the hanging batch too soon. So, add support to the scheduling policy helper for disabling resets as well as making them quicker!
In GuC submission mode, the 'is engine idle' test basically turns into 'is engine PM wakelock held'. Independently, there is a heartbeat disable helper function that the tests use. For unexplained reasons, this acquires the engine wakelock before disabling the heartbeat and only releases it when re-enabling the heartbeat. As one of the tests tries to do a wait for idle in the middle of a heartbeat disabled section, it is therefore guaranteed to always fail. Added a '
no_pm' variant of the heartbeat helper that allows the engine to be asleep while also having heartbeats disabled.
Quoted 2 lines
Signed-off-by John Harrison <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 634 lines
Cc Daniele Ceraolo Spurio <[email protected]>Cc Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/intel_engine_types.h | 1 + .../drm/i915/gt/selftest_engine_heartbeat.c | 22 ++ .../drm/i915/gt/selftest_engine_heartbeat.h | 2 + drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 223 +++++++++++++----- drivers/gpu/drm/i915/gt/selftest_mocs.c | 3 +- .../gpu/drm/i915/gt/selftest_workarounds.c | 6 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 3 + .../i915/selftests/intel_scheduler_helpers.c | 39 ++- .../i915/selftests/intel_scheduler_helpers.h | 9 +- 9 files changed, 237 insertions(+), 71 deletions(-)drivers/gpu/drm/i915/gt/intel_engine_types.h +1
-0@@ -449,6 +449,7 @@ struct intel_engine_cs {#define I915_ENGINE_IS_VIRTUAL BIT(5)#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(6)#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(7) +#define I915_ENGINE_WANT_FORCED_PREEMPTION BIT(8)unsigned int flags;/* drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c +22
-0@@ -405,3 +405,25 @@ void st_engine_heartbeat_enable(struct intel_engine_cs *engine) engine->props.heartbeat_interval_ms = engine->defaults.heartbeat_interval_ms; } + +void st_engine_heartbeat_disable_no_pm (struct intel_engine_cs *engine) +{ + engine->props.heartbeat_interval_ms =0 ; + +/* +* Park the heartbeat but without holding the PM lock as that +* makes the engines appear not-idle. Note that if/when unpark +* is called due to the PM lock being acquired later the +* heartbeat still won't be enabled because of the above = 0. +*/ +if (intel_engine_pm_get_if_awake (engine)) { +intel_engine_park_heartbeat (engine); +intel_engine_pm_put (engine); + } +} + +void st_engine_heartbeat_enable_no_pm (struct intel_engine_cs *engine) +{ + engine->props.heartbeat_interval_ms = + engine->defaults.heartbeat_interval_ms; +}drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.h +2
-0@@ -9,6 +9,8 @@struct intel_engine_cs ;void st_engine_heartbeat_disable (struct intel_engine_cs *engine); +void st_engine_heartbeat_disable_no_pm (struct intel_engine_cs *engine);void st_engine_heartbeat_enable (struct intel_engine_cs *engine); +void st_engine_heartbeat_enable_no_pm (struct intel_engine_cs *engine);#endif /* SELFTEST_ENGINE_HEARTBEAT_H */ drivers/gpu/drm/i915/gt/selftest_hangcheck.c +169
-54@@ -17,6 +17,8 @@#include "selftests/igt_flush_test.h" #include "selftests/igt_reset.h" #include "selftests/igt_atomic.h" +#include "selftests/igt_spinner.h" +#include "selftests/intel_scheduler_helpers.h" #include "selftests/mock_drm.h" @@ -449,6 +451,14 @@ static int igt_reset_nop_engine(void *arg)IGT_TIMEOUT (end_time);int err; +if (intel_engine_uses_guc (engine)) { +/* Engine level resets are triggered by GuC when a hang +* is detected. They can't be triggered by the KMD any +* more. Thus a nop batch cannot be used as a reset test +*/ +continue ; + } + ce =intel_context_create (engine);if (IS_ERR (ce)) {pr_err ("[%s] Create context failed: %d!\n" , engine->name, err);@@ -560,6 +570,10 @@ static int igt_reset_fail_engine(void *arg)IGT_TIMEOUT (end_time);int err; +/* Can't manually break the reset if i915 doesn't perform it */ +if (intel_engine_uses_guc (engine)) +continue ; + ce =intel_context_create (engine);if (IS_ERR (ce)) {pr_err ("[%s] Create context failed: %d!\n" , engine->name, err);@@ -699,8 +713,12 @@ static int __igt_reset_engine(struct intel_gt *gt, bool active)for_each_engine (engine, gt, id) {unsigned int reset_count, reset_engine_count;unsigned long count; +bool using_guc =intel_engine_uses_guc (engine);IGT_TIMEOUT (end_time); +if (using_guc && !active) +continue ; +if (active && !intel_engine_can_store_dword (engine))continue ;@@ -718,14 +736,23 @@ static int __igt_reset_engine(struct intel_gt *gt, bool active)set_bit (I915_RESET_ENGINE + id, >->reset.flags); count =0 ; do { - if (active) { - struct i915_request *rq; + struct i915_request *rq = NULL; + struct intel_selftest_saved_policy saved; + int err2; + + err = intel_selftest_modify_policy(engine, &saved, + SELFTEST_SCHEDULER_MODIFY_FAST_RESET); + if (err) { + pr_err("[%s] Modify policy failed: %d!\n", engine->name, err); + break; + } + if (active) { rq = hang_create_request(&h, engine); if (IS_ERR(rq)) { err = PTR_ERR(rq); pr_err("[%s] Create hang request failed: %d!\n", engine->name, err); - break; + goto restore; } i915_request_get(rq);@@ -741,34 +768,58 @@ static int __igt_reset_engine(struct intel_gt *gt, bool active)i915_request_put (rq); err = -EIO ; -break ; + goto restore; } + } -i915_request_put (rq); +if (!using_guc) { + err =intel_engine_reset (engine,NULL ); +if (err) { +pr_err ("intel_engine_reset(%s) failed, err:%d\n" , + engine->name, err); + goto skip; + } } - err =intel_engine_reset (engine,NULL ); -if (err) { -pr_err ("intel_engine_reset(%s) failed, err:%d\n" , - engine->name, err); -break ; +if (rq) { +/* Ensure the reset happens and kills the engine */ + err =intel_selftest_wait_for_rq (rq); +if (err) +pr_err ("[%s] Wait for request %lld:%lld [0x%04X] failed: %d!\n" , + engine->name, rq->fence.context, rq->fence.seqno, rq->context->guc_id, err); } +skip: +if (rq) +i915_request_put (rq); +if (i915_reset_count (global) != reset_count) {pr_err ("Full GPU reset recorded! (engine reset expected)\n" ); err = -EINVAL ; -break ; + goto restore; } -if (i915_reset_engine_count (global, engine) != - ++reset_engine_count) { -pr_err ("%s engine reset not recorded!\n" , - engine->name); - err = -EINVAL ; -break ; +/* GuC based resets are not logged per engine */ +if (!using_guc) { +if (i915_reset_engine_count (global, engine) != + ++reset_engine_count) { +pr_err ("%s engine reset not recorded!\n" , + engine->name); + err = -EINVAL ; + goto restore; + } } count++; + +restore: + err2 =intel_selftest_restore_policy (engine, &saved); +if (err2) +pr_err ("[%s] Restore policy failed: %d!\n" , engine->name, err); +if (err ==0 ) + err = err2; +if (err) +break ; }while (time_before (jiffies, end_time));clear_bit (I915_RESET_ENGINE + id, >->reset.flags);st_engine_heartbeat_enable (engine);@@ -941,10 +992,13 @@ static int __igt_reset_engines(struct intel_gt *gt,struct active_engine threads[I915_NUM_ENGINES ] = {};unsigned long device =i915_reset_count (global);unsigned long count =0 , reported; +bool using_guc =intel_engine_uses_guc (engine);IGT_TIMEOUT (end_time); -if (flags &TEST_ACTIVE && - !intel_engine_can_store_dword (engine)) +if (flags &TEST_ACTIVE ) { +if (!intel_engine_can_store_dword (engine)) +continue ; + }else if (using_guc)continue ;if (!wait_for_idle (engine)) {@@ -984,17 +1038,26 @@ static int __igt_reset_engines(struct intel_gt *gt,yield ();/* start all threads before we begin */ -st_engine_heartbeat_disable (engine); +st_engine_heartbeat_disable_no_pm (engine);set_bit (I915_RESET_ENGINE + id, >->reset.flags); do { struct i915_request *rq = NULL; + struct intel_selftest_saved_policy saved; + int err2; + + err = intel_selftest_modify_policy(engine, &saved, + SELFTEST_SCHEDULER_MODIFY_FAST_RESET); + if (err) { + pr_err("[%s] Modify policy failed: %d!\n", engine->name, err); + break; + } if (flags & TEST_ACTIVE) { rq = hang_create_request(&h, engine); if (IS_ERR(rq)) { err = PTR_ERR(rq); pr_err("[%s] Create hang request failed: %d!\n", engine->name, err); - break; + goto restore; } i915_request_get(rq);@@ -1010,15 +1073,27 @@ static int __igt_reset_engines(struct intel_gt *gt,i915_request_put (rq); err = -EIO ; -break ; + goto restore; } + }else { +intel_engine_pm_get (engine); } - err =intel_engine_reset (engine,NULL ); -if (err) { -pr_err ("i915_reset_engine(%s:%s): failed, err=%d\n" , - engine->name, test_name, err); -break ; +if (!using_guc) { + err =intel_engine_reset (engine,NULL ); +if (err) { +pr_err ("i915_reset_engine(%s:%s): failed, err=%d\n" , + engine->name, test_name, err); + goto restore; + } + } + +if (rq) { +/* Ensure the reset happens and kills the engine */ + err =intel_selftest_wait_for_rq (rq); +if (err) +pr_err ("[%s] Wait for request %lld:%lld [0x%04X] failed: %d!\n" , + engine->name, rq->fence.context, rq->fence.seqno, rq->context->guc_id, err); } count++;@@ -1035,7 +1110,7 @@ static int __igt_reset_engines(struct intel_gt *gt,GEM_TRACE_DUMP ();intel_gt_set_wedged (gt); err = -EIO ; -break ; + goto restore; }if (i915_request_wait (rq,0 ,HZ /5 ) <0 ) {@@ -1054,12 +1129,15 @@ static int __igt_reset_engines(struct intel_gt *gt,GEM_TRACE_DUMP ();intel_gt_set_wedged (gt); err = -EIO ; -break ; + goto restore; }i915_request_put (rq); } +if (!(flags &TEST_ACTIVE )) +intel_engine_pm_put (engine); +if (!(flags &TEST_SELF ) && !wait_for_idle (engine)) {struct drm_printer p =drm_info_printer (gt->i915->drm.dev);@@ -1071,22 +1149,34 @@ static int __igt_reset_engines(struct intel_gt *gt, "%s\n", engine->name); err = -EIO ; -break ; + goto restore; } + +restore: + err2 =intel_selftest_restore_policy (engine, &saved); +if (err2) +pr_err ("[%s] Restore policy failed: %d!\n" , engine->name, err2); +if (err ==0 ) + err = err2; +if (err) +break ; }while (time_before (jiffies, end_time));clear_bit (I915_RESET_ENGINE + id, >->reset.flags); -st_engine_heartbeat_enable (engine); +st_engine_heartbeat_enable_no_pm (engine);pr_info ("i915_reset_engine(%s:%s): %lu resets\n" , engine->name, test_name, count); - reported =i915_reset_engine_count (global, engine); - reported -= threads[engine->id].resets; -if (reported != count) { -pr_err ("i915_reset_engine(%s:%s): reset %lu times, but reported %lu\n" , - engine->name, test_name, count, reported); -if (!err) - err = -EINVAL ; +/* GuC based resets are not logged per engine */ +if (!using_guc) { + reported =i915_reset_engine_count (global, engine); + reported -= threads[engine->id].resets; +if (reported != count) { +pr_err ("i915_reset_engine(%s:%s): reset %lu times, but reported %lu\n" , + engine->name, test_name, count, reported); +if (!err) + err = -EINVAL ; + } } unwind:@@ -1105,15 +1195,18 @@ static int __igt_reset_engines(struct intel_gt *gt, }put_task_struct (threads[tmp].task); -if (other->uabi_class != engine->uabi_class && - threads[tmp].resets != -i915_reset_engine_count (global, other)) { -pr_err ("Innocent engine %s was reset (count=%ld)\n" , - other->name, -i915_reset_engine_count (global, other) - - threads[tmp].resets); -if (!err) - err = -EINVAL ; +/* GuC based resets are not logged per engine */ +if (!using_guc) { +if (other->uabi_class != engine->uabi_class && + threads[tmp].resets != +i915_reset_engine_count (global, other)) { +pr_err ("Innocent engine %s was reset (count=%ld)\n" , + other->name, +i915_reset_engine_count (global, other) - + threads[tmp].resets); +if (!err) + err = -EINVAL ; + } } }@@ -1553,18 +1646,29 @@ static int igt_reset_queue(void *arg) goto unlock;for_each_engine (engine, gt, id) { +struct intel_selftest_saved_policy saved;struct i915_request *prev;IGT_TIMEOUT (end_time);unsigned int count; +bool using_guc =intel_engine_uses_guc (engine);if (!intel_engine_can_store_dword (engine))continue ; +if (using_guc) { + err =intel_selftest_modify_policy (engine, &saved, +SELFTEST_SCHEDULER_MODIFY_NO_HANGCHECK ); +if (err) { +pr_err ("[%s] Modify policy failed: %d!\n" , engine->name, err); + goto fini; + } + } + prev =hang_create_request (&h, engine);if (IS_ERR (prev)) { err =PTR_ERR (prev);pr_err ("[%s] Create 'prev' hang request failed: %d!\n" , engine->name, err); - goto fini; + goto restore; }i915_request_get (prev);@@ -1579,7 +1683,7 @@ static int igt_reset_queue(void *arg)if (IS_ERR (rq)) { err =PTR_ERR (rq);pr_err ("[%s] Create hang request failed: %d!\n" , engine->name, err); - goto fini; + goto restore; }i915_request_get (rq);@@ -1604,7 +1708,7 @@ static int igt_reset_queue(void *arg)GEM_TRACE_DUMP ();intel_gt_set_wedged (gt); - goto fini; + goto restore; }if (!wait_until_running (&h, prev)) {@@ -1622,7 +1726,7 @@ static int igt_reset_queue(void *arg)intel_gt_set_wedged (gt); err = -EIO ; - goto fini; + goto restore; } reset_count =fake_hangcheck (gt,BIT (id));@@ -1633,7 +1737,7 @@ static int igt_reset_queue(void *arg)i915_request_put (rq);i915_request_put (prev); err = -EINVAL ; - goto fini; + goto restore; }if (rq->fence.error) {@@ -1642,7 +1746,7 @@ static int igt_reset_queue(void *arg)i915_request_put (rq);i915_request_put (prev); err = -EINVAL ; - goto fini; + goto restore; }if (i915_reset_count (global) == reset_count) {@@ -1650,7 +1754,7 @@ static int igt_reset_queue(void *arg)i915_request_put (rq);i915_request_put (prev); err = -EINVAL ; - goto fini; + goto restore; }i915_request_put (prev);@@ -1665,6 +1769,17 @@ static int igt_reset_queue(void *arg)i915_request_put (prev); +restore: +if (using_guc) { +int err2 =intel_selftest_restore_policy (engine, &saved); +if (err2) +pr_err ("%s:%d> [%s] Restore policy failed: %d!\n" , __func__, __LINE__, engine->name, err2); +if (err ==0 ) + err = err2; + } +if (err) + goto fini; + err =igt_flush_test (gt->i915);if (err) {pr_err ("[%s] Flush failed: %d!\n" , engine->name, err);drivers/gpu/drm/i915/gt/selftest_mocs.c +2
-1@@ -408,7 +408,8 @@ static int live_mocs_reset(void *arg)struct intel_context *ce;int err2; - err =intel_selftest_modify_policy (engine, &saved); + err =intel_selftest_modify_policy (engine, &saved, +SELFTEST_SCHEDULER_MODIFY_FAST_RESET );if (err)break ;drivers/gpu/drm/i915/gt/selftest_workarounds.c +4
-2@@ -810,7 +810,8 @@ static int live_reset_whitelist(void *arg)struct intel_selftest_saved_policy saved;int err2; - err =intel_selftest_modify_policy (engine, &saved); + err =intel_selftest_modify_policy (engine, &saved, +SELFTEST_SCHEDULER_MODIFY_FAST_RESET );if (err) goto out;@@ -1268,7 +1269,8 @@ live_engine_reset_workarounds(void *arg)int ret2;pr_info ("Verifying after %s reset...\n" , engine->name); - ret =intel_selftest_modify_policy (engine, &saved); + ret =intel_selftest_modify_policy (engine, &saved, +SELFTEST_SCHEDULER_MODIFY_FAST_RESET );if (ret)break ;drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +3
-0@@ -1235,6 +1235,9 @@ static void guc_context_policy_init(struct intel_engine_cs *engine, { desc->policy_flags =0 ; +if (engine->flags &I915_ENGINE_WANT_FORCED_PREEMPTION ) + desc->policy_flags |=CONTEXT_POLICY_FLAG_PREEMPT_TO_IDLE ; +/* NB: For both of these, zero means disabled. */ desc->execution_quantum = engine->props.timeslice_duration_ms *1000 ; desc->preemption_timeout = engine->props.preempt_timeout_ms *1000 ;drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c +26
-13@@ -16,7 +16,8 @@#define WAIT_FOR_RESET_TIME 1000int intel_selftest_modify_policy (struct intel_engine_cs *engine, -struct intel_selftest_saved_policy *saved) +struct intel_selftest_saved_policy *saved, +u32 modify_type) {int err;@@ -26,18 +27,30 @@ int intel_selftest_modify_policy(struct intel_engine_cs *engine, saved->timeslice = engine->props.timeslice_duration_ms; saved->preempt_timeout = engine->props.preempt_timeout_ms; -/* -* Enable force pre-emption on time slice expiration -* together with engine reset on pre-emption timeout. -* This is required to make the GuC notice and reset -* the single hanging context. -* Also, reduce the preemption timeout to something -* small to speed the test up. -*/ - engine->i915->params.reset =2 ; - engine->flags |=I915_ENGINE_WANT_FORCED_PREEMPTION ; - engine->props.timeslice_duration_ms =REDUCED_TIMESLICE ; - engine->props.preempt_timeout_ms =REDUCED_PREEMPT ; +switch (modify_type) { +case SELFTEST_SCHEDULER_MODIFY_FAST_RESET : +/* +* Enable force pre-emption on time slice expiration +* together with engine reset on pre-emption timeout. +* This is required to make the GuC notice and reset +* the single hanging context. +* Also, reduce the preemption timeout to something +* small to speed the test up. +*/ + engine->i915->params.reset =2 ; + engine->flags |=I915_ENGINE_WANT_FORCED_PREEMPTION ; + engine->props.timeslice_duration_ms =REDUCED_TIMESLICE ; + engine->props.preempt_timeout_ms =REDUCED_PREEMPT ; +break ; + +case SELFTEST_SCHEDULER_MODIFY_NO_HANGCHECK : + engine->props.preempt_timeout_ms =0 ; +break ; + +default : +pr_err ("Invalid scheduler policy modification type: %d!\n" , modify_type); +return -EINVAL ; + }if (!intel_engine_uses_guc (engine))return 0 ;drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h +8
-1@@ -19,8 +19,15 @@ struct intel_selftest_saved_policyu64 preempt_timeout; }; +enum selftest_scheduler_modify +{ +SELFTEST_SCHEDULER_MODIFY_NO_HANGCHECK =0 , +SELFTEST_SCHEDULER_MODIFY_FAST_RESET , +}; +int intel_selftest_modify_policy (struct intel_engine_cs *engine, -struct intel_selftest_saved_policy *saved); +struct intel_selftest_saved_policy *saved, +enum selftest_scheduler_modify modify_type);int intel_selftest_restore_policy (struct intel_engine_cs *engine,struct intel_selftest_saved_policy *saved);int intel_selftest_wait_for_rq (struct i915_request *rq);Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 49/51 drm/i915/selftest: Bump selftest timeouts for hangcheck
In reply to Matthew BrostFrom: John Harrison <[email protected]>
Some testing environments and some heavier tests are slower than previous limits allowed for. For example, it can take multiple seconds for the 'context has been reset' notification handler to reach the 'kill the requests' code in the 'active' version of the 'reset engines' test. During which time the selftest gets bored, gives up waiting and fails the test.
There is also an async thread that the selftest uses to pump work through the hardware in parallel to the context that is marked for reset. That also could get bored waiting for completions and kill the test off.
Lastly, the flush at the of various test sections can also see timeouts due to the large amount of work backed up. This is also true of the live_hwsp_read test.
--- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 2 +- drivers/gpu/drm/i915/selftests/igt_flush_test.c | 2 +- drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gt/selftest_hangcheck.c +1 -1
@@ -876,7 +876,7 @@ static int active_request_put(struct i915_request *rq)if (!rq)return 0 ; -if (i915_request_wait (rq,0 ,5 *HZ ) <0 ) { +if (i915_request_wait (rq,0 ,10 *HZ ) <0 ) { GEM_TRACE("%s timed out waiting for completion of fence %llx:%lld\n", rq->engine->name, rq->fence.context,
drivers/gpu/drm/i915/selftests/igt_flush_test.c +1 -1
@@ -19,7 +19,7 @@ int igt_flush_test(struct drm_i915_private *i915)cond_resched (); -if (intel_gt_wait_for_idle (gt,HZ /5 ) == -ETIME ) { +if (intel_gt_wait_for_idle (gt,HZ ) == -ETIME ) {pr_err ("%pS timed out, cancelling all further testing.\n" ,__builtin_return_address (0 ));
drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c +1 -1
@@ -13,7 +13,7 @@#define REDUCED_TIMESLICE 5#define REDUCED_PREEMPT 10 -#define WAIT_FOR_RESET_TIME 1000 +#define WAIT_FOR_RESET_TIME 10000 int intel_selftest_modify_policy(struct intel_engine_cs *engine, struct intel_selftest_saved_policy *saved,
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 49/51] drm/i915/selftest: Bump selftest timeouts for hangcheck
Quoted 14 lines · Matthew Brost
From: John Harrison <[email protected]>
Some testing environments and some heavier tests are slower than previous limits allowed for. For example, it can take multiple seconds for the 'context has been reset' notification handler to reach the 'kill the requests' code in the 'active' version of the 'reset engines' test. During which time the selftest gets bored, gives up waiting and fails the test.
There is also an async thread that the selftest uses to pump work through the hardware in parallel to the context that is marked for reset. That also could get bored waiting for completions and kill the test off.
Quoted 7 lines
Lastly, the flush at the of various test sections can also see timeouts due to the large amount of work backed up. This is also true of the
live_hwsp_readtest.Signed-off-by John Harrison <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>
Quoted 48 lines
--- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 2 +- drivers/gpu/drm/i915/selftests/igt_flush_test.c | 2 +- drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/gt/selftest_hangcheck.c +1
-1@@ -876,7 +876,7 @@ static int active_request_put(struct i915_request *rq)if (!rq)return 0 ; -if (i915_request_wait (rq,0 ,5 *HZ ) <0 ) { +if (i915_request_wait (rq,0 ,10 *HZ ) <0 ) { GEM_TRACE("%s timed out waiting for completion of fence %llx:%lld\n", rq->engine->name, rq->fence.context,drivers/gpu/drm/i915/selftests/igt_flush_test.c +1
-1@@ -19,7 +19,7 @@ int igt_flush_test(struct drm_i915_private *i915)cond_resched (); -if (intel_gt_wait_for_idle (gt,HZ /5 ) == -ETIME ) { +if (intel_gt_wait_for_idle (gt,HZ ) == -ETIME ) {pr_err ("%pS timed out, cancelling all further testing.\n" ,__builtin_return_address (0 ));drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c +1
-1@@ -13,7 +13,7 @@#define REDUCED_TIMESLICE 5#define REDUCED_PREEMPT 10 -#define WAIT_FOR_RESET_TIME 1000 +#define WAIT_FOR_RESET_TIME 10000 int intel_selftest_modify_policy(struct intel_engine_cs *engine, struct intel_selftest_saved_policy *saved,Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 49/51] drm/i915/selftest: Bump selftest timeouts for hangcheck
In reply to Matthew BrostQuoted 3 lines · Matthew Brost
From: John Harrison <[email protected]>
Some testing environments and some heavier tests are slower than
What testing environments are they? It's not a simulation patch which "escaped" by accident I am wondering. If not then it's just GuC which is so slow, like that other patch two steps previous in the series?
Regards,
Tvrtko
Quoted 64 lines
previous limits allowed for. For example, it can take multiple seconds for the 'context has been reset' notification handler to reach the 'kill the requests' code in the 'active' version of the 'reset engines' test. During which time the selftest gets bored, gives up waiting and fails the test.
There is also an async thread that the selftest uses to pump work through the hardware in parallel to the context that is marked for reset. That also could get bored waiting for completions and kill the test off.
Lastly, the flush at the of various test sections can also see timeouts due to the large amount of work backed up. This is also true of the
live_hwsp_readtest.Signed-off-by John Harrison <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>--- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 2 +- drivers/gpu/drm/i915/selftests/igt_flush_test.c | 2 +- drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/gt/selftest_hangcheck.c +1
-1@@ -876,7 +876,7 @@ static int active_request_put(struct i915_request *rq)if (!rq)return 0 ; -if (i915_request_wait (rq,0 ,5 *HZ ) <0 ) { +if (i915_request_wait (rq,0 ,10 *HZ ) <0 ) { GEM_TRACE("%s timed out waiting for completion of fence %llx:%lld\n", rq->engine->name, rq->fence.context,drivers/gpu/drm/i915/selftests/igt_flush_test.c +1
-1@@ -19,7 +19,7 @@ int igt_flush_test(struct drm_i915_private *i915)cond_resched (); -if (intel_gt_wait_for_idle (gt,HZ /5 ) == -ETIME ) { +if (intel_gt_wait_for_idle (gt,HZ ) == -ETIME ) {pr_err ("%pS timed out, cancelling all further testing.\n" ,__builtin_return_address (0 ));drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c +1
-1@@ -13,7 +13,7 @@#define REDUCED_TIMESLICE 5#define REDUCED_PREEMPT 10 -#define WAIT_FOR_RESET_TIME 1000 +#define WAIT_FOR_RESET_TIME 10000 int intel_selftest_modify_policy(struct intel_engine_cs *engine, struct intel_selftest_saved_policy *saved,
PATCH 50/51 drm/i915/guc: Implement GuC priority management
In reply to Matthew BrostImplement a simple static mapping algorithm of the i915 priority levels (int, -1k to 1k exposed to user) to the 4 GuC levels. Mapping is as follows:
i915 level < 0 -> GuC low level (3) i915 level == 0 -> GuC normal level (2) i915 level < INT_MAX -> GuC high level (1) i915 level == INT_MAX -> GuC highest level (0)
We believe this mapping should cover the UMD use cases (3 distinct user levels + 1 kernel level).
In addition to static mapping, a simple counter system is attached to each context tracking the number of requests inflight on the context at each level. This is needed as the GuC levels are per context while in the i915 levels are per request.
--- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 3 + drivers/gpu/drm/i915/gt/intel_context_types.h | 9 +- drivers/gpu/drm/i915/gt/intel_engine_user.c | 4 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 207 +++++++++++++++++- drivers/gpu/drm/i915/i915_request.c | 5 + drivers/gpu/drm/i915/i915_request.h | 8 + drivers/gpu/drm/i915/i915_scheduler.c | 7 + drivers/gpu/drm/i915/i915_scheduler_types.h | 12 + drivers/gpu/drm/i915/i915_trace.h | 16 +- include/uapi/drm/i915_drm.h | 9 + 10 files changed, 274 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +3 -0
@@ -245,6 +245,9 @@ static void signal_irq_work(struct irq_work *work)llist_entry (signal,typeof (*rq), signal_node);struct list_head cb_list; +if (rq->engine->sched_engine->retire_inflight_request_prio) + rq->engine->sched_engine->retire_inflight_request_prio (rq); +spin_lock (&rq->lock);list_replace (&rq->fence.cb_list, &cb_list);__dma_fence_signal__timestamp (&rq->fence, timestamp);
drivers/gpu/drm/i915/gt/intel_context_types.h +8 -1
@@ -18,8 +18,9 @@#include "intel_engine_types.h" #include "intel_sseu.h" -#define CONTEXT_REDZONE POISON_INUSE +#include "uc/intel_guc_fwif.h" +#define CONTEXT_REDZONE POISON_INUSEDECLARE_EWMA (runtime,3 ,8 );struct i915_gem_context ;
@@ -191,6 +192,12 @@ struct intel_context {/* GuC context blocked fence */ struct i915_sw_fence guc_blocked; + +/* +* GuC priority management +*/ +u8 guc_prio; + u32 guc_prio_count[GUC_CLIENT_PRIORITY_NUM]; };#endif /* __INTEL_CONTEXT_TYPES__ */
drivers/gpu/drm/i915/gt/intel_engine_user.c +4 -0
@@ -11,6 +11,7 @@#include "intel_engine.h" #include "intel_engine_user.h" #include "intel_gt.h" +#include "uc/intel_guc_submission.h" struct intel_engine_cs *intel_engine_lookup_user (struct drm_i915_private *i915,u8 class,u8 instance)
@@ -115,6 +116,9 @@ static void set_scheduler_caps(struct drm_i915_private *i915) disabled |= (I915_SCHEDULER_CAP_ENABLED |I915_SCHEDULER_CAP_PRIORITY ); +if (intel_uc_uses_guc_submission (&i915->gt.uc)) + enabled |=I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP ; +for (i =0 ; i <ARRAY_SIZE (map); i++) {if (engine->flags &BIT (map[i].engine)) enabled |=BIT (map[i].sched);
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +204 -3
314 lines not on this page · raw message
drivers/gpu/drm/i915/i915_request.c +5 -0
@@ -114,6 +114,9 @@ static void i915_fence_release(struct dma_fence *fence) {struct i915_request *rq =to_request (fence); +GEM_BUG_ON (rq->guc_prio !=GUC_PRIO_INIT && + rq->guc_prio !=GUC_PRIO_FINI ); +/* * The request is put onto a RCU freelist (i.e. the address * is immediately reused), mark the fences as being freed now.
@@ -922,6 +925,8 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp) rq->rcustate =get_state_synchronize_rcu ();/* acts as smp_mb() */ + rq->guc_prio =GUC_PRIO_INIT ; +/* We bump the ref for the fence chain */ i915_sw_fence_reinit (&i915_request_get (rq)->submit);i915_sw_fence_reinit (&i915_request_get (rq)->semaphore);
drivers/gpu/drm/i915/i915_request.h +8 -0
@@ -293,6 +293,14 @@ struct i915_request {*/ struct list_head guc_fence_link; +/** +* Priority level while the request is inflight. Differs slightly than +* i915 scheduler priority. +*/ +#define GUC_PRIO_INIT 0xff +#define GUC_PRIO_FINI 0xfe +u8 guc_prio; + I915_SELFTEST_DECLARE(struct { struct list_head link; unsigned long delay;
drivers/gpu/drm/i915/i915_scheduler.c +7 -0
@@ -241,6 +241,9 @@ static void __i915_schedule(struct i915_sched_node *node,/* Fifo and depth-first replacement ensure our deps execute before us */ sched_engine =lock_sched_engine (node, sched_engine, &cache);list_for_each_entry_safe_reverse (dep, p, &dfs, dfs_link) { +struct i915_request *from =container_of (dep->signaler, + struct i915_request, + sched);INIT_LIST_HEAD (&dep->dfs_link); node = dep->signaler;
@@ -254,6 +257,10 @@ static void __i915_schedule(struct i915_sched_node *node,GEM_BUG_ON (node_to_request (node)->engine->sched_engine != sched_engine); +/* Must be called before changing the nodes priority */ +if (sched_engine->bump_inflight_request_prio) + sched_engine->bump_inflight_request_prio (from, prio); +WRITE_ONCE (node->attr.priority, prio);/*
drivers/gpu/drm/i915/i915_scheduler_types.h +12 -0
@@ -179,6 +179,18 @@ struct i915_sched_engine {void (*kick_backend)(const struct i915_request *rq,int prio); +/** +* @bump_inflight_request_prio: update priority of an inflight request +*/ +void (*bump_inflight_request_prio)(struct i915_request *rq, +int prio); + +/** +* @retire_inflight_request_prio: indicate request is retired to +* priority tracking +*/ +void (*retire_inflight_request_prio)(struct i915_request *rq); +/** * @schedule: adjust priority of request *
drivers/gpu/drm/i915/i915_trace.h +14 -2
@@ -914,6 +914,7 @@ DECLARE_EVENT_CLASS(intel_context, __field(int, pin_count) __field(u32, sched_state) __field(u32, guc_sched_state_no_lock) +__field (u8, guc_prio) ), TP_fast_assign(
@@ -922,11 +923,17 @@ DECLARE_EVENT_CLASS(intel_context, __entry->sched_state = ce->guc_state.sched_state; __entry->guc_sched_state_no_lock =atomic_read (&ce->guc_sched_state_no_lock); + __entry->guc_prio = ce->guc_prio; ), -TP_printk ("guc_id=%d, pin_count=%d sched_state=0x%x,0x%x" , +TP_printk ("guc_id=%d, pin_count=%d sched_state=0x%x,0x%x, guc_prio=%u" , __entry->guc_id, __entry->pin_count, __entry->sched_state, - __entry->guc_sched_state_no_lock) + __entry->guc_sched_state_no_lock, __entry->guc_prio) +); + +DEFINE_EVENT (intel_context, intel_context_set_prio, + TP_PROTO(struct intel_context *ce), +TP_ARGS (ce) ); DEFINE_EVENT(intel_context, intel_context_reset,
@@ -1036,6 +1043,11 @@ trace_i915_request_out(struct i915_request *rq) { } +static inline void +trace_intel_context_set_prio (struct intel_context *ce) +{ +} +static inline void trace_intel_context_reset (struct intel_context *ce) {
include/uapi/drm/i915_drm.h +9 -0
@@ -572,6 +572,15 @@ typedef struct drm_i915_irq_wait {#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4) +/* +* Indicates the 2k user priority levels are statically mapped into 3 buckets as +* follows: +* +* -1k to -1 Low priority +* 0 Normal priority +* 1 to 1k Highest priority +*/ +#define I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP (1ul << 5)#define I915_PARAM_HUC_STATUS 42
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 50/51] drm/i915/guc: Implement GuC priority management
Quoted 9 lines · Matthew Brost
Implement a simple static mapping algorithm of the i915 priority levels (int, -1k to 1k exposed to user) to the 4 GuC levels. Mapping is as follows:
i915 level < 0 -> GuC low level (3) i915 level == 0 -> GuC normal level (2) i915 level < INT_MAX -> GuC high level (1) i915 level == INT_MAX -> GuC highest level (0)
Quoted 7 lines
We believe this mapping should cover the UMD use cases (3 distinct user levels + 1 kernel level).
In addition to static mapping, a simple counter system is attached to each context tracking the number of requests inflight on the context at each level. This is needed as the GuC levels are per context while in the i915 levels are per request.
As a general note on this patch, IMO we could do a better job of integrating context-level priority with request-level prio. However, I'm aware that this code is going to be overhauled again for drm scheduler so I'm not going to comment in that direction and I'll review the result again once the drm scheduler patches are available.
Quoted 128 lines
Signed-off-by Matthew Brost <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>--- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 3 + drivers/gpu/drm/i915/gt/intel_context_types.h | 9 +- drivers/gpu/drm/i915/gt/intel_engine_user.c | 4 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 207 +++++++++++++++++- drivers/gpu/drm/i915/i915_request.c | 5 + drivers/gpu/drm/i915/i915_request.h | 8 + drivers/gpu/drm/i915/i915_scheduler.c | 7 + drivers/gpu/drm/i915/i915_scheduler_types.h | 12 + drivers/gpu/drm/i915/i915_trace.h | 16 +- include/uapi/drm/i915_drm.h | 9 + 10 files changed, 274 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +3
-0@@ -245,6 +245,9 @@ static void signal_irq_work(struct irq_work *work)llist_entry (signal,typeof (*rq), signal_node);struct list_head cb_list; +if (rq->engine->sched_engine->retire_inflight_request_prio) + rq->engine->sched_engine->retire_inflight_request_prio (rq); +spin_lock (&rq->lock);list_replace (&rq->fence.cb_list, &cb_list);__dma_fence_signal__timestamp (&rq->fence, timestamp);drivers/gpu/drm/i915/gt/intel_context_types.h +8
-1@@ -18,8 +18,9 @@#include "intel_engine_types.h" #include "intel_sseu.h" -#define CONTEXT_REDZONE POISON_INUSE +#include "uc/intel_guc_fwif.h" +#define CONTEXT_REDZONE POISON_INUSEDECLARE_EWMA (runtime,3 ,8 );struct i915_gem_context ;@@ -191,6 +192,12 @@ struct intel_context {/* GuC context blocked fence */ struct i915_sw_fence guc_blocked; + +/* +* GuC priority management +*/ +u8 guc_prio; + u32 guc_prio_count[GUC_CLIENT_PRIORITY_NUM]; };#endif /* __INTEL_CONTEXT_TYPES__ */ drivers/gpu/drm/i915/gt/intel_engine_user.c +4
-0@@ -11,6 +11,7 @@#include "intel_engine.h" #include "intel_engine_user.h" #include "intel_gt.h" +#include "uc/intel_guc_submission.h" struct intel_engine_cs *intel_engine_lookup_user (struct drm_i915_private *i915,u8 class,u8 instance)@@ -115,6 +116,9 @@ static void set_scheduler_caps(struct drm_i915_private *i915) disabled |= (I915_SCHEDULER_CAP_ENABLED |I915_SCHEDULER_CAP_PRIORITY ); +if (intel_uc_uses_guc_submission (&i915->gt.uc)) + enabled |=I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP ; +for (i =0 ; i <ARRAY_SIZE (map); i++) {if (engine->flags &BIT (map[i].engine)) enabled |=BIT (map[i].sched);drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +21
-1@@ -81,7 +81,8 @@ guc_create_virtual(struct intel_engine_cs **siblings, unsigned int count);*/ #define SCHED_STATE_NO_LOCK_ENABLED BIT(0)#define SCHED_STATE_NO_LOCK_PENDING_ENABLE BIT(1) -#define SCHED_STATE_NO_LOCK_BLOCKED_SHIFT 2 +#define SCHED_STATE_NO_LOCK_REGISTERED BIT(2) +#define SCHED_STATE_NO_LOCK_BLOCKED_SHIFT 3#define SCHED_STATE_NO_LOCK_BLOCKED \ BIT(SCHED_STATE_NO_LOCK_BLOCKED_SHIFT)#define SCHED_STATE_NO_LOCK_BLOCKED_MASK \@@ -142,6 +143,24 @@ static inline void decr_context_blocked(struct intel_context *ce) &ce->guc_sched_state_no_lock); } +static inline bool context_registered (struct intel_context *ce) +{ +return (atomic_read (&ce->guc_sched_state_no_lock) & +SCHED_STATE_NO_LOCK_REGISTERED ); +} + +static inline void set_context_registered (struct intel_context *ce) +{ +atomic_or (SCHED_STATE_NO_LOCK_REGISTERED , + &ce->guc_sched_state_no_lock); +} + +static inline void clr_context_registered (struct intel_context *ce) +{ +atomic_and ((u32 )~SCHED_STATE_NO_LOCK_REGISTERED , + &ce->guc_sched_state_no_lock); +} +/* * Below is a set of functions which control the GuC scheduling state which * require a lock, aside from the special case where the functions are called @@ -1080,6 +1099,7 @@ static int steal_guc_id(struct intel_guc *guc)list_del_init (&ce->guc_id_link); guc_id = ce->guc_id; +clr_context_registered (ce);set_context_guc_id_invalid (ce);return guc_id; }else {
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int register_context(struct intel_context *ce, bool loop) · line 1212
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +3
-1@@ -1184,10 +1204,13 @@ static int register_context(struct intel_context *ce, bool loop)struct intel_guc *guc =ce_to_guc (ce);u32 offset =intel_guc_ggtt_offset (guc, guc->lrc_desc_pool) + ce->guc_id *sizeof (struct guc_lrc_desc ); +int ret;trace_intel_context_register (ce); -return __guc_action_register_context (guc, ce->guc_id, offset, loop); + ret =__guc_action_register_context (guc, ce->guc_id, offset, loop); +set_context_registered (ce);
Should this setting be conditional to ret == 0 ?
Quoted 87 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +39
-1+return ret; } static int __guc_action_deregister_context(struct intel_guc *guc,@@ -1243,6 +1266,8 @@ static void guc_context_policy_init(struct intel_engine_cs *engine, desc->preemption_timeout = engine->props.preempt_timeout_ms *1000 ; } +static inline u8 map_i915_prio_to_guc_prio (int prio); +static int guc_lrc_desc_pin (struct intel_context *ce,bool loop) { struct intel_runtime_pm *runtime_pm =@@ -1251,6 +1276,8 @@ static int guc_lrc_desc_pin(struct intel_context *ce, bool loop)struct intel_guc *guc = &engine->gt->uc.guc;u32 desc_idx = ce->guc_id;struct guc_lrc_desc *desc; +const struct i915_gem_context *ctx; +int prio =I915_CONTEXT_DEFAULT_PRIORITY ;bool context_registered;intel_wakeref_t wakeref;int ret =0 ;@@ -1266,6 +1293,12 @@ static int guc_lrc_desc_pin(struct intel_context *ce, bool loop) context_registered =lrc_desc_registered (guc, desc_idx); +rcu_read_lock (); + ctx =rcu_dereference (ce->gem_context); +if (ctx) + prio = ctx->sched.priority; +rcu_read_unlock (); +reset_lrc_desc (guc, desc_idx);set_lrc_desc_registered (guc, desc_idx, ce);@@ -1274,7 +1307,8 @@ static int guc_lrc_desc_pin(struct intel_context *ce, bool loop) desc->engine_submit_mask =adjust_engine_mask (engine->class, engine->mask); desc->hw_context_desc = ce->lrc.lrca; - desc->priority =GUC_CLIENT_PRIORITY_KMD_NORMAL ; + ce->guc_prio =map_i915_prio_to_guc_prio (prio); + desc->priority = ce->guc_prio; desc->context_flags =CONTEXT_REGISTRATION_FLAG_KMD ;guc_context_policy_init (engine, desc);init_sched_state (ce);@@ -1659,11 +1693,17 @@ static inline void guc_lrc_desc_unpin(struct intel_context *ce)GEM_BUG_ON (ce !=__get_context (guc, ce->guc_id));GEM_BUG_ON (context_enabled (ce)); +clr_context_registered (ce);deregister_context (ce, ce->guc_id, true); }static void __guc_context_destroy (struct intel_context *ce) { +GEM_BUG_ON (ce->guc_prio_count[GUC_CLIENT_PRIORITY_KMD_HIGH ] || + ce->guc_prio_count[GUC_CLIENT_PRIORITY_HIGH ] || + ce->guc_prio_count[GUC_CLIENT_PRIORITY_KMD_NORMAL ] || + ce->guc_prio_count[GUC_CLIENT_PRIORITY_NORMAL ]); +lrc_fini (ce);intel_context_fini (ce);@@ -1756,15 +1796,119 @@ static int guc_context_alloc(struct intel_context *ce)return lrc_alloc (ce, ce->engine); } +static void guc_context_set_prio (struct intel_guc *guc, +struct intel_context *ce, +u8 prio) +{ +u32 action[] = { +INTEL_GUC_ACTION_SET_CONTEXT_PRIORITY , + ce->guc_id, + prio, + }; + +GEM_BUG_ON (prio <GUC_CLIENT_PRIORITY_KMD_HIGH || + prio >GUC_CLIENT_PRIORITY_NORMAL ); + +if (ce->guc_prio == prio ||submission_disabled (guc) || + !context_registered (ce)) +return ; + +guc_submission_send_busy_loop (guc, action,ARRAY_SIZE (action),0 , true); + + ce->guc_prio = prio;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int guc_context_alloc(struct intel_context *ce) · line 1828
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-0+trace_intel_context_set_prio (ce); +} + +static inline u8 map_i915_prio_to_guc_prio (int prio) +{ +if (prio ==I915_PRIORITY_NORMAL ) +return GUC_CLIENT_PRIORITY_KMD_NORMAL ; +else if (prio <I915_PRIORITY_NORMAL ) +return GUC_CLIENT_PRIORITY_NORMAL ; +else if (prio !=I915_PRIORITY_BARRIER )
Shouldn't this be I915_PRIORITY_UNPREEMPTABLE?
Quoted 27 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +27
-0+return GUC_CLIENT_PRIORITY_HIGH ; + else + return GUC_CLIENT_PRIORITY_KMD_HIGH; +} + +static inline void add_context_inflight_prio (struct intel_context *ce, +u8 guc_prio) +{ +lockdep_assert_held (&ce->guc_active.lock); +GEM_BUG_ON (guc_prio >=ARRAY_SIZE (ce->guc_prio_count)); + + ++ce->guc_prio_count[guc_prio]; + +/* Overflow protection */ +GEM_WARN_ON (!ce->guc_prio_count[guc_prio]); +} + +static inline void sub_context_inflight_prio (struct intel_context *ce, +u8 guc_prio) +{ +lockdep_assert_held (&ce->guc_active.lock); +GEM_BUG_ON (guc_prio >=ARRAY_SIZE (ce->guc_prio_count)); + +/* Underflow protection */ +GEM_WARN_ON (!ce->guc_prio_count[guc_prio]); + + --ce->guc_prio_count[guc_prio];
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int guc_context_alloc(struct intel_context *ce) · line 1865
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-0+} + +static inline void update_context_prio (struct intel_context *ce) +{ +struct intel_guc *guc = &ce->engine->gt->uc.guc; +int i; + +lockdep_assert_held (&ce->guc_active.lock); + +for (i =0 ; i <ARRAY_SIZE (ce->guc_prio_count); ++i) {
This amd other loops/checks rely on the prios going from highest to lowest starting from zero. Maybe add a build check somewhere?
BUILD_BUG_ON(GUC_PRIO_KMD_HIGH != 0);BUILD_BUG_ON(GUC_PRIO_KMD_HIGH > GUC_PRIO_LOW);
Quoted 28 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +22
-0+if (ce->guc_prio_count[i]) { +guc_context_set_prio (guc, ce, i); +break ; + } + } +} + +static inline bool new_guc_prio_higher (u8 old_guc_prio,u8 new_guc_prio) +{ +/* Lower value is higher priority */ +return new_guc_prio < old_guc_prio; +} +static void add_to_context (struct i915_request *rq) {struct intel_context *ce = rq->context; +u8 new_guc_prio =map_i915_prio_to_guc_prio (rq_prio (rq)); + +GEM_BUG_ON (rq->guc_prio ==GUC_PRIO_FINI );spin_lock (&ce->guc_active.lock);list_move_tail (&rq->sched.link, &ce->guc_active.requests); + +if (rq->guc_prio ==GUC_PRIO_INIT ) { + rq->guc_prio = new_guc_prio; +add_context_inflight_prio (ce, rq->guc_prio); + }else if (new_guc_prio_higher (rq->guc_prio, new_guc_prio)) { +sub_context_inflight_prio (ce, rq->guc_prio);
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int guc_context_alloc(struct intel_context *ce) · line 1903
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +7
-0+ rq->guc_prio = new_guc_prio; +add_context_inflight_prio (ce, rq->guc_prio); + } +update_context_prio (ce); +spin_unlock (&ce->guc_active.lock); } +static void guc_prio_fini (struct i915_request *rq,struct intel_context *ce) +{
assert_spin_lock_held(&ce->guc_active.lock) ?
Quoted 131 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +65
-0+if (rq->guc_prio !=GUC_PRIO_INIT && + rq->guc_prio !=GUC_PRIO_FINI ) { +sub_context_inflight_prio (ce, rq->guc_prio); +update_context_prio (ce); + } + rq->guc_prio =GUC_PRIO_FINI ; +} +static void remove_from_context (struct i915_request *rq) {struct intel_context *ce = rq->context;@@ -1777,6 +1921,8 @@ static void remove_from_context(struct i915_request *rq)/* Prevent further __await_execution() registering a cb, then flush */ set_bit (I915_FENCE_FLAG_ACTIVE , &rq->fence.flags); +guc_prio_fini (rq, ce); +spin_unlock_irq (&ce->guc_active.lock);atomic_dec (&ce->guc_id_ref);@@ -2058,6 +2204,39 @@ static void guc_init_breadcrumbs(struct intel_engine_cs *engine) } } +static void guc_bump_inflight_request_prio (struct i915_request *rq, +int prio) +{ +struct intel_context *ce = rq->context; +u8 new_guc_prio =map_i915_prio_to_guc_prio (prio); + +/* Short circuit function */ +if (prio <I915_PRIORITY_NORMAL || + (rq->guc_prio ==GUC_PRIO_FINI ) || + (rq->guc_prio !=GUC_PRIO_INIT && + !new_guc_prio_higher (rq->guc_prio, new_guc_prio))) +return ; + +spin_lock (&ce->guc_active.lock); +if (rq->guc_prio !=GUC_PRIO_FINI ) { +if (rq->guc_prio !=GUC_PRIO_INIT ) +sub_context_inflight_prio (ce, rq->guc_prio); + rq->guc_prio = new_guc_prio; +add_context_inflight_prio (ce, rq->guc_prio); +update_context_prio (ce); + } +spin_unlock (&ce->guc_active.lock); +} + +static void guc_retire_inflight_request_prio (struct i915_request *rq) +{ +struct intel_context *ce = rq->context; + +spin_lock (&ce->guc_active.lock); +guc_prio_fini (rq, ce); +spin_unlock (&ce->guc_active.lock); +} +static void sanitize_hwsp (struct intel_engine_cs *engine) {struct intel_timeline *tl;@@ -2293,6 +2472,10 @@ int intel_guc_submission_setup(struct intel_engine_cs *engine) guc->sched_engine->disabled = guc_sched_engine_disabled; guc->sched_engine->private_data = guc; guc->sched_engine->destroy = guc_sched_engine_destroy; + guc->sched_engine->bump_inflight_request_prio = + guc_bump_inflight_request_prio; + guc->sched_engine->retire_inflight_request_prio = + guc_retire_inflight_request_prio;tasklet_setup (&guc->sched_engine->tasklet, guc_submission_tasklet); }@@ -2670,6 +2853,22 @@ void intel_guc_submission_print_info(struct intel_guc *guc,drm_printf (p,"\n" ); } +static inline void guc_log_context_priority (struct drm_printer *p, +struct intel_context *ce) +{ +int i; + +drm_printf (p,"\t\tPriority: %d\n" , + ce->guc_prio); +drm_printf (p,"\t\tNumber Requests (lower index == higher priority)\n" ); +for (i =GUC_CLIENT_PRIORITY_KMD_HIGH ; + i <GUC_CLIENT_PRIORITY_NUM ; ++i) { +drm_printf (p,"\t\tNumber requests in priority band[%d]: %d\n" , + i, ce->guc_prio_count[i]); + } +drm_printf (p,"\n" ); +} +void intel_guc_submission_print_context_info (struct intel_guc *guc,struct drm_printer *p) {@@ -2692,6 +2891,8 @@ void intel_guc_submission_print_context_info(struct intel_guc *guc,drm_printf (p,"\t\tSchedule State: 0x%x, 0x%x\n\n" , ce->guc_state.sched_state,atomic_read (&ce->guc_sched_state_no_lock)); + +guc_log_context_priority (p, ce); } }drivers/gpu/drm/i915/i915_request.c +5
-0@@ -114,6 +114,9 @@ static void i915_fence_release(struct dma_fence *fence) {struct i915_request *rq =to_request (fence); +GEM_BUG_ON (rq->guc_prio !=GUC_PRIO_INIT && + rq->guc_prio !=GUC_PRIO_FINI ); +/* * The request is put onto a RCU freelist (i.e. the address * is immediately reused), mark the fences as being freed now. @@ -922,6 +925,8 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp) rq->rcustate =get_state_synchronize_rcu ();/* acts as smp_mb() */ + rq->guc_prio =GUC_PRIO_INIT ; +/* We bump the ref for the fence chain */ i915_sw_fence_reinit (&i915_request_get (rq)->submit);i915_sw_fence_reinit (&i915_request_get (rq)->semaphore);drivers/gpu/drm/i915/i915_request.h +0
-0
drivers/gpu/drm/i915/i915_request.h struct i915_request { · line 298
Quoted 6 lines
drivers/gpu/drm/i915/i915_request.h +3
-0@@ -293,6 +293,14 @@ struct i915_request {*/ struct list_head guc_fence_link; +/** +* Priority level while the request is inflight. Differs slightly than +* i915 scheduler priority.
I'd say it differs quite a bit. Maybe refer to the comment above I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP?
Daniele
Quoted 120 lines
drivers/gpu/drm/i915/i915_request.h +5
-0+*/ +#define GUC_PRIO_INIT 0xff +#define GUC_PRIO_FINI 0xfe +u8 guc_prio; + I915_SELFTEST_DECLARE(struct { struct list_head link; unsigned long delay;drivers/gpu/drm/i915/i915_scheduler.c +7
-0@@ -241,6 +241,9 @@ static void __i915_schedule(struct i915_sched_node *node,/* Fifo and depth-first replacement ensure our deps execute before us */ sched_engine =lock_sched_engine (node, sched_engine, &cache);list_for_each_entry_safe_reverse (dep, p, &dfs, dfs_link) { +struct i915_request *from =container_of (dep->signaler, + struct i915_request, + sched);INIT_LIST_HEAD (&dep->dfs_link); node = dep->signaler;@@ -254,6 +257,10 @@ static void __i915_schedule(struct i915_sched_node *node,GEM_BUG_ON (node_to_request (node)->engine->sched_engine != sched_engine); +/* Must be called before changing the nodes priority */ +if (sched_engine->bump_inflight_request_prio) + sched_engine->bump_inflight_request_prio (from, prio); +WRITE_ONCE (node->attr.priority, prio);/* drivers/gpu/drm/i915/i915_scheduler_types.h +12
-0@@ -179,6 +179,18 @@ struct i915_sched_engine {void (*kick_backend)(const struct i915_request *rq,int prio); +/** +* @bump_inflight_request_prio: update priority of an inflight request +*/ +void (*bump_inflight_request_prio)(struct i915_request *rq, +int prio); + +/** +* @retire_inflight_request_prio: indicate request is retired to +* priority tracking +*/ +void (*retire_inflight_request_prio)(struct i915_request *rq); +/** * @schedule: adjust priority of request * drivers/gpu/drm/i915/i915_trace.h +14
-2@@ -914,6 +914,7 @@ DECLARE_EVENT_CLASS(intel_context, __field(int, pin_count) __field(u32, sched_state) __field(u32, guc_sched_state_no_lock) +__field (u8, guc_prio) ), TP_fast_assign(@@ -922,11 +923,17 @@ DECLARE_EVENT_CLASS(intel_context, __entry->sched_state = ce->guc_state.sched_state; __entry->guc_sched_state_no_lock =atomic_read (&ce->guc_sched_state_no_lock); + __entry->guc_prio = ce->guc_prio; ), -TP_printk ("guc_id=%d, pin_count=%d sched_state=0x%x,0x%x" , +TP_printk ("guc_id=%d, pin_count=%d sched_state=0x%x,0x%x, guc_prio=%u" , __entry->guc_id, __entry->pin_count, __entry->sched_state, - __entry->guc_sched_state_no_lock) + __entry->guc_sched_state_no_lock, __entry->guc_prio) +); + +DEFINE_EVENT (intel_context, intel_context_set_prio, + TP_PROTO(struct intel_context *ce), +TP_ARGS (ce) ); DEFINE_EVENT(intel_context, intel_context_reset,@@ -1036,6 +1043,11 @@ trace_i915_request_out(struct i915_request *rq) { } +static inline void +trace_intel_context_set_prio (struct intel_context *ce) +{ +} +static inline void trace_intel_context_reset (struct intel_context *ce) {include/uapi/drm/i915_drm.h +9
-0@@ -572,6 +572,15 @@ typedef struct drm_i915_irq_wait {#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4) +/* +* Indicates the 2k user priority levels are statically mapped into 3 buckets as +* follows: +* +* -1k to -1 Low priority +* 0 Normal priority +* 1 to 1k Highest priority +*/ +#define I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP (1ul << 5)#define I915_PARAM_HUC_STATUS 42
Re: [PATCH 50/51] drm/i915/guc: Implement GuC priority management
Quoted 20 lines · Daniele Ceraolo Spurio
Quoted 9 lines · Matthew Brost
Implement a simple static mapping algorithm of the i915 priority levels (int, -1k to 1k exposed to user) to the 4 GuC levels. Mapping is as follows:
i915 level < 0 -> GuC low level (3) i915 level == 0 -> GuC normal level (2) i915 level < INT_MAX -> GuC high level (1) i915 level == INT_MAX -> GuC highest level (0)Quoted 7 lines
We believe this mapping should cover the UMD use cases (3 distinct user levels + 1 kernel level).
In addition to static mapping, a simple counter system is attached to each context tracking the number of requests inflight on the context at each level. This is needed as the GuC levels are per context while in the i915 levels are per request.
Quoted 6 lines
As a general note on this patch, IMO we could do a better job of integrating context-level priority with request-level prio. However, I'm aware that this code is going to be overhauled again for drm scheduler so I'm not going to comment in that direction and I'll review the result again once the drm scheduler patches are available.
This will change a bit with DRM scheduler.
Quoted 120 lines
Quoted 120 lines
Signed-off-by Matthew Brost <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>--- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 3 + drivers/gpu/drm/i915/gt/intel_context_types.h | 9 +- drivers/gpu/drm/i915/gt/intel_engine_user.c | 4 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 207 +++++++++++++++++- drivers/gpu/drm/i915/i915_request.c | 5 + drivers/gpu/drm/i915/i915_request.h | 8 + drivers/gpu/drm/i915/i915_scheduler.c | 7 + drivers/gpu/drm/i915/i915_scheduler_types.h | 12 + drivers/gpu/drm/i915/i915_trace.h | 16 +- include/uapi/drm/i915_drm.h | 9 + 10 files changed, 274 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +3
-0@@ -245,6 +245,9 @@ static void signal_irq_work(struct irq_work *work)llist_entry (signal,typeof (*rq), signal_node);struct list_head cb_list; +if (rq->engine->sched_engine->retire_inflight_request_prio) + rq->engine->sched_engine->retire_inflight_request_prio (rq); +spin_lock (&rq->lock);list_replace (&rq->fence.cb_list, &cb_list);__dma_fence_signal__timestamp (&rq->fence, timestamp);drivers/gpu/drm/i915/gt/intel_context_types.h +8
-1@@ -18,8 +18,9 @@#include "intel_engine_types.h" #include "intel_sseu.h" -#define CONTEXT_REDZONE POISON_INUSE +#include "uc/intel_guc_fwif.h" +#define CONTEXT_REDZONE POISON_INUSEDECLARE_EWMA (runtime,3 ,8 );struct i915_gem_context ;@@ -191,6 +192,12 @@ struct intel_context {/* GuC context blocked fence */ struct i915_sw_fence guc_blocked; + +/* +* GuC priority management +*/ +u8 guc_prio; + u32 guc_prio_count[GUC_CLIENT_PRIORITY_NUM]; };#endif /* __INTEL_CONTEXT_TYPES__ */ drivers/gpu/drm/i915/gt/intel_engine_user.c +4
-0@@ -11,6 +11,7 @@#include "intel_engine.h" #include "intel_engine_user.h" #include "intel_gt.h" +#include "uc/intel_guc_submission.h" struct intel_engine_cs *intel_engine_lookup_user (struct drm_i915_private *i915,u8 class,u8 instance)@@ -115,6 +116,9 @@ static void set_scheduler_caps(struct drm_i915_private *i915) disabled |= (I915_SCHEDULER_CAP_ENABLED |I915_SCHEDULER_CAP_PRIORITY ); +if (intel_uc_uses_guc_submission (&i915->gt.uc)) + enabled |=I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP ; +for (i =0 ; i <ARRAY_SIZE (map); i++) {if (engine->flags &BIT (map[i].engine)) enabled |=BIT (map[i].sched);drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +21
-1@@ -81,7 +81,8 @@ guc_create_virtual(struct intel_engine_cs **siblings, unsigned int count);*/ #define SCHED_STATE_NO_LOCK_ENABLED BIT(0)#define SCHED_STATE_NO_LOCK_PENDING_ENABLE BIT(1) -#define SCHED_STATE_NO_LOCK_BLOCKED_SHIFT 2 +#define SCHED_STATE_NO_LOCK_REGISTERED BIT(2) +#define SCHED_STATE_NO_LOCK_BLOCKED_SHIFT 3#define SCHED_STATE_NO_LOCK_BLOCKED \ BIT(SCHED_STATE_NO_LOCK_BLOCKED_SHIFT)#define SCHED_STATE_NO_LOCK_BLOCKED_MASK \@@ -142,6 +143,24 @@ static inline void decr_context_blocked(struct intel_context *ce) &ce->guc_sched_state_no_lock); } +static inline bool context_registered (struct intel_context *ce) +{ +return (atomic_read (&ce->guc_sched_state_no_lock) & +SCHED_STATE_NO_LOCK_REGISTERED ); +} + +static inline void set_context_registered (struct intel_context *ce) +{ +atomic_or (SCHED_STATE_NO_LOCK_REGISTERED , + &ce->guc_sched_state_no_lock); +} + +static inline void clr_context_registered (struct intel_context *ce) +{ +atomic_and ((u32 )~SCHED_STATE_NO_LOCK_REGISTERED , + &ce->guc_sched_state_no_lock); +} +/* * Below is a set of functions which control the GuC scheduling state which * require a lock, aside from the special case where the functions are called @@ -1080,6 +1099,7 @@ static int steal_guc_id(struct intel_guc *guc)list_del_init (&ce->guc_id_link); guc_id = ce->guc_id; +clr_context_registered (ce);set_context_guc_id_invalid (ce);return guc_id; }else {@@ -1184,10 +1204,13 @@ static int register_context(struct intel_context *ce, bool loop)struct intel_guc *guc =ce_to_guc (ce); u32 offset = intel_guc_ggtt_offset(guc, guc->lrc_desc_pool) +
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int register_context(struct intel_context *ce, bool loop) · line 1212
Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +3
-1ce->guc_id *sizeof (struct guc_lrc_desc ); +int ret;trace_intel_context_register (ce); -return __guc_action_register_context (guc, ce->guc_id, offset, loop); + ret =__guc_action_register_context (guc, ce->guc_id, offset, loop); +set_context_registered (ce);Should this setting be conditional to ret == 0 ?
Yep.
Quoted 82 lines
Quoted 82 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +43
-1+return ret; } static int __guc_action_deregister_context(struct intel_guc *guc,@@ -1243,6 +1266,8 @@ static void guc_context_policy_init(struct intel_engine_cs *engine, desc->preemption_timeout = engine->props.preempt_timeout_ms *1000 ; } +static inline u8 map_i915_prio_to_guc_prio (int prio); +static int guc_lrc_desc_pin (struct intel_context *ce,bool loop) { struct intel_runtime_pm *runtime_pm =@@ -1251,6 +1276,8 @@ static int guc_lrc_desc_pin(struct intel_context *ce, bool loop)struct intel_guc *guc = &engine->gt->uc.guc;u32 desc_idx = ce->guc_id;struct guc_lrc_desc *desc; +const struct i915_gem_context *ctx; +int prio =I915_CONTEXT_DEFAULT_PRIORITY ;bool context_registered;intel_wakeref_t wakeref;int ret =0 ;@@ -1266,6 +1293,12 @@ static int guc_lrc_desc_pin(struct intel_context *ce, bool loop) context_registered =lrc_desc_registered (guc, desc_idx); +rcu_read_lock (); + ctx =rcu_dereference (ce->gem_context); +if (ctx) + prio = ctx->sched.priority; +rcu_read_unlock (); +reset_lrc_desc (guc, desc_idx);set_lrc_desc_registered (guc, desc_idx, ce);@@ -1274,7 +1307,8 @@ static int guc_lrc_desc_pin(struct intel_context *ce, bool loop) desc->engine_submit_mask =adjust_engine_mask (engine->class, engine->mask); desc->hw_context_desc = ce->lrc.lrca; - desc->priority =GUC_CLIENT_PRIORITY_KMD_NORMAL ; + ce->guc_prio =map_i915_prio_to_guc_prio (prio); + desc->priority = ce->guc_prio; desc->context_flags =CONTEXT_REGISTRATION_FLAG_KMD ;guc_context_policy_init (engine, desc);init_sched_state (ce);@@ -1659,11 +1693,17 @@ static inline void guc_lrc_desc_unpin(struct intel_context *ce)GEM_BUG_ON (ce !=__get_context (guc, ce->guc_id));GEM_BUG_ON (context_enabled (ce)); +clr_context_registered (ce);deregister_context (ce, ce->guc_id, true); }static void __guc_context_destroy (struct intel_context *ce) { +GEM_BUG_ON (ce->guc_prio_count[GUC_CLIENT_PRIORITY_KMD_HIGH ] || + ce->guc_prio_count[GUC_CLIENT_PRIORITY_HIGH ] || + ce->guc_prio_count[GUC_CLIENT_PRIORITY_KMD_NORMAL ] || + ce->guc_prio_count[GUC_CLIENT_PRIORITY_NORMAL ]); +lrc_fini (ce);intel_context_fini (ce);@@ -1756,15 +1796,119 @@ static int guc_context_alloc(struct intel_context *ce)return lrc_alloc (ce, ce->engine); } +static void guc_context_set_prio (struct intel_guc *guc, +struct intel_context *ce, +u8 prio) +{ +u32 action[] = { +INTEL_GUC_ACTION_SET_CONTEXT_PRIORITY , + ce->guc_id, + prio, + }; + +GEM_BUG_ON (prio <GUC_CLIENT_PRIORITY_KMD_HIGH || + prio >GUC_CLIENT_PRIORITY_NORMAL ); + +if (ce->guc_prio == prio ||submission_disabled (guc) || + !context_registered (ce)) +return ; + +guc_submission_send_busy_loop (guc, action,ARRAY_SIZE (action),0 , true); + + ce->guc_prio = prio; +trace_intel_context_set_prio (ce); +} + +static inline u8 map_i915_prio_to_guc_prio (int prio)
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int guc_context_alloc(struct intel_context *ce) · line 1828
Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +6
-0+{ +if (prio ==I915_PRIORITY_NORMAL ) +return GUC_CLIENT_PRIORITY_KMD_NORMAL ; +else if (prio <I915_PRIORITY_NORMAL ) +return GUC_CLIENT_PRIORITY_NORMAL ; +else if (prio !=I915_PRIORITY_BARRIER )Shouldn't this be
I915_PRIORITY_UNPREEMPTABLE?
No, I915_PRIORITY_UNPREEMPTABLE is an execlists only concept.
Quoted 41 lines
Quoted 27 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +27
-0+return GUC_CLIENT_PRIORITY_HIGH ; + else + return GUC_CLIENT_PRIORITY_KMD_HIGH; +} + +static inline void add_context_inflight_prio (struct intel_context *ce, +u8 guc_prio) +{ +lockdep_assert_held (&ce->guc_active.lock); +GEM_BUG_ON (guc_prio >=ARRAY_SIZE (ce->guc_prio_count)); + + ++ce->guc_prio_count[guc_prio]; + +/* Overflow protection */ +GEM_WARN_ON (!ce->guc_prio_count[guc_prio]); +} + +static inline void sub_context_inflight_prio (struct intel_context *ce, +u8 guc_prio) +{ +lockdep_assert_held (&ce->guc_active.lock); +GEM_BUG_ON (guc_prio >=ARRAY_SIZE (ce->guc_prio_count)); + +/* Underflow protection */ +GEM_WARN_ON (!ce->guc_prio_count[guc_prio]); + + --ce->guc_prio_count[guc_prio];drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int guc_context_alloc(struct intel_context *ce) · line 1865
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-0+} + +static inline void update_context_prio (struct intel_context *ce) +{ +struct intel_guc *guc = &ce->engine->gt->uc.guc; +int i; + +lockdep_assert_held (&ce->guc_active.lock); + +for (i =0 ; i <ARRAY_SIZE (ce->guc_prio_count); ++i) {This amd other loops/checks rely on the prios going from highest to lowest starting from zero. Maybe add a build check somewhere?
Quoted 3 lines
BUILD_BUG_ON(GUC_PRIO_KMD_HIGH != 0);BUILD_BUG_ON(GUC_PRIO_KMD_HIGH > GUC_PRIO_LOW);
Good idea.
Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +25
-0+if (ce->guc_prio_count[i]) { +guc_context_set_prio (guc, ce, i); +break ; + } + } +} + +static inline bool new_guc_prio_higher (u8 old_guc_prio,u8 new_guc_prio) +{ +/* Lower value is higher priority */ +return new_guc_prio < old_guc_prio; +} +static void add_to_context (struct i915_request *rq) {struct intel_context *ce = rq->context; +u8 new_guc_prio =map_i915_prio_to_guc_prio (rq_prio (rq)); + +GEM_BUG_ON (rq->guc_prio ==GUC_PRIO_FINI );spin_lock (&ce->guc_active.lock);list_move_tail (&rq->sched.link, &ce->guc_active.requests); + +if (rq->guc_prio ==GUC_PRIO_INIT ) { + rq->guc_prio = new_guc_prio; +add_context_inflight_prio (ce, rq->guc_prio); + }else if (new_guc_prio_higher (rq->guc_prio, new_guc_prio)) { +sub_context_inflight_prio (ce, rq->guc_prio); + rq->guc_prio = new_guc_prio; +add_context_inflight_prio (ce, rq->guc_prio); + }
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int guc_context_alloc(struct intel_context *ce) · line 1903
Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +4
-0+update_context_prio (ce); +spin_unlock (&ce->guc_active.lock); } +static void guc_prio_fini (struct i915_request *rq,struct intel_context *ce) +{
assert_spin_lock_held(&ce->guc_active.lock)?
Why not.
Quoted 123 lines
Quoted 123 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +65
-0+if (rq->guc_prio !=GUC_PRIO_INIT && + rq->guc_prio !=GUC_PRIO_FINI ) { +sub_context_inflight_prio (ce, rq->guc_prio); +update_context_prio (ce); + } + rq->guc_prio =GUC_PRIO_FINI ; +} +static void remove_from_context (struct i915_request *rq) {struct intel_context *ce = rq->context;@@ -1777,6 +1921,8 @@ static void remove_from_context(struct i915_request *rq)/* Prevent further __await_execution() registering a cb, then flush */ set_bit (I915_FENCE_FLAG_ACTIVE , &rq->fence.flags); +guc_prio_fini (rq, ce); +spin_unlock_irq (&ce->guc_active.lock);atomic_dec (&ce->guc_id_ref);@@ -2058,6 +2204,39 @@ static void guc_init_breadcrumbs(struct intel_engine_cs *engine) } } +static void guc_bump_inflight_request_prio (struct i915_request *rq, +int prio) +{ +struct intel_context *ce = rq->context; +u8 new_guc_prio =map_i915_prio_to_guc_prio (prio); + +/* Short circuit function */ +if (prio <I915_PRIORITY_NORMAL || + (rq->guc_prio ==GUC_PRIO_FINI ) || + (rq->guc_prio !=GUC_PRIO_INIT && + !new_guc_prio_higher (rq->guc_prio, new_guc_prio))) +return ; + +spin_lock (&ce->guc_active.lock); +if (rq->guc_prio !=GUC_PRIO_FINI ) { +if (rq->guc_prio !=GUC_PRIO_INIT ) +sub_context_inflight_prio (ce, rq->guc_prio); + rq->guc_prio = new_guc_prio; +add_context_inflight_prio (ce, rq->guc_prio); +update_context_prio (ce); + } +spin_unlock (&ce->guc_active.lock); +} + +static void guc_retire_inflight_request_prio (struct i915_request *rq) +{ +struct intel_context *ce = rq->context; + +spin_lock (&ce->guc_active.lock); +guc_prio_fini (rq, ce); +spin_unlock (&ce->guc_active.lock); +} +static void sanitize_hwsp (struct intel_engine_cs *engine) {struct intel_timeline *tl;@@ -2293,6 +2472,10 @@ int intel_guc_submission_setup(struct intel_engine_cs *engine) guc->sched_engine->disabled = guc_sched_engine_disabled; guc->sched_engine->private_data = guc; guc->sched_engine->destroy = guc_sched_engine_destroy; + guc->sched_engine->bump_inflight_request_prio = + guc_bump_inflight_request_prio; + guc->sched_engine->retire_inflight_request_prio = + guc_retire_inflight_request_prio;tasklet_setup (&guc->sched_engine->tasklet, guc_submission_tasklet); }@@ -2670,6 +2853,22 @@ void intel_guc_submission_print_info(struct intel_guc *guc,drm_printf (p,"\n" ); } +static inline void guc_log_context_priority (struct drm_printer *p, +struct intel_context *ce) +{ +int i; + +drm_printf (p,"\t\tPriority: %d\n" , + ce->guc_prio); +drm_printf (p,"\t\tNumber Requests (lower index == higher priority)\n" ); +for (i =GUC_CLIENT_PRIORITY_KMD_HIGH ; + i <GUC_CLIENT_PRIORITY_NUM ; ++i) { +drm_printf (p,"\t\tNumber requests in priority band[%d]: %d\n" , + i, ce->guc_prio_count[i]); + } +drm_printf (p,"\n" ); +} +void intel_guc_submission_print_context_info (struct intel_guc *guc,struct drm_printer *p) {@@ -2692,6 +2891,8 @@ void intel_guc_submission_print_context_info(struct intel_guc *guc,drm_printf (p,"\t\tSchedule State: 0x%x, 0x%x\n\n" , ce->guc_state.sched_state,atomic_read (&ce->guc_sched_state_no_lock)); + +guc_log_context_priority (p, ce); } }drivers/gpu/drm/i915/i915_request.c +5
-0@@ -114,6 +114,9 @@ static void i915_fence_release(struct dma_fence *fence) {struct i915_request *rq =to_request (fence); +GEM_BUG_ON (rq->guc_prio !=GUC_PRIO_INIT && + rq->guc_prio !=GUC_PRIO_FINI ); +/* * The request is put onto a RCU freelist (i.e. the address * is immediately reused), mark the fences as being freed now. @@ -922,6 +925,8 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp) rq->rcustate =get_state_synchronize_rcu ();/* acts as smp_mb() */ + rq->guc_prio =GUC_PRIO_INIT ; +/* We bump the ref for the fence chain */ i915_sw_fence_reinit (&i915_request_get (rq)->submit);i915_sw_fence_reinit (&i915_request_get (rq)->semaphore);drivers/gpu/drm/i915/i915_request.h +0
-0@@ -293,6 +293,14 @@ struct i915_request {
Quoted 9 lines
drivers/gpu/drm/i915/i915_request.h struct i915_request { · line 298
Quoted 5 lines
drivers/gpu/drm/i915/i915_request.h +3
-0*/ struct list_head guc_fence_link; +/** +* Priority level while the request is inflight. Differs slightly than +* i915 scheduler priority. I'd say it differs quite a bit. Maybe refer to the comment above
I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP?
Sure.
Matt
Quoted 104 lines
Daniele
Quoted 102 lines
drivers/gpu/drm/i915/i915_request.h +5
-0+*/ +#define GUC_PRIO_INIT 0xff +#define GUC_PRIO_FINI 0xfe +u8 guc_prio; + I915_SELFTEST_DECLARE(struct { struct list_head link; unsigned long delay;drivers/gpu/drm/i915/i915_scheduler.c +7
-0@@ -241,6 +241,9 @@ static void __i915_schedule(struct i915_sched_node *node,/* Fifo and depth-first replacement ensure our deps execute before us */ sched_engine =lock_sched_engine (node, sched_engine, &cache);list_for_each_entry_safe_reverse (dep, p, &dfs, dfs_link) { +struct i915_request *from =container_of (dep->signaler, + struct i915_request, + sched);INIT_LIST_HEAD (&dep->dfs_link); node = dep->signaler;@@ -254,6 +257,10 @@ static void __i915_schedule(struct i915_sched_node *node,GEM_BUG_ON (node_to_request (node)->engine->sched_engine != sched_engine); +/* Must be called before changing the nodes priority */ +if (sched_engine->bump_inflight_request_prio) + sched_engine->bump_inflight_request_prio (from, prio); +WRITE_ONCE (node->attr.priority, prio);/* drivers/gpu/drm/i915/i915_scheduler_types.h +12
-0@@ -179,6 +179,18 @@ struct i915_sched_engine {void (*kick_backend)(const struct i915_request *rq,int prio); +/** +* @bump_inflight_request_prio: update priority of an inflight request +*/ +void (*bump_inflight_request_prio)(struct i915_request *rq, +int prio); + +/** +* @retire_inflight_request_prio: indicate request is retired to +* priority tracking +*/ +void (*retire_inflight_request_prio)(struct i915_request *rq); +/** * @schedule: adjust priority of request * drivers/gpu/drm/i915/i915_trace.h +14
-2@@ -914,6 +914,7 @@ DECLARE_EVENT_CLASS(intel_context, __field(int, pin_count) __field(u32, sched_state) __field(u32, guc_sched_state_no_lock) +__field (u8, guc_prio) ), TP_fast_assign(@@ -922,11 +923,17 @@ DECLARE_EVENT_CLASS(intel_context, __entry->sched_state = ce->guc_state.sched_state; __entry->guc_sched_state_no_lock =atomic_read (&ce->guc_sched_state_no_lock); + __entry->guc_prio = ce->guc_prio; ), -TP_printk ("guc_id=%d, pin_count=%d sched_state=0x%x,0x%x" , +TP_printk ("guc_id=%d, pin_count=%d sched_state=0x%x,0x%x, guc_prio=%u" , __entry->guc_id, __entry->pin_count, __entry->sched_state, - __entry->guc_sched_state_no_lock) + __entry->guc_sched_state_no_lock, __entry->guc_prio) +); + +DEFINE_EVENT (intel_context, intel_context_set_prio, + TP_PROTO(struct intel_context *ce), +TP_ARGS (ce) ); DEFINE_EVENT(intel_context, intel_context_reset,@@ -1036,6 +1043,11 @@ trace_i915_request_out(struct i915_request *rq) { } +static inline void +trace_intel_context_set_prio (struct intel_context *ce) +{ +} +static inline void trace_intel_context_reset (struct intel_context *ce) {include/uapi/drm/i915_drm.h +2
-0@@ -572,6 +572,15 @@ typedef struct drm_i915_irq_wait {#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4) +/* +* Indicates the 2k user priority levels are statically mapped into 3 buckets as
Quoted 9 lines
include/uapi/drm/i915_drm.h typedef struct drm_i915_irq_wait { · line 585
Quoted 8 lines
include/uapi/drm/i915_drm.h +7
-0+* follows: +* +* -1k to -1 Low priority +* 0 Normal priority +* 1 to 1k Highest priority +*/ +#define I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP (1ul << 5)#define I915_PARAM_HUC_STATUS 42
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 50/51] drm/i915/guc: Implement GuC priority management
<snip>
Quoted 35 lines
Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +23
-0@@ -1756,15 +1796,119 @@ static int guc_context_alloc(struct intel_context *ce)return lrc_alloc (ce, ce->engine); } +static void guc_context_set_prio (struct intel_guc *guc, +struct intel_context *ce, +u8 prio) +{ +u32 action[] = { +INTEL_GUC_ACTION_SET_CONTEXT_PRIORITY , + ce->guc_id, + prio, + }; + +GEM_BUG_ON (prio <GUC_CLIENT_PRIORITY_KMD_HIGH || + prio >GUC_CLIENT_PRIORITY_NORMAL ); + +if (ce->guc_prio == prio ||submission_disabled (guc) || + !context_registered (ce)) +return ; + +guc_submission_send_busy_loop (guc, action,ARRAY_SIZE (action),0 , true); + + ce->guc_prio = prio; +trace_intel_context_set_prio (ce); +} +Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int guc_context_alloc(struct intel_context *ce) · line 1828
Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +7
-0+static inline u8 map_i915_prio_to_guc_prio (int prio) +{ +if (prio ==I915_PRIORITY_NORMAL ) +return GUC_CLIENT_PRIORITY_KMD_NORMAL ; +else if (prio <I915_PRIORITY_NORMAL ) +return GUC_CLIENT_PRIORITY_NORMAL ; +else if (prio !=I915_PRIORITY_BARRIER )Shouldn't this be
I915_PRIORITY_UNPREEMPTABLE?
Quoted 1 line
No,
I915_PRIORITY_UNPREEMPTABLEis an execlists only concept.
then we need a
/* we don't expect umpreemptable submissions with the GuC */ GEM_BUG_ON(prio == I915_PRIORITY_UNPREEMPTABLE)
or something, because that prio level would be assigned incorrectly otherwise.
Daniele
Re: [PATCH 50/51] drm/i915/guc: Implement GuC priority management
Quoted 38 lines · Daniele Ceraolo Spurio
<snip>
Quoted 35 lines
Quoted 35 lines
Quoted 23 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +20
-0@@ -1756,15 +1796,119 @@ static int guc_context_alloc(struct intel_context *ce)return lrc_alloc (ce, ce->engine); } +static void guc_context_set_prio (struct intel_guc *guc, +struct intel_context *ce, +u8 prio) +{ +u32 action[] = { +INTEL_GUC_ACTION_SET_CONTEXT_PRIORITY , + ce->guc_id, + prio, + }; + +GEM_BUG_ON (prio <GUC_CLIENT_PRIORITY_KMD_HIGH || + prio >GUC_CLIENT_PRIORITY_NORMAL ); + +if (ce->guc_prio == prio ||submission_disabled (guc) || + !context_registered (ce)) +return ; + +guc_submission_send_busy_loop (guc, action,ARRAY_SIZE (action),0 , true); + + ce->guc_prio = prio;drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static int guc_context_alloc(struct intel_context *ce) · line 1827
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-0+trace_intel_context_set_prio (ce); +} + +static inline u8 map_i915_prio_to_guc_prio (int prio) +{ +if (prio ==I915_PRIORITY_NORMAL ) +return GUC_CLIENT_PRIORITY_KMD_NORMAL ; +else if (prio <I915_PRIORITY_NORMAL ) +return GUC_CLIENT_PRIORITY_NORMAL ; +else if (prio !=I915_PRIORITY_BARRIER )Shouldn't this be
I915_PRIORITY_UNPREEMPTABLE?
Quoted 7 lines
Quoted 1 line
No,
I915_PRIORITY_UNPREEMPTABLEis an execlists only concept.then we need a
/* we don't expect umpreemptable submissions with the GuC */
GEM_BUG_ON(prio == I915_PRIORITY_UNPREEMPTABLE)
Actually this probably should < I915_PRIORITY_DISPLAY as we really want pageflips to be high than any user context.
Matt
Quoted 5 lines
or something, because that prio level would be assigned incorrectly otherwise.
Daniele
PATCH 51/51 drm/i915/guc: Unblock GuC submission on Gen11+
In reply to Matthew BrostFrom: Daniele Ceraolo Spurio <[email protected]>
Unblock GuC submission on Gen11+ platforms.
v2:
(Martin Peres / John H)
- Delete debug message when GuC is disabled by default on certain platforms
--- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 + drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 8 ++++++++ drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h | 3 +-- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 13 ++++++++----- 4 files changed, 18 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.h +1 -0
@@ -55,6 +55,7 @@ struct intel_guc {struct ida guc_ids;struct list_head guc_id_list; +bool submission_supported;bool submission_selected;struct i915_vma *ads_vma;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +8 -0
@@ -2512,6 +2512,13 @@ void intel_guc_submission_disable(struct intel_guc *guc)/* Note: By the time we're here, GuC may have already been reset */ } +static bool __guc_submission_supported (struct intel_guc *guc) +{ +/* GuC submission is unavailable for pre-Gen11 */ +return intel_guc_is_supported (guc) && +GRAPHICS_VER (guc_to_gt (guc)->i915) >=11 ; +} +static bool __guc_submission_selected (struct intel_guc *guc) {struct drm_i915_private *i915 =guc_to_gt (guc)->i915;
@@ -2524,6 +2531,7 @@ static bool __guc_submission_selected(struct intel_guc *guc)void intel_guc_submission_init_early (struct intel_guc *guc) { + guc->submission_supported =__guc_submission_supported (guc); guc->submission_selected =__guc_submission_selected (guc); }
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +1 -2
@@ -38,8 +38,7 @@ int intel_guc_wait_for_pending_msg(struct intel_guc *guc,static inline bool intel_guc_submission_is_supported (struct intel_guc *guc) { -/* XXX: GuC submission is unavailable for now */ -return false; +return guc->submission_supported; }static inline bool intel_guc_submission_is_wanted (struct intel_guc *guc)
drivers/gpu/drm/i915/gt/uc/intel_uc.c +8 -5
@@ -34,8 +34,14 @@ static void uc_expand_default_options(struct intel_uc *uc)return ; } -/* Default: enable HuC authentication only */ - i915->params.enable_guc =ENABLE_GUC_LOAD_HUC ; +/* Intermediate platforms are HuC authentication only */ +if (IS_DG1 (i915) ||IS_ALDERLAKE_S (i915)) { + i915->params.enable_guc =ENABLE_GUC_LOAD_HUC ; +return ; + } + +/* Default: enable HuC authentication and GuC submission */ + i915->params.enable_guc =ENABLE_GUC_LOAD_HUC |ENABLE_GUC_SUBMISSION ; }/* Reset GuC providing us with fresh state for both GuC and HuC.
@@ -313,9 +319,6 @@ static int __uc_init(struct intel_uc *uc)if (i915_inject_probe_failure (uc_to_gt (uc)->i915))return -ENOMEM ; -/* XXX: GuC submission is unavailable for now */ -GEM_BUG_ON (intel_uc_uses_guc_submission (uc)); - ret =intel_guc_init (guc);if (ret)return ret;
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for GuC submission support (rev3)
In reply to Matthew Brost== Series Details ==
== Series Details ==
Series: GuC submission support (rev3)
URL : https://patchwork.freedesktop.org/series/91840/
State : failure
== Summary ==
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
LD [M] drivers/gpu/drm/i915/i915.o
HDRTEST drivers/gpu/drm/i915/gt/intel_gt_requests.h
In file included from <command-line>:./drivers/gpu/drm/i915/gt/intel_gt_requests.h: In function ‘intel_gt_retire_requests’:./drivers/gpu/drm/i915/gt/intel_gt_requests.h:17:42: error: ‘NULL’ undeclared (first use in this function)
intel_gt_retire_requests_timeout(gt, 0, NULL);
^~~~./drivers/gpu/drm/i915/gt/intel_gt_requests.h:17:42: note: ‘NULL’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’? ./drivers/gpu/drm/i915/gt/intel_gt_requests.h:1:1:
+#include <stddef.h>
/* SPDX-License-Identifier: MIT */./drivers/gpu/drm/i915/gt/intel_gt_requests.h:17:42:
intel_gt_retire_requests_timeout(gt, 0, NULL);
^~~~./drivers/gpu/drm/i915/gt/intel_gt_requests.h:17:42: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/i915/Makefile:319: recipe for target 'drivers/gpu/drm/i915/gt/intel_gt_requests.hdrtest' failed make[4]: *** [drivers/gpu/drm/i915/gt/intel_gt_requests.hdrtest] Error 1scripts/Makefile.build:514: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:514: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:514: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1841: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Matthew Brost
As discussed in [1], [2] we are enabling GuC submission support in the i915. This is a subset of the patches in step 5 described in [1], basically it is absolute to enable CI with GuC submission on gen11+ platforms.
This series itself will likely be broken down into smaller patch sets to merge. Likely into CTBs changes, basic submission, virtual engines, and resets.
Quoted 6 lines
A following series will address the missing patches remaining from [1].
Locally tested on TGL machine and basic tests seem to be passing.
v2: Address all review comments in [3], include several more patches to make CI [4] happy.
What about:
[email protected] [email protected]
?
Regards,
Tvrtko
Quoted 141 lines
Signed-off-by Matthew Brost <[email protected]>[1] https://patchwork.freedesktop.org/series/89844/
[2] https://patchwork.freedesktop.org/series/91417/
[3] https://patchwork.freedesktop.org/series/91840/
[4] https://patchwork.freedesktop.org/series/91885/Signed-off-by Matthew Brost <[email protected]>Daniele Ceraolo Spurio (1):
drm/i915/guc: Unblock GuC submission on Gen11+John Harrison (12):
drm/i915: Track 'serial' counts for virtual engines drm/i915/guc: Provide mmio list to be saved/restored on engine reset drm/i915/guc: Don't complain about reset races drm/i915/guc: Enable GuC engine reset
drm/i915/guc: Fix for error capture after full GPU reset with GuC drm/i915/guc: Hook GuC scheduling policies up drm/i915/guc: Connect reset modparam updates to GuC policy flags drm/i915/guc: Include scheduling policies in the debugfs state dump drm/i915/guc: Add golden context to GuC ADS drm/i915/selftest: Better error reporting from hangcheck selftest drm/i915/selftest: Fix hangcheck self test for GuC submission drm/i915/selftest: Bump selftest timeouts for hangcheckMatthew Brost (36):
drm/i915/guc: Add new GuC interface defines and structures drm/i915/guc: Remove GuC stage descriptor, add LRC descriptor drm/i915/guc: Add LRC descriptor context lookup array drm/i915/guc: Implement GuC submission tasklet drm/i915/guc: Add bypass tasklet submission path to GuC drm/i915/guc: Implement GuC context operations for new inteface drm/i915/guc: Insert fence on context when deregistering drm/i915/guc: Defer context unpin until scheduling is disabled drm/i915/guc: Disable engine barriers with GuC during unpin drm/i915/guc: Extend deregistration fence to schedule disable drm/i915: Disable preempt busywait when using GuC scheduling drm/i915/guc: Ensure request ordering via completion fences drm/i915/guc: Disable semaphores when using GuC scheduling drm/i915/guc: Ensure G2H response has space in buffer drm/i915/guc: Updateintel_gt_wait_for_idleto work with GuC drm/i915/guc: Update GuC debugfs to support new GuC drm/i915/guc: Add several request trace points
drm/i915: Addintel_contexttracing
drm/i915/guc: GuC virtual engines
drm/i915: Hold reference tointel_contextover life ofi915_requestdrm/i915/guc: Disable bonding extension with GuC submission drm/i915/guc: Direct all breadcrumbs for a class to single breadcrumbs drm/i915: Addi915_sched_enginedestroy vfunc
drm/i915: Move active request tracking to a vfunc drm/i915/guc: Reset implementation for new GuC interface drm/i915: Reset GPU immediately if submission is disabled drm/i915/guc: Add disable interrupts to guc sanitize drm/i915/guc: Suspend/resume implementation for new interface drm/i915/guc: Handle context reset notification drm/i915/guc: Handle engine reset failure notification drm/i915/guc: Enable the timer expired interrupt for GuC drm/i915/guc: Capture error state on context reset drm/i915/guc: Implement banned contexts for GuC submission drm/i915/guc: Support request cancellation drm/i915/selftest: Increase some timeouts inlive_requestsdrm/i915/guc: Implement GuC priority managementRahul Kumar Singh (2):
drm/i915/selftest: Fix workarounds selftest for GuC submission drm/i915/selftest: Fix MOCS selftest for GuC submissiondrivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_context.c | 21 +- drivers/gpu/drm/i915/gem/i915_gem_context.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_mman.c | 3 +- drivers/gpu/drm/i915/gt/gen8_engine_cs.c | 6 +- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 44 +- drivers/gpu/drm/i915/gt/intel_breadcrumbs.h | 16 +- .../gpu/drm/i915/gt/intel_breadcrumbs_types.h | 7 + drivers/gpu/drm/i915/gt/intel_context.c | 50 +- drivers/gpu/drm/i915/gt/intel_context.h | 50 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 63 +- drivers/gpu/drm/i915/gt/intel_engine.h | 54 +- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 182 +- .../gpu/drm/i915/gt/intel_engine_heartbeat.c | 71 +- .../gpu/drm/i915/gt/intel_engine_heartbeat.h | 4 + drivers/gpu/drm/i915/gt/intel_engine_types.h | 13 +- drivers/gpu/drm/i915/gt/intel_engine_user.c | 4 + .../drm/i915/gt/intel_execlists_submission.c | 95 +- .../drm/i915/gt/intel_execlists_submission.h | 4 - drivers/gpu/drm/i915/gt/intel_gt.c | 21 + drivers/gpu/drm/i915/gt/intel_gt.h | 2 + drivers/gpu/drm/i915/gt/intel_gt_pm.c | 6 +- drivers/gpu/drm/i915/gt/intel_gt_requests.c | 21 +- drivers/gpu/drm/i915/gt/intel_gt_requests.h | 7 +- drivers/gpu/drm/i915/gt/intel_lrc_reg.h | 1 - drivers/gpu/drm/i915/gt/intel_reset.c | 50 +- .../gpu/drm/i915/gt/intel_ring_submission.c | 48 + drivers/gpu/drm/i915/gt/intel_rps.c | 4 + drivers/gpu/drm/i915/gt/intel_workarounds.c | 46 +- .../gpu/drm/i915/gt/intel_workarounds_types.h | 1 + drivers/gpu/drm/i915/gt/mock_engine.c | 40 +- drivers/gpu/drm/i915/gt/selftest_context.c | 10 + .../drm/i915/gt/selftest_engine_heartbeat.c | 22 + .../drm/i915/gt/selftest_engine_heartbeat.h | 2 + drivers/gpu/drm/i915/gt/selftest_execlists.c | 12 +- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 314 +- drivers/gpu/drm/i915/gt/selftest_mocs.c | 50 +- .../gpu/drm/i915/gt/selftest_workarounds.c | 132 +- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 15 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 82 +- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 101 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 461 ++- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h | 4 + drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 132 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 16 +- .../gpu/drm/i915/gt/uc/intel_guc_debugfs.c | 25 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 88 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 2776 +++++++++++++++-- .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 18 +- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 101 +- drivers/gpu/drm/i915/gt/uc/intel_uc.h | 11 + drivers/gpu/drm/i915/i915_debugfs_params.c | 31 + drivers/gpu/drm/i915/i915_gem_evict.c | 1 + drivers/gpu/drm/i915/i915_gpu_error.c | 25 +- drivers/gpu/drm/i915/i915_reg.h | 2 + drivers/gpu/drm/i915/i915_request.c | 174 +- drivers/gpu/drm/i915/i915_request.h | 29 + drivers/gpu/drm/i915/i915_scheduler.c | 16 +- drivers/gpu/drm/i915/i915_scheduler.h | 10 +- drivers/gpu/drm/i915/i915_scheduler_types.h | 22 + drivers/gpu/drm/i915/i915_trace.h | 219 +- drivers/gpu/drm/i915/selftests/i915_request.c | 4 +- .../gpu/drm/i915/selftests/igt_flush_test.c | 2 +- .../gpu/drm/i915/selftests/igt_live_test.c | 2 +- .../i915/selftests/intel_scheduler_helpers.c | 89 + .../i915/selftests/intel_scheduler_helpers.h | 35 + .../gpu/drm/i915/selftests/mock_gem_device.c | 3 +- include/uapi/drm/i915_drm.h | 9 + 68 files changed, 5119 insertions(+), 862 deletions(-)create mode 100644
drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.ccreate mode 100644drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h