Message ID | 1501487985-2017-7-git-send-email-sagar.a.kamble@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Sagar, I'm curious to what happens if 2 contexts submit requests which a time period smaller than the sampling OA period on Gen7.5. My understanding is that with this change you'll only retain the last submission and then the ctx_id reported in the SAMPLE_CTX_ID field will be incorrect for the first workload. Am I missing something? - Lionel On 31/07/17 08:59, Sagar Arun Kamble wrote: > From: Sourab Gupta <sourab.gupta@intel.com> > > 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. > > Signed-off-by: Sourab Gupta <sourab.gupta@intel.com> > Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> > --- > drivers/gpu/drm/i915/i915_drv.h | 8 ++++++ > drivers/gpu/drm/i915/i915_perf.c | 58 +++++++++++++++++++++++++++++++--------- > 2 files changed, 54 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index fb81315..6c011f3 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -2077,6 +2077,8 @@ struct i915_perf_stream { > > wait_queue_head_t poll_wq; > bool pollin; > + > + u32 last_ctx_id; > }; > > /** > @@ -2151,6 +2153,12 @@ struct i915_oa_ops { > * generations. > */ > u32 (*oa_hw_tail_read)(struct drm_i915_private *dev_priv); > + > + /** > + * @get_ctx_id: Retrieve the ctx_id associated with the (periodic) OA > + * report. > + */ > + u32 (*get_ctx_id)(struct i915_perf_stream *stream, const u8 *report); > }; > > /* > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c > index 905c5bb..1f5ebdb 100644 > --- a/drivers/gpu/drm/i915/i915_perf.c > +++ b/drivers/gpu/drm/i915/i915_perf.c > @@ -790,6 +790,45 @@ static u32 oa_buffer_num_reports_unlocked( > return aged_tail == INVALID_TAIL_PTR ? 0 : num_reports; > } > > +static u32 gen7_oa_buffer_get_ctx_id(struct i915_perf_stream *stream, > + const u8 *report) > +{ > + if (!stream->cs_mode) > + WARN_ONCE(1, > + "CTX ID can't be retrieved if command stream mode not enabled"); > + > + /* > + * OA reports generated in Gen7 don't have the ctx ID information. > + * Therefore, just rely on the ctx ID information from the last CS > + * sample forwarded > + */ > + return stream->last_ctx_id; > +} > + > +static u32 gen8_oa_buffer_get_ctx_id(struct i915_perf_stream *stream, > + const u8 *report) > +{ > + u32 ctx_id; > + > + /* The ctx ID present in the OA reports have intel_context::hw_id > + * present, since this is programmed into the ELSP in execlist mode. > + * In non-execlist mode, fall back to retrieving the ctx ID from the > + * last saved ctx ID from command stream mode. > + */ > + if (i915.enable_execlists) { > + u32 *report32 = (void *)report; > + > + ctx_id = report32[2] & 0x1fffff; > + } else { > + if (!stream->cs_mode) > + WARN_ONCE(1, > + "CTX ID can't be retrieved if command stream mode not enabled"); > + > + ctx_id = stream->last_ctx_id; > + } > + return ctx_id; > +} > + > /** > * append_oa_status - Appends a status record to a userspace read() buffer. > * @stream: An i915-perf stream opened for OA metrics > @@ -914,22 +953,12 @@ static int append_oa_buffer_sample(struct i915_perf_stream *stream, > struct drm_i915_private *dev_priv = stream->dev_priv; > u32 sample_flags = stream->sample_flags; > struct i915_perf_sample_data data = { 0 }; > - u32 *report32 = (u32 *)report; > > if (sample_flags & SAMPLE_OA_SOURCE) > data.source = I915_PERF_SAMPLE_OA_SOURCE_OABUFFER; > > if (sample_flags & SAMPLE_CTX_ID) { > - if (INTEL_INFO(dev_priv)->gen < 8) > - data.ctx_id = 0; > - else { > - /* > - * XXX: Just keep the lower 21 bits for now since I'm > - * not entirely sure if the HW touches any of the higher > - * bits in this field > - */ > - data.ctx_id = report32[2] & 0x1fffff; > - } > + data.ctx_id = dev_priv->perf.oa.ops.get_ctx_id(stream, report); > } > > if (sample_flags & SAMPLE_OA_REPORT) > @@ -1524,8 +1553,10 @@ static int append_cs_buffer_sample(struct i915_perf_stream *stream, > if (sample_flags & SAMPLE_OA_SOURCE) > data.source = I915_PERF_SAMPLE_OA_SOURCE_CS; > > - if (sample_flags & SAMPLE_CTX_ID) > + if (sample_flags & SAMPLE_CTX_ID) { > data.ctx_id = node->ctx_id; > + stream->last_ctx_id = data.ctx_id; > + } > > return append_perf_sample(stream, buf, count, offset, &data); > } > @@ -3838,6 +3869,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv) > dev_priv->perf.oa.ops.read = gen7_oa_read; > dev_priv->perf.oa.ops.oa_hw_tail_read = > gen7_oa_hw_tail_read; > + dev_priv->perf.oa.ops.get_ctx_id = gen7_oa_buffer_get_ctx_id; > > dev_priv->perf.oa.timestamp_frequency = 12500000; > > @@ -3933,6 +3965,8 @@ void i915_perf_init(struct drm_i915_private *dev_priv) > dev_priv->perf.oa.ops.read = gen8_oa_read; > dev_priv->perf.oa.ops.oa_hw_tail_read = > gen8_oa_hw_tail_read; > + dev_priv->perf.oa.ops.get_ctx_id = > + gen8_oa_buffer_get_ctx_id; > > dev_priv->perf.oa.oa_formats = gen8_plus_oa_formats; > }
Ctx_id for first submission will be its corresponding context as CS sample for that is allocated during submission with ctx_id taken from ctx->hw_id. For periodic reports, cs sample after those reports will have the ctx_id info as the timestamp of that CS sample's report is greater than periodic report. With no CS samples, periodic reports can't be associated with last context hence that would need change in following patch to set last ctx id to INVALID f5f73cf drm/i915: Flush periodic samples, in case of no pending CS sample requests Timestamps of OA reports taken before and after batch are used to associate ctx_id information with OA reports. So for e.g. for batches B1, B2 if following is the timeline: B1.start -> P1 -> P2 -> B1.end -> P3 -> B2.start -> P4 -> B2.end Then while reading CS samples will be read first interleaved with OA samples so Read sequence will be 1. Read B1.start report 2. Read P1 and P2 and associate with B1's context 3. Read B1.end report 4. Read P3 and associate with B1 (this is incorrect - should not be tagged with any context) 5. Read B2.start report 6. Read P4 and associate with B2's context 7. Read B2.end report -----Original Message----- From: Landwerlin, Lionel G Sent: Monday, July 31, 2017 2:57 PM To: Kamble, Sagar A <sagar.a.kamble@intel.com>; intel-gfx@lists.freedesktop.org Cc: Sourab Gupta <sourab.gupta@intel.com> Subject: Re: [Intel-gfx] [PATCH 06/12] drm/i915: Populate ctx ID for periodic OA reports Hi Sagar, I'm curious to what happens if 2 contexts submit requests which a time period smaller than the sampling OA period on Gen7.5. My understanding is that with this change you'll only retain the last submission and then the ctx_id reported in the SAMPLE_CTX_ID field will be incorrect for the first workload. Am I missing something? - Lionel On 31/07/17 08:59, Sagar Arun Kamble wrote: > From: Sourab Gupta <sourab.gupta@intel.com> > > 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. > > Signed-off-by: Sourab Gupta <sourab.gupta@intel.com> > Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> > --- > drivers/gpu/drm/i915/i915_drv.h | 8 ++++++ > drivers/gpu/drm/i915/i915_perf.c | 58 +++++++++++++++++++++++++++++++--------- > 2 files changed, 54 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h > b/drivers/gpu/drm/i915/i915_drv.h index fb81315..6c011f3 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -2077,6 +2077,8 @@ struct i915_perf_stream { > > wait_queue_head_t poll_wq; > bool pollin; > + > + u32 last_ctx_id; > }; > > /** > @@ -2151,6 +2153,12 @@ struct i915_oa_ops { > * generations. > */ > u32 (*oa_hw_tail_read)(struct drm_i915_private *dev_priv); > + > + /** > + * @get_ctx_id: Retrieve the ctx_id associated with the (periodic) OA > + * report. > + */ > + u32 (*get_ctx_id)(struct i915_perf_stream *stream, const u8 > +*report); > }; > > /* > diff --git a/drivers/gpu/drm/i915/i915_perf.c > b/drivers/gpu/drm/i915/i915_perf.c > index 905c5bb..1f5ebdb 100644 > --- a/drivers/gpu/drm/i915/i915_perf.c > +++ b/drivers/gpu/drm/i915/i915_perf.c > @@ -790,6 +790,45 @@ static u32 oa_buffer_num_reports_unlocked( > return aged_tail == INVALID_TAIL_PTR ? 0 : num_reports; > } > > +static u32 gen7_oa_buffer_get_ctx_id(struct i915_perf_stream *stream, > + const u8 *report) > +{ > + if (!stream->cs_mode) > + WARN_ONCE(1, > + "CTX ID can't be retrieved if command stream mode not enabled"); > + > + /* > + * OA reports generated in Gen7 don't have the ctx ID information. > + * Therefore, just rely on the ctx ID information from the last CS > + * sample forwarded > + */ > + return stream->last_ctx_id; > +} > + > +static u32 gen8_oa_buffer_get_ctx_id(struct i915_perf_stream *stream, > + const u8 *report) > +{ > + u32 ctx_id; > + > + /* The ctx ID present in the OA reports have intel_context::hw_id > + * present, since this is programmed into the ELSP in execlist mode. > + * In non-execlist mode, fall back to retrieving the ctx ID from the > + * last saved ctx ID from command stream mode. > + */ > + if (i915.enable_execlists) { > + u32 *report32 = (void *)report; > + > + ctx_id = report32[2] & 0x1fffff; > + } else { > + if (!stream->cs_mode) > + WARN_ONCE(1, > + "CTX ID can't be retrieved if command stream mode not enabled"); > + > + ctx_id = stream->last_ctx_id; > + } > + return ctx_id; > +} > + > /** > * append_oa_status - Appends a status record to a userspace read() buffer. > * @stream: An i915-perf stream opened for OA metrics @@ -914,22 > +953,12 @@ static int append_oa_buffer_sample(struct i915_perf_stream *stream, > struct drm_i915_private *dev_priv = stream->dev_priv; > u32 sample_flags = stream->sample_flags; > struct i915_perf_sample_data data = { 0 }; > - u32 *report32 = (u32 *)report; > > if (sample_flags & SAMPLE_OA_SOURCE) > data.source = I915_PERF_SAMPLE_OA_SOURCE_OABUFFER; > > if (sample_flags & SAMPLE_CTX_ID) { > - if (INTEL_INFO(dev_priv)->gen < 8) > - data.ctx_id = 0; > - else { > - /* > - * XXX: Just keep the lower 21 bits for now since I'm > - * not entirely sure if the HW touches any of the higher > - * bits in this field > - */ > - data.ctx_id = report32[2] & 0x1fffff; > - } > + data.ctx_id = dev_priv->perf.oa.ops.get_ctx_id(stream, report); > } > > if (sample_flags & SAMPLE_OA_REPORT) @@ -1524,8 +1553,10 @@ static > int append_cs_buffer_sample(struct i915_perf_stream *stream, > if (sample_flags & SAMPLE_OA_SOURCE) > data.source = I915_PERF_SAMPLE_OA_SOURCE_CS; > > - if (sample_flags & SAMPLE_CTX_ID) > + if (sample_flags & SAMPLE_CTX_ID) { > data.ctx_id = node->ctx_id; > + stream->last_ctx_id = data.ctx_id; > + } > > return append_perf_sample(stream, buf, count, offset, &data); > } > @@ -3838,6 +3869,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv) > dev_priv->perf.oa.ops.read = gen7_oa_read; > dev_priv->perf.oa.ops.oa_hw_tail_read = > gen7_oa_hw_tail_read; > + dev_priv->perf.oa.ops.get_ctx_id = gen7_oa_buffer_get_ctx_id; > > dev_priv->perf.oa.timestamp_frequency = 12500000; > > @@ -3933,6 +3965,8 @@ void i915_perf_init(struct drm_i915_private *dev_priv) > dev_priv->perf.oa.ops.read = gen8_oa_read; > dev_priv->perf.oa.ops.oa_hw_tail_read = > gen8_oa_hw_tail_read; > + dev_priv->perf.oa.ops.get_ctx_id = > + gen8_oa_buffer_get_ctx_id; > > dev_priv->perf.oa.oa_formats = gen8_plus_oa_formats; > }
Hi Sourab, [auto build test WARNING on drm-intel/for-linux-next] [also build test WARNING on next-20170731] [cannot apply to v4.13-rc3] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Sagar-Arun-Kamble/i915-perf-support-for-command-stream-based-OA-GPU-and-workload-metrics-capture/20170731-184412 base: git://anongit.freedesktop.org/drm-intel for-linux-next reproduce: make htmldocs All warnings (new ones prefixed by >>): WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org) include/linux/init.h:1: warning: no structured comments found include/linux/mod_devicetable.h:687: warning: Excess struct/union/enum/typedef member 'ver_major' description in 'fsl_mc_device_id' include/linux/mod_devicetable.h:687: warning: Excess struct/union/enum/typedef member 'ver_minor' description in 'fsl_mc_device_id' kernel/sched/core.c:2080: warning: No description found for parameter 'rf' kernel/sched/core.c:2080: warning: Excess function parameter 'cookie' description in 'try_to_wake_up_local' include/linux/wait.h:555: warning: No description found for parameter 'wq' include/linux/wait.h:555: warning: Excess function parameter 'wq_head' description in 'wait_event_interruptible_hrtimeout' include/linux/wait.h:759: warning: No description found for parameter 'wq_head' include/linux/wait.h:759: warning: Excess function parameter 'wq' description in 'wait_event_killable' include/linux/kthread.h:26: warning: Excess function parameter '...' description in 'kthread_create' kernel/sys.c:1: warning: no structured comments found include/linux/device.h:968: warning: No description found for parameter 'dma_ops' drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found include/linux/iio/iio.h:603: warning: No description found for parameter 'trig_readonly' include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev' include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig' include/linux/device.h:969: warning: No description found for parameter 'dma_ops' drivers/ata/libata-eh.c:1449: warning: No description found for parameter 'link' drivers/ata/libata-eh.c:1449: warning: Excess function parameter 'ap' description in 'ata_eh_done' drivers/ata/libata-eh.c:1590: warning: No description found for parameter 'qc' drivers/ata/libata-eh.c:1590: warning: Excess function parameter 'dev' description in 'ata_eh_request_sense' drivers/mtd/nand/nand_base.c:2751: warning: Excess function parameter 'cached' description in 'nand_write_page' drivers/mtd/nand/nand_base.c:2751: warning: Excess function parameter 'cached' description in 'nand_write_page' arch/s390/include/asm/cmb.h:1: warning: no structured comments found drivers/scsi/scsi_lib.c:1116: warning: No description found for parameter 'rq' drivers/scsi/constants.c:1: warning: no structured comments found include/linux/usb/gadget.h:230: warning: No description found for parameter 'claimed' include/linux/usb/gadget.h:230: warning: No description found for parameter 'enabled' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_altset_not_supp' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_stall_not_supp' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_zlp_not_supp' fs/inode.c:1666: warning: No description found for parameter 'rcu' include/linux/jbd2.h:443: warning: No description found for parameter 'i_transaction' include/linux/jbd2.h:443: warning: No description found for parameter 'i_next_transaction' include/linux/jbd2.h:443: warning: No description found for parameter 'i_list' include/linux/jbd2.h:443: warning: No description found for parameter 'i_vfs_inode' include/linux/jbd2.h:443: warning: No description found for parameter 'i_flags' include/linux/jbd2.h:497: warning: No description found for parameter 'h_rsv_handle' include/linux/jbd2.h:497: warning: No description found for parameter 'h_reserved' include/linux/jbd2.h:497: warning: No description found for parameter 'h_type' include/linux/jbd2.h:497: warning: No description found for parameter 'h_line_no' include/linux/jbd2.h:497: warning: No description found for parameter 'h_start_jiffies' include/linux/jbd2.h:497: warning: No description found for parameter 'h_requested_credits' include/linux/jbd2.h:497: warning: No description found for parameter 'saved_alloc_context' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chkpt_bhs' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_devname' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_average_commit_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_min_batch_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_max_batch_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_commit_callback' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_failed_commit' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chksum_driver' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_csum_seed' fs/jbd2/transaction.c:511: warning: No description found for parameter 'type' fs/jbd2/transaction.c:511: warning: No description found for parameter 'line_no' fs/jbd2/transaction.c:641: warning: No description found for parameter 'gfp_mask' include/drm/drm_drv.h:553: warning: No description found for parameter 'debugfs_init' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_open_object' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_close_object' include/drm/drm_drv.h:553: warning: No description found for parameter 'prime_handle_to_fd' include/drm/drm_drv.h:553: warning: No description found for parameter 'prime_fd_to_handle' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_export' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_import' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_pin' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_unpin' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_res_obj' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_get_sg_table' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_import_sg_table' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_vmap' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_vunmap' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_mmap' include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_vm_ops' include/drm/drm_drv.h:553: warning: No description found for parameter 'major' include/drm/drm_drv.h:553: warning: No description found for parameter 'minor' include/drm/drm_drv.h:553: warning: No description found for parameter 'patchlevel' include/drm/drm_drv.h:553: warning: No description found for parameter 'name' include/drm/drm_drv.h:553: warning: No description found for parameter 'desc' include/drm/drm_drv.h:553: warning: No description found for parameter 'date' include/drm/drm_drv.h:553: warning: No description found for parameter 'driver_features' drivers/gpu/drm/drm_modes.c:1623: warning: No description found for parameter 'display' drivers/gpu/drm/drm_modes.c:1623: warning: Excess function parameter 'connector' description in 'drm_mode_is_420_only' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_drv.h:2000: warning: No description found for parameter 'emit_sample_capture' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_buffer' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_samples' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_samples_lock' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'poll_wq' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'pollin' >> drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'last_ctx_id' drivers/gpu/drm/i915/i915_drv.h:2000: warning: No description found for parameter 'emit_sample_capture' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_buffer' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_samples' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_samples_lock' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'poll_wq' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'pollin' >> drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'last_ctx_id' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_drv.h:2000: warning: No description found for parameter 'emit_sample_capture' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_buffer' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_samples' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'cs_samples_lock' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'poll_wq' drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'pollin' >> drivers/gpu/drm/i915/i915_drv.h:2082: warning: No description found for parameter 'last_ctx_id' drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:1: warning: no structured comments found drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:1: warning: no structured comments found drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:1: warning: no structured comments found drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:1: warning: no structured comments found drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:1: warning: no structured comments found drivers/gpu/drm/i915/i915_perf.c:688: warning: No description found for parameter 'last_ts' drivers/gpu/drm/i915/i915_perf.c:1: warning: no structured comments found drivers/gpu/drm/i915/i915_perf.c:689: warning: No description found for parameter 'last_ts' drivers/gpu/host1x/bus.c:50: warning: Excess function parameter 'driver' description in 'host1x_subdev_add' Documentation/doc-guide/sphinx.rst:121: ERROR: Unknown target name: "sphinx c domain". kernel/sched/fair.c:7584: WARNING: Inline emphasis start-string without end-string. kernel/time/timer.c:1200: ERROR: Unexpected indentation. kernel/time/timer.c:1202: ERROR: Unexpected indentation. kernel/time/timer.c:1203: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:108: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:111: ERROR: Unexpected indentation. include/linux/wait.h:113: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/time/hrtimer.c:991: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/signal.c:323: WARNING: Inline literal start-string without end-string. kernel/rcu/tree.c:3187: ERROR: Unexpected indentation. kernel/rcu/tree.c:3214: ERROR: Unexpected indentation. kernel/rcu/tree.c:3215: WARNING: Bullet list ends without a blank line; unexpected unindent. include/linux/iio/iio.h:219: ERROR: Unexpected indentation. include/linux/iio/iio.h:220: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/iio/iio.h:226: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/iio/industrialio-core.c:633: ERROR: Unknown target name: "iio_val". drivers/iio/industrialio-core.c:640: ERROR: Unknown target name: "iio_val". drivers/ata/libata-core.c:5906: ERROR: Unknown target name: "hw". drivers/message/fusion/mptbase.c:5051: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/tty/serial/serial_core.c:1897: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/pci/pci.c:3470: ERROR: Unexpected indentation. include/linux/regulator/driver.h:271: ERROR: Unknown target name: "regulator_regmap_x_voltage". include/linux/spi/spi.h:373: ERROR: Unexpected indentation. drivers/w1/w1_io.c:196: WARNING: Definition list ends without a blank line; unexpected unindent. block/bio.c:404: ERROR: Unknown target name: "gfp". include/drm/drm_modeset_helper_vtables.h:1182: WARNING: Bullet list ends without a blank line; unexpected unindent. drivers/gpu/drm/drm_scdc_helper.c:203: ERROR: Unexpected indentation. drivers/gpu/drm/drm_scdc_helper.c:204: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/gpu/todo.rst:111: ERROR: Unknown target name: "drm_fb". sound/soc/soc-core.c:2703: ERROR: Unknown target name: "snd_soc_daifmt". sound/core/jack.c:312: ERROR: Unknown target name: "snd_jack_btn". Documentation/media/v4l-drivers/imx.rst:: WARNING: document isn't included in any toctree Documentation/virtual/kvm/vcpu-requests.rst:: WARNING: document isn't included in any toctree Documentation/dev-tools/kselftest.rst:15: WARNING: Could not lex literal_block as "c". Highlighting skipped. Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected vim +/last_ctx_id +2082 drivers/gpu/drm/i915/i915_drv.h eec688e1 Robert Bragg 2016-11-07 1925 16d98b31 Robert Bragg 2016-12-07 1926 /** 16d98b31 Robert Bragg 2016-12-07 1927 * struct i915_perf_stream_ops - the OPs to support a specific stream type 16d98b31 Robert Bragg 2016-12-07 1928 */ eec688e1 Robert Bragg 2016-11-07 1929 struct i915_perf_stream_ops { 16d98b31 Robert Bragg 2016-12-07 1930 /** 16d98b31 Robert Bragg 2016-12-07 1931 * @enable: Enables the collection of HW samples, either in response to 16d98b31 Robert Bragg 2016-12-07 1932 * `I915_PERF_IOCTL_ENABLE` or implicitly called when stream is opened 16d98b31 Robert Bragg 2016-12-07 1933 * without `I915_PERF_FLAG_DISABLED`. eec688e1 Robert Bragg 2016-11-07 1934 */ eec688e1 Robert Bragg 2016-11-07 1935 void (*enable)(struct i915_perf_stream *stream); eec688e1 Robert Bragg 2016-11-07 1936 16d98b31 Robert Bragg 2016-12-07 1937 /** 16d98b31 Robert Bragg 2016-12-07 1938 * @disable: Disables the collection of HW samples, either in response 16d98b31 Robert Bragg 2016-12-07 1939 * to `I915_PERF_IOCTL_DISABLE` or implicitly called before destroying 16d98b31 Robert Bragg 2016-12-07 1940 * the stream. eec688e1 Robert Bragg 2016-11-07 1941 */ eec688e1 Robert Bragg 2016-11-07 1942 void (*disable)(struct i915_perf_stream *stream); eec688e1 Robert Bragg 2016-11-07 1943 16d98b31 Robert Bragg 2016-12-07 1944 /** 16d98b31 Robert Bragg 2016-12-07 1945 * @poll_wait: Call poll_wait, passing a wait queue that will be woken eec688e1 Robert Bragg 2016-11-07 1946 * once there is something ready to read() for the stream eec688e1 Robert Bragg 2016-11-07 1947 */ eec688e1 Robert Bragg 2016-11-07 1948 void (*poll_wait)(struct i915_perf_stream *stream, eec688e1 Robert Bragg 2016-11-07 1949 struct file *file, eec688e1 Robert Bragg 2016-11-07 1950 poll_table *wait); eec688e1 Robert Bragg 2016-11-07 1951 16d98b31 Robert Bragg 2016-12-07 1952 /** 16d98b31 Robert Bragg 2016-12-07 1953 * @wait_unlocked: For handling a blocking read, wait until there is 16d98b31 Robert Bragg 2016-12-07 1954 * something to ready to read() for the stream. E.g. wait on the same d7965152 Robert Bragg 2016-11-07 1955 * wait queue that would be passed to poll_wait(). eec688e1 Robert Bragg 2016-11-07 1956 */ eec688e1 Robert Bragg 2016-11-07 1957 int (*wait_unlocked)(struct i915_perf_stream *stream); eec688e1 Robert Bragg 2016-11-07 1958 16d98b31 Robert Bragg 2016-12-07 1959 /** 16d98b31 Robert Bragg 2016-12-07 1960 * @read: Copy buffered metrics as records to userspace 16d98b31 Robert Bragg 2016-12-07 1961 * **buf**: the userspace, destination buffer 16d98b31 Robert Bragg 2016-12-07 1962 * **count**: the number of bytes to copy, requested by userspace 16d98b31 Robert Bragg 2016-12-07 1963 * **offset**: zero at the start of the read, updated as the read 16d98b31 Robert Bragg 2016-12-07 1964 * proceeds, it represents how many bytes have been copied so far and 16d98b31 Robert Bragg 2016-12-07 1965 * the buffer offset for copying the next record. eec688e1 Robert Bragg 2016-11-07 1966 * 16d98b31 Robert Bragg 2016-12-07 1967 * Copy as many buffered i915 perf samples and records for this stream 16d98b31 Robert Bragg 2016-12-07 1968 * to userspace as will fit in the given buffer. eec688e1 Robert Bragg 2016-11-07 1969 * 16d98b31 Robert Bragg 2016-12-07 1970 * Only write complete records; returning -%ENOSPC if there isn't room 16d98b31 Robert Bragg 2016-12-07 1971 * for a complete record. eec688e1 Robert Bragg 2016-11-07 1972 * 16d98b31 Robert Bragg 2016-12-07 1973 * Return any error condition that results in a short read such as 16d98b31 Robert Bragg 2016-12-07 1974 * -%ENOSPC or -%EFAULT, even though these may be squashed before 16d98b31 Robert Bragg 2016-12-07 1975 * returning to userspace. eec688e1 Robert Bragg 2016-11-07 1976 */ eec688e1 Robert Bragg 2016-11-07 1977 int (*read)(struct i915_perf_stream *stream, eec688e1 Robert Bragg 2016-11-07 1978 char __user *buf, eec688e1 Robert Bragg 2016-11-07 1979 size_t count, eec688e1 Robert Bragg 2016-11-07 1980 size_t *offset); eec688e1 Robert Bragg 2016-11-07 1981 16d98b31 Robert Bragg 2016-12-07 1982 /** 16d98b31 Robert Bragg 2016-12-07 1983 * @destroy: Cleanup any stream specific resources. eec688e1 Robert Bragg 2016-11-07 1984 * eec688e1 Robert Bragg 2016-11-07 1985 * The stream will always be disabled before this is called. eec688e1 Robert Bragg 2016-11-07 1986 */ eec688e1 Robert Bragg 2016-11-07 1987 void (*destroy)(struct i915_perf_stream *stream); b0aca6b4 Sourab Gupta 2017-07-31 1988 b0aca6b4 Sourab Gupta 2017-07-31 1989 /* b0aca6b4 Sourab Gupta 2017-07-31 1990 * @emit_sample_capture: Emit the commands in the command streamer b0aca6b4 Sourab Gupta 2017-07-31 1991 * for a particular gpu engine. b0aca6b4 Sourab Gupta 2017-07-31 1992 * b0aca6b4 Sourab Gupta 2017-07-31 1993 * The commands are inserted to capture the perf sample data at b0aca6b4 Sourab Gupta 2017-07-31 1994 * specific points during workload execution, such as before and after b0aca6b4 Sourab Gupta 2017-07-31 1995 * the batch buffer. b0aca6b4 Sourab Gupta 2017-07-31 1996 */ b0aca6b4 Sourab Gupta 2017-07-31 1997 void (*emit_sample_capture)(struct i915_perf_stream *stream, b0aca6b4 Sourab Gupta 2017-07-31 1998 struct drm_i915_gem_request *request, b0aca6b4 Sourab Gupta 2017-07-31 1999 bool preallocate); b0aca6b4 Sourab Gupta 2017-07-31 @2000 }; b0aca6b4 Sourab Gupta 2017-07-31 2001 b0aca6b4 Sourab Gupta 2017-07-31 2002 enum i915_perf_stream_state { b0aca6b4 Sourab Gupta 2017-07-31 2003 I915_PERF_STREAM_DISABLED, b0aca6b4 Sourab Gupta 2017-07-31 2004 I915_PERF_STREAM_ENABLE_IN_PROGRESS, b0aca6b4 Sourab Gupta 2017-07-31 2005 I915_PERF_STREAM_ENABLED, eec688e1 Robert Bragg 2016-11-07 2006 }; eec688e1 Robert Bragg 2016-11-07 2007 16d98b31 Robert Bragg 2016-12-07 2008 /** 16d98b31 Robert Bragg 2016-12-07 2009 * struct i915_perf_stream - state for a single open stream FD 16d98b31 Robert Bragg 2016-12-07 2010 */ eec688e1 Robert Bragg 2016-11-07 2011 struct i915_perf_stream { 16d98b31 Robert Bragg 2016-12-07 2012 /** 16d98b31 Robert Bragg 2016-12-07 2013 * @dev_priv: i915 drm device 16d98b31 Robert Bragg 2016-12-07 2014 */ eec688e1 Robert Bragg 2016-11-07 2015 struct drm_i915_private *dev_priv; eec688e1 Robert Bragg 2016-11-07 2016 16d98b31 Robert Bragg 2016-12-07 2017 /** b0aca6b4 Sourab Gupta 2017-07-31 2018 * @engine: Engine to which this stream corresponds. 16d98b31 Robert Bragg 2016-12-07 2019 */ b0aca6b4 Sourab Gupta 2017-07-31 2020 struct intel_engine_cs *engine; eec688e1 Robert Bragg 2016-11-07 2021 16d98b31 Robert Bragg 2016-12-07 2022 /** 16d98b31 Robert Bragg 2016-12-07 2023 * @sample_flags: Flags representing the `DRM_I915_PERF_PROP_SAMPLE_*` 16d98b31 Robert Bragg 2016-12-07 2024 * properties given when opening a stream, representing the contents 16d98b31 Robert Bragg 2016-12-07 2025 * of a single sample as read() by userspace. 16d98b31 Robert Bragg 2016-12-07 2026 */ eec688e1 Robert Bragg 2016-11-07 2027 u32 sample_flags; 16d98b31 Robert Bragg 2016-12-07 2028 16d98b31 Robert Bragg 2016-12-07 2029 /** 16d98b31 Robert Bragg 2016-12-07 2030 * @sample_size: Considering the configured contents of a sample 16d98b31 Robert Bragg 2016-12-07 2031 * combined with the required header size, this is the total size 16d98b31 Robert Bragg 2016-12-07 2032 * of a single sample record. 16d98b31 Robert Bragg 2016-12-07 2033 */ d7965152 Robert Bragg 2016-11-07 2034 int sample_size; eec688e1 Robert Bragg 2016-11-07 2035 16d98b31 Robert Bragg 2016-12-07 2036 /** 16d98b31 Robert Bragg 2016-12-07 2037 * @ctx: %NULL if measuring system-wide across all contexts or a 16d98b31 Robert Bragg 2016-12-07 2038 * specific context that is being monitored. 16d98b31 Robert Bragg 2016-12-07 2039 */ eec688e1 Robert Bragg 2016-11-07 2040 struct i915_gem_context *ctx; 16d98b31 Robert Bragg 2016-12-07 2041 16d98b31 Robert Bragg 2016-12-07 2042 /** b0aca6b4 Sourab Gupta 2017-07-31 2043 * @state: Current stream state, which can be either disabled, enabled, b0aca6b4 Sourab Gupta 2017-07-31 2044 * or enable_in_progress, while considering whether the stream was b0aca6b4 Sourab Gupta 2017-07-31 2045 * opened in a disabled state and based on `I915_PERF_IOCTL_ENABLE` and b0aca6b4 Sourab Gupta 2017-07-31 2046 * `I915_PERF_IOCTL_DISABLE` calls. 16d98b31 Robert Bragg 2016-12-07 2047 */ b0aca6b4 Sourab Gupta 2017-07-31 2048 enum i915_perf_stream_state state; b0aca6b4 Sourab Gupta 2017-07-31 2049 b0aca6b4 Sourab Gupta 2017-07-31 2050 /** b0aca6b4 Sourab Gupta 2017-07-31 2051 * @cs_mode: Whether command stream based perf sample collection is b0aca6b4 Sourab Gupta 2017-07-31 2052 * enabled for this stream b0aca6b4 Sourab Gupta 2017-07-31 2053 */ b0aca6b4 Sourab Gupta 2017-07-31 2054 bool cs_mode; b0aca6b4 Sourab Gupta 2017-07-31 2055 b0aca6b4 Sourab Gupta 2017-07-31 2056 /** b0aca6b4 Sourab Gupta 2017-07-31 2057 * @using_oa: Whether OA unit is in use for this particular stream b0aca6b4 Sourab Gupta 2017-07-31 2058 */ b0aca6b4 Sourab Gupta 2017-07-31 2059 bool using_oa; eec688e1 Robert Bragg 2016-11-07 2060 16d98b31 Robert Bragg 2016-12-07 2061 /** 16d98b31 Robert Bragg 2016-12-07 2062 * @ops: The callbacks providing the implementation of this specific 16d98b31 Robert Bragg 2016-12-07 2063 * type of configured stream. 16d98b31 Robert Bragg 2016-12-07 2064 */ d7965152 Robert Bragg 2016-11-07 2065 const struct i915_perf_stream_ops *ops; b0aca6b4 Sourab Gupta 2017-07-31 2066 b0aca6b4 Sourab Gupta 2017-07-31 2067 /* Command stream based perf data buffer */ b0aca6b4 Sourab Gupta 2017-07-31 2068 struct { b0aca6b4 Sourab Gupta 2017-07-31 2069 struct i915_vma *vma; b0aca6b4 Sourab Gupta 2017-07-31 2070 u8 *vaddr; 71fd8fc0 Sourab Gupta 2017-07-31 2071 #define I915_PERF_CMD_STREAM_BUF_STATUS_OVERFLOW (1<<0) 71fd8fc0 Sourab Gupta 2017-07-31 2072 u32 status; b0aca6b4 Sourab Gupta 2017-07-31 2073 } cs_buffer; b0aca6b4 Sourab Gupta 2017-07-31 2074 b0aca6b4 Sourab Gupta 2017-07-31 2075 struct list_head cs_samples; b0aca6b4 Sourab Gupta 2017-07-31 2076 spinlock_t cs_samples_lock; b0aca6b4 Sourab Gupta 2017-07-31 2077 b0aca6b4 Sourab Gupta 2017-07-31 2078 wait_queue_head_t poll_wq; b0aca6b4 Sourab Gupta 2017-07-31 2079 bool pollin; 7405a923 Sourab Gupta 2017-07-31 2080 7405a923 Sourab Gupta 2017-07-31 2081 u32 last_ctx_id; d7965152 Robert Bragg 2016-11-07 @2082 }; d7965152 Robert Bragg 2016-11-07 2083 :::::: The code at line 2082 was first introduced by commit :::::: d79651522e89c4ffa8992b48dfe449f0c583f809 drm/i915: Enable i915 perf stream for Haswell OA unit :::::: TO: Robert Bragg <robert@sixbynine.org> :::::: CC: Daniel Vetter <daniel.vetter@ffwll.ch> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index fb81315..6c011f3 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2077,6 +2077,8 @@ struct i915_perf_stream { wait_queue_head_t poll_wq; bool pollin; + + u32 last_ctx_id; }; /** @@ -2151,6 +2153,12 @@ struct i915_oa_ops { * generations. */ u32 (*oa_hw_tail_read)(struct drm_i915_private *dev_priv); + + /** + * @get_ctx_id: Retrieve the ctx_id associated with the (periodic) OA + * report. + */ + u32 (*get_ctx_id)(struct i915_perf_stream *stream, const u8 *report); }; /* diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index 905c5bb..1f5ebdb 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -790,6 +790,45 @@ static u32 oa_buffer_num_reports_unlocked( return aged_tail == INVALID_TAIL_PTR ? 0 : num_reports; } +static u32 gen7_oa_buffer_get_ctx_id(struct i915_perf_stream *stream, + const u8 *report) +{ + if (!stream->cs_mode) + WARN_ONCE(1, + "CTX ID can't be retrieved if command stream mode not enabled"); + + /* + * OA reports generated in Gen7 don't have the ctx ID information. + * Therefore, just rely on the ctx ID information from the last CS + * sample forwarded + */ + return stream->last_ctx_id; +} + +static u32 gen8_oa_buffer_get_ctx_id(struct i915_perf_stream *stream, + const u8 *report) +{ + u32 ctx_id; + + /* The ctx ID present in the OA reports have intel_context::hw_id + * present, since this is programmed into the ELSP in execlist mode. + * In non-execlist mode, fall back to retrieving the ctx ID from the + * last saved ctx ID from command stream mode. + */ + if (i915.enable_execlists) { + u32 *report32 = (void *)report; + + ctx_id = report32[2] & 0x1fffff; + } else { + if (!stream->cs_mode) + WARN_ONCE(1, + "CTX ID can't be retrieved if command stream mode not enabled"); + + ctx_id = stream->last_ctx_id; + } + return ctx_id; +} + /** * append_oa_status - Appends a status record to a userspace read() buffer. * @stream: An i915-perf stream opened for OA metrics @@ -914,22 +953,12 @@ static int append_oa_buffer_sample(struct i915_perf_stream *stream, struct drm_i915_private *dev_priv = stream->dev_priv; u32 sample_flags = stream->sample_flags; struct i915_perf_sample_data data = { 0 }; - u32 *report32 = (u32 *)report; if (sample_flags & SAMPLE_OA_SOURCE) data.source = I915_PERF_SAMPLE_OA_SOURCE_OABUFFER; if (sample_flags & SAMPLE_CTX_ID) { - if (INTEL_INFO(dev_priv)->gen < 8) - data.ctx_id = 0; - else { - /* - * XXX: Just keep the lower 21 bits for now since I'm - * not entirely sure if the HW touches any of the higher - * bits in this field - */ - data.ctx_id = report32[2] & 0x1fffff; - } + data.ctx_id = dev_priv->perf.oa.ops.get_ctx_id(stream, report); } if (sample_flags & SAMPLE_OA_REPORT) @@ -1524,8 +1553,10 @@ static int append_cs_buffer_sample(struct i915_perf_stream *stream, if (sample_flags & SAMPLE_OA_SOURCE) data.source = I915_PERF_SAMPLE_OA_SOURCE_CS; - if (sample_flags & SAMPLE_CTX_ID) + if (sample_flags & SAMPLE_CTX_ID) { data.ctx_id = node->ctx_id; + stream->last_ctx_id = data.ctx_id; + } return append_perf_sample(stream, buf, count, offset, &data); } @@ -3838,6 +3869,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv) dev_priv->perf.oa.ops.read = gen7_oa_read; dev_priv->perf.oa.ops.oa_hw_tail_read = gen7_oa_hw_tail_read; + dev_priv->perf.oa.ops.get_ctx_id = gen7_oa_buffer_get_ctx_id; dev_priv->perf.oa.timestamp_frequency = 12500000; @@ -3933,6 +3965,8 @@ void i915_perf_init(struct drm_i915_private *dev_priv) dev_priv->perf.oa.ops.read = gen8_oa_read; dev_priv->perf.oa.ops.oa_hw_tail_read = gen8_oa_hw_tail_read; + dev_priv->perf.oa.ops.get_ctx_id = + gen8_oa_buffer_get_ctx_id; dev_priv->perf.oa.oa_formats = gen8_plus_oa_formats; }