Queued/runnable/running engine stats
Subsystems (3)
Tvrtko Ursulin
maintainerv3 cover Queued/runnable/running engine stats
From: Tvrtko Ursulin <[email protected]>
Per-engine queue depths are an interesting metric for analyzing the system load and also for users who wish to use it to load balance their submissions based on it.
In this version I have split the metrics into three separate counters:
1. QUEUED - From execbuf time to request being runnable - runnable meaning until dependencies have been resolved and fences signaled.
2. RUNNABLE - From runnable to running on the GPU.
3. RUNNING - Running on the GPU.
When inspected with perf stat the output looks roughly like this:
# time counts unit events
201.160490145 0.01 i915/rcs0-queued/ 201.160490145 19.13 i915/rcs0-runnable/ 201.160490145 2.39 i915/rcs0-running/
The reported numbers are average queue depths for the last query period.
Having split out metrics should be more flexible for all users, and it is still possible to fetch an atomic snapshot of all using the perf groups for those wanting to combine them.
For users wanting instantanous numbers instead of averaged, we could potentially expose them using the query API Lionel is working on.
(https://patchwork.freedesktop.org/series/36622/)
For instance a query packet could look like:
#define DRM_I915_QUERY_ENGINE_QUEUES 0x04
struct drm_i915_query_engine_queues {
__u8 class;
__u8 instance
__u8 pad[2];
__u32 queued;
__u32 runnable;
__u32 running;
};I also have patches to expose this via intel-gpu-top, using the perf API.
v2:
* Review feedback (see patch changelogs).
* Renamed the counters and re-ordered some patches.
v3:
* Review feedback and rebase.
Tvrtko Ursulin (6):
drm/i915/pmu: Fix enable count array size and bounds checking drm/i915: Keep a count of requests waiting for a slot on GPU drm/i915: Keep a count of requests submitted from userspace drm/i915/pmu: Add queued counter
drm/i915/pmu: Add runnable counter
drm/i915/pmu: Add running counter
drivers/gpu/drm/i915/i915_gem_request.c | 10 ++++ drivers/gpu/drm/i915/i915_pmu.c | 81 +++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_engine_cs.c | 6 ++- drivers/gpu/drm/i915/intel_lrc.c | 2 + drivers/gpu/drm/i915/intel_ringbuffer.h | 21 ++++++++- include/uapi/drm/i915_drm.h | 19 +++++++- 6 files changed, 126 insertions(+), 13 deletions(-)
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v3 1/6 drm/i915/pmu: Fix enable count array size and bounds checking
From: Tvrtko Ursulin <[email protected]>
Enable count array is supposed to have one counter for each possible engine sampler. As such array sizing and bounds checking is not correct when more engine samplers are added.
At the same time tidy the assert for readability and robustness.
--- drivers/gpu/drm/i915/i915_pmu.c | 13 +++++++++---- drivers/gpu/drm/i915/intel_ringbuffer.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +9 -4
@@ -576,7 +576,8 @@ static void i915_pmu_enable(struct perf_event *event)* Update the bitmask of enabled events and increment * the event reference counter. */ -GEM_BUG_ON (bit >=I915_PMU_MASK_BITS ); +BUILD_BUG_ON (ARRAY_SIZE (i915->pmu.enable_count) !=I915_PMU_MASK_BITS ); +GEM_BUG_ON (bit >=ARRAY_SIZE (i915->pmu.enable_count));GEM_BUG_ON (i915->pmu.enable_count[bit] == ~0 ); i915->pmu.enable |=BIT_ULL (bit); i915->pmu.enable_count[bit]++;
@@ -600,7 +601,10 @@ static void i915_pmu_enable(struct perf_event *event)GEM_BUG_ON (!engine); engine->pmu.enable |=BIT (sample); -GEM_BUG_ON (sample >=I915_PMU_SAMPLE_BITS ); +BUILD_BUG_ON (ARRAY_SIZE (engine->pmu.enable_count) != + (1 <<I915_PMU_SAMPLE_BITS )); +GEM_BUG_ON (sample >=ARRAY_SIZE (engine->pmu.enable_count)); +GEM_BUG_ON (sample >=ARRAY_SIZE (engine->pmu.sample));GEM_BUG_ON (engine->pmu.enable_count[sample] == ~0 ); engine->pmu.enable_count[sample]++; }
@@ -632,7 +636,8 @@ static void i915_pmu_disable(struct perf_event *event)engine_event_class (event), engine_event_instance(event));GEM_BUG_ON (!engine); -GEM_BUG_ON (sample >=I915_PMU_SAMPLE_BITS ); +GEM_BUG_ON (sample >=ARRAY_SIZE (engine->pmu.enable_count)); +GEM_BUG_ON (sample >=ARRAY_SIZE (engine->pmu.sample));GEM_BUG_ON (engine->pmu.enable_count[sample] ==0 );/* * Decrement the reference count and clear the enabled
@@ -642,7 +647,7 @@ static void i915_pmu_disable(struct perf_event *event) engine->pmu.enable &= ~BIT (sample); } -GEM_BUG_ON (bit >=I915_PMU_MASK_BITS ); +GEM_BUG_ON (bit >=ARRAY_SIZE (i915->pmu.enable_count));GEM_BUG_ON (i915->pmu.enable_count[bit] ==0 );/* * Decrement the reference count and clear the enabled
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -1
@@ -363,7 +363,7 @@ struct intel_engine_cs {* * Index number corresponds to the bit number from @enable. */ -unsigned int enable_count[I915_PMU_SAMPLE_BITS ]; +unsigned int enable_count[1 <<I915_PMU_SAMPLE_BITS ];/** * @sample: Counter values for sampling events. *
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v3 2/6 drm/i915: Keep a count of requests waiting for a slot on GPU
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Keep a per-engine number of runnable (waiting for GPU time) requests.
v2:
* Move queued increment from insert_request to execlist_submit_request to avoid bumping when re-ordering for priority.
* Support the counter on the ringbuffer submission path as well, albeit just notionally. (Chris Wilson)
v3:
* Rebase.
v4:
* Rename and move the stats into a container structure. (Chris Wilson)
v5:
* Re-order fields in struct intel_engine_cs. (Chris Wilson)
--- drivers/gpu/drm/i915/i915_gem_request.c | 7 +++++++ drivers/gpu/drm/i915/intel_engine_cs.c | 5 +++-- drivers/gpu/drm/i915/intel_lrc.c | 2 ++ drivers/gpu/drm/i915/intel_ringbuffer.h | 9 +++++++++ 4 files changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_request.c +7 -0
@@ -511,6 +511,9 @@ void __i915_gem_request_submit(struct drm_i915_gem_request *request) engine->emit_breadcrumb (request, request->ring->vaddr + request->postfix); +GEM_BUG_ON (engine->request_stats.runnable ==0 ); + engine->request_stats.runnable--; +spin_lock (&request->timeline->lock);list_move_tail (&request->link, &timeline->requests);spin_unlock (&request->timeline->lock);
@@ -526,6 +529,8 @@ void i915_gem_request_submit(struct drm_i915_gem_request *request)/* Will be called from irq-context when using foreign fences. */ spin_lock_irqsave (&engine->timeline->lock, flags); + engine->request_stats.runnable++; +__i915_gem_request_submit (request);spin_unlock_irqrestore (&engine->timeline->lock, flags);
@@ -559,6 +564,8 @@ void __i915_gem_request_unsubmit(struct drm_i915_gem_request *request) timeline = request->timeline;GEM_BUG_ON (timeline == engine->timeline); + engine->request_stats.runnable++; +spin_lock (&timeline->lock);list_move (&request->link, &timeline->requests);spin_unlock (&timeline->lock);
drivers/gpu/drm/i915/intel_engine_cs.c +3 -2
@@ -1727,12 +1727,13 @@ void intel_engine_dump(struct intel_engine_cs *engine,if (i915_terminally_wedged (&engine->i915->gpu_error))drm_printf (m,"*** WEDGED ***\n" ); -drm_printf (m,"\tcurrent seqno %x, last %x, hangcheck %x [%d ms], inflight %d\n" , +drm_printf (m,"\tcurrent seqno %x, last %x, hangcheck %x [%d ms], inflight %d, runnable %u\n" ,intel_engine_get_seqno (engine),intel_engine_last_submit (engine), engine->hangcheck.seqno,jiffies_to_msecs (jiffies - engine->hangcheck.action_timestamp), - engine->timeline->inflight_seqnos); + engine->timeline->inflight_seqnos, + engine->request_stats.runnable);drm_printf (m,"\tReset count: %d (global %d)\n" ,i915_reset_engine_count (error, engine),i915_reset_count (error));
drivers/gpu/drm/i915/intel_lrc.c +2 -0
@@ -929,6 +929,8 @@ static void execlists_submit_request(struct drm_i915_gem_request *request)/* Will be called from irq-context when using foreign fences. */ spin_lock_irqsave (&engine->timeline->lock, flags); + engine->request_stats.runnable++; +insert_request (engine, &request->priotree, request->priotree.priority);GEM_BUG_ON (!engine->execlists.first);
drivers/gpu/drm/i915/intel_ringbuffer.h +9 -0
@@ -310,6 +310,15 @@ struct intel_engine_cs {struct drm_i915_gem_object *default_state; +struct { +/** +* @runnable: Number of runnable requests sent to the backend. +* +* Count of requests waiting for the GPU to execute them. +*/ +unsigned int runnable; + } request_stats; +atomic_t irq_count;unsigned long irq_posted;#define ENGINE_IRQ_BREADCRUMB 0
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v3 3/6 drm/i915: Keep a count of requests submitted from userspace
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Keep a count of requests submitted from userspace and not yet runnable due unresolved dependencies.
v2: Rename and move under the container struct. (Chris Wilson)
--- drivers/gpu/drm/i915/i915_gem_request.c | 3 +++ drivers/gpu/drm/i915/intel_engine_cs.c | 3 ++- drivers/gpu/drm/i915/intel_ringbuffer.h | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_request.c +3 -0
@@ -610,6 +610,7 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)rcu_read_lock (); request->engine->submit_request (request);rcu_read_unlock (); +atomic_dec (&request->engine->request_stats.queued);break ;case FENCE_FREE :
@@ -1083,6 +1084,8 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)if (engine->schedule) engine->schedule (request, request->ctx->priority); +atomic_inc (&engine->request_stats.queued); +local_bh_disable ();i915_sw_fence_commit (&request->submit);local_bh_enable ();/* Kick the execlists tasklet if just scheduled */
drivers/gpu/drm/i915/intel_engine_cs.c +2 -1
@@ -1727,12 +1727,13 @@ void intel_engine_dump(struct intel_engine_cs *engine,if (i915_terminally_wedged (&engine->i915->gpu_error))drm_printf (m,"*** WEDGED ***\n" ); -drm_printf (m,"\tcurrent seqno %x, last %x, hangcheck %x [%d ms], inflight %d, runnable %u\n" , +drm_printf (m,"\tcurrent seqno %x, last %x, hangcheck %x [%d ms], inflight %d, queued %u, runnable %u\n" ,intel_engine_get_seqno (engine),intel_engine_last_submit (engine), engine->hangcheck.seqno,jiffies_to_msecs (jiffies - engine->hangcheck.action_timestamp), engine->timeline->inflight_seqnos, +atomic_read (&engine->request_stats.queued), engine->request_stats.runnable); drm_printf(m, "\tReset count: %d (global %d)\n", i915_reset_engine_count(error, engine),
drivers/gpu/drm/i915/intel_ringbuffer.h +8 -0
@@ -311,6 +311,14 @@ struct intel_engine_cs {struct drm_i915_gem_object *default_state;struct { +/** +* @queued: Number of submitted requests with dependencies. +* +* Count of requests waiting for dependencies before they can be +* submitted to the backend. +*/ +atomic_t queued; +/** * @runnable: Number of runnable requests sent to the backend. *
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v3 4/6 drm/i915/pmu: Add queued counter
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
We add a PMU counter to expose the number of requests which have been submitted from userspace but are not yet runnable due dependencies and unsignaled fences.
This is useful to analyze the overall load of the system.
v2:
* Rebase for name change and re-order.
* Drop floating point constant. (Chris Wilson)
v3:
* Change scale to 1024 for faster arithmetics. (Chris Wilson)
--- drivers/gpu/drm/i915/i915_pmu.c | 40 +++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_ringbuffer.h | 2 +- include/uapi/drm/i915_drm.h | 9 +++++++- 3 files changed, 45 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +36 -4
@@ -36,7 +36,8 @@#define ENGINE_SAMPLE_MASK \ (BIT(I915_SAMPLE_BUSY) | \ BIT(I915_SAMPLE_WAIT) | \ - BIT(I915_SAMPLE_SEMA)) + BIT(I915_SAMPLE_SEMA) | \ + BIT(I915_SAMPLE_QUEUED))#define ENGINE_SAMPLE_BITS (1 << I915_PMU_SAMPLE_BITS)
@@ -220,6 +221,11 @@ static void engines_sample(struct drm_i915_private *dev_priv)update_sample (&engine->pmu.sample[I915_SAMPLE_SEMA ],PERIOD , !!(val &RING_WAIT_SEMAPHORE )); + +if (engine->pmu.enable &BIT (I915_SAMPLE_QUEUED )) +update_sample (&engine->pmu.sample[I915_SAMPLE_QUEUED ], +I915_SAMPLE_QUEUED_DIVISOR , +atomic_read (&engine->request_stats.queued)); }if (fw)
@@ -317,6 +323,7 @@ engine_event_status(struct intel_engine_cs *engine,switch (sample) {case I915_SAMPLE_BUSY :case I915_SAMPLE_WAIT : +case I915_SAMPLE_QUEUED :break ;case I915_SAMPLE_SEMA :if (INTEL_GEN (engine->i915) <6 )
@@ -524,6 +531,9 @@ static u64 __i915_pmu_event_read(struct perf_event *event, bool locked) }else { val = engine->pmu.sample[sample].cur; } + +if (sample ==I915_SAMPLE_QUEUED ) + val =div_u64 (val,FREQUENCY ); }else {switch (event->attr.config) {case I915_PMU_ACTUAL_FREQUENCY :
@@ -779,6 +789,16 @@ static const struct attribute_group *i915_pmu_attr_groups[] = { { \ .sample = (__sample), \ .name = (__name), \ + .suffix = "unit", \ + .value = "ns", \ +} + +#define __engine_event_scale (__sample, __name, __scale) \ +{ \ + .sample = (__sample), \ + .name = (__name), \ + .suffix = "scale", \ + .value = (__scale), \ } static struct i915_ext_attribute *
@@ -806,6 +826,9 @@ add_pmu_attr(struct perf_pmu_events_attr *attr, const char *name,return ++attr; } +/* No brackets or quotes below please. */ +#define I915_SAMPLE_QUEUED_SCALE 0.0009765625 +static struct attribute **create_event_attributes (struct drm_i915_private *i915) {
@@ -822,10 +845,14 @@ create_event_attributes(struct drm_i915_private *i915)static const struct {enum drm_i915_pmu_engine_sample sample;char *name; +char *suffix; +char *value; } engine_events[] = {__engine_event (I915_SAMPLE_BUSY ,"busy" ),__engine_event (I915_SAMPLE_SEMA ,"sema" ),__engine_event (I915_SAMPLE_WAIT ,"wait" ), +__engine_event_scale (I915_SAMPLE_QUEUED ,"queued" , +__stringify (I915_SAMPLE_QUEUED_SCALE )), };unsigned int count =0 ;struct perf_pmu_events_attr *pmu_attr =NULL , *pmu_iter;
@@ -835,6 +862,9 @@ create_event_attributes(struct drm_i915_private *i915)enum intel_engine_id id;unsigned int i; +BUILD_BUG_ON (I915_SAMPLE_QUEUED_DIVISOR != + (1 /I915_SAMPLE_QUEUED_SCALE )); +/* Count how many counters we will be exposing. */ for (i =0 ; i <ARRAY_SIZE (events); i++) {if (!config_status (i915, events[i].config))
@@ -912,13 +942,15 @@ create_event_attributes(struct drm_i915_private *i915) engine->instance, engine_events[i].sample)); - str =kasprintf (GFP_KERNEL ,"%s-%s.unit" , - engine->name, engine_events[i].name); + str =kasprintf (GFP_KERNEL ,"%s-%s.%s" , + engine->name, engine_events[i].name, + engine_events[i].suffix);if (!str) goto err; *attr_iter++ = &pmu_iter->attr.attr; - pmu_iter =add_pmu_attr (pmu_iter, str,"ns" ); + pmu_iter =add_pmu_attr (pmu_iter, str, + engine_events[i].value); } }
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -1
@@ -386,7 +386,7 @@ struct intel_engine_cs {* * Our internal timer stores the current counters in this field. */ -#define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_SEMA + 1) +#define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_QUEUED + 1)struct i915_pmu_sample sample[I915_ENGINE_SAMPLE_MAX ]; } pmu;
include/uapi/drm/i915_drm.h +8 -1
@@ -110,9 +110,13 @@ enum drm_i915_gem_engine_class {enum drm_i915_pmu_engine_sample {I915_SAMPLE_BUSY =0 ,I915_SAMPLE_WAIT =1 , -I915_SAMPLE_SEMA =2 +I915_SAMPLE_SEMA =2 , +I915_SAMPLE_QUEUED =3 }; +/* Divide counter value by divisor to get the real value. */ +#define I915_SAMPLE_QUEUED_DIVISOR (1024) +#define I915_PMU_SAMPLE_BITS (4)#define I915_PMU_SAMPLE_MASK (0xf)#define I915_PMU_SAMPLE_INSTANCE_BITS (8)
@@ -133,6 +137,9 @@ enum drm_i915_pmu_engine_sample {#define I915_PMU_ENGINE_SEMA (class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA) +#define I915_PMU_ENGINE_QUEUED (class, instance) \ + __I915_PMU_ENGINE(class, instance, I915_SAMPLE_QUEUED) +#define __I915_PMU_OTHER (x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v3 5/6 drm/i915/pmu: Add runnable counter
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
We add a PMU counter to expose the number of requests with resolved dependencies waiting for a slot on the GPU to run.
This is useful to analyze the overall load of the system.
v2: Don't limit to gen8+.
v3:
* Rebase for dynamic sysfs.
* Drop currently executing requests.
v4:
* Sync with internal renaming.
* Drop floating point constant. (Chris Wilson)
v5:
* Change scale to 1024 for faster arithmetics. (Chris Wilson)
--- drivers/gpu/drm/i915/i915_pmu.c | 18 ++++++++++++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 2 +- include/uapi/drm/i915_drm.h | 7 ++++++- 3 files changed, 23 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +16 -2
@@ -37,7 +37,8 @@ (BIT (I915_SAMPLE_BUSY ) | \BIT (I915_SAMPLE_WAIT ) | \BIT (I915_SAMPLE_SEMA ) | \ - BIT(I915_SAMPLE_QUEUED)) +BIT (I915_SAMPLE_QUEUED ) | \ + BIT(I915_SAMPLE_RUNNABLE))#define ENGINE_SAMPLE_BITS (1 << I915_PMU_SAMPLE_BITS)
@@ -226,6 +227,11 @@ static void engines_sample(struct drm_i915_private *dev_priv)update_sample (&engine->pmu.sample[I915_SAMPLE_QUEUED ],I915_SAMPLE_QUEUED_DIVISOR ,atomic_read (&engine->request_stats.queued)); + +if (engine->pmu.enable &BIT (I915_SAMPLE_RUNNABLE )) +update_sample (&engine->pmu.sample[I915_SAMPLE_RUNNABLE ], +I915_SAMPLE_RUNNABLE_DIVISOR , + engine->request_stats.runnable); }if (fw)
@@ -324,6 +330,7 @@ engine_event_status(struct intel_engine_cs *engine,case I915_SAMPLE_BUSY :case I915_SAMPLE_WAIT :case I915_SAMPLE_QUEUED : +case I915_SAMPLE_RUNNABLE :break ;case I915_SAMPLE_SEMA :if (INTEL_GEN (engine->i915) <6 )
@@ -532,7 +539,8 @@ static u64 __i915_pmu_event_read(struct perf_event *event, bool locked) val = engine->pmu.sample[sample].cur; } -if (sample ==I915_SAMPLE_QUEUED ) +if (sample ==I915_SAMPLE_QUEUED || + sample ==I915_SAMPLE_RUNNABLE ) val =div_u64 (val,FREQUENCY ); }else {switch (event->attr.config) {
@@ -828,6 +836,7 @@ add_pmu_attr(struct perf_pmu_events_attr *attr, const char *name,/* No brackets or quotes below please. */ #define I915_SAMPLE_QUEUED_SCALE 0.0009765625 +#define I915_SAMPLE_RUNNABLE_SCALE 0.0009765625static struct attribute **create_event_attributes (struct drm_i915_private *i915)
@@ -853,6 +862,8 @@ create_event_attributes(struct drm_i915_private *i915)__engine_event (I915_SAMPLE_WAIT ,"wait" ),__engine_event_scale (I915_SAMPLE_QUEUED ,"queued" ,__stringify (I915_SAMPLE_QUEUED_SCALE )), +__engine_event_scale (I915_SAMPLE_RUNNABLE ,"runnable" , + __stringify(I915_SAMPLE_RUNNABLE_SCALE)), };unsigned int count =0 ;struct perf_pmu_events_attr *pmu_attr =NULL , *pmu_iter;
@@ -865,6 +876,9 @@ create_event_attributes(struct drm_i915_private *i915)BUILD_BUG_ON (I915_SAMPLE_QUEUED_DIVISOR != (1 /I915_SAMPLE_QUEUED_SCALE )); +BUILD_BUG_ON (I915_SAMPLE_RUNNABLE_DIVISOR != + (1 /I915_SAMPLE_RUNNABLE_SCALE )); +/* Count how many counters we will be exposing. */ for (i =0 ; i <ARRAY_SIZE (events); i++) {if (!config_status (i915, events[i].config))
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -1
@@ -386,7 +386,7 @@ struct intel_engine_cs {* * Our internal timer stores the current counters in this field. */ -#define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_QUEUED + 1) +#define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_RUNNABLE + 1)struct i915_pmu_sample sample[I915_ENGINE_SAMPLE_MAX ]; } pmu;
include/uapi/drm/i915_drm.h +6 -1
@@ -111,11 +111,13 @@ enum drm_i915_pmu_engine_sample {I915_SAMPLE_BUSY =0 ,I915_SAMPLE_WAIT =1 ,I915_SAMPLE_SEMA =2 , - I915_SAMPLE_QUEUED = 3 +I915_SAMPLE_QUEUED =3 , + I915_SAMPLE_RUNNABLE = 4, };/* Divide counter value by divisor to get the real value. */ #define I915_SAMPLE_QUEUED_DIVISOR (1024) +#define I915_SAMPLE_RUNNABLE_DIVISOR (1024)#define I915_PMU_SAMPLE_BITS (4)#define I915_PMU_SAMPLE_MASK (0xf)
@@ -140,6 +142,9 @@ enum drm_i915_pmu_engine_sample {#define I915_PMU_ENGINE_QUEUED (class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_QUEUED) +#define I915_PMU_ENGINE_RUNNABLE (class, instance) \ + __I915_PMU_ENGINE(class, instance, I915_SAMPLE_RUNNABLE) +#define __I915_PMU_OTHER (x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v3 6/6 drm/i915/pmu: Add running counter
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
We add a PMU counter to expose the number of requests currently executing on the GPU.
This is useful to analyze the overall load of the system.
v2:
* Rebase.
* Drop floating point constant. (Chris Wilson)
v3:
* Change scale to 1024 for faster arithmetics. (Chris Wilson)
--- drivers/gpu/drm/i915/i915_pmu.c | 18 ++++++++++++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 2 +- include/uapi/drm/i915_drm.h | 5 +++++ 3 files changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +16 -2
@@ -38,7 +38,8 @@BIT (I915_SAMPLE_WAIT ) | \BIT (I915_SAMPLE_SEMA ) | \BIT (I915_SAMPLE_QUEUED ) | \ - BIT(I915_SAMPLE_RUNNABLE)) +BIT (I915_SAMPLE_RUNNABLE ) | \ + BIT(I915_SAMPLE_RUNNING)) #define ENGINE_SAMPLE_BITS (1 << I915_PMU_SAMPLE_BITS)
@@ -232,6 +233,11 @@ static void engines_sample(struct drm_i915_private *dev_priv)update_sample (&engine->pmu.sample[I915_SAMPLE_RUNNABLE ],I915_SAMPLE_RUNNABLE_DIVISOR , engine->request_stats.runnable); + +if (engine->pmu.enable &BIT (I915_SAMPLE_RUNNING )) +update_sample (&engine->pmu.sample[I915_SAMPLE_RUNNING ], +I915_SAMPLE_RUNNING_DIVISOR , + last_seqno - current_seqno); }if (fw)
@@ -331,6 +337,7 @@ engine_event_status(struct intel_engine_cs *engine,case I915_SAMPLE_WAIT :case I915_SAMPLE_QUEUED :case I915_SAMPLE_RUNNABLE : +case I915_SAMPLE_RUNNING :break ;case I915_SAMPLE_SEMA :if (INTEL_GEN (engine->i915) <6 )
@@ -540,7 +547,8 @@ static u64 __i915_pmu_event_read(struct perf_event *event, bool locked) }if (sample ==I915_SAMPLE_QUEUED || - sample ==I915_SAMPLE_RUNNABLE ) + sample ==I915_SAMPLE_RUNNABLE || + sample ==I915_SAMPLE_RUNNING ) val =div_u64 (val,FREQUENCY ); }else {switch (event->attr.config) {
@@ -837,6 +845,7 @@ add_pmu_attr(struct perf_pmu_events_attr *attr, const char *name,/* No brackets or quotes below please. */ #define I915_SAMPLE_QUEUED_SCALE 0.0009765625#define I915_SAMPLE_RUNNABLE_SCALE 0.0009765625 +#define I915_SAMPLE_RUNNING_SCALE 0.0009765625static struct attribute **create_event_attributes (struct drm_i915_private *i915)
@@ -864,6 +873,8 @@ create_event_attributes(struct drm_i915_private *i915) __stringify(I915_SAMPLE_QUEUED_SCALE)),__engine_event_scale (I915_SAMPLE_RUNNABLE ,"runnable" ,__stringify (I915_SAMPLE_RUNNABLE_SCALE )), +__engine_event_scale (I915_SAMPLE_RUNNING ,"running" , + __stringify(I915_SAMPLE_RUNNING_SCALE)), };unsigned int count =0 ;struct perf_pmu_events_attr *pmu_attr =NULL , *pmu_iter;
@@ -879,6 +890,9 @@ create_event_attributes(struct drm_i915_private *i915)BUILD_BUG_ON (I915_SAMPLE_RUNNABLE_DIVISOR != (1 /I915_SAMPLE_RUNNABLE_SCALE )); +BUILD_BUG_ON (I915_SAMPLE_RUNNING_DIVISOR != + (1 /I915_SAMPLE_RUNNING_SCALE )); +/* Count how many counters we will be exposing. */ for (i =0 ; i <ARRAY_SIZE (events); i++) {if (!config_status (i915, events[i].config))
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -1
@@ -386,7 +386,7 @@ struct intel_engine_cs {* * Our internal timer stores the current counters in this field. */ -#define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_RUNNABLE + 1) +#define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_RUNNING + 1)struct i915_pmu_sample sample[I915_ENGINE_SAMPLE_MAX ]; } pmu;
include/uapi/drm/i915_drm.h +5 -0
@@ -113,11 +113,13 @@ enum drm_i915_pmu_engine_sample {I915_SAMPLE_SEMA =2 ,I915_SAMPLE_QUEUED =3 ,I915_SAMPLE_RUNNABLE =4 , + I915_SAMPLE_RUNNING = 5, };/* Divide counter value by divisor to get the real value. */ #define I915_SAMPLE_QUEUED_DIVISOR (1024)#define I915_SAMPLE_RUNNABLE_DIVISOR (1024) +#define I915_SAMPLE_RUNNING_DIVISOR (1024)#define I915_PMU_SAMPLE_BITS (4)#define I915_PMU_SAMPLE_MASK (0xf)
@@ -145,6 +147,9 @@ enum drm_i915_pmu_engine_sample {#define I915_PMU_ENGINE_RUNNABLE (class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_RUNNABLE) +#define I915_PMU_ENGINE_RUNNING (class, instance) \ + __I915_PMU_ENGINE(class, instance, I915_SAMPLE_RUNNING) +#define __I915_PMU_OTHER (x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Queued/runnable/running engine stats (rev2)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: Queued/runnable/running engine stats (rev2)
URL : https://patchwork.freedesktop.org/series/36926/
State : success
== Summary ==
Series 36926v2 Queued/runnable/running engine stats
https://patchwork.freedesktop.org/api/1.0/series/36926/revisions/2/mbox/
Test gem_ringfill:
Subgroup basic-default-hang:
dmesg-warn -> INCOMPLETE (fi-blb-e6850) fdo#101600 +1
Test prime_vgem:
Subgroup basic-fence-flip:
fail -> PASS (fi-ilk-650)fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fi-bdw-5557u total:288 pass:265 dwarn:0 dfail:0 fail:2 skip:21 time:441s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:424s fi-blb-e6850 total:146 pass:114 dwarn:0 dfail:0 fail:0 skip:31 fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:482s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:288s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:483s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:487s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:468s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:459s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:567s fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:578s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:415s fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:280s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:512s fi-hsw-4770 total:288 pass:259 dwarn:0 dfail:0 fail:2 skip:27 time:411s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:418s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:455s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:413s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:458s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:494s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:501s fi-pnv-d510 total:146 pass:113 dwarn:0 dfail:0 fail:0 skip:32 fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:426s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:507s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:526s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:488s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:477s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:412s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:430s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:528s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:400s
Blacklisted hosts:
fi-glk-dsi total:288 pass:222 dwarn:36 dfail:0 fail:0 skip:30 time:512s
83878f486e686dd291ef3566a45103962d7617ed drm-tip: 2018y-02m-12d-17h-43m-07s UTC integration manifest 6a799d3c4de5 drm/i915/pmu: Add running counterd237f5f9f64a drm/i915/pmu: Add runnable counter4195f08e5171 drm/i915/pmu: Add queued counter0b151e057a18 drm/i915: Keep a count of requests submitted from userspace 8b8673e0296c drm/i915: Keep a count of requests waiting for a slot on GPU a9eb3199938c drm/i915/pmu: Fix enable count array size and bounds checking
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7985/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: failure for Queued/runnable/running engine stats (rev2)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: Queued/runnable/running engine stats (rev2)
URL : https://patchwork.freedesktop.org/series/36926/
State : failure
== Summary ==
Test kms_plane_scaling:
Subgroup pipe-a-scaler-with-rotation:
skip -> PASS (shard-apl)
Test kms_vblank:
Subgroup pipe-b-wait-busy:
skip -> PASS (shard-apl)
Test kms_color:
Subgroup pipe-c-ctm-max:
skip -> PASS (shard-apl)
Subgroup pipe-c-degamma:
skip -> PASS (shard-apl)
Subgroup pipe-b-ctm-green-to-red:
skip -> PASS (shard-apl)
Test pm_rpm:
Subgroup gem-mmap-cpu:
skip -> PASS (shard-apl)
Subgroup system-suspend-modeset:
skip -> PASS (shard-apl)
Test kms_flip:
Subgroup dpms-vs-vblank-race:
pass -> FAIL (shard-hsw) fdo#103060
Subgroup blocking-absolute-wf_vblank:
skip -> PASS (shard-apl)
Subgroup wf_vblank-ts-check-interruptible:
skip -> PASS (shard-apl) fdo#100368
Test gem_eio:
Subgroup in-flight-internal:
pass -> INCOMPLETE (shard-snb)
pass -> INCOMPLETE (shard-apl)
Subgroup in-flight-external:
pass -> INCOMPLETE (shard-snb)
pass -> INCOMPLETE (shard-hsw) fdo#104676
pass -> INCOMPLETE (shard-apl)
Test kms_mmio_vs_cs_flip:
Subgroup setcrtc_vs_cs_flip:
skip -> PASS (shard-apl)
Test kms_cursor_legacy:
Subgroup flip-vs-cursor-crc-legacy:
skip -> PASS (shard-apl)
Subgroup cursora-vs-flipa-legacy:
skip -> PASS (shard-apl)
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-indfb-draw-render:
skip -> PASS (shard-apl) fdo#103167 +1
Test kms_rmfb:
Subgroup rmfb-ioctl:
skip -> PASS (shard-apl)
Test kms_rotation_crc:
Subgroup exhaust-fences:
skip -> PASS (shard-apl)
Subgroup cursor-rotation-180:
pass -> FAIL (shard-hsw) fdo#102614fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
shard-apl total:3280 pass:1694 dwarn:1 dfail:0 fail:21 skip:1561 time:12820s shard-hsw total:3356 pass:1674 dwarn:1 dfail:0 fail:55 skip:1624 time:14315s shard-snb total:3297 pass:1291 dwarn:1 dfail:0 fail:11 skip:1992 time:7179s
Blacklisted hosts:
shard-kbl total:3297 pass:1828 dwarn:1 dfail:0 fail:22 skip:1444 time:10284s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7985/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx