drm/i915/pmu: Add a name to the execlists stats
Subsystems (2)
PATCH 1/2 drm/i915/pmu: Add a name to the execlists stats
In preparation for GuC pmu stats, add a name to the execlists stats structure so that it can be differentiated from the GuC stats.
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 14 +++--- drivers/gpu/drm/i915/gt/intel_engine_stats.h | 33 +++++++------ drivers/gpu/drm/i915/gt/intel_engine_types.h | 52 +++++++++++--------- 3 files changed, 53 insertions(+), 46 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +8 -6
@@ -361,7 +361,7 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id)DRIVER_CAPS (i915)->has_logical_contexts = true;ewma__engine_latency_init (&engine->latency); -seqcount_init (&engine->stats.lock); +seqcount_init (&engine->stats.execlists.lock);ATOMIC_INIT_NOTIFIER_HEAD (&engine->context_status_notifier);
@@ -1876,15 +1876,16 @@ void intel_engine_dump(struct intel_engine_cs *engine,static ktime_t __intel_engine_get_busy_time (struct intel_engine_cs *engine,ktime_t *now) { -ktime_t total = engine->stats.total; +struct intel_engine_execlists_stats *stats = &engine->stats.execlists; +ktime_t total = stats->total;/* * If the engine is executing something at the moment * add it to the total. */ *now =ktime_get (); -if (READ_ONCE (engine->stats.active)) - total =ktime_add (total,ktime_sub (*now, engine->stats.start)); +if (READ_ONCE (stats->active)) + total =ktime_add (total,ktime_sub (*now, stats->start));return total; }
@@ -1898,13 +1899,14 @@ static ktime_t __intel_engine_get_busy_time(struct intel_engine_cs *engine,*/ ktime_t intel_engine_get_busy_time (struct intel_engine_cs *engine,ktime_t *now) { +struct intel_engine_execlists_stats *stats = &engine->stats.execlists;unsigned int seq;ktime_t total;do { - seq =read_seqcount_begin (&engine->stats.lock); + seq =read_seqcount_begin (&stats->lock); total =__intel_engine_get_busy_time (engine, now); - }while (read_seqcount_retry (&engine->stats.lock, seq)); + }while (read_seqcount_retry (&stats->lock, seq));return total; }
drivers/gpu/drm/i915/gt/intel_engine_stats.h +17 -16
@@ -15,45 +15,46 @@static inline void intel_engine_context_in (struct intel_engine_cs *engine) { +struct intel_engine_execlists_stats *stats = &engine->stats.execlists;unsigned long flags; -if (engine->stats.active) { - engine->stats.active++; +if (stats->active) { + stats->active++;return ; }/* The writer is serialised; but the pmu reader may be from hardirq */ local_irq_save (flags); -write_seqcount_begin (&engine->stats.lock); +write_seqcount_begin (&stats->lock); - engine->stats.start =ktime_get (); - engine->stats.active++; + stats->start =ktime_get (); + stats->active++; -write_seqcount_end (&engine->stats.lock); +write_seqcount_end (&stats->lock);local_irq_restore (flags); -GEM_BUG_ON (!engine->stats.active); +GEM_BUG_ON (!stats->active); }static inline void intel_engine_context_out (struct intel_engine_cs *engine) { +struct intel_engine_execlists_stats *stats = &engine->stats.execlists;unsigned long flags; -GEM_BUG_ON (!engine->stats.active); -if (engine->stats.active >1 ) { - engine->stats.active--; +GEM_BUG_ON (!stats->active); +if (stats->active >1 ) { + stats->active--;return ; }local_irq_save (flags); -write_seqcount_begin (&engine->stats.lock); +write_seqcount_begin (&stats->lock); - engine->stats.active--; - engine->stats.total = -ktime_add (engine->stats.total, -ktime_sub (ktime_get (), engine->stats.start)); + stats->active--; + stats->total =ktime_add (stats->total, +ktime_sub (ktime_get (), stats->start)); -write_seqcount_end (&engine->stats.lock); +write_seqcount_end (&stats->lock);local_irq_restore (flags); }
drivers/gpu/drm/i915/gt/intel_engine_types.h +28 -24
64 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 2/2 drm/i915/pmu: Connect engine busyness stats from GuC to pmu
With GuC handling scheduling, i915 is not aware of the time that a context is scheduled in and out of the engine. Since i915 pmu relies on this info to provide engine busyness to the user, GuC shares this info with i915 for all engines using shared memory. For each engine, this info contains:
- total busyness: total time that the context was running (total)
- id: id of the running context (id)
- start timestamp: timestamp when the context started running (start)
At the time (now) of sampling the engine busyness, if the id is valid (!= ~0), and start is non-zero, then the context is considered to be active and the engine busyness is calculated using the below equation
engine busyness = total + (now - start)
All times are obtained from the gt clock base. For inactive contexts, engine busyness is just equal to the total.
The start and total values provided by GuC are 32 bits and wrap around in a few minutes. Since perf pmu provides busyness as 64 bit monotonically increasing values, there is a need for this implementation to account for overflows and extend the time to 64 bits before returning busyness to the user. In order to do that, a worker runs periodically at frequency = 1/8th the time it takes for the timestamp to wrap. As an example, that would be once in 27 seconds for a gt clock frequency of 19.2 MHz.
Note:
There might be an overaccounting of busyness due to the fact that GuC may be updating the total and start values while kmd is reading them. (i.e kmd may read the updated total and the stale start). In such a case, user may see higher busyness value followed by smaller ones which would eventually catch up to the higher value.
v2: (Tvrtko)
- Include details in commit message
- Move intel engine busyness function into execlist code
- Use union inside engine->stats
- Use natural type for ping delay jiffies
- Drop active_work condition checks
- Use for_each_engine if iterating all engines
- Drop seq locking, use spinlock at guc level to update engine stats
- Document worker specific details
v3: (Tvrtko/Umesh)
- Demarcate guc and execlist stat objects with comments
- Document known over-accounting issue in commit
- Provide a consistent view of guc state
- Add hooks to gt park/unpark for guc busyness
- Stop/start worker in gt park/unpark path
- Drop inline
- Move spinlock and worker inits to guc initialization
- Drop helpers that are called only once
v4: (Tvrtko/Matt/Umesh)
- Drop addressed opens from commit message
- Get runtime pm in ping, remove from the park path
- Use cancel_delayed_work_sync in disable_submission path
- Update stats during reset prepare
- Skip ping if reset in progress
- Explicitly name execlists and guc stats objects
- Since disable_submission is called from many places, move resetting stats to intel_guc_submission_reset_prepare
v5: (Tvrtko)
- Add a trylock helper that does not sleep and synchronize PMU event callbacks and worker with gt reset
v6: (CI BAT failures)
- DUTs using execlist submission failed to boot since __gt_unpark is called during i915 load. This ends up calling the guc busyness unpark hook and results in kiskstarting an uninitialized worker. Let park/unpark hooks check if guc submission has been initialized.
- drop cant_sleep() from trylock hepler since rcu_read_lock takes care of that.
v7: (CI) Fix igt@i915_selftest@live@gt_engines
- For guc mode of submission the engine busyness is derived from gt time domain. Use gt time elapsed as reference in the selftest.
- Increase busyness calculation to 10ms duration to ensure batch runs longer and falls within the busyness tolerances in selftest.
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 28 +- drivers/gpu/drm/i915/gt/intel_engine_types.h | 33 ++- .../drm/i915/gt/intel_execlists_submission.c | 34 +++ drivers/gpu/drm/i915/gt/intel_gt_pm.c | 2 + drivers/gpu/drm/i915/gt/intel_reset.c | 15 + drivers/gpu/drm/i915/gt/intel_reset.h | 1 + drivers/gpu/drm/i915/gt/selftest_engine_pm.c | 21 +- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 1 + drivers/gpu/drm/i915/gt/uc/intel_guc.h | 30 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 21 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h | 5 + drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 13 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 273 ++++++++++++++++++ .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 2 + 15 files changed, 449 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +1 -27
@@ -1873,23 +1873,6 @@ void intel_engine_dump(struct intel_engine_cs *engine,intel_engine_print_breadcrumbs (engine, m); } -static ktime_t __intel_engine_get_busy_time (struct intel_engine_cs *engine, -ktime_t *now) -{ -struct intel_engine_execlists_stats *stats = &engine->stats.execlists; -ktime_t total = stats->total; - -/* -* If the engine is executing something at the moment -* add it to the total. -*/ - *now =ktime_get (); -if (READ_ONCE (stats->active)) - total =ktime_add (total,ktime_sub (*now, stats->start)); - -return total; -} -/** * intel_engine_get_busy_time() - Return current accumulated engine busyness * @engine: engine to report on
@@ -1899,16 +1882,7 @@ static ktime_t __intel_engine_get_busy_time(struct intel_engine_cs *engine,*/ ktime_t intel_engine_get_busy_time (struct intel_engine_cs *engine,ktime_t *now) { -struct intel_engine_execlists_stats *stats = &engine->stats.execlists; -unsigned int seq; -ktime_t total; - -do { - seq =read_seqcount_begin (&stats->lock); - total =__intel_engine_get_busy_time (engine, now); - }while (read_seqcount_retry (&stats->lock, seq)); - -return total; +return engine->busyness (engine, now); } struct intel_context *
drivers/gpu/drm/i915/gt/intel_engine_types.h +32 -1
@@ -284,6 +284,28 @@ struct intel_engine_execlists_stats {ktime_t start; }; +struct intel_engine_guc_stats { +/** +* @running: Active state of the engine when busyness was last sampled. +*/ +bool running; + +/** +* @prev_total: Previous value of total runtime clock cycles. +*/ +u32 prev_total; + +/** +* @total_gt_clks: Total gt clock cycles this engine was busy. +*/ +u64 total_gt_clks; + +/** +* @start_gt_clk: GT clock time of last idle to active transition. +*/ +u64 start_gt_clk; +}; +struct intel_engine_cs {struct drm_i915_private *i915;struct intel_gt *gt;
@@ -459,6 +481,12 @@ struct intel_engine_cs {void (*add_active_request)(struct i915_request *rq);void (*remove_active_request)(struct i915_request *rq); +/* +* Get engine busyness and the time at which the busyness was sampled. +*/ +ktime_t (*busyness)(struct intel_engine_cs *engine, +ktime_t *now); +struct intel_engine_execlists execlists;/*
@@ -508,7 +536,10 @@ struct intel_engine_cs {u32 (*get_cmd_length_mask)(u32 cmd_header);struct { -struct intel_engine_execlists_stats execlists; +union { +struct intel_engine_execlists_stats execlists; +struct intel_engine_guc_stats guc; + };/** * @rps: Utilisation at last RPS sampling.
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +34 -0
@@ -3292,6 +3292,38 @@ static void execlists_release(struct intel_engine_cs *engine)lrc_fini_wa_ctx (engine); } +static ktime_t __execlists_engine_busyness (struct intel_engine_cs *engine, +ktime_t *now) +{ +struct intel_engine_execlists_stats *stats = &engine->stats.execlists; +ktime_t total = stats->total; + +/* +* If the engine is executing something at the moment +* add it to the total. +*/ + *now =ktime_get (); +if (READ_ONCE (stats->active)) + total =ktime_add (total,ktime_sub (*now, stats->start)); + +return total; +} + +static ktime_t execlists_engine_busyness (struct intel_engine_cs *engine, +ktime_t *now) +{ +struct intel_engine_execlists_stats *stats = &engine->stats.execlists; +unsigned int seq; +ktime_t total; + +do { + seq =read_seqcount_begin (&stats->lock); + total =__execlists_engine_busyness (engine, now); + }while (read_seqcount_retry (&stats->lock, seq)); + +return total; +} +static void logical_ring_default_vfuncs (struct intel_engine_cs *engine) {
@@ -3348,6 +3380,8 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine) engine->emit_bb_start = gen8_emit_bb_start; else engine->emit_bb_start = gen8_emit_bb_start_noarb; + + engine->busyness = execlists_engine_busyness; }static void logical_ring_default_irqs (struct intel_engine_cs *engine)
drivers/gpu/drm/i915/gt/intel_gt_pm.c +2 -0
@@ -86,6 +86,7 @@ static int __gt_unpark(struct intel_wakeref *wf)intel_rc6_unpark (>->rc6);intel_rps_unpark (>->rps);i915_pmu_gt_unparked (i915); +intel_guc_busyness_unpark (gt);intel_gt_unpark_requests (gt);runtime_begin (gt);
@@ -104,6 +105,7 @@ static int __gt_park(struct intel_wakeref *wf)runtime_end (gt);intel_gt_park_requests (gt); +intel_guc_busyness_park (gt);i915_vma_parked (gt);i915_pmu_gt_parked (i915);intel_rps_park (>->rps);
drivers/gpu/drm/i915/gt/intel_reset.c +15 -0
@@ -1389,6 +1389,21 @@ void intel_gt_handle_error(struct intel_gt *gt,intel_runtime_pm_put (gt->uncore->rpm, wakeref); } +bool intel_gt_reset_trylock_no_wait (struct intel_gt *gt,int *srcu) +{ +int reset_in_progress; + +might_lock (>->reset.backoff_srcu); + +rcu_read_lock (); + reset_in_progress =test_bit (I915_RESET_BACKOFF , >->reset.flags); +if (!reset_in_progress) + *srcu =srcu_read_lock (>->reset.backoff_srcu); +rcu_read_unlock (); + +return reset_in_progress; +} +int intel_gt_reset_trylock (struct intel_gt *gt,int *srcu) {might_lock (>->reset.backoff_srcu);
drivers/gpu/drm/i915/gt/intel_reset.h +1 -0
@@ -38,6 +38,7 @@ int __intel_engine_reset_bh(struct intel_engine_cs *engine,void __i915_request_reset (struct i915_request *rq,bool guilty); +bool __must_check intel_gt_reset_trylock_no_wait (struct intel_gt *gt,int *srcu);int __must_check intel_gt_reset_trylock (struct intel_gt *gt,int *srcu);void intel_gt_reset_unlock (struct intel_gt *gt,int tag);
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +17 -4
@@ -234,6 +234,7 @@ static int live_engine_busy_stats(void *arg)struct i915_request *rq;ktime_t de, dt;ktime_t t[2 ]; +u32 gt_stamp;if (!intel_engine_supports_stats (engine))continue ;
@@ -251,10 +252,16 @@ static int live_engine_busy_stats(void *arg)ENGINE_TRACE (engine,"measuring idle time\n" );preempt_disable (); de =intel_engine_get_busy_time (engine, &t[0 ]); -udelay (100 ); + gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ); +udelay (10000 ); de =ktime_sub (intel_engine_get_busy_time (engine, &t[1 ]), de); + gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ) - gt_stamp;preempt_enable (); - dt =ktime_sub (t[1 ], t[0 ]); + + dt =intel_engine_uses_guc (engine) ? +intel_gt_clock_interval_to_ns (engine->gt, gt_stamp) : +ktime_sub (t[1 ], t[0 ]); +if (de <0 || de >10 ) { pr_err("%s: reported %lldns [%d%%] busyness while sleeping [for %lldns]\n", engine->name,
@@ -283,10 +290,16 @@ static int live_engine_busy_stats(void *arg)ENGINE_TRACE (engine,"measuring busy time\n" );preempt_disable (); de =intel_engine_get_busy_time (engine, &t[0 ]); -udelay (100 ); + gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ); +udelay (10000 ); de =ktime_sub (intel_engine_get_busy_time (engine, &t[1 ]), de); + gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ) - gt_stamp;preempt_enable (); - dt =ktime_sub (t[1 ], t[0 ]); + + dt =intel_engine_uses_guc (engine) ? +intel_gt_clock_interval_to_ns (engine->gt, gt_stamp) : +ktime_sub (t[1 ], t[0 ]); +if (100 * de <95 * dt ||95 * de >100 * dt) { pr_err("%s: reported %lldns [%d%%] busyness while spinning [for %lldns]\n", engine->name,
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +1 -0
@@ -143,6 +143,7 @@ enum intel_guc_action {INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER =0x4506 ,INTEL_GUC_ACTION_DEREGISTER_CONTEXT_DONE =0x4600 ,INTEL_GUC_ACTION_RESET_CLIENT =0x5507 , +INTEL_GUC_ACTION_SET_ENG_UTIL_BUFF =0x550A , INTEL_GUC_ACTION_LIMIT };
drivers/gpu/drm/i915/gt/uc/intel_guc.h +30 -0
@@ -104,6 +104,8 @@ struct intel_guc {u32 ads_regset_size;/** @ads_golden_ctxt_size: size of the golden contexts in the ADS */ u32 ads_golden_ctxt_size; +/** @ads_engine_usage_size: size of engine usage in the ADS */ +u32 ads_engine_usage_size;/** @lrc_desc_pool: object allocated to hold the GuC LRC descriptor pool */ struct i915_vma *lrc_desc_pool;
@@ -138,6 +140,34 @@ struct intel_guc {/** @send_mutex: used to serialize the intel_guc_send actions */ struct mutex send_mutex; + +/** +* @timestamp: GT timestamp object that stores a copy of the timestamp +* and adjusts it for overflow using a worker. +*/ +struct { +/** +* @lock: Lock protecting the below fields and the engine stats. +*/ +spinlock_t lock; + +/** +* @gt_stamp: 64 bit extended value of the GT timestamp. +*/ +u64 gt_stamp; + +/** +* @ping_delay: Period for polling the GT timestamp for +* overflow. +*/ +unsigned long ping_delay; + +/** +* @work: Periodic work to adjust GT timestamp, engine and +* context usage for overflows. +*/ +struct delayed_work work; + } timestamp; };static inline struct intel_guc *log_to_guc (struct intel_guc_log *log)
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +21 -0
@@ -26,6 +26,8 @@* | guc_policies | * +---------------------------------------+ * | guc_gt_system_info | +* +---------------------------------------+ +* | guc_engine_usage | * +---------------------------------------+ <== static * | guc_mmio_reg[countA] (engine 0.0) | * | guc_mmio_reg[countB] (engine 0.1) |
@@ -47,6 +49,7 @@ struct __guc_ads_blob {struct guc_ads ads;struct guc_policies policies;struct guc_gt_system_info system_info; +struct guc_engine_usage engine_usage;/* From here on, location is dynamic! Refer to above diagram. */ struct guc_mmio_reg regset[0 ]; } __packed;
@@ -628,3 +631,21 @@ void intel_guc_ads_reset(struct intel_guc *guc)guc_ads_private_data_reset (guc); } + +u32 intel_guc_engine_usage_offset (struct intel_guc *guc) +{ +struct __guc_ads_blob *blob = guc->ads_blob; +u32 base =intel_guc_ggtt_offset (guc, guc->ads_vma); +u32 offset = base +ptr_offset (blob, engine_usage); + +return offset; +} + +struct guc_engine_usage_record *intel_guc_engine_usage (struct intel_engine_cs *engine) +{ +struct intel_guc *guc = &engine->gt->uc.guc; +struct __guc_ads_blob *blob = guc->ads_blob; +u8 guc_class =engine_class_to_guc_class (engine->class); + +return &blob->engine_usage.engines[guc_class][engine->instance]; +}
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h +5 -0
@@ -6,8 +6,11 @@#ifndef _INTEL_GUC_ADS_H_#define _INTEL_GUC_ADS_H_ +#include <linux/types.h> +struct intel_guc ;struct drm_printer ; +struct intel_engine_cs ;int intel_guc_ads_create (struct intel_guc *guc);void intel_guc_ads_destroy (struct intel_guc *guc);
@@ -15,5 +18,7 @@ void intel_guc_ads_init_late(struct intel_guc *guc);void intel_guc_ads_reset (struct intel_guc *guc);void intel_guc_ads_print_policy_info (struct intel_guc *guc,struct drm_printer *p); +struct guc_engine_usage_record *intel_guc_engine_usage (struct intel_engine_cs *engine); +u32 intel_guc_engine_usage_offset (struct intel_guc *guc);#endif
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +13 -0
@@ -294,6 +294,19 @@ struct guc_ads {u32 reserved[15 ]; } __packed; +/* Engine usage stats */ +struct guc_engine_usage_record { +u32 current_context_index; +u32 last_switch_in_stamp; +u32 reserved0; +u32 total_runtime; +u32 reserved1[4 ]; +} __packed; + +struct guc_engine_usage { +struct guc_engine_usage_record engines[GUC_MAX_ENGINE_CLASSES ][GUC_MAX_INSTANCES_PER_CLASS ]; +} __packed; +/* GuC logging structures */ enum guc_log_buffer_type {
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +273 -0
322 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +2 -0
@@ -28,6 +28,8 @@ void intel_guc_submission_print_context_info(struct intel_guc *guc,void intel_guc_dump_active_requests (struct intel_engine_cs *engine,struct i915_request *hung_rq,struct drm_printer *m); +void intel_guc_busyness_park (struct intel_gt *gt); +void intel_guc_busyness_unpark (struct intel_gt *gt);bool intel_guc_virtual_engine_has_heartbeat (const struct intel_engine_cs *ve);
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -2664,6 +2664,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define RING_WAIT (1 << 11)/* gen3+, PRBx_CTL */ #define RING_WAIT_SEMAPHORE (1 << 10)/* gen6+ */ +#define GUCPMTIMESTAMP _MMIO(0xC3E8) +/* There are 16 64-bit CS General Purpose Registers per-engine on Gen8+ */ #define GEN8_RING_CS_GPR (base, n) _MMIO((base) + 0x600 + (n) * 8)#define GEN8_RING_CS_GPR_UDW (base, n) _MMIO((base) + 0x600 + (n) * 8 + 4)
Signature · 1 line
2.20.1
Re: [PATCH 2/2] drm/i915/pmu: Connect engine busyness stats from GuC to pmu
Quoted 82 lines · Umesh Nerlige Ramappa
With GuC handling scheduling, i915 is not aware of the time that a context is scheduled in and out of the engine. Since i915 pmu relies on this info to provide engine busyness to the user, GuC shares this info with i915 for all engines using shared memory. For each engine, this info contains:
- total busyness: total time that the context was running (total)
- id: id of the running context (id)
- start timestamp: timestamp when the context started running (start)At the time (now) of sampling the engine busyness, if the id is valid (!= ~0), and start is non-zero, then the context is considered to be active and the engine busyness is calculated using the below equation
engine busyness = total + (now - start)
All times are obtained from the gt clock base. For inactive contexts, engine busyness is just equal to the total.
The start and total values provided by GuC are 32 bits and wrap around in a few minutes. Since perf pmu provides busyness as 64 bit monotonically increasing values, there is a need for this implementation to account for overflows and extend the time to 64 bits before returning busyness to the user. In order to do that, a worker runs periodically at frequency = 1/8th the time it takes for the timestamp to wrap. As an example, that would be once in 27 seconds for a gt clock frequency of 19.2 MHz.
Note:
There might be an overaccounting of busyness due to the fact that GuC may be updating the total and start values while kmd is reading them. (i.e kmd may read the updated total and the stale start). In such a case, user may see higher busyness value followed by smaller ones which would eventually catch up to the higher value.v2: (Tvrtko)
- Include details in commit message
- Move intel engine busyness function into execlist code
- Use union insideengine->stats
- Use natural type for ping delay jiffies
- Dropactive_workcondition checks
- Usefor_each_engineif iterating all engines
- Drop seq locking, use spinlock at guc level to update engine stats
- Document worker specific detailsv3: (Tvrtko/Umesh)
- Demarcate guc and execlist stat objects with comments
- Document known over-accounting issue in commit
- Provide a consistent view of guc state
- Add hooks to gt park/unpark for guc busyness
- Stop/start worker in gt park/unpark path
- Drop inline
- Move spinlock and worker inits to guc initialization
- Drop helpers that are called only oncev4: (Tvrtko/Matt/Umesh)
- Drop addressed opens from commit message
- Get runtime pm in ping, remove from the park path
- Usecancel_delayed_work_syncindisable_submissionpath
- Update stats during reset prepare
- Skip ping if reset in progress
- Explicitly name execlists and guc stats objects
- Sincedisable_submissionis called from many places, move resetting stats tointel_guc_submission_reset_preparev5: (Tvrtko)
- Add a trylock helper that does not sleep and synchronize PMU event callbacks and worker with gt resetv6: (CI BAT failures)
- DUTs using execlist submission failed to boot since__gt_unparkis called during i915 load. This ends up calling the guc busyness unpark hook and results in kiskstarting an uninitialized worker. Let park/unpark hooks check if guc submission has been initialized.
- dropcant_sleep()from trylock hepler sincercu_read_locktakes care of that.v7: (CI) Fix igt@i915_selftest@live@gt_engines
- For guc mode of submission the engine busyness is derived from gt time domain. Use gt time elapsed as reference in the selftest.
- Increase busyness calculation to 10ms duration to ensure batch runs longer and falls within the busyness tolerances in selftest.
[snip]
Quoted 18 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +1
-1@@ -234,6 +234,7 @@ static int live_engine_busy_stats(void *arg)struct i915_request *rq;ktime_t de, dt;ktime_t t[2 ]; +u32 gt_stamp;if (!intel_engine_supports_stats (engine))continue ;@@ -251,10 +252,16 @@ static int live_engine_busy_stats(void *arg)ENGINE_TRACE (engine,"measuring idle time\n" );preempt_disable (); de =intel_engine_get_busy_time (engine, &t[0 ]); -udelay (100 );
drivers/gpu/drm/i915/gt/selftest_engine_pm.c static int live_engine_busy_stats(void *arg) · line 263
Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +7
-1+ gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ); +udelay (10000 ); de =ktime_sub (intel_engine_get_busy_time (engine, &t[1 ]), de); + gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ) - gt_stamp;preempt_enable (); - dt =ktime_sub (t[1 ], t[0 ]); + + dt =intel_engine_uses_guc (engine) ? +intel_gt_clock_interval_to_ns (engine->gt, gt_stamp) : +ktime_sub (t[1 ], t[0 ]);
But this then shows the thing might not work for external callers like PMU who have no idea about GUCPMTIMESTAMP and cannot obtain it anyway.
What is the root cause of the failure here, 100us or clock source? Is the granularity of GUCPMTIMESTAMP perhaps simply too coarse for 100us test period? I forget what frequency it runs at.
Regards,
Tvrtko
Re: [PATCH 2/2] drm/i915/pmu: Connect engine busyness stats from GuC to pmu
Quoted 117 lines · Tvrtko Ursulin
Quoted 82 lines · Umesh Nerlige Ramappa
With GuC handling scheduling, i915 is not aware of the time that a context is scheduled in and out of the engine. Since i915 pmu relies on this info to provide engine busyness to the user, GuC shares this info with i915 for all engines using shared memory. For each engine, this info contains:
- total busyness: total time that the context was running (total)
- id: id of the running context (id)
- start timestamp: timestamp when the context started running (start)At the time (now) of sampling the engine busyness, if the id is valid (!= ~0), and start is non-zero, then the context is considered to be active and the engine busyness is calculated using the below equation
engine busyness = total + (now - start)
All times are obtained from the gt clock base. For inactive contexts, engine busyness is just equal to the total.
The start and total values provided by GuC are 32 bits and wrap around in a few minutes. Since perf pmu provides busyness as 64 bit monotonically increasing values, there is a need for this implementation to account for overflows and extend the time to 64 bits before returning busyness to the user. In order to do that, a worker runs periodically at frequency = 1/8th the time it takes for the timestamp to wrap. As an example, that would be once in 27 seconds for a gt clock frequency of 19.2 MHz.
Note:
There might be an overaccounting of busyness due to the fact that GuC may be updating the total and start values while kmd is reading them. (i.e kmd may read the updated total and the stale start). In such a case, user may see higher busyness value followed by smaller ones which would eventually catch up to the higher value.v2: (Tvrtko)
- Include details in commit message
- Move intel engine busyness function into execlist code
- Use union insideengine->stats
- Use natural type for ping delay jiffies
- Dropactive_workcondition checks
- Usefor_each_engineif iterating all engines
- Drop seq locking, use spinlock at guc level to update engine stats
- Document worker specific detailsv3: (Tvrtko/Umesh)
- Demarcate guc and execlist stat objects with comments
- Document known over-accounting issue in commit
- Provide a consistent view of guc state
- Add hooks to gt park/unpark for guc busyness
- Stop/start worker in gt park/unpark path
- Drop inline
- Move spinlock and worker inits to guc initialization
- Drop helpers that are called only oncev4: (Tvrtko/Matt/Umesh)
- Drop addressed opens from commit message
- Get runtime pm in ping, remove from the park path
- Usecancel_delayed_work_syncindisable_submissionpath
- Update stats during reset prepare
- Skip ping if reset in progress
- Explicitly name execlists and guc stats objects
- Sincedisable_submissionis called from many places, move resetting stats tointel_guc_submission_reset_preparev5: (Tvrtko)
- Add a trylock helper that does not sleep and synchronize PMU event callbacks and worker with gt resetv6: (CI BAT failures)
- DUTs using execlist submission failed to boot since__gt_unparkis called during i915 load. This ends up calling the guc busyness unpark hook and results in kiskstarting an uninitialized worker. Let park/unpark hooks check if guc submission has been initialized.
- dropcant_sleep()from trylock hepler sincercu_read_locktakes care of that.v7: (CI) Fix igt@i915_selftest@live@gt_engines
- For guc mode of submission the engine busyness is derived from gt time domain. Use gt time elapsed as reference in the selftest.
- Increase busyness calculation to 10ms duration to ensure batch runs longer and falls within the busyness tolerances in selftest.[snip]
Quoted 16 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +1
-1@@ -234,6 +234,7 @@ static int live_engine_busy_stats(void *arg)struct i915_request *rq;ktime_t de, dt;ktime_t t[2 ]; +u32 gt_stamp;if (!intel_engine_supports_stats (engine))continue ;@@ -251,10 +252,16 @@ static int live_engine_busy_stats(void *arg)ENGINE_TRACE (engine,"measuring idle time\n" );preempt_disable (); de =intel_engine_get_busy_time (engine, &t[0 ]); -udelay (100 );drivers/gpu/drm/i915/gt/selftest_engine_pm.c static int live_engine_busy_stats(void *arg) · line 263
Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +7
-1+ gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ); +udelay (10000 ); de =ktime_sub (intel_engine_get_busy_time (engine, &t[1 ]), de); + gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ) - gt_stamp;preempt_enable (); - dt =ktime_sub (t[1 ], t[0 ]); + + dt =intel_engine_uses_guc (engine) ? +intel_gt_clock_interval_to_ns (engine->gt, gt_stamp) : +ktime_sub (t[1 ], t[0 ]);But this then shows the thing might not work for external callers like PMU who have no idea about GUCPMTIMESTAMP and cannot obtain it anyway.
Quoted 1 line
What is the root cause of the failure here, 100us or clock source? Is the granularity of GUCPMTIMESTAMP perhaps simply too coarse for 100us test period? I forget what frequency it runs at.
guc timestamp is ticking at 19.2 MHz in adlp/rkl (where I ran this).
1)
With 100us, often times I see that the batch has not yet started, so I get busy time in the range 0 - 60 %. I increased the time such that the batch runs long enough to make the scheduling time < 5%.
2)
I did a 100 runs on rkl/adlp. No failures on rkl. On adlp, I saw one in 25 runs show 93%/94% busyness for rcs0 and fail (expected is 95%). For that I tried using the guc timestamp thinking it would provide more accuracy. It did in my testing, but CI still failed for rkl-guc (110% busyness!!), so now I just think we need to tweak the expected busyness for guc.
Is 1) acceptable?
For 2) I am thinking of just changing the expected busyness to 90% plus for guc mode OR should we just let it fail occassionally? Thoughts?
Thanks,
Umesh
Quoted 4 lines
Regards,
Tvrtko
Re: [PATCH 2/2] drm/i915/pmu: Connect engine busyness stats from GuC to pmu
Quoted 120 lines · Umesh Nerlige Ramappa
Quoted 117 lines · Tvrtko Ursulin
Quoted 82 lines · Umesh Nerlige Ramappa
With GuC handling scheduling, i915 is not aware of the time that a context is scheduled in and out of the engine. Since i915 pmu relies on this info to provide engine busyness to the user, GuC shares this info with i915 for all engines using shared memory. For each engine, this info contains:
- total busyness: total time that the context was running (total)
- id: id of the running context (id)
- start timestamp: timestamp when the context started running (start)At the time (now) of sampling the engine busyness, if the id is valid (!= ~0), and start is non-zero, then the context is considered to be active and the engine busyness is calculated using the below equation
engine busyness = total + (now - start)
All times are obtained from the gt clock base. For inactive contexts, engine busyness is just equal to the total.
The start and total values provided by GuC are 32 bits and wrap around in a few minutes. Since perf pmu provides busyness as 64 bit monotonically increasing values, there is a need for this implementation to account for overflows and extend the time to 64 bits before returning busyness to the user. In order to do that, a worker runs periodically at frequency = 1/8th the time it takes for the timestamp to wrap. As an example, that would be once in 27 seconds for a gt clock frequency of 19.2 MHz.
Note:
There might be an overaccounting of busyness due to the fact that GuC may be updating the total and start values while kmd is reading them. (i.e kmd may read the updated total and the stale start). In such a case, user may see higher busyness value followed by smaller ones which would eventually catch up to the higher value.v2: (Tvrtko)
- Include details in commit message
- Move intel engine busyness function into execlist code
- Use union insideengine->stats
- Use natural type for ping delay jiffies
- Dropactive_workcondition checks
- Usefor_each_engineif iterating all engines
- Drop seq locking, use spinlock at guc level to update engine stats
- Document worker specific detailsv3: (Tvrtko/Umesh)
- Demarcate guc and execlist stat objects with comments
- Document known over-accounting issue in commit
- Provide a consistent view of guc state
- Add hooks to gt park/unpark for guc busyness
- Stop/start worker in gt park/unpark path
- Drop inline
- Move spinlock and worker inits to guc initialization
- Drop helpers that are called only oncev4: (Tvrtko/Matt/Umesh)
- Drop addressed opens from commit message
- Get runtime pm in ping, remove from the park path
- Usecancel_delayed_work_syncindisable_submissionpath
- Update stats during reset prepare
- Skip ping if reset in progress
- Explicitly name execlists and guc stats objects
- Sincedisable_submissionis called from many places, move resetting stats tointel_guc_submission_reset_preparev5: (Tvrtko)
- Add a trylock helper that does not sleep and synchronize PMU event callbacks and worker with gt resetv6: (CI BAT failures)
- DUTs using execlist submission failed to boot since__gt_unparkis called during i915 load. This ends up calling the guc busyness unpark hook and results in kiskstarting an uninitialized worker. Let park/unpark hooks check if guc submission has been initialized.
- dropcant_sleep()from trylock hepler sincercu_read_locktakes care of that.v7: (CI) Fix igt@i915_selftest@live@gt_engines
- For guc mode of submission the engine busyness is derived from gt time domain. Use gt time elapsed as reference in the selftest.
- Increase busyness calculation to 10ms duration to ensure batch runs longer and falls within the busyness tolerances in selftest.[snip]
Quoted 16 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +1
-1@@ -234,6 +234,7 @@ static int live_engine_busy_stats(void *arg)struct i915_request *rq;ktime_t de, dt;ktime_t t[2 ]; +u32 gt_stamp;if (!intel_engine_supports_stats (engine))continue ;@@ -251,10 +252,16 @@ static int live_engine_busy_stats(void *arg)ENGINE_TRACE (engine,"measuring idle time\n" );preempt_disable (); de =intel_engine_get_busy_time (engine, &t[0 ]); -udelay (100 );drivers/gpu/drm/i915/gt/selftest_engine_pm.c static int live_engine_busy_stats(void *arg) · line 263
Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +7
-1+ gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ); +udelay (10000 ); de =ktime_sub (intel_engine_get_busy_time (engine, &t[1 ]), de); + gt_stamp =intel_uncore_read (gt->uncore,GUCPMTIMESTAMP ) - gt_stamp;preempt_enable (); - dt =ktime_sub (t[1 ], t[0 ]); + + dt =intel_engine_uses_guc (engine) ? +intel_gt_clock_interval_to_ns (engine->gt, gt_stamp) : +ktime_sub (t[1 ], t[0 ]);But this then shows the thing might not work for external callers like PMU who have no idea about GUCPMTIMESTAMP and cannot obtain it anyway.
Quoted 1 line
What is the root cause of the failure here, 100us or clock source? Is the granularity of GUCPMTIMESTAMP perhaps simply too coarse for 100us test period? I forget what frequency it runs at.
Quoted 7 lines
guc timestamp is ticking at 19.2 MHz in adlp/rkl (where I ran this).
1)
With 100us, often times I see that the batch has not yet started, so I get busy time in the range 0 - 60 %. I increased the time such that the batch runs long enough to make the scheduling time < 5%.2)
I did a 100 runs on rkl/adlp. No failures on rkl.
Sorry, my bad, RKL failed with 91% busyness always (checked it again now). I think the first time I ran this, GuC was not enabled by default.
Regards,
Umesh
Quoted 13 lines
On adlp, I saw one in 25 runs show 93%/94% busyness for rcs0 and fail (expected is 95%). For that I tried using the guc timestamp thinking it would provide more accuracy. It did in my testing, but CI still failed for rkl-guc (110% busyness!!), so now I just think we need to tweak the expected busyness for guc.
Is 1) acceptable?
For 2) I am thinking of just changing the expected busyness to 90% plus for guc mode OR should we just let it fail occassionally? Thoughts?
Thanks,
UmeshQuoted 4 lines
Regards,
Tvrtko
Re: [PATCH 2/2] drm/i915/pmu: Connect engine busyness stats from GuC to pmu
In reply to Umesh Nerlige RamappaQuoted 119 lines · Umesh Nerlige Ramappa
Quoted 118 lines · Tvrtko Ursulin
Quoted 82 lines · Umesh Nerlige Ramappa
With GuC handling scheduling, i915 is not aware of the time that a context is scheduled in and out of the engine. Since i915 pmu relies on this info to provide engine busyness to the user, GuC shares this info with i915 for all engines using shared memory. For each engine, this info contains:
- total busyness: total time that the context was running (total)
- id: id of the running context (id)
- start timestamp: timestamp when the context started running (start)At the time (now) of sampling the engine busyness, if the id is valid (!= ~0), and start is non-zero, then the context is considered to be active and the engine busyness is calculated using the below equation
engine busyness = total + (now - start)
All times are obtained from the gt clock base. For inactive contexts, engine busyness is just equal to the total.
The start and total values provided by GuC are 32 bits and wrap around in a few minutes. Since perf pmu provides busyness as 64 bit monotonically increasing values, there is a need for this implementation to account for overflows and extend the time to 64 bits before returning busyness to the user. In order to do that, a worker runs periodically at frequency = 1/8th the time it takes for the timestamp to wrap. As an example, that would be once in 27 seconds for a gt clock frequency of 19.2 MHz.
Note:
There might be an overaccounting of busyness due to the fact that GuC may be updating the total and start values while kmd is reading them. (i.e kmd may read the updated total and the stale start). In such a case, user may see higher busyness value followed by smaller ones which would eventually catch up to the higher value.v2: (Tvrtko)
- Include details in commit message
- Move intel engine busyness function into execlist code
- Use union insideengine->stats
- Use natural type for ping delay jiffies
- Dropactive_workcondition checks
- Usefor_each_engineif iterating all engines
- Drop seq locking, use spinlock at guc level to update engine stats
- Document worker specific detailsv3: (Tvrtko/Umesh)
- Demarcate guc and execlist stat objects with comments
- Document known over-accounting issue in commit
- Provide a consistent view of guc state
- Add hooks to gt park/unpark for guc busyness
- Stop/start worker in gt park/unpark path
- Drop inline
- Move spinlock and worker inits to guc initialization
- Drop helpers that are called only oncev4: (Tvrtko/Matt/Umesh)
- Drop addressed opens from commit message
- Get runtime pm in ping, remove from the park path
- Usecancel_delayed_work_syncindisable_submissionpath
- Update stats during reset prepare
- Skip ping if reset in progress
- Explicitly name execlists and guc stats objects
- Sincedisable_submissionis called from many places, move resetting stats tointel_guc_submission_reset_preparev5: (Tvrtko)
- Add a trylock helper that does not sleep and synchronize PMU event callbacks and worker with gt resetv6: (CI BAT failures)
- DUTs using execlist submission failed to boot since__gt_unparkis called during i915 load. This ends up calling the guc busyness unpark hook and results in kiskstarting an uninitialized worker. Let park/unpark hooks check if guc submission has been initialized.
- dropcant_sleep()from trylock hepler sincercu_read_locktakes care of that.v7: (CI) Fix igt@i915_selftest@live@gt_engines
- For guc mode of submission the engine busyness is derived from gt time domain. Use gt time elapsed as reference in the selftest.
- Increase busyness calculation to 10ms duration to ensure batch runs longer and falls within the busyness tolerances in selftest.[snip]
Quoted 17 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +2
-1@@ -234,6 +234,7 @@ static int live_engine_busy_stats(void *arg) struct i915_request *rq; ktime_t de, dt; ktime_t t[2]; + u32 gt_stamp; if (!intel_engine_supports_stats(engine)) continue;@@ -251,10 +252,16 @@ static int live_engine_busy_stats(void *arg) ENGINE_TRACE(engine, "measuring idle time\n"); preempt_disable(); de = intel_engine_get_busy_time(engine, &t[0]); - udelay(100); + gt_stamp = intel_uncore_read(gt->uncore, GUCPMTIMESTAMP);drivers/gpu/drm/i915/gt/selftest_engine_pm.c static int live_engine_busy_stats(void *arg) · line 264
Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +6
-1+ udelay(10000); de = ktime_sub(intel_engine_get_busy_time(engine, &t[1]), de); + gt_stamp = intel_uncore_read(gt->uncore, GUCPMTIMESTAMP) - gt_stamp; preempt_enable(); - dt = ktime_sub(t[1], t[0]); + + dt = intel_engine_uses_guc(engine) ? + intel_gt_clock_interval_to_ns(engine->gt, gt_stamp) : + ktime_sub(t[1], t[0]);But this then shows the thing might not work for external callers like PMU who have no idea about GUCPMTIMESTAMP and cannot obtain it anyway.
Quoted 3 lines
Quoted 1 line
What is the root cause of the failure here, 100us or clock source? Is the granularity of GUCPMTIMESTAMP perhaps simply too coarse for 100us test period? I forget what frequency it runs at.
guc timestamp is ticking at 19.2 MHz in adlp/rkl (where I ran this).
So ~52ns clock granularity, right?
In which case 100us with +/- 52ns error should be max 0.05% error - is this math correct?
Quoted 3 lines
1)
With 100us, often times I see that the batch has not yet started, so I get busy time in the range 0 - 60 %. I increased the time such that the batch runs long enough to make the scheduling time < 5%.
0-60% should not be possible since there is a igt_wait_for_spinner call before measuring starts, which ensures spinner is executing on the GPU.
I think we first need to understand where is this 0 - 60% problem coming from because I don't think it is from batch not yet started.
Regards,
Tvrtko
Quoted 15 lines
2)
I did a 100 runs on rkl/adlp. No failures on rkl. On adlp, I saw one in 25 runs show 93%/94% busyness for rcs0 and fail (expected is 95%). For that I tried using the guc timestamp thinking it would provide more accuracy. It did in my testing, but CI still failed for rkl-guc (110% busyness!!), so now I just think we need to tweak the expected busyness for guc.Is 1) acceptable?
For 2) I am thinking of just changing the expected busyness to 90% plus for guc mode OR should we just let it fail occassionally? Thoughts?
Thanks,
UmeshQuoted 4 lines
Regards,
Tvrtko
Re: [PATCH 2/2] drm/i915/pmu: Connect engine busyness stats from GuC to pmu
Quoted 121 lines · Tvrtko Ursulin
Quoted 119 lines · Umesh Nerlige Ramappa
Quoted 118 lines · Tvrtko Ursulin
Quoted 82 lines · Umesh Nerlige Ramappa
With GuC handling scheduling, i915 is not aware of the time that a context is scheduled in and out of the engine. Since i915 pmu relies on this info to provide engine busyness to the user, GuC shares this info with i915 for all engines using shared memory. For each engine, this info contains:
- total busyness: total time that the context was running (total)
- id: id of the running context (id)
- start timestamp: timestamp when the context started running (start)At the time (now) of sampling the engine busyness, if the id is valid (!= ~0), and start is non-zero, then the context is considered to be active and the engine busyness is calculated using the below equation
engine busyness = total + (now - start)
All times are obtained from the gt clock base. For inactive contexts, engine busyness is just equal to the total.
The start and total values provided by GuC are 32 bits and wrap around in a few minutes. Since perf pmu provides busyness as 64 bit monotonically increasing values, there is a need for this implementation to account for overflows and extend the time to 64 bits before returning busyness to the user. In order to do that, a worker runs periodically at frequency = 1/8th the time it takes for the timestamp to wrap. As an example, that would be once in 27 seconds for a gt clock frequency of 19.2 MHz.
Note:
There might be an overaccounting of busyness due to the fact that GuC may be updating the total and start values while kmd is reading them. (i.e kmd may read the updated total and the stale start). In such a case, user may see higher busyness value followed by smaller ones which would eventually catch up to the higher value.v2: (Tvrtko)
- Include details in commit message
- Move intel engine busyness function into execlist code
- Use union insideengine->stats
- Use natural type for ping delay jiffies
- Dropactive_workcondition checks
- Usefor_each_engineif iterating all engines
- Drop seq locking, use spinlock at guc level to update engine stats
- Document worker specific detailsv3: (Tvrtko/Umesh)
- Demarcate guc and execlist stat objects with comments
- Document known over-accounting issue in commit
- Provide a consistent view of guc state
- Add hooks to gt park/unpark for guc busyness
- Stop/start worker in gt park/unpark path
- Drop inline
- Move spinlock and worker inits to guc initialization
- Drop helpers that are called only oncev4: (Tvrtko/Matt/Umesh)
- Drop addressed opens from commit message
- Get runtime pm in ping, remove from the park path
- Usecancel_delayed_work_syncindisable_submissionpath
- Update stats during reset prepare
- Skip ping if reset in progress
- Explicitly name execlists and guc stats objects
- Sincedisable_submissionis called from many places, move resetting stats tointel_guc_submission_reset_preparev5: (Tvrtko)
- Add a trylock helper that does not sleep and synchronize PMU event callbacks and worker with gt resetv6: (CI BAT failures)
- DUTs using execlist submission failed to boot since__gt_unparkis called during i915 load. This ends up calling the guc busyness unpark hook and results in kiskstarting an uninitialized worker. Let park/unpark hooks check if guc submission has been initialized.
- dropcant_sleep()from trylock hepler sincercu_read_locktakes care of that.v7: (CI) Fix igt@i915_selftest@live@gt_engines
- For guc mode of submission the engine busyness is derived from gt time domain. Use gt time elapsed as reference in the selftest.
- Increase busyness calculation to 10ms duration to ensure batch runs longer and falls within the busyness tolerances in selftest.[snip]
Quoted 17 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +2
-1@@ -234,6 +234,7 @@ static int live_engine_busy_stats(void *arg) struct i915_request *rq; ktime_t de, dt; ktime_t t[2]; + u32 gt_stamp; if (!intel_engine_supports_stats(engine)) continue;@@ -251,10 +252,16 @@ static int live_engine_busy_stats(void *arg) ENGINE_TRACE(engine, "measuring idle time\n"); preempt_disable(); de = intel_engine_get_busy_time(engine, &t[0]); - udelay(100); + gt_stamp = intel_uncore_read(gt->uncore, GUCPMTIMESTAMP);drivers/gpu/drm/i915/gt/selftest_engine_pm.c static int live_engine_busy_stats(void *arg) · line 264
Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +6
-1+ udelay(10000); de = ktime_sub(intel_engine_get_busy_time(engine, &t[1]), de); + gt_stamp = intel_uncore_read(gt->uncore,GUCPMTIMESTAMP ) - gt_stamp; preempt_enable(); - dt = ktime_sub(t[1], t[0]); + + dt = intel_engine_uses_guc(engine) ? + intel_gt_clock_interval_to_ns(engine->gt, gt_stamp) : + ktime_sub(t[1], t[0]);But this then shows the thing might not work for external callers like PMU who have no idea about GUCPMTIMESTAMP and cannot obtain it anyway.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
What is the root cause of the failure here, 100us or clock source? Is the granularity of GUCPMTIMESTAMP perhaps simply too coarse for 100us test period? I forget what frequency it runs at.
guc timestamp is ticking at 19.2 MHz in adlp/rkl (where I ran this).
So ~52ns clock granularity, right?
In which case 100us with +/- 52ns error should be max 0.05% error - is this math correct?
Correct, but correlating GPU and CPU time in this manner is not accurate. In some cases the MMIO read of the GUC timestamp can take longer and since intel_engine_get_busy_time captures ktime into t[0] and t[1] BEFORE the stats are calculated, there is room for error. Even if t[0]/t[1] are captured AFTER the stats are calculated, it's the same issue. Ideally the test should do
before = ktime_get()
busyness1 = intel_engine_get_busy_time()
udelay(100)
busyness2 = intel_engine_get_busy_time()
after = ktime_get()
busy% = (busyness2 - busyness1)/(after - before) * 100
Isn't that how the user would do it?
Note: Second parameter to intel_engine_get_busy_time is not uabi, it's internal to i915 and mostly used by selftest or rps_timer (in non SLPC mode).
Quoted 8 lines
Quoted 4 lines
1)
With 100us, often times I see that the batch has not yet started, so I get busy time in the range 0 - 60 %. I increased the time such that the batch runs long enough to make the scheduling time < 5%.0-60% should not be possible since there is a
igt_wait_for_spinnercall before measuring starts, which ensures spinner is executing on the GPU.I think we first need to understand where is this 0 - 60% problem coming from because I don't think it is from batch not yet started.
Looks like it's possible that the GuC would update the busyness stats after the batch starts (when context goes from idle to active), so that's where this discrepancy is creeping in from. I am thinking of capturing busyness before igt_wait_for_spinner and then poll for busyness after the wait until the busyness starts ticking. Then we can continue with the remaining part of the test. Thoughts?
I tried running the above and ran into busyness > 100%. That's likely from the ktime_get issue mentioned above.
Thanks,
Umesh
Quoted 20 lines
Regards,
Tvrtko
Quoted 15 lines
2)
I did a 100 runs on rkl/adlp. No failures on rkl. On adlp, I saw one in 25 runs show 93%/94% busyness for rcs0 and fail (expected is 95%). For that I tried using the guc timestamp thinking it would provide more accuracy. It did in my testing, but CI still failed for rkl-guc (110% busyness!!), so now I just think we need to tweak the expected busyness for guc.Is 1) acceptable?
For 2) I am thinking of just changing the expected busyness to 90% plus for guc mode OR should we just let it fail occassionally? Thoughts?
Thanks,
UmeshQuoted 4 lines
Regards,
Tvrtko
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915/pmu: Add a name to the execlists stats
In reply to Umesh Nerlige Ramappa== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915/pmu: Add a name to the execlists stats
URL : https://patchwork.freedesktop.org/series/95904/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 7d0d1caf5425 drm/i915/pmu: Add a name to the execlists stats 08a443a8135c drm/i915/pmu: Connect engine busyness stats from GuC to pmu -:325: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #325: FILE: drivers/gpu/drm/i915/gt/selftest_engine_pm.c:256: + udelay(10000);
-:325: WARNING:LONG_UDELAY: long udelay - prefer mdelay; see arch/arm/include/asm/delay.h #325: FILE: drivers/gpu/drm/i915/gt/selftest_engine_pm.c:256:
+ udelay(10000);
-:344: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #344: FILE: drivers/gpu/drm/i915/gt/selftest_engine_pm.c:294:
+ udelay(10000);
-:344: WARNING:LONG_UDELAY: long udelay - prefer mdelay; see arch/arm/include/asm/delay.h #344: FILE: drivers/gpu/drm/i915/gt/selftest_engine_pm.c:294:
+ udelay(10000);
total: 0 errors, 2 warnings, 2 checks, 682 lines checked
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/2] drm/i915/pmu: Add a name to the execlists stats
In reply to Umesh Nerlige Ramappa== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915/pmu: Add a name to the execlists stats
URL : https://patchwork.freedesktop.org/series/95904/
State : warning
== Summary ==
$ dim sparse --fast origin/drm-tip Sparse version: v0.6.2 Fast mode used, each commit won't be checked separately. +drivers/gpu/drm/i915/gt/intel_engine_stats.h:28:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:28:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:28:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:33:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:33:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:51:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:51:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:51:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:57:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:57:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_reset.c:1407:5: warning: context imbalance in 'intel_gt_reset_trylock' - different lock contexts for basic block +./include/linux/rcupdate.h:716:9: warning: context imbalance in 'intel_gt_reset_trylock_no_wait' - different lock contexts for basic block -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:32:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:32:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:56:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_engine_stats.h:56:9: warning: trying to copy expression type 31 -O:drivers/gpu/drm/i915/gt/intel_reset.c:1392:5: warning: context imbalance in 'intel_gt_reset_trylock' - different lock contexts for basic block
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915/pmu: Add a name to the execlists stats
In reply to Umesh Nerlige Ramappa== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915/pmu: Add a name to the execlists stats
URL : https://patchwork.freedesktop.org/series/95904/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_10744 -> Patchwork_21358
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_21358 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_21358, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_21358:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@gt_engines:
- fi-rkl-guc: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10744/fi-rkl-guc/igt@i915_selftest@live@gt_engines.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-rkl-guc/igt@i915_selftest@live@gt_engines.html
Known issues
------------
Here are the changes found in Patchwork_21358 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_fence@basic-busy@bcs0:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271]) +9 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-kbl-soraka/igt@gem_exec_fence@[email protected]
* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-kbl-soraka/igt@[email protected]
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][5] ([i915#1886] / [i915#2291])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
* igt@kms_chamelium@common-hpd-after-suspend:
- fi-kbl-soraka: NOTRUN -> [SKIP][6] ([fdo#109271] / [fdo#111827]) +8 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-kbl-soraka/igt@[email protected]
- fi-kbl-7500u: [PASS][7] -> [DMESG-WARN][8] ([i915#2868])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10744/fi-kbl-7500u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-kbl-7500u/igt@[email protected]
* igt@kms_flip@basic-flip-vs-dpms@c-dp2:
- fi-cfl-8109u: [PASS][9] -> [DMESG-WARN][10] ([i915#165])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10744/fi-cfl-8109u/igt@kms_flip@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-cfl-8109u/igt@kms_flip@[email protected]
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:
- fi-cfl-8109u: [PASS][11] -> [DMESG-WARN][12] ([i915#165] / [i915#295]) +26 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10744/fi-cfl-8109u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-cfl-8109u/igt@[email protected]
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-kbl-soraka: NOTRUN -> [SKIP][13] ([fdo#109271] / [i915#533])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-kbl-soraka/igt@[email protected]
* igt@prime_vgem@basic-userptr:
- fi-pnv-d510: NOTRUN -> [SKIP][14] ([fdo#109271]) +48 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-pnv-d510/igt@[email protected]
* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][15] ([i915#1602] / [i915#2029])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-bdw-5557u/igt@[email protected]
- fi-rkl-guc: NOTRUN -> [FAIL][16] ([i915#3928])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-rkl-guc/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_parallel@engines@userptr:
- fi-pnv-d510: [INCOMPLETE][17] ([i915#299]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10744/fi-pnv-d510/igt@gem_exec_parallel@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/fi-pnv-d510/igt@gem_exec_parallel@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112080]: https://bugs.freedesktop.org/show_bug.cgi?id=112080
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#165]: https://gitlab.freedesktop.org/drm/intel/issues/165
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
[i915#2868]: https://gitlab.freedesktop.org/drm/intel/issues/2868
[i915#295]: https://gitlab.freedesktop.org/drm/intel/issues/295
[i915#299]: https://gitlab.freedesktop.org/drm/intel/issues/299
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
[i915#3928]: https://gitlab.freedesktop.org/drm/intel/issues/3928
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
Participating hosts (39 -> 36)
------------------------------
Additional (2): fi-kbl-soraka fi-jsl-1
Missing (5): bat-dg1-6 fi-hsw-4200u bat-dg1-5 fi-bsw-cyan fi-bdw-samus
Build changes
-------------
* Linux: CI_DRM_10744 -> Patchwork_21358
CI-20190529: 20190529
CI_DRM_10744: dc405215cfabb6f13490cbdceb1f6e831e8a8596 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6250: 3c2ac88757f0d0ac9450487d314fcaceebc8bc26 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21358: 08a443a8135cf9ab19c3373833fe9a09594a06cb @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
08a443a8135c drm/i915/pmu: Connect engine busyness stats from GuC to pmu 7d0d1caf5425 drm/i915/pmu: Add a name to the execlists stats
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21358/index.html