Framework to collect command stream gpu metrics using i915 perf
Subsystems (3)
cover Framework to collect command stream gpu metrics using i915 perf
From: Sourab Gupta <[email protected]>
This series adds framework for collection of gpu performance metrics associated with the command stream of a particular engine. These metrics include OA reports, timestamps, mmio metrics, etc. These metrics are are collected around batchbuffer boundaries.
This work utilizes the underlying infrastructure introduced in Robert Bragg's patches for collecting periodic OA counter snapshots (based on Haswell):
https://lists.freedesktop.org/archives/intel-gfx/2016-April/093206.html
This patch set is based on Gen8+ version of Robert's patches which can be found
here: https://github.com/rib/linux/commits/wip/rib/oa-2016-04-18-nightly
These are not yet individually floated in the mailing list, which I hope doesn't lead to any significant loss of clarity in order to review the work proposed in this patch series.
Compared to last series I floated earlier,
(https://lists.freedesktop.org/archives/intel-gfx/2016-February/087686.html),
this series incorporates the following changes/fixes, besides rebasing on Robert's latest work:
* Few refinements related to flushing periodic OA samples in case of no pending CS samples, but not doing so in case there are pending CS samples (queued but requests not yet completed).
* For the case of overflow of command stream buf, we can choose to overwrite old entries or stop collecting more samples. This is right now controlled via compile time macro. We can move to either of these behaviors going forward.
* The sample consistency is maintained between the periodic OA reports and command stream ones. This implies, for e.g., that if ctx_id/pid sample type is requested, the most recent pid collected in the CS samples is used to populate the relevant field in the periodic samples.
* In case both timestamp and OA sample type are requested for render engine, the raw gpu timestamps are extracted from OA report only, and we don't need to insert seperate commands for retreiving timestamps.
* Introduction of a new property to request inclusion of CLOCK_MONOTONIC time in the samples. Being able to correlate gpu events/samples with CLOCK_MONOTONIC is of practical use to userspace, for usecases involving correlation of gpu events with system time. This may, for e.g., involve plotting gpu and system events on the same timeline (such as vblank events, or timestamps for when work was submitted to the kernel, etc.). The patch introduces a sync mechanism in order to correlate the gpu timestamps with CLOCK_MONOTONIC time to begin with. This can further be extended for other clock domains. Sync is needed because published gpu timestamp clock frequency may differ and lead to clock drift. The sync mechanism may be crude right now and improved upon going forward, but this is the general thinking behind introduction of this mechanism.
* The gpu raw timestamp can also be forwarded in conjunction with CLOCK_MONOTONIC time, since userspace may have a need for both. E.g. the raw timestamps are exposed to userspace if it uses PIPE_CONTROL + post_sync_op='write timestamp' and userspace may want to correlate these with perf metrics.
For reference, the patches can be fetched from here:
https://github.com/sourabgu/linux/tree/perf-2016-04-19
Robert Bragg (2):
drm/i915: Constrain intel_context::global_id to 20 bits drm/i915: return ctx->global_id from intel_execlists_ctx_id()
Sourab Gupta (14):
drm/i915: Introduce global id for contexts
drm/i915: Add ctx getparam ioctl parameter to retrieve ctx global id drm/i915: Expose OA sample source to userspace
drm/i915: Framework for capturing command stream based OA reports drm/i915: flush periodic samples, in case of no pending CS sample
requests
drm/i915: Handle the overflow condition for command stream buf drm/i915: Populate ctx ID for periodic OA reports drm/i915: Add support for having pid output with OA report drm/i915: Add support for emitting execbuffer tags through OA counter
reports
drm/i915: Extend i915 perf framework for collecting timestamps on all
gpu engines
drm/i915: Extract raw GPU timestamps from OA reports to forward in
perf samples
drm/i915: Support opening multiple concurrent perf streams drm/i915: Mechanism to forward clock monotonic time in perf samples drm/i915: Support for capturing MMIO register values
drivers/gpu/drm/i915/i915_debugfs.c | 4 +- drivers/gpu/drm/i915/i915_drv.h | 97 +- drivers/gpu/drm/i915/i915_gem_context.c | 23 + drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 + drivers/gpu/drm/i915/i915_perf.c | 1842 +++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_reg.h | 16 + drivers/gpu/drm/i915/intel_lrc.c | 32 +- drivers/gpu/drm/i915/intel_lrc.h | 3 +- include/uapi/drm/i915_drm.h | 79 ++ 9 files changed, 1907 insertions(+), 194 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/16 drm/i915: Introduce global id for contexts
From: Sourab Gupta <[email protected]>
The current context user handles are specific to drm file instance. There are some usecases, which may require a global id for the contexts. For e.g. a system level GPU profiler tool may lean upon the global context ids to associate the performance snapshots with individual contexts.
This global id may also be used further in order to provide a unique context id to hw.
In this patch, the global ids are allocated from a separate cyclic idr and can be further utilized for any usecase described above.
v2: According to Chris' suggestion, implemented a separate idr for holding global ids for contexts, as opposed to overloading the file specific ctx->user_handle for this purpose. This global id can also further be used wherever hw has to be programmed with ctx unique id, though this patch just introduces the hw global id as such.
--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_gem_context.c | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -848,6 +848,7 @@ struct i915_ctx_hang_stats {struct intel_context {struct kref ref;int user_handle; +int global_id;uint8_t remap_slice;struct drm_i915_private *i915;int flags;
@@ -1890,6 +1891,8 @@ struct drm_i915_private {bool preserve_bios_swizzle; +struct idr global_ctx_idr; +/* overlay */ struct intel_overlay *overlay;
drivers/gpu/drm/i915/i915_gem_context.c +21 -0
@@ -263,6 +263,18 @@ __create_hw_context(struct drm_device *dev, ctx->file_priv = file_priv; ctx->user_handle = ret; + +/* TODO: If required, this global id can be used for programming the hw +* fields too. In that case, we'll have take care of hw restrictions +* while allocating idr. e.g. for some hw, we may not have full 32 bits +* available. +*/ + ret =idr_alloc_cyclic (&dev_priv->global_ctx_idr, + ctx,0 ,0 ,GFP_KERNEL ); +if (ret <0 ) + goto err_out; + + ctx->global_id = ret;/* NB: Mark all slices as needing a remap so that when the context first * loads it will restore whatever remap state already exists. If there * is no remap info, it will be a NOP. */
@@ -287,6 +299,7 @@ i915_gem_create_context(struct drm_device *dev, struct drm_i915_file_private *file_priv) {const bool is_global_default_ctx = file_priv ==NULL ; +struct drm_i915_private *dev_priv = dev->dev_private;struct intel_context *ctx;int ret =0 ;
@@ -333,6 +346,7 @@ err_unpin:i915_gem_object_ggtt_unpin (ctx->legacy_hw_ctx.rcs_state); err_destroy:idr_remove (&file_priv->context_idr, ctx->user_handle); +idr_remove (&dev_priv->global_ctx_idr, ctx->global_id);i915_gem_context_unreference (ctx);return ERR_PTR (ret); }
@@ -403,6 +417,7 @@ int i915_gem_context_init(struct drm_device *dev) dev_priv->hw_context_size =0 ; } } +idr_init (&dev_priv->global_ctx_idr); ctx =i915_gem_create_context (dev,NULL );if (IS_ERR (ctx)) {
@@ -425,6 +440,8 @@ void i915_gem_context_fini(struct drm_device *dev)struct intel_context *dctx = dev_priv->kernel_context;int i; +idr_destroy (&dev_priv->global_ctx_idr); +if (dctx->legacy_hw_ctx.rcs_state) {/* The only known way to stop the gpu from accessing the hw context is * to reset it. Do this as the very last operation to avoid confusing
@@ -480,6 +497,8 @@ static int context_idr_cleanup(int id, void *p, void *data) {struct intel_context *ctx = p; +idr_remove (&ctx->i915->global_ctx_idr, ctx->global_id); +i915_gem_context_unreference (ctx);return 0 ; }
@@ -906,6 +925,7 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, {struct drm_i915_gem_context_destroy *args = data;struct drm_i915_file_private *file_priv = file->driver_priv; +struct drm_i915_private *dev_priv = dev->dev_private;struct intel_context *ctx;int ret;
@@ -926,6 +946,7 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, }idr_remove (&ctx->file_priv->context_idr, ctx->user_handle); +idr_remove (&dev_priv->global_ctx_idr, ctx->global_id);i915_gem_context_unreference (ctx);mutex_unlock (&dev->struct_mutex);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/16 drm/i915: Constrain intel_context::global_id to 20 bits
In reply to [email protected]From: Robert Bragg <[email protected]>
This will allow the ID to be given to the HW as the unique context identifier that's written, for example, to the context status buffer on preemption and included in reports written by the OA unit.
--- drivers/gpu/drm/i915/i915_gem_context.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +5 -6
@@ -90,6 +90,10 @@#include "i915_drv.h" #include "i915_trace.h" +/* With execlist scheduling we can program our own HW context ID but we we +* are limited to 20bits */ +#define I915_MAX_HW_CTX_ID ((1<<20)-1) +/* This is a HW constraint. The value below is the largest known requirement * I've seen in a spec to date, and that was a workaround for a non-shipping * part. It should be safe to decrease this, but it's more future proof as is.
@@ -264,13 +268,8 @@ __create_hw_context(struct drm_device *dev, ctx->file_priv = file_priv; ctx->user_handle = ret; -/* TODO: If required, this global id can be used for programming the hw -* fields too. In that case, we'll have take care of hw restrictions -* while allocating idr. e.g. for some hw, we may not have full 32 bits -* available. -*/ ret =idr_alloc_cyclic (&dev_priv->global_ctx_idr, - ctx,0 ,0 ,GFP_KERNEL ); + ctx,0 ,I915_MAX_HW_CTX_ID ,GFP_KERNEL );if (ret <0 ) goto err_out;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/16 drm/i915: return ctx->global_id from intel_execlists_ctx_id()
In reply to [email protected]From: Robert Bragg <[email protected]>
The newly added intel_context::global_id is suitable (a globally unique 20 bit ID) for giving to the hardware as a unique context identifier.
Compared to using the pinned address of a logical ring context these IDs are constant for the lifetime of a context whereas a context could be repinned at different addresses during its lifetime.
Having a stable ID is useful when we need to buffer information associated with a context based on this ID so the association can't be lost. For example the OA unit writes out counter reports to a circular buffer tagged with this ID and we want to be able to accurately filter reports for a specific context, ideally without the added complexity of tracking context re-pinning while the OA buffer may contain reports with older IDs.
--- drivers/gpu/drm/i915/i915_debugfs.c | 4 ++-- drivers/gpu/drm/i915/intel_lrc.c | 28 ++++++++++++++-------------- drivers/gpu/drm/i915/intel_lrc.h | 3 +-- 3 files changed, 17 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
@@ -2050,7 +2050,7 @@ static void i915_dump_lrc_obj(struct seq_file *m, }seq_printf (m,"CONTEXT: %s %u\n" , engine->name, -intel_execlists_ctx_id (ctx, engine)); +intel_execlists_ctx_id (ctx));if (!i915_gem_obj_ggtt_bound (ctx_obj))seq_puts (m,"\tNot bound in GGTT\n" );
@@ -2171,7 +2171,7 @@ static int i915_execlists(struct seq_file *m, void *data)seq_printf (m,"\t%d requests in queue\n" , count);if (head_req) {seq_printf (m,"\tHead request id: %u\n" , -intel_execlists_ctx_id (head_req->ctx, engine)); +intel_execlists_ctx_id (head_req->ctx));seq_printf (m,"\tHead request tail: %u\n" , head_req->tail); }
drivers/gpu/drm/i915/intel_lrc.c +14 -14
@@ -307,21 +307,23 @@ logical_ring_init_platform_invariants(struct intel_engine_cs *engine)* This is what a descriptor looks like, from LSB to MSB: * bits 0-11: flags, GEN8_CTX_* (cached in ctx_desc_template) * bits 12-31: LRCA, GTT address of (the HWSP of) this context -* bits 32-51: ctx ID, a globally unique tag (the LRCA again!) +* bits 32-51: ctx ID, a globally unique tag (ctx->global_id) * bits 52-63: reserved, may encode the engine ID (for GuC) */ static void intel_lr_context_descriptor_update (struct intel_context *ctx,struct intel_engine_cs *engine) { -uint64_t lrca, desc; +uint64_t lrca, id, desc; lrca = ctx->engine[engine->id].lrc_vma->node.start +LRC_PPHWSP_PN *PAGE_SIZE ; - desc = engine->ctx_desc_template;/* bits 0-11 */ - desc |= lrca;/* bits 12-31 */ - desc |= (lrca >>PAGE_SHIFT ) <<GEN8_CTX_ID_SHIFT ;/* bits 32-51 */ + id = ctx->global_id; + + desc = engine->ctx_desc_template;/* bits 0-11 */ + desc |= lrca;/* bits 12-31 */ + desc |= id <<GEN8_CTX_ID_SHIFT ;/* bits 32-51 */ ctx->engine[engine->id].lrc_desc = desc; }
@@ -335,7 +337,6 @@ uint64_t intel_lr_context_descriptor(struct intel_context *ctx,/** * intel_execlists_ctx_id() - get the Execlists Context ID * @ctx: Context to get the ID for -* @ring: Engine to get the ID for * * Do not confuse with ctx->id! Unfortunately we have a name overload * here: the old context ID we pass to userspace as a handler so that
@@ -343,15 +344,14 @@ uint64_t intel_lr_context_descriptor(struct intel_context *ctx,* ELSP so that the GPU can inform us of the context status via * interrupts. * -* The context ID is a portion of the context descriptor, so we can -* just extract the required part from the cached descriptor. -* -* Return: 20-bits globally unique context ID. +* Further the ID given to HW can now be relied on to be constant for +* the lifetime of the context, unlike previously when we used an +* associated logical ring context address (which could be repinned at +* a different address). */ -u32 intel_execlists_ctx_id (struct intel_context *ctx, -struct intel_engine_cs *engine) +u32 intel_execlists_ctx_id (struct intel_context *ctx) { -return intel_lr_context_descriptor (ctx, engine) >>GEN8_CTX_ID_SHIFT ; +return ctx->global_id; } static void execlists_elsp_write(struct drm_i915_gem_request *rq0,
@@ -501,7 +501,7 @@ execlists_check_remove_request(struct intel_engine_cs *engine, u32 request_id)if (!head_req)return 0 ; -if (unlikely (intel_execlists_ctx_id (head_req->ctx, engine) != request_id)) +if (unlikely (intel_execlists_ctx_id (head_req->ctx) != request_id))return 0 ;WARN (head_req->elsp_submitted ==0 ,"Never submitted head request\n" );
drivers/gpu/drm/i915/intel_lrc.h +1 -2
@@ -114,8 +114,7 @@ void intel_lr_context_reset(struct drm_i915_private *dev_priv,uint64_t intel_lr_context_descriptor (struct intel_context *ctx,struct intel_engine_cs *engine); -u32 intel_execlists_ctx_id (struct intel_context *ctx, -struct intel_engine_cs *engine); +u32 intel_execlists_ctx_id (struct intel_context *ctx);/* Execlists */ int intel_sanitize_enable_execlists (struct drm_device *dev,int enable_execlists);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/16 drm/i915: Add ctx getparam ioctl parameter to retrieve ctx global id
In reply to [email protected]From: Sourab Gupta <[email protected]>
This patch adds a new ctx getparam ioctl parameter, which can be used to retrieve ctx global_id for any particular ctx by userspace.
This can be used by userspace to map the i915 perf samples with their particular ctx's, since those would be having ctx global_id's. Otherwise the userspace has no way of maintaining this association, since it has the knowledge of only per-drm file specific ctx handles.
--- drivers/gpu/drm/i915/i915_gem_context.c | 3 +++ include/uapi/drm/i915_drm.h | 1 + 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
@@ -987,6 +987,9 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,else args->value =to_i915 (dev)->ggtt.base.total;break ; +case I915_CONTEXT_PARAM_GLOBAL_ID : + args->value = ctx->global_id; +break ;default : ret = -EINVAL ;break ;
include/uapi/drm/i915_drm.h +1 -0
@@ -1171,6 +1171,7 @@ struct drm_i915_gem_context_param {#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2#define I915_CONTEXT_PARAM_GTT_SIZE 0x3 +#define I915_CONTEXT_PARAM_GLOBAL_ID 0x4__u64 value; };
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/16 drm/i915: Expose OA sample source to userspace
In reply to [email protected]From: Sourab Gupta <[email protected]>
This patch exposes a new sample source field to userspace. This field can be populated to specify the origin of the OA report.
For e.g. for internally triggerred reports (non MI_RPC reports), the RPT_ID field has bitfields for specifying the origin such as timer, or render ctx switch, etc.
Likewise this field can be used to specify the source as MI_RPC when such support is added.
--- drivers/gpu/drm/i915/i915_perf.c | 55 ++++++++++++++++++++++++++++++++++------ include/uapi/drm/i915_drm.h | 16 ++++++++++++ 2 files changed, 63 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +47 -8
@@ -73,6 +73,13 @@ static u32 i915_perf_stream_paranoid = true;*/ #define OA_EXPONENT_MAX 31 +#define GEN8_OAREPORT_REASON_TIMER (1<<19) +#define GEN8_OAREPORT_REASON_TRIGGER1 (1<<20) +#define GEN8_OAREPORT_REASON_TRIGGER2 (1<<21) +#define GEN8_OAREPORT_REASON_CTX_SWITCH (1<<22) +#define GEN8_OAREPORT_REASON_GO_TRANSITION (1<<23) +#define GEN9_OAREPORT_REASON_CLK_RATIO (1<<24) +/* for sysctl proc_dointvec_minmax of i915_oa_min_timer_exponent */ static int zero;static int oa_exponent_max =OA_EXPONENT_MAX ;
@@ -112,7 +119,8 @@ static struct i915_oa_format gen8_plus_oa_formats[I915_OA_FORMAT_MAX] = { [I915_OA_FORMAT_C4_B8] = { 7, 64 }, }; -#define SAMPLE_OA_REPORT (1<<0) +#define SAMPLE_OA_REPORT (1<<0) +#define SAMPLE_OA_SOURCE_INFO (1<<1)struct perf_open_properties {u32 sample_flags;
@@ -214,6 +222,27 @@ static int append_oa_sample(struct i915_perf_stream *stream,return -EFAULT ; buf +=sizeof (header); +if (sample_flags &SAMPLE_OA_SOURCE_INFO ) { +enum drm_i915_perf_oa_event_source source; + +if (INTEL_INFO (dev_priv)->gen >=8 ) { +u32 reason = *(u32 *)report; + +if (reason &GEN8_OAREPORT_REASON_CTX_SWITCH ) + source = +I915_PERF_OA_EVENT_SOURCE_CONTEXT_SWITCH ; +else if (reason &GEN8_OAREPORT_REASON_TIMER ) + source =I915_PERF_OA_EVENT_SOURCE_PERIODIC ; +else + source =I915_PERF_OA_EVENT_SOURCE_UNDEFINED ; + }else + source =I915_PERF_OA_EVENT_SOURCE_PERIODIC ; + +if (copy_to_user (buf, &source,4 )) +return -EFAULT ; + buf +=4 ; + } +if (sample_flags &SAMPLE_OA_REPORT ) {if (copy_to_user (buf, report, report_size))return -EFAULT ;
@@ -1130,11 +1159,6 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,int format_size;int ret; -if (!(props->sample_flags &SAMPLE_OA_REPORT )) { -DRM_ERROR ("Only OA report sampling supported\n" ); -return -EINVAL ; - } -if (!dev_priv->perf.oa.ops.init_oa_buffer) {DRM_ERROR ("OA unit not supported\n" );return -ENODEV ;
@@ -1163,8 +1187,20 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, format_size = dev_priv->perf.oa.oa_formats[props->oa_format].size; - stream->sample_flags |=SAMPLE_OA_REPORT ; - stream->sample_size += format_size; +if (props->sample_flags &SAMPLE_OA_REPORT ) { + stream->sample_flags |=SAMPLE_OA_REPORT ; + stream->sample_size += format_size; + } + +if (props->sample_flags &SAMPLE_OA_SOURCE_INFO ) { +if (!(props->sample_flags &SAMPLE_OA_REPORT )) { +DRM_ERROR ( +"OA source type can't be sampled without OA report" ); +return -EINVAL ; + } + stream->sample_flags |=SAMPLE_OA_SOURCE_INFO ; + stream->sample_size +=4 ; + } dev_priv->perf.oa.oa_buffer.format_size = format_size;BUG_ON (dev_priv->perf.oa.oa_buffer.format_size ==0 );
@@ -1817,6 +1853,9 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv, props->oa_periodic = true; props->oa_period_exponent = value;break ; +case DRM_I915_PERF_PROP_SAMPLE_OA_SOURCE : + props->sample_flags |=SAMPLE_OA_SOURCE_INFO ; +break ;case DRM_I915_PERF_PROP_MAX :BUG (); }
include/uapi/drm/i915_drm.h +16 -0
@@ -1192,6 +1192,14 @@ enum drm_i915_oa_format {I915_OA_FORMAT_MAX /* non-ABI */ }; +enum drm_i915_perf_oa_event_source { +I915_PERF_OA_EVENT_SOURCE_UNDEFINED , +I915_PERF_OA_EVENT_SOURCE_PERIODIC , +I915_PERF_OA_EVENT_SOURCE_CONTEXT_SWITCH , + +I915_PERF_OA_EVENT_SOURCE_MAX /* non-ABI */ +}; +enum drm_i915_perf_property_id {/** * Open the stream for a specific context handle (as used with
@@ -1226,6 +1234,13 @@ enum drm_i915_perf_property_id {*/ DRM_I915_PERF_PROP_OA_EXPONENT , +/** +* The value of this property set to 1 requests inclusion of sample +* source field to be given to userspace. The sample source field +* specifies the origin of OA report. +*/ +DRM_I915_PERF_PROP_SAMPLE_OA_SOURCE , + DRM_I915_PERF_PROP_MAX /* non-ABI */ };
@@ -1290,6 +1305,7 @@ enum drm_i915_perf_record_type {* struct { * struct drm_i915_perf_record_header header; * +* { u32 source_info; } && DRM_I915_PERF_PROP_SAMPLE_OA_SOURCE * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/16 drm/i915: Framework for capturing command stream based OA reports
In reply to [email protected]From: Sourab Gupta <[email protected]>
This patch introduces a framework to enable OA counter reports associated with Render command stream. We can then associate the reports captured through this mechanism with their corresponding context id's. This can be further extended to associate any other metadata information with the corresponding samples (since the association with Render command stream gives us the ability to capture these information while inserting the corresponding capture commands into the command stream).
The OA reports generated in this way are associated with a corresponding workload, and thus can be used the delimit the workload (i.e. sample the counters at the workload boundaries), within an ongoing stream of periodic counter snapshots.
There may be usecases wherein we need more than periodic OA capture mode which is supported currently. This mode is primarily used for two usecases:
- Ability to capture system wide metrics, alongwith the ability to map the reports back to individual contexts (particularly for HSW).
- Ability to inject tags for work, into the reports. This provides visibility into the multiple stages of work within single context.
The userspace will be able to distinguish between the periodic and CS based OA reports by the virtue of source_info sample field.
The command MI_REPORT_PERF_COUNT can be used to capture snapshots of OA counters, and is inserted at BB boundaries.
The data thus captured will be stored in a separate buffer, which will be different from the buffer used otherwise for periodic OA capture mode. The metadata information pertaining to snapshot is maintained in a list, which also has offsets into the gem buffer object per captured snapshot. In order to track whether the gpu has completed processing the node, a field pertaining to corresponding gem request is added, which is tracked for completion of the command.
Both periodic and RCS based reports are associated with a single stream (corresponding to render engine), and it is expected to have the samples in the sequential order according to their timestamps. Now, since these reports are collected in separate buffers, these are merge sorted at the time of forwarding to userspace during the read call.
v2: Aligining with the non-perf interface (custom drm ioctl based). Also, few related patches are squashed together for better readability
--- drivers/gpu/drm/i915/i915_drv.h | 36 +- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 + drivers/gpu/drm/i915/i915_perf.c | 829 +++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_lrc.c | 4 + include/uapi/drm/i915_drm.h | 15 + 5 files changed, 774 insertions(+), 114 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +35 -1
@@ -1735,12 +1735,16 @@ struct i915_perf_stream {struct list_head link; +enum intel_engine_id engine;u32 sample_flags;int sample_size;struct intel_context *ctx;bool enabled; +/* Whether command stream based data collection is enabled */ +bool cs_mode; +/* Enables the collection of HW samples, either in response to * I915_PERF_IOCTL_ENABLE or implicitly called when stream is * opened without I915_PERF_FLAG_DISABLED.
@@ -1796,6 +1800,12 @@ struct i915_perf_stream {* The stream will always be disabled before this is called. */ void (*destroy)(struct i915_perf_stream *stream); + +/* +* Routine to emit the commands in the command streamer associated +* with the corresponding gpu engine. +*/ +void (*command_stream_hook)(struct drm_i915_gem_request *req); };struct i915_oa_ops {
@@ -1809,10 +1819,21 @@ struct i915_oa_ops { u32 ctx_id);void (*legacy_ctx_switch_unlocked)(struct drm_i915_gem_request *req);int (*read)(struct i915_perf_stream *stream, -struct i915_perf_read_state *read_state); +struct i915_perf_read_state *read_state,u32 ts);bool (*oa_buffer_is_empty)(struct drm_i915_private *dev_priv); }; +/* +* List element to hold info about the perf sample data associated +* with a particular GPU command stream. +*/ +struct i915_perf_cs_data_node { +struct list_head link; +struct drm_i915_gem_request *request; +u32 offset; +u32 ctx_id; +}; +struct drm_i915_private {struct drm_device *dev;struct kmem_cache *objects;
@@ -2093,6 +2114,8 @@ struct drm_i915_private {struct ctl_table_header *sysctl_header;struct mutex lock; + +struct mutex streams_lock;struct list_head streams;spinlock_t hook_lock;
@@ -2137,6 +2160,16 @@ struct drm_i915_private {const struct i915_oa_format *oa_formats;int n_builtin_sets; } oa; + +/* Command stream based perf data buffer */ +struct { +struct drm_i915_gem_object *obj; +struct i915_vma *vma; +u8 *addr; + } command_stream_buf; + +struct list_head node_list; +spinlock_t node_list_lock; } perf;/* Abstract the submission mechanism (legacy ringbuffer or execlists) away */
@@ -3504,6 +3537,7 @@ void i915_oa_legacy_ctx_switch_notify(struct drm_i915_gem_request *req);void i915_oa_update_reg_state (struct intel_engine_cs *engine,struct intel_context *ctx,uint32_t *reg_state); +void i915_perf_command_stream_hook (struct drm_i915_gem_request *req);/* i915_gem_evict.c */ int __must_check i915_gem_evict_something(struct drm_device *dev,
drivers/gpu/drm/i915/i915_gem_execbuffer.c +4 -0
@@ -1313,12 +1313,16 @@ i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params,if (exec_len ==0 ) exec_len = params->batch_obj->base.size; +i915_perf_command_stream_hook (params->request); + ret = engine->dispatch_execbuffer (params->request, exec_start, exec_len, params->dispatch_flags);if (ret)return ret; +i915_perf_command_stream_hook (params->request); +trace_i915_gem_ring_dispatch (params->request, params->dispatch_flags);i915_gem_execbuffer_move_to_active (vmas, params->request);
drivers/gpu/drm/i915/i915_perf.c +716 -113
1,101 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +4 -0
@@ -1002,10 +1002,14 @@ int intel_execlists_submission(struct i915_execbuffer_params *params, exec_start = params->batch_obj_vm_offset + args->batch_start_offset; +i915_perf_command_stream_hook (params->request); + ret = engine->emit_bb_start (params->request, exec_start, params->dispatch_flags);if (ret)return ret; +i915_perf_command_stream_hook (params->request); +trace_i915_gem_ring_dispatch (params->request, params->dispatch_flags);i915_gem_execbuffer_move_to_active (vmas, params->request);
include/uapi/drm/i915_drm.h +15 -0
@@ -1196,6 +1196,7 @@ enum drm_i915_perf_oa_event_source {I915_PERF_OA_EVENT_SOURCE_UNDEFINED ,I915_PERF_OA_EVENT_SOURCE_PERIODIC ,I915_PERF_OA_EVENT_SOURCE_CONTEXT_SWITCH , +I915_PERF_OA_EVENT_SOURCE_RCS , I915_PERF_OA_EVENT_SOURCE_MAX /* non-ABI */ };
@@ -1241,6 +1242,19 @@ enum drm_i915_perf_property_id {*/ DRM_I915_PERF_PROP_SAMPLE_OA_SOURCE , +/** +* The value of this property specifies the GPU engine for which +* the samples need to be collected. Specifying this property also +* implies the command stream based sample collection. +*/ +DRM_I915_PERF_PROP_ENGINE , + +/** +* The value of this property set to 1 requests inclusion of context ID +* in the perf sample data. +*/ +DRM_I915_PERF_PROP_SAMPLE_CTX_ID , + DRM_I915_PERF_PROP_MAX /* non-ABI */ };
@@ -1306,6 +1320,7 @@ enum drm_i915_perf_record_type {* struct drm_i915_perf_record_header header; * * { u32 source_info; } && DRM_I915_PERF_PROP_SAMPLE_OA_SOURCE +* { u32 ctx_id; } && DRM_I915_PERF_PROP_SAMPLE_CTX_ID * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/16 drm/i915: flush periodic samples, in case of no pending CS sample requests
In reply to [email protected]From: Sourab Gupta <[email protected]>
When there are no pending CS OA samples, flush the periodic OA samples collected so far.
We can safely forward the periodic OA samples in the case we have no pending CS samples, but we can't do so in the case we have pending CS samples, since we don't know what the ordering between pending CS samples and periodic samples will eventually be. If we have no pending CS sample, it won't be possible for future pending CS sample to have timestamps earlier than current periodic timestamp.
--- drivers/gpu/drm/i915/i915_drv.h | 14 ++-- drivers/gpu/drm/i915/i915_perf.c | 173 +++++++++++++++++++++++++++++---------- 2 files changed, 140 insertions(+), 47 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +9 -5
@@ -1760,7 +1760,7 @@ struct i915_perf_stream {/* Return: true if any i915 perf records are ready to read() * for this stream. */ -bool (*can_read)(struct i915_perf_stream *stream); +bool (*can_read_unlocked)(struct i915_perf_stream *stream);/* Call poll_wait, passing a wait queue that will be woken * once there is something ready to read() for the stream
@@ -1772,8 +1772,8 @@ struct i915_perf_stream {/* For handling a blocking read, wait until there is something * to ready to read() for the stream. E.g. wait on the same * wait queue that would be passed to poll_wait() until -* ->can_read() returns true (if its safe to call ->can_read() -* without the i915 perf lock held). +* ->can_read_unlocked() returns true (if its safe to call +* ->can_read_unlocked() without the i915 perf lock held). */ int (*wait_unlocked)(struct i915_perf_stream *stream);
@@ -1819,8 +1819,10 @@ struct i915_oa_ops { u32 ctx_id);void (*legacy_ctx_switch_unlocked)(struct drm_i915_gem_request *req);int (*read)(struct i915_perf_stream *stream, -struct i915_perf_read_state *read_state,u32 ts); -bool (*oa_buffer_is_empty)(struct drm_i915_private *dev_priv); +struct i915_perf_read_state *read_state, +u32 ts,u32 max_records); +int (*oa_buffer_num_samples)(struct drm_i915_private *dev_priv, +u32 *last_ts); };/*
@@ -2155,6 +2157,8 @@ struct drm_i915_private {u32 gen7_latched_oastatus1;u32 ctx_oactxctrl_off;u32 ctx_flexeu0_off; +u32 n_pending_periodic_samples; +u32 pending_periodic_ts;struct i915_oa_ops ops;const struct i915_oa_format *oa_formats;
drivers/gpu/drm/i915/i915_perf.c +131 -42
357 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/16 drm/i915: Handle the overflow condition for command stream buf
In reply to [email protected]From: Sourab Gupta <[email protected]>
Add a compile time option for detecting the overflow condition of command stream buffer, and not overwriting the old entries in such a case. Also, set a status flag to forward the overflow condition to userspace if overflow is detected.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_perf.c | 76 +++++++++++++++++++++++++++++++--------- 2 files changed, 62 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -2170,6 +2170,8 @@ struct drm_i915_private {struct drm_i915_gem_object *obj;struct i915_vma *vma;u8 *addr; +#define I915_PERF_CMD_STREAM_BUF_STATUS_OVERFLOW (1<<0) +u32 status; } command_stream_buf;struct list_head node_list;
drivers/gpu/drm/i915/i915_perf.c +60 -16
160 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/16 drm/i915: Populate ctx ID for periodic OA reports
In reply to [email protected]From: Sourab Gupta <[email protected]>
This adds support for populating the ctx id for the periodic OA reports when requested through the corresponding property.
For Gen8, the OA reports itself have the ctx ID and it is the one programmed into HW while submitting workloads. Thus it's retrieved from reports itself. For Gen7, the OA reports don't have any such field, and we can populate this field with the last seen ctx ID while sending CS reports.
--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_perf.c | 52 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -1823,6 +1823,8 @@ struct i915_oa_ops { u32 ts, u32 max_records);int (*oa_buffer_num_samples)(struct drm_i915_private *dev_priv,u32 *last_ts); +u32 (*oa_buffer_get_ctx_id)(struct i915_perf_stream *stream, +const u8 *report); };/*
@@ -2174,6 +2176,7 @@ struct drm_i915_private {u32 status; } command_stream_buf; +u32 last_ctx_id;struct list_head node_list;spinlock_t node_list_lock; } perf;
drivers/gpu/drm/i915/i915_perf.c +49 -3
84 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/16 drm/i915: Add support for having pid output with OA report
In reply to [email protected]From: Sourab Gupta <[email protected]>
This patch introduces flags and adds support for having pid output with the OA reports generated through the RCS commands.
When the stream is opened with pid sample type, the pid information is also captured through the command stream samples and forwarded along with the OA reports.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_perf.c | 48 +++++++++++++++++++++++++++++++++++++++- include/uapi/drm/i915_drm.h | 7 ++++++ 3 files changed, 56 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -1836,6 +1836,7 @@ struct i915_perf_cs_data_node {struct drm_i915_gem_request *request;u32 offset;u32 ctx_id; +u32 pid; };struct drm_i915_private {
@@ -2177,6 +2178,7 @@ struct drm_i915_private { } command_stream_buf;u32 last_ctx_id; +u32 last_pid;struct list_head node_list;spinlock_t node_list_lock; } perf;
drivers/gpu/drm/i915/i915_perf.c +47 -1
114 lines not on this page · raw message
include/uapi/drm/i915_drm.h +7 -0
@@ -1255,6 +1255,12 @@ enum drm_i915_perf_property_id {*/ DRM_I915_PERF_PROP_SAMPLE_CTX_ID , +/** +* The value of this property set to 1 requests inclusion of pid in the +* perf sample data. +*/ +DRM_I915_PERF_PROP_SAMPLE_PID , + DRM_I915_PERF_PROP_MAX /* non-ABI */ };
@@ -1321,6 +1327,7 @@ enum drm_i915_perf_record_type {* * { u32 source_info; } && DRM_I915_PERF_PROP_SAMPLE_OA_SOURCE * { u32 ctx_id; } && DRM_I915_PERF_PROP_SAMPLE_CTX_ID +* { u32 pid; } && DRM_I915_PERF_PROP_SAMPLE_PID * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/16 drm/i915: Add support for emitting execbuffer tags through OA counter reports
In reply to [email protected]From: Sourab Gupta <[email protected]>
This patch enables userspace to specify tags (per workload), provided via execbuffer ioctl, which could be added to OA reports, to help associate reports with the corresponding workloads.
There may be multiple stages within a single context, from a userspace perspective. An ability is needed to individually associate the OA reports with their corresponding workloads(execbuffers), which may not be possible solely with ctx_id or pid information. This patch enables such a mechanism.
In this patch, upper 32 bits of rsvd1 field, which were previously unused are now being used to pass in the tag.
--- drivers/gpu/drm/i915/i915_drv.h | 7 ++++-- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 ++-- drivers/gpu/drm/i915/i915_perf.c | 37 ++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_lrc.c | 4 ++-- include/uapi/drm/i915_drm.h | 12 ++++++++++ 5 files changed, 54 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +5 -2
@@ -1705,6 +1705,7 @@ struct i915_execbuffer_params {struct drm_i915_gem_object *batch_obj;struct intel_context *ctx;struct drm_i915_gem_request *request; +uint32_t tag; };/* used in computing the new watermarks state */
@@ -1805,7 +1806,7 @@ struct i915_perf_stream {* Routine to emit the commands in the command streamer associated * with the corresponding gpu engine. */ -void (*command_stream_hook)(struct drm_i915_gem_request *req); +void (*command_stream_hook)(struct drm_i915_gem_request *req,u32 tag); };struct i915_oa_ops {
@@ -1837,6 +1838,7 @@ struct i915_perf_cs_data_node {u32 offset;u32 ctx_id;u32 pid; +u32 tag; };struct drm_i915_private {
@@ -2179,6 +2181,7 @@ struct drm_i915_private {u32 last_ctx_id;u32 last_pid; +u32 last_tag;struct list_head node_list;spinlock_t node_list_lock; } perf;
@@ -3548,7 +3551,7 @@ void i915_oa_legacy_ctx_switch_notify(struct drm_i915_gem_request *req);void i915_oa_update_reg_state (struct intel_engine_cs *engine,struct intel_context *ctx,uint32_t *reg_state); -void i915_perf_command_stream_hook (struct drm_i915_gem_request *req); +void i915_perf_command_stream_hook (struct drm_i915_gem_request *req,u32 tag);/* i915_gem_evict.c */ int __must_check i915_gem_evict_something(struct drm_device *dev,
drivers/gpu/drm/i915/i915_gem_execbuffer.c +3 -2
@@ -1313,7 +1313,7 @@ i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params,if (exec_len ==0 ) exec_len = params->batch_obj->base.size; -i915_perf_command_stream_hook (params->request); +i915_perf_command_stream_hook (params->request, params->tag); ret = engine->dispatch_execbuffer(params->request, exec_start, exec_len,
@@ -1321,7 +1321,7 @@ i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params,if (ret)return ret; -i915_perf_command_stream_hook (params->request); +i915_perf_command_stream_hook (params->request, params->tag);trace_i915_gem_ring_dispatch (params->request, params->dispatch_flags);
@@ -1642,6 +1642,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, params->batch_obj = batch_obj; params->ctx = ctx; params->request = req; + params->tag =i915_execbuffer2_get_tag (*args); ret = dev_priv->gt.execbuf_submit (params, args, &eb->vmas); err_request:
drivers/gpu/drm/i915/i915_perf.c +32 -5
@@ -88,6 +88,7 @@ struct oa_sample_data {u32 source;u32 ctx_id;u32 pid; +u32 tag;const u8 *report; };
@@ -134,6 +135,7 @@ static struct i915_oa_format gen8_plus_oa_formats[I915_OA_FORMAT_MAX] = {#define SAMPLE_OA_SOURCE_INFO (1<<1)#define SAMPLE_CTX_ID (1<<2)#define SAMPLE_PID (1<<3) +#define SAMPLE_TAG (1<<4)struct perf_open_properties {u32 sample_flags;
@@ -158,7 +160,7 @@ struct perf_open_properties {* perf mutex lock. */ -void i915_perf_command_stream_hook (struct drm_i915_gem_request *req) +void i915_perf_command_stream_hook (struct drm_i915_gem_request *req,u32 tag) {struct intel_engine_cs *engine = req->engine;struct drm_i915_private *dev_priv = engine->dev->dev_private;
@@ -170,7 +172,7 @@ void i915_perf_command_stream_hook(struct drm_i915_gem_request *req)mutex_lock (&dev_priv->perf.streams_lock);list_for_each_entry (stream, &dev_priv->perf.streams, link) {if (stream->enabled && stream->command_stream_hook) - stream->command_stream_hook (req); + stream->command_stream_hook (req, tag); }mutex_unlock (&dev_priv->perf.streams_lock); }
@@ -284,7 +286,8 @@ out_unlock:return ret; } -static void i915_perf_command_stream_hook_oa (struct drm_i915_gem_request *req) +static void i915_perf_command_stream_hook_oa (struct drm_i915_gem_request *req, +u32 tag) {struct intel_engine_cs *engine = req->engine;struct intel_ringbuffer *ringbuf = req->ringbuf;
@@ -316,6 +319,7 @@ static void i915_perf_command_stream_hook_oa(struct drm_i915_gem_request *req) entry->ctx_id = ctx->global_id; entry->pid = current->pid; + entry->tag = tag;i915_gem_request_assign (&entry->request, req); addr = dev_priv->perf.command_stream_buf.vma->node.start +
@@ -582,6 +586,12 @@ static int append_oa_sample(struct i915_perf_stream *stream, buf +=4 ; } +if (sample_flags &SAMPLE_TAG ) { +if (copy_to_user (buf, &data->tag,4 )) +return -EFAULT ; + buf +=4 ; + } +if (sample_flags &SAMPLE_OA_REPORT ) {if (copy_to_user (buf, data->report, report_size))return -EFAULT ;
@@ -627,6 +637,9 @@ static int append_oa_buffer_sample(struct i915_perf_stream *stream,if (sample_flags &SAMPLE_PID ) data.pid = dev_priv->perf.last_pid; +if (sample_flags &SAMPLE_TAG ) + data.tag = dev_priv->perf.last_tag; +if (sample_flags &SAMPLE_OA_REPORT ) data.report = report;
@@ -1060,6 +1073,11 @@ static int append_oa_rcs_sample(struct i915_perf_stream *stream, dev_priv->perf.last_pid = node->pid; } +if (sample_flags &SAMPLE_TAG ) { + data.tag = node->tag; + dev_priv->perf.last_tag = node->tag; + } +if (sample_flags &SAMPLE_OA_REPORT ) data.report = report;
@@ -1850,7 +1868,8 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,struct drm_i915_private *dev_priv = stream->dev_priv;bool require_oa_unit = props->sample_flags & (SAMPLE_OA_REPORT |SAMPLE_OA_SOURCE_INFO ); -bool require_cs_mode = props->sample_flags &SAMPLE_PID ; +bool require_cs_mode = props->sample_flags & (SAMPLE_PID | +SAMPLE_TAG );bool cs_sample_data = props->sample_flags &SAMPLE_OA_REPORT ;int ret;
@@ -1988,7 +2007,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, }if (require_cs_mode && !props->cs_mode) { -DRM_ERROR ("PID sampling requires a ring to be specified" ); +DRM_ERROR ("PID or TAG sampling require a ring to be specified" ); ret = -EINVAL ; goto cs_error; }
@@ -2021,6 +2040,11 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, stream->sample_size +=4 ; } +if (props->sample_flags &SAMPLE_TAG ) { + stream->sample_flags |=SAMPLE_TAG ; + stream->sample_size +=4 ; + } + ret =alloc_command_stream_buf (dev_priv);if (ret) goto cs_error;
@@ -2677,6 +2701,9 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,case DRM_I915_PERF_PROP_SAMPLE_PID : props->sample_flags |=SAMPLE_PID ;break ; +case DRM_I915_PERF_PROP_SAMPLE_TAG : + props->sample_flags |=SAMPLE_TAG ; +break ;case DRM_I915_PERF_PROP_MAX :BUG (); }
drivers/gpu/drm/i915/intel_lrc.c +2 -2
@@ -1002,13 +1002,13 @@ int intel_execlists_submission(struct i915_execbuffer_params *params, exec_start = params->batch_obj_vm_offset + args->batch_start_offset; -i915_perf_command_stream_hook (params->request); +i915_perf_command_stream_hook (params->request, params->tag); ret = engine->emit_bb_start (params->request, exec_start, params->dispatch_flags);if (ret)return ret; -i915_perf_command_stream_hook (params->request); +i915_perf_command_stream_hook (params->request, params->tag);trace_i915_gem_ring_dispatch (params->request, params->dispatch_flags);
include/uapi/drm/i915_drm.h +12 -0
@@ -796,6 +796,11 @@ struct drm_i915_gem_execbuffer2 {#define i915_execbuffer2_get_context_id (eb2) \ ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK) +/* upper 32 bits of rsvd1 field contain tag */ +#define I915_EXEC_TAG_MASK (0xffffffff00000000UL) +#define i915_execbuffer2_get_tag (eb2) \ + ((eb2).rsvd1 & I915_EXEC_TAG_MASK) +struct drm_i915_gem_pin {/** Handle of the buffer to be pinned. */ __u32 handle;
@@ -1261,6 +1266,12 @@ enum drm_i915_perf_property_id {*/ DRM_I915_PERF_PROP_SAMPLE_PID , +/** +* The value of this property set to 1 requests inclusion of tag in the +* perf sample data. +*/ +DRM_I915_PERF_PROP_SAMPLE_TAG , + DRM_I915_PERF_PROP_MAX /* non-ABI */ };
@@ -1328,6 +1339,7 @@ enum drm_i915_perf_record_type {* { u32 source_info; } && DRM_I915_PERF_PROP_SAMPLE_OA_SOURCE * { u32 ctx_id; } && DRM_I915_PERF_PROP_SAMPLE_CTX_ID * { u32 pid; } && DRM_I915_PERF_PROP_SAMPLE_PID +* { u32 tag; } && DRM_I915_PERF_PROP_SAMPLE_TAG * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/16 drm/i915: Extend i915 perf framework for collecting timestamps on all gpu engines
In reply to [email protected]From: Sourab Gupta <[email protected]>
This patch extends the i915 perf framework to handle the perf sample collection for any given gpu engine. Particularly, the support for collecting timestamp sample type is added, which can be requested for any engine.
With this, for RCS, timestamps and OA reports can be collected together, and provided to userspace in separate sample fields. For other engines, the capabilility to collect timestamps is added.
The thing to note is that, still only a single stream instance can be opened at any particular time. Though that stream may now be opened for any gpu engine, for collection of timestamp samples.
So, this patch doesn't add the support to open multiple concurrent streams, as yet. Though it lays the groundwork for this support to be added susequently. Part of this groundwork involves having separate command stream buffers, per engine, for holding the samples generated. Likewise for a few other data structures maintaining per-engine state.
--- drivers/gpu/drm/i915/i915_drv.h | 29 +- drivers/gpu/drm/i915/i915_perf.c | 650 ++++++++++++++++++++++++++------------- drivers/gpu/drm/i915/i915_reg.h | 2 + include/uapi/drm/i915_drm.h | 7 + 4 files changed, 469 insertions(+), 219 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +22 -7
@@ -1746,6 +1746,9 @@ struct i915_perf_stream {/* Whether command stream based data collection is enabled */ bool cs_mode; +/* Whether the OA unit is in use */ +bool using_oa; +/* Enables the collection of HW samples, either in response to * I915_PERF_IOCTL_ENABLE or implicitly called when stream is * opened without I915_PERF_FLAG_DISABLED.
@@ -1806,7 +1809,8 @@ struct i915_perf_stream {* Routine to emit the commands in the command streamer associated * with the corresponding gpu engine. */ -void (*command_stream_hook)(struct drm_i915_gem_request *req,u32 tag); +void (*command_stream_hook)(struct i915_perf_stream *stream, +struct drm_i915_gem_request *req,u32 tag); };struct i915_oa_ops {
@@ -1835,7 +1839,16 @@ struct i915_oa_ops {struct i915_perf_cs_data_node {struct list_head link;struct drm_i915_gem_request *request; -u32 offset; + +/* Offsets into the GEM obj holding the data */ +u32 start_offset; +u32 oa_offset; +u32 ts_offset; + +/* buffer size corresponding to this entry */ +u32 size; + +/* Other metadata */ u32 ctx_id;u32 pid;u32 tag;
@@ -2127,9 +2140,11 @@ struct drm_i915_private {spinlock_t hook_lock; -struct { -struct i915_perf_stream *exclusive_stream; +struct hrtimer poll_check_timer; +struct i915_perf_stream *exclusive_stream; +wait_queue_head_t poll_wq[I915_NUM_ENGINES ]; +struct {u32 specific_ctx_id;struct hrtimer poll_check_timer;
@@ -2177,13 +2192,13 @@ struct drm_i915_private {u8 *addr;#define I915_PERF_CMD_STREAM_BUF_STATUS_OVERFLOW (1<<0)u32 status; - } command_stream_buf; + } command_stream_buf[I915_NUM_ENGINES ];u32 last_ctx_id;u32 last_pid;u32 last_tag; -struct list_head node_list; -spinlock_t node_list_lock; +struct list_head node_list[I915_NUM_ENGINES ]; +spinlock_t node_list_lock[I915_NUM_ENGINES ]; } perf;/* Abstract the submission mechanism (legacy ringbuffer or execlists) away */
drivers/gpu/drm/i915/i915_perf.c +438 -212
1,164 lines not on this page · raw message
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -392,6 +392,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)#define MI_FLUSH_DW_OP_STOREDW (1<<14) +#define MI_FLUSH_DW_OP_STAMP (3<<14)#define MI_FLUSH_DW_OP_MASK (3<<14)#define MI_FLUSH_DW_NOTIFY (1<<8)#define MI_INVALIDATE_BSD (1<<7)
@@ -473,6 +474,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define PIPE_CONTROL_TLB_INVALIDATE (1<<18)#define PIPE_CONTROL_MEDIA_STATE_CLEAR (1<<16)#define PIPE_CONTROL_QW_WRITE (1<<14) +#define PIPE_CONTROL_TIMESTAMP_WRITE (3<<14)#define PIPE_CONTROL_POST_SYNC_OP_MASK (3<<14)#define PIPE_CONTROL_DEPTH_STALL (1<<13)#define PIPE_CONTROL_WRITE_FLUSH (1<<12)
include/uapi/drm/i915_drm.h +7 -0
@@ -1272,6 +1272,12 @@ enum drm_i915_perf_property_id {*/ DRM_I915_PERF_PROP_SAMPLE_TAG , +/** +* The value of this property set to 1 requests inclusion of timestamp +* in the perf sample data. +*/ +DRM_I915_PERF_PROP_SAMPLE_TS , + DRM_I915_PERF_PROP_MAX /* non-ABI */ };
@@ -1340,6 +1346,7 @@ enum drm_i915_perf_record_type {* { u32 ctx_id; } && DRM_I915_PERF_PROP_SAMPLE_CTX_ID * { u32 pid; } && DRM_I915_PERF_PROP_SAMPLE_PID * { u32 tag; } && DRM_I915_PERF_PROP_SAMPLE_TAG +* { u64 timestamp; } && DRM_I915_PERF_PROP_SAMPLE_TS * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/16 drm/i915: Extract raw GPU timestamps from OA reports to forward in perf samples
In reply to [email protected]From: Sourab Gupta <[email protected]>
The OA reports contain the least significant 32 bits of the gpu timestamp. This patch enables retrieval of the timestamp field from OA reports, to forward as 64 bit raw gpu timestamps in the perf samples.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_perf.c | 44 ++++++++++++++++++++++++++++++---------- drivers/gpu/drm/i915/i915_reg.h | 4 ++++ 3 files changed, 38 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2179,6 +2179,7 @@ struct drm_i915_private {u32 ctx_flexeu0_off;u32 n_pending_periodic_samples;u32 pending_periodic_ts; +u64 last_gpu_ts;struct i915_oa_ops ops;const struct i915_oa_format *oa_formats;
drivers/gpu/drm/i915/i915_perf.c +33 -11
86 lines not on this page · raw message
drivers/gpu/drm/i915/i915_reg.h +4 -0
@@ -573,6 +573,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define PS_DEPTH_COUNT _MMIO(0x2350)#define PS_DEPTH_COUNT_UDW _MMIO(0x2350 + 4) +/* Timestamp count register */ +#define GT_TIMESTAMP_COUNT _MMIO(0x2358) +#define GT_TIMESTAMP_COUNT_UDW _MMIO(0x2358 + 4) +/* There are the 4 64-bit counter registers, one for each stream output */ #define GEN7_SO_NUM_PRIMS_WRITTEN (n) _MMIO(0x5200 + (n) * 8)#define GEN7_SO_NUM_PRIMS_WRITTEN_UDW (n) _MMIO(0x5200 + (n) * 8 + 4)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/16 drm/i915: Support opening multiple concurrent perf streams
In reply to [email protected]From: Sourab Gupta <[email protected]>
This patch adds support for opening multiple concurrent perf streams for different gpu engines, while having the restriction to open only a single stream open for a particular gpu engine.
This enables userspace client to open multiple streams, one per engine, at any time to capture sample data for multiple gpu engines.
--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/i915_perf.c | 65 ++++++++++++++++++++++------------------ 2 files changed, 37 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -2141,7 +2141,7 @@ struct drm_i915_private {spinlock_t hook_lock;struct hrtimer poll_check_timer; -struct i915_perf_stream *exclusive_stream; +struct i915_perf_stream *ring_stream[I915_NUM_ENGINES ];wait_queue_head_t poll_wq[I915_NUM_ENGINES ];struct {
drivers/gpu/drm/i915/i915_perf.c +36 -29
136 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 15/16 drm/i915: Mechanism to forward clock monotonic time in perf samples
In reply to [email protected]From: Sourab Gupta <[email protected]>
Currently, we have the ability to only forward the GPU timestamps in the samples (which are generated via OA reports or PIPE_CONTROL commands inserted in the ring). This limits the ability to correlate these samples with the system events. If we scale the GPU timestamps according the timestamp base/frequency info present in bspec, it is observed that the timestamps drift really quickly from the system time.
An ability is therefore needed to report timestamps in different clock domains, such as CLOCK_MONOTONIC, in the perf samples to be of more practical use to the userspace. This ability becomes important when we want to correlate/plot GPU events/samples with other system events on the same timeline (e.g. vblank events, or timestamps when work was submitted to kernel, etc.)
The patch here proposes a mechanism to achieve this. The gpu time and CLOCK_MONOTONIC system time are correlated to detect and correct the error in published gpu timestamp clock frequency. The userspace can request CLOCK_MONOTONIC in samples by requesting the corresponding property while opening the stream.
--- drivers/gpu/drm/i915/i915_drv.h | 12 ++- drivers/gpu/drm/i915/i915_perf.c | 218 ++++++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_reg.h | 10 ++ include/uapi/drm/i915_drm.h | 9 +- 4 files changed, 230 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +11 -1
@@ -1749,6 +1749,9 @@ struct i915_perf_stream {/* Whether the OA unit is in use */ bool using_oa; +/* monotonic clk ts for last sample */ +u64 last_sample_ts; +/* Enables the collection of HW samples, either in response to * I915_PERF_IOCTL_ENABLE or implicitly called when stream is * opened without I915_PERF_FLAG_DISABLED.
@@ -2144,6 +2147,14 @@ struct drm_i915_private {struct i915_perf_stream *ring_stream[I915_NUM_ENGINES ];wait_queue_head_t poll_wq[I915_NUM_ENGINES ]; +/* Timekeeping Info */ +u64 clk_mono;/* last monotonic clk value */ +u64 gpu_time;/* last gpu time value */ +s64 clk_offset;/* Offset between clk mono and gpu time */ +u32 timestamp_frequency; +u32 resync_period;/* in msecs */ +struct delayed_work clk_sync_work; +struct {u32 specific_ctx_id;
@@ -2152,7 +2163,6 @@ struct drm_i915_private {bool periodic;int period_exponent; -int timestamp_frequency;int tail_margin;
drivers/gpu/drm/i915/i915_perf.c +201 -17
343 lines not on this page · raw message
drivers/gpu/drm/i915/i915_reg.h +10 -0
@@ -3288,6 +3288,16 @@ enum skl_disp_power_wells { INTERVAL_1_33_US(us)) : \ INTERVAL_1_28_US(us)) +/* GT CS timestamp frequency */ +#define FREQUENCY_12_5_MHZ (12500000) +#define FREQUENCY_12_0_MHZ (12000000) +#define FREQUENCY_19_2_MHZ (19200000) +#define GT_CS_TIMESTAMP_FREQUENCY (dev_priv) (IS_GEN9(dev_priv) ? \ + (IS_BROXTON(dev_priv) ? \ + FREQUENCY_19_2_MHZ : \ + FREQUENCY_12_0_MHZ) : \ + FREQUENCY_12_5_MHZ) +/* * Logical Context regs */
include/uapi/drm/i915_drm.h +8 -1
@@ -1278,6 +1278,12 @@ enum drm_i915_perf_property_id {*/ DRM_I915_PERF_PROP_SAMPLE_TS , +/** +* This property requests inclusion of CLOCK_MONOTONIC system time in +* the perf sample data. +*/ +DRM_I915_PERF_PROP_SAMPLE_CLOCK_MONOTONIC , + DRM_I915_PERF_PROP_MAX /* non-ABI */ };
@@ -1346,7 +1352,8 @@ enum drm_i915_perf_record_type {* { u32 ctx_id; } && DRM_I915_PERF_PROP_SAMPLE_CTX_ID * { u32 pid; } && DRM_I915_PERF_PROP_SAMPLE_PID * { u32 tag; } && DRM_I915_PERF_PROP_SAMPLE_TAG -* { u64 timestamp; } && DRM_I915_PERF_PROP_SAMPLE_TS +* { u64 gpu_ts; } && DRM_I915_PERF_PROP_SAMPLE_TS +* { u64 clk_mono; } && DRM_I915_PERF_PROP_SAMPLE_CLOCK_MONOTONIC * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/16] drm/i915: Mechanism to forward clock monotonic time in perf samples
drivers/gpu/drm/i915/i915_perf.c static int append_sample(struct i915_perf_stream *stream, · line 795
Quoted 4 lines · On Fri, Apr 22, 2016 at 05:04:04PM +0530, [email protected] wrote:
drivers/gpu/drm/i915/i915_perf.c +4
-0+static u64 get_current_gpu_ts (struct drm_i915_private *dev_priv) +{ +return ((u64 )I915_READ (GT_TIMESTAMP_COUNT_UDW ) <<32 ) | +I915_READ (GT_TIMESTAMP_COUNT );
return I915_READ64_2x32(GT_TIMESTAMP_COUNT, GT_TIMESTAMP_COUNT_UDW);
Quoted 11 lines
drivers/gpu/drm/i915/i915_perf.c +11
-0+static void i915_perf_get_clock (struct drm_i915_private *dev_priv, +u64 *clk_mono,u64 *gpu_time,u64 *gpu_ts) +{ +u64 remainder, ts_interval =NSEC_PER_SEC ; +u32 gpu_freq = dev_priv->perf.timestamp_frequency; +unsigned long flags; + +local_irq_save (flags); + *clk_mono =ktime_get_mono_fast_ns (); + *gpu_ts =get_current_gpu_ts (dev_priv); +local_irq_restore (flags);
drivers/gpu/drm/i915/i915_perf.c static void gen8_oa_enable(struct drm_i915_private *dev_priv) · line 2121
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+ + remainder =do_div (ts_interval, gpu_freq); + remainder *= *gpu_ts; +do_div (remainder, gpu_freq); + + *gpu_time = ((*gpu_ts) * ts_interval) + remainder; +} + +static void i915_perf_clock_sync_work (struct work_struct *work) +{
Have you looked at cross-timestamps?
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/16] drm/i915: Mechanism to forward clock monotonic time in perf samples
Quoted 7 lines · Chris Wilson
drivers/gpu/drm/i915/i915_perf.c static int append_sample(struct i915_perf_stream *stream, · line 795
Quoted 4 lines · On Fri, Apr 22, 2016 at 05:04:04PM +0530, [email protected] wrote:
drivers/gpu/drm/i915/i915_perf.c +4
-0+static u64 get_current_gpu_ts (struct drm_i915_private *dev_priv) +{ +return ((u64 )I915_READ (GT_TIMESTAMP_COUNT_UDW ) <<32 ) | +I915_READ (GT_TIMESTAMP_COUNT );return
I915_READ64_2x32(GT_TIMESTAMP_COUNT, GT_TIMESTAMP_COUNT_UDW);
Thanks for pointing out. Will make this change.
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/i915_perf.c +15
-0+static void i915_perf_get_clock (struct drm_i915_private *dev_priv, +u64 *clk_mono,u64 *gpu_time,u64 *gpu_ts) +{ +u64 remainder, ts_interval =NSEC_PER_SEC ; +u32 gpu_freq = dev_priv->perf.timestamp_frequency; +unsigned long flags; + +local_irq_save (flags); + *clk_mono =ktime_get_mono_fast_ns (); + *gpu_ts =get_current_gpu_ts (dev_priv); +local_irq_restore (flags); + + remainder =do_div (ts_interval, gpu_freq); + remainder *= *gpu_ts; +do_div (remainder, gpu_freq);
Quoted 8 lines
drivers/gpu/drm/i915/i915_perf.c static void gen8_oa_enable(struct drm_i915_private *dev_priv) · line 2121
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0+ + *gpu_time = ((*gpu_ts) * ts_interval) + remainder; +} + +static void i915_perf_clock_sync_work (struct work_struct *work) +{Have you looked at cross-timestamps?
I was looking at the cross-timestamp patch set
(https://lkml.org/lkml/2016/1/4/541), but I'm not entirely sure the cross timestamp stuff is solving the same problem. The cross timestamp stuff is trying to "synchronously capture system/device timestamp(s)". While here, we have a log of many recorded device timestamps and want to correlate all of those with system timestamp (_CLOCK_MONOTONOC for now). As we aren't reading system/device timestamps together for all timestamps we have, our problem is more about deriving an accurate idea of timestamp frequency to improve the accuracy when correlating between the synchronization points. Maybe the cross timestamp stuff will help to periodically read tightly correlated timestamp pairs synchronously which can be used as basis for correlating the logged timestamps based on our derived timestamp frequency. This idea can be evaluated once the cross timestamp patches land in kernel.
Quoted 2 lines
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/16] drm/i915: Mechanism to forward clock monotonic time in perf samples
Quoted 17 lines · sourab gupta
Quoted 1 line · Chris Wilson
Have you looked at cross-timestamps?
I was looking at the cross-timestamp patch set
(https://lkml.org/lkml/2016/1/4/541), but I'm not entirely sure the cross timestamp stuff is solving the same problem. The cross timestamp stuff is trying to "synchronously capture system/device timestamp(s)". While here, we have a log of many recorded device timestamps and want to correlate all of those with system timestamp (_CLOCK_MONOTONOCfor now). As we aren't reading system/device timestamps together for all timestamps we have, our problem is more about deriving an accurate idea of timestamp frequency to improve the accuracy when correlating between the synchronization points. Maybe the cross timestamp stuff will help to periodically read tightly correlated timestamp pairs synchronously which can be used as basis for correlating the logged timestamps based on our derived timestamp frequency. This idea can be evaluated once the cross timestamp patches land in kernel.
My understanding was that the cross-timestamps was for providing the tight coupling between clock sources. It is already available in upstream or -nightly for use.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 16/16 drm/i915: Support for capturing MMIO register values
In reply to [email protected]From: Sourab Gupta <[email protected]>
This patch adds support for capturing MMIO register values through i915 perf interface.
The userspace can request upto 8 MMIO register values to be dumped. The addresses of these registers can be passed through the corresponding property 'value' field while opening the stream.
The commands to dump the values of these MMIO registers are then inserted into the ring alongwith other commands.
--- drivers/gpu/drm/i915/i915_drv.h | 4 + drivers/gpu/drm/i915/i915_perf.c | 179 ++++++++++++++++++++++++++++++++++++++- include/uapi/drm/i915_drm.h | 14 +++ 3 files changed, 194 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -1847,6 +1847,7 @@ struct i915_perf_cs_data_node {u32 start_offset;u32 oa_offset;u32 ts_offset; +u32 mmio_offset;/* buffer size corresponding to this entry */ u32 size;
@@ -2155,6 +2156,9 @@ struct drm_i915_private {u32 resync_period;/* in msecs */ struct delayed_work clk_sync_work; +u32 num_mmio; +u32 mmio_list[I915_PERF_MMIO_NUM_MAX ]; +struct {u32 specific_ctx_id;
drivers/gpu/drm/i915/i915_perf.c +176 -3
271 lines not on this page · raw message
include/uapi/drm/i915_drm.h +14 -0
@@ -1206,6 +1206,12 @@ enum drm_i915_perf_oa_event_source {I915_PERF_OA_EVENT_SOURCE_MAX /* non-ABI */ }; +#define I915_PERF_MMIO_NUM_MAX 8 +struct drm_i915_perf_mmio_list { +__u32 num_mmio; +__u32 mmio_list[I915_PERF_MMIO_NUM_MAX ]; +}; +enum drm_i915_perf_property_id {/** * Open the stream for a specific context handle (as used with
@@ -1284,6 +1290,13 @@ enum drm_i915_perf_property_id {*/ DRM_I915_PERF_PROP_SAMPLE_CLOCK_MONOTONIC , +/** +* This property requests inclusion of mmio register values in the perf +* sample data. The value of this property specifies the address of user +* struct having the register addresses. +*/ +DRM_I915_PERF_PROP_SAMPLE_MMIO , + DRM_I915_PERF_PROP_MAX /* non-ABI */ };
@@ -1354,6 +1367,7 @@ enum drm_i915_perf_record_type {* { u32 tag; } && DRM_I915_PERF_PROP_SAMPLE_TAG * { u64 gpu_ts; } && DRM_I915_PERF_PROP_SAMPLE_TS * { u64 clk_mono; } && DRM_I915_PERF_PROP_SAMPLE_CLOCK_MONOTONIC +* { u32 mmio[]; } && DRM_I915_PERF_PROP_SAMPLE_MMIO * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 16/16] drm/i915: Support for capturing MMIO register values
drivers/gpu/drm/i915/i915_perf.c static int i915_ring_stream_capture_ts(struct drm_i915_gem_request *req, · line 518
Quoted 6 lines · On Fri, Apr 22, 2016 at 05:04:05PM +0530, [email protected] wrote:
drivers/gpu/drm/i915/i915_perf.c +6
-0+if (i915.enable_execlists) { +for (i =0 ; i < num_mmio; i++) { +uint32_t cmd; + + addr = mmio_addr + + i *sizeof (dev_priv->perf.mmio_list[i]);
Coincidence! The sizeof the i915_reg_t offset only happens to be the same size as the dword write for SRM.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx