Enable Gen 7 Observation Architecture
Subsystems (3)
cover Enable Gen 7 Observation Architecture
I've been working on some i-g-t tests for this new interface and while I still have some more tests to write, it still seemed worth sending out another updated series in the mean time.
Firstly this includes updates based on Emil's previous comments.
Then there have been a few issue hit while writing tests:
* It seems it can take a fairly long time for the MUX config to apply after the register writes have finished, and now the driver inserts a delay after configuration, before enabling periodic sampling.
* I've found that sometimes the HW tail pointer can get ahead of OA buffer writes, especially with higher sampling frequencies, and so now the driver maintains a margin behind the HW tail pointer to ensure the most recent reports have some time to land before attempting to copy them to userspace.
* As a sanity check that a report is valid before it's copied to userspace the driver checks the report-id field != 0
* The _BUFFER_OVERFLOW record has been replaced with a _BUFFER_LOST record with more specific semantics.
* Since we can't clear the overflow status on Haswell while periodic sampling is enabled, if an overflow occurs we now restart the unit.
* The maximum OA periodic sampling exponent is now 31
* We verify the head/tail pointers read back from HW look sane before using as offsets to read reports from the OA buffer. We reset the HW if they look bad.
For reference the work-in-progress i-g-t tests can be found here:
https://github.com/rib/intel-gpu-tools
branch = wip/rib/i915-perf-tests
or browsed here:
https://github.com/rib/intel-gpu-tools/commits/wip/rib/i915-perf-tests
Also for reference these patches can be fetched from here:
https://github.com/rib/linux
branch = wip/rib/oa-2016-04-19-nightly
Regards,
- Robert
Robert Bragg (9):
drm/i915: Add i915 perf infrastructure drm/i915: rename OACONTROL GEN7_OACONTROL drm/i915: don't whitelist oacontrol in cmd parser drm/i915: Add 'render basic' Haswell OA unit config drm/i915: Enable i915 perf stream for Haswell OA unit drm/i915: advertise available metrics via sysfs drm/i915: Add dev.i915.perf_event_paranoid sysctl option drm/i915: add oa_event_min_timer_exponent sysctl drm/i915: Add more Haswell OA metric sets
drivers/gpu/drm/i915/Makefile | 4 + drivers/gpu/drm/i915/i915_cmd_parser.c | 33 +- drivers/gpu/drm/i915/i915_dma.c | 8 + drivers/gpu/drm/i915/i915_drv.h | 155 ++++ drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_oa_hsw.c | 658 ++++++++++++++ drivers/gpu/drm/i915/i915_oa_hsw.h | 38 + drivers/gpu/drm/i915/i915_perf.c | 1439 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_reg.h | 340 +++++++- include/uapi/drm/i915_drm.h | 133 +++ 10 files changed, 2795 insertions(+), 37 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_oa_hsw.c create mode 100644 drivers/gpu/drm/i915/i915_oa_hsw.h create mode 100644 drivers/gpu/drm/i915/i915_perf.c
Signature · 6 lines
2.7.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/9 drm/i915: Add i915 perf infrastructure
Adds base i915 perf infrastructure for Gen performance metrics.
This adds a DRM_IOCTL_I915_PERF_OPEN ioctl that takes an array of uint64 properties to configure a stream of metrics and returns a new fd usable with standard VFS system calls including read() to read typed and sized records; ioctl() to enable or disable capture and poll() to wait for data.
A stream is opened something like:
uint64_t properties[] = {
/* Single context sampling */
DRM_I915_PERF_PROP_CTX_HANDLE, ctx_handle, /* Include OA reports in samples */
DRM_I915_PERF_PROP_SAMPLE_OA, true,
/* OA unit configuration */
DRM_I915_PERF_PROP_OA_METRICS_SET, metrics_set_id,
DRM_I915_PERF_PROP_OA_FORMAT, report_format,
DRM_I915_PERF_PROP_OA_EXPONENT, period_exponent,
};
struct drm_i915_perf_open_param parm = {
.flags = I915_PERF_FLAG_FD_CLOEXEC |
I915_PERF_FLAG_FD_NONBLOCK |
I915_PERF_FLAG_DISABLED,
.properties_ptr = (uint64_t)properties,
.num_properties = sizeof(properties) / 16, };
int fd = drmIoctl(drm_fd, DRM_IOCTL_I915_PERF_OPEN, ¶m);
Records read all start with a common { type, size } header with DRM_I915_PERF_RECORD_SAMPLE being of most interest. Sample records contain an extensible number of fields and it's the DRM_I915_PERF_PROP_SAMPLE_xyz properties given when opening that determine what's included in every sample.
No specific streams are supported yet so any attempt to open a stream will return an error.
--- drivers/gpu/drm/i915/Makefile | 3 + drivers/gpu/drm/i915/i915_dma.c | 8 + drivers/gpu/drm/i915/i915_drv.h | 86 ++++++++ drivers/gpu/drm/i915/i915_perf.c | 443 +++++++++++++++++++++++++++++++++++++++ include/uapi/drm/i915_drm.h | 67 ++++++ 5 files changed, 607 insertions(+) create mode 100644 drivers/gpu/drm/i915/i915_perf.c
drivers/gpu/drm/i915/Makefile +3 -0
@@ -98,6 +98,9 @@ i915-y += dvo_ch7017.o \ # virtual gpu code i915-y += i915_vgpu.o +# perf code +i915-y += i915_perf.o + # legacy horrors i915-y += i915_dma.o
drivers/gpu/drm/i915/i915_dma.c +8 -0
@@ -1039,6 +1039,11 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,if (ret <0 )return ret; +/* Must at least be initialized before trying to pin any context +* which i915_perf hooks into. +*/ +i915_perf_init (dev); +/* This must be called before any calls to HAS_PCH_* */ intel_detect_pch (dev);
@@ -1425,6 +1430,8 @@ int i915_driver_unload(struct drm_device *dev)i915_driver_unregister (dev_priv); +i915_perf_fini (dev); +drm_vblank_cleanup (dev);intel_modeset_cleanup (dev);
@@ -1579,6 +1586,7 @@ const struct drm_ioctl_desc i915_ioctls[] = {DRM_IOCTL_DEF_DRV (I915_GEM_USERPTR , i915_gem_userptr_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_CONTEXT_GETPARAM , i915_gem_context_getparam_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_CONTEXT_SETPARAM , i915_gem_context_setparam_ioctl,DRM_RENDER_ALLOW ), + DRM_IOCTL_DEF_DRV(I915_PERF_OPEN, i915_perf_open_ioctl, DRM_RENDER_ALLOW), };int i915_max_ioctl =ARRAY_SIZE (i915_ioctls);
drivers/gpu/drm/i915/i915_drv.h +86 -0
110 lines not on this page · raw message
drivers/gpu/drm/i915/i915_perf.c new file +443 -0
443 lines not on this page · raw message
include/uapi/drm/i915_drm.h +67 -0
83 lines not on this page · raw message
Signature · 6 lines
2.7.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/9] drm/i915: Add i915 perf infrastructure
Quoted 35 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c new file +35
-0+static struct intel_context * +lookup_context (struct drm_i915_private *dev_priv, +struct file *user_filp, +u32 ctx_user_handle) +{ +struct intel_context *ctx; + +mutex_lock (&dev_priv->dev->struct_mutex); +list_for_each_entry (ctx, &dev_priv->context_list, link) { +struct drm_file *drm_file; + +if (!ctx->file_priv) +continue ; + + drm_file = ctx->file_priv->file; + +if (user_filp->private_data == drm_file && + ctx->user_handle == ctx_user_handle) { +i915_gem_context_reference (ctx); +mutex_unlock (&dev_priv->dev->struct_mutex); + +return ctx; + } + } +mutex_unlock (&dev_priv->dev->struct_mutex); + +return NULL ; +} + +int i915_perf_open_ioctl_locked (struct drm_device *dev, +struct drm_i915_perf_open_param *param, +struct perf_open_properties *props, +struct drm_file *file) +{ +struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/i915_perf.c line 259
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c new file +10
-0+struct intel_context *specific_ctx =NULL ; +struct i915_perf_stream *stream =NULL ; +unsigned long f_flags =0 ; +int stream_fd; +int ret =0 ; + +if (props->single_context) { +u32 ctx_handle = props->ctx_handle; + + specific_ctx =lookup_context (dev_priv, file->filp, ctx_handle);
i915_gem_context_get(file->driver_priv, ctx_handle) ?
Though this doesn't allow ptrace like ability to watch a context elsewhere. For that you need to pass in fd:ctx props. -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 2/9 drm/i915: rename OACONTROL GEN7_OACONTROL
In reply to Robert BraggOACONTROL changes quite a bit for gen8, with some bits split out into a per-context OACTXCONTROL register. Rename now before add more gen7 OA registers
--- drivers/gpu/drm/i915/i915_cmd_parser.c | 4 ++-- drivers/gpu/drm/i915/i915_reg.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +2 -2
@@ -445,7 +445,7 @@ static const struct drm_i915_reg_descriptor gen7_render_regs[] = {REG64 (PS_INVOCATION_COUNT ),REG64 (PS_DEPTH_COUNT ),REG64_IDX (RING_TIMESTAMP ,RENDER_RING_BASE ), -REG32 (OACONTROL ),/* Only allowed for LRI and SRM. See below. */ +REG32 (GEN7_OACONTROL ),/* Only allowed for LRI and SRM. See below. */ REG64 (MI_PREDICATE_SRC0 ),REG64 (MI_PREDICATE_SRC1 ), REG32(GEN7_3DPRIM_END_OFFSET),
@@ -1092,7 +1092,7 @@ static bool check_cmd(const struct intel_engine_cs *engine,* to the register. Hence, limit OACONTROL writes to * only MI_LOAD_REGISTER_IMM commands. */ -if (reg_addr ==i915_mmio_reg_offset (OACONTROL )) { +if (reg_addr ==i915_mmio_reg_offset (GEN7_OACONTROL )) {if (desc->cmd.value ==MI_LOAD_REGISTER_MEM ) {DRM_DEBUG_DRIVER ("CMD: Rejected LRM to OACONTROL\n" );return false;
drivers/gpu/drm/i915/i915_reg.h +1 -1
@@ -593,7 +593,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define HSW_CS_GPR (n) _MMIO(0x2600 + (n) * 8)#define HSW_CS_GPR_UDW (n) _MMIO(0x2600 + (n) * 8 + 4) -#define OACONTROL _MMIO(0x2360) +#define GEN7_OACONTROL _MMIO(0x2360)#define _GEN7_PIPEA_DE_LOAD_SL 0x70068#define _GEN7_PIPEB_DE_LOAD_SL 0x71068
Signature · 6 lines
2.7.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/9 drm/i915: don't whitelist oacontrol in cmd parser
In reply to Robert BraggBeing able to program OACONTROL from a non-privileged batch buffer is not sufficient to be able to configure the OA unit. This was originally allowed to help enable Mesa to expose OA counters via the INTEL_performance_query extension, but the current implementation based on programming OACONTROL via a batch buffer isn't able to report useable data without a more complete OA unit configuration. Mesa handles the possibility that writes to OACONTROL may not be allowed and so only advertises the extension after explicitly testing that a write to OACONTROL succeeds. Based on this; removing OACONTROL from the whitelist should be ok for userspace.
Removing this simplifies adding a new kernel api for configuring the OA unit without needing to consider the possibility that userspace might trample on OACONTROL state which we'd like to start managing within the kernel instead. In particular running any Mesa based GL application currently results in clearing OACONTROL when initializing which would disable the capturing of metrics.
XXX: actually since rebasing this on a recent nightly this patch does seem to be breaking gnome-shell on mesa-11.1 - it's not clear a.t.m why the change didn't seem to cause a problem based on v4.5 with the same gnome-shell/mesa versions.
--- drivers/gpu/drm/i915/i915_cmd_parser.c | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +2 -31
@@ -445,7 +445,6 @@ static const struct drm_i915_reg_descriptor gen7_render_regs[] = {REG64 (PS_INVOCATION_COUNT ),REG64 (PS_DEPTH_COUNT ),REG64_IDX (RING_TIMESTAMP ,RENDER_RING_BASE ), -REG32 (GEN7_OACONTROL ),/* Only allowed for LRI and SRM. See below. */ REG64 (MI_PREDICATE_SRC0 ),REG64 (MI_PREDICATE_SRC1 ), REG32(GEN7_3DPRIM_END_OFFSET),
@@ -1044,8 +1043,7 @@ bool i915_needs_cmd_parser(struct intel_engine_cs *engine)static bool check_cmd (const struct intel_engine_cs *engine,const struct drm_i915_cmd_descriptor *desc,const u32 *cmd,u32 length, -const bool is_master, -bool *oacontrol_set) +const bool is_master) {if (desc->flags &CMD_DESC_REJECT ) {DRM_DEBUG_DRIVER ("CMD: Rejected command: 0x%08X\n" , *cmd);
@@ -1083,26 +1081,6 @@ static bool check_cmd(const struct intel_engine_cs *engine, }/* -* OACONTROL requires some special handling for -* writes. We want to make sure that any batch which -* enables OA also disables it before the end of the -* batch. The goal is to prevent one process from -* snooping on the perf data from another process. To do -* that, we need to check the value that will be written -* to the register. Hence, limit OACONTROL writes to -* only MI_LOAD_REGISTER_IMM commands. -*/ -if (reg_addr ==i915_mmio_reg_offset (GEN7_OACONTROL )) { -if (desc->cmd.value ==MI_LOAD_REGISTER_MEM ) { -DRM_DEBUG_DRIVER ("CMD: Rejected LRM to OACONTROL\n" ); -return false; - } - -if (desc->cmd.value ==MI_LOAD_REGISTER_IMM (1 )) - *oacontrol_set = (cmd[offset +1 ] !=0 ); - } - -/* * Check the value written to the register against the * allowed mask/value pair given in the whitelist entry. */
@@ -1186,7 +1164,6 @@ int i915_parse_cmds(struct intel_engine_cs *engine, {u32 *cmd, *batch_base, *batch_end;struct drm_i915_cmd_descriptor default_desc = {0 }; -bool oacontrol_set = false;/* OACONTROL tracking. See check_cmd() */ int ret =0 ; batch_base = copy_batch(shadow_batch_obj, batch_obj,
@@ -1243,8 +1220,7 @@ int i915_parse_cmds(struct intel_engine_cs *engine,break ; } -if (!check_cmd (engine, desc, cmd, length, is_master, - &oacontrol_set)) { +if (!check_cmd (engine, desc, cmd, length, is_master)) { ret = -EINVAL ;break ; }
@@ -1252,11 +1228,6 @@ int i915_parse_cmds(struct intel_engine_cs *engine, cmd += length; } -if (oacontrol_set) { -DRM_DEBUG_DRIVER ("CMD: batch set OACONTROL but did not clear it\n" ); - ret = -EINVAL ; - } -if (cmd >= batch_end) {DRM_DEBUG_DRIVER ("CMD: Got to the end of the buffer w/o a BBE cmd!\n" ); ret = -EINVAL ;
Signature · 6 lines
2.7.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/9 drm/i915: Add 'render basic' Haswell OA unit config
In reply to Robert BraggAdds a static OA unit, MUX + B Counter configuration for basic render metrics on Haswell. This is autogenerated from an internal XML description of metric sets.
--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/i915_drv.h | 14 ++++ drivers/gpu/drm/i915/i915_oa_hsw.c | 132 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_oa_hsw.h | 34 ++++++++++ 4 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/i915_oa_hsw.c create mode 100644 drivers/gpu/drm/i915/i915_oa_hsw.h
drivers/gpu/drm/i915/Makefile +2 -1
@@ -99,7 +99,8 @@ i915-y += dvo_ch7017.o \ i915-y += i915_vgpu.o # perf code -i915-y += i915_perf.o +i915-y += i915_perf.o \ + i915_oa_hsw.o # legacy horrors i915-y += i915_dma.o
drivers/gpu/drm/i915/i915_drv.h +14 -0
@@ -1708,6 +1708,11 @@ struct intel_wm_config {bool sprites_scaled; }; +struct i915_oa_reg { +u32 addr; +u32 value; +}; +struct i915_perf_read_state {int count;ssize_t read;
@@ -2056,6 +2061,15 @@ struct drm_i915_private {bool initialized;struct mutex lock;struct list_head streams; + +struct { +u32 metrics_set; + +const struct i915_oa_reg *mux_regs; +int mux_regs_len; +const struct i915_oa_reg *b_counter_regs; +int b_counter_regs_len; + } oa; } perf;/* Abstract the submission mechanism (legacy ringbuffer or execlists) away */
drivers/gpu/drm/i915/i915_oa_hsw.c new file +132 -0
132 lines not on this page · raw message
drivers/gpu/drm/i915/i915_oa_hsw.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Autogenerated file, DO NOT EDIT manually! +* +* Copyright (c) 2015 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +* +*/ + +#ifndef __I915_OA_HSW_H__ +#define __I915_OA_HSW_H__ + +extern int i915_oa_n_builtin_metric_sets_hsw; + +extern int i915_oa_select_metric_set_hsw (struct drm_i915_private *dev_priv); + +#endif
Signature · 6 lines
2.7.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/9 drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggGen graphics hardware can be set up to periodically write snapshots of performance counters into a circular buffer via its Observation Architecture and this patch exposes that capability to userspace via the i915 perf interface.
--- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338 ++++++++++++ include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +54 -2
@@ -1708,8 +1708,13 @@ struct intel_wm_config {bool sprites_scaled; }; +struct i915_oa_format { +u32 format; +int size; +}; +struct i915_oa_reg { -u32 addr; +i915_reg_t addr;u32 value; };
@@ -1725,6 +1730,7 @@ struct i915_perf_stream {struct list_head link;u32 sample_flags; +int sample_size;struct intel_context *ctx;bool enabled;
@@ -1786,6 +1792,20 @@ struct i915_perf_stream {void (*destroy)(struct i915_perf_stream *stream); }; +struct i915_oa_ops { +void (*init_oa_buffer)(struct drm_i915_private *dev_priv); +int (*enable_metric_set)(struct drm_i915_private *dev_priv); +void (*disable_metric_set)(struct drm_i915_private *dev_priv); +void (*oa_enable)(struct drm_i915_private *dev_priv); +void (*oa_disable)(struct drm_i915_private *dev_priv); +void (*update_oacontrol)(struct drm_i915_private *dev_priv); +void (*update_hw_ctx_id_locked)(struct drm_i915_private *dev_priv, +u32 ctx_id); +int (*read)(struct i915_perf_stream *stream, +struct i915_perf_read_state *read_state); +bool (*oa_buffer_is_empty)(struct drm_i915_private *dev_priv); +}; +struct drm_i915_private {struct drm_device *dev;struct kmem_cache *objects;
@@ -2059,16 +2079,46 @@ struct drm_i915_private {struct {bool initialized; +struct mutex lock;struct list_head streams; +spinlock_t hook_lock; +struct { -u32 metrics_set; +struct i915_perf_stream *exclusive_stream; + +u32 specific_ctx_id; + +struct hrtimer poll_check_timer; +wait_queue_head_t poll_wq; + +bool periodic; +int period_exponent; +int timestamp_frequency; + +int tail_margin; + +int metrics_set;const struct i915_oa_reg *mux_regs;int mux_regs_len;const struct i915_oa_reg *b_counter_regs;int b_counter_regs_len; + +struct { +struct drm_i915_gem_object *obj; +u32 gtt_offset; +u8 *addr; +int format; +int format_size; + } oa_buffer; + +u32 gen7_latched_oastatus1; + +struct i915_oa_ops ops; +const struct i915_oa_format *oa_formats; +int n_builtin_sets; } oa; } perf;
@@ -3429,6 +3479,8 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,int i915_perf_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file); +void i915_oa_context_pin_notify (struct drm_i915_private *dev_priv, +struct intel_context *context);/* i915_gem_evict.c */ int __must_check i915_gem_evict_something(struct drm_device *dev,
drivers/gpu/drm/i915/i915_gem_context.c +19 -5
@@ -133,6 +133,23 @@ static int get_context_size(struct drm_device *dev)return ret; } +static int i915_gem_context_pin_state (struct drm_device *dev, +struct intel_context *ctx) +{ +int ret; + +BUG_ON (!mutex_is_locked (&dev->struct_mutex)); + + ret =i915_gem_obj_ggtt_pin (ctx->legacy_hw_ctx.rcs_state, +get_context_alignment (dev),0 ); +if (ret) +return ret; + +i915_oa_context_pin_notify (dev->dev_private, ctx); + +return 0 ; +} +static void i915_gem_context_clean (struct intel_context *ctx) {struct i915_hw_ppgtt *ppgtt = ctx->ppgtt;
@@ -287,8 +304,7 @@ i915_gem_create_context(struct drm_device *dev,* be available. To avoid this we always pin the default * context. */ - ret =i915_gem_obj_ggtt_pin (ctx->legacy_hw_ctx.rcs_state, -get_context_alignment (dev),0 ); + ret =i915_gem_context_pin_state (dev, ctx);if (ret) {DRM_DEBUG_DRIVER ("Couldn't pin %d\n" , ret); goto err_destroy;
@@ -671,9 +687,7 @@ static int do_rcs_switch(struct drm_i915_gem_request *req)return 0 ;/* Trying to pin first makes error handling easier. */ - ret =i915_gem_obj_ggtt_pin (to->legacy_hw_ctx.rcs_state, -get_context_alignment (engine->dev), -0 ); + ret =i915_gem_context_pin_state (engine->dev, to);if (ret)return ret;
drivers/gpu/drm/i915/i915_perf.c +929 -11
1,002 lines not on this page · raw message
drivers/gpu/drm/i915/i915_reg.h +338 -0
350 lines not on this page · raw message
include/uapi/drm/i915_drm.h +68 -2
104 lines not on this page · raw message
Signature · 6 lines
2.7.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
kbuild test robot
build botRe: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
reproduce:
Hi,
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on next-20160420]
[cannot apply to v4.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Robert-Bragg/Enable-Gen-7-Observation-Architecture/20160420-222746 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-s1-201616 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
drivers/built-in.o: In function `i915_perf_open_ioctl_locked':
>> (.text+0x2cadf4): undefined reference to `__udivdi3'
drivers/built-in.o: In function `i915_perf_open_ioctl_locked':
(.text+0x2cae0d): undefined reference to `__udivdi3'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
kbuild test robot
build botRe: [Intel-gfx] [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert Braggreproduce:
Hi,
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on next-20160420]
[cannot apply to v4.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Robert-Bragg/Enable-Gen-7-Observation-Architecture/20160420-222746 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
>> ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 16 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +16
-0+static void gen7_update_oacontrol_locked (struct drm_i915_private *dev_priv) +{ +assert_spin_locked (&dev_priv->perf.hook_lock); + +if (dev_priv->perf.oa.exclusive_stream->enabled) { +unsigned long ctx_id =0 ; + +if (dev_priv->perf.oa.exclusive_stream->ctx) + ctx_id = dev_priv->perf.oa.specific_ctx_id; + +if (dev_priv->perf.oa.exclusive_stream->ctx ==NULL || ctx_id) { +bool periodic = dev_priv->perf.oa.periodic; +u32 period_exponent = dev_priv->perf.oa.period_exponent; +u32 report_format = dev_priv->perf.oa.oa_buffer.format; + + I915_WRITE(GEN7_OACONTROL,
drivers/gpu/drm/i915/i915_perf.c line 647
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+ (ctx_id &GEN7_OACONTROL_CTX_MASK ) | + (period_exponent << +GEN7_OACONTROL_TIMER_PERIOD_SHIFT ) | + (periodic ? +GEN7_OACONTROL_TIMER_ENABLE :0 ) | + (report_format << +GEN7_OACONTROL_FORMAT_SHIFT ) | + (ctx_id ? +GEN7_OACONTROL_PER_CTX_ENABLE :0 ) | + GEN7_OACONTROL_ENABLE);
So this works by only recording when the OACONTROL context address matches the CCID.
Rather than hooking into switch context and checking every batch whether you have the exclusive context in case it changed address, you could just pin the exclusive context when told by the user to bind perf to that context. Then it will also have the same address until oa is finished (and releases it vma pin).
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 36 lines · Chris Wilson
Quoted 1 line · Robert Bragg
+static void gen7_update_oacontrol_locked(struct
drm_i915_private
*dev_priv)drivers/gpu/drm/i915/i915_perf.c
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+{ +assert_spin_locked (&dev_priv->perf.hook_lock); + +if (dev_priv->perf.oa.exclusive_stream->enabled) { +unsigned long ctx_id =0 ; + +if (dev_priv->perf.oa.exclusive_stream->ctx) + ctx_id = dev_priv->perf.oa.specific_ctx_id; + + if (dev_priv->perf.oa.exclusive_stream->ctx == NULL ||
ctx_id) {Review
Quoted 2 lines
(quoted diff) +2
-0+ bool periodic = dev_priv->perf.oa.periodic; + u32 period_exponent =
dev_priv->perf.oa.period_exponent;Quoted 1 line
+ u32
report_format=
dev_priv->perf.oa.oa_buffer.format;drivers/gpu/drm/i915/i915_perf.c line 647
Quoted 12 lines
drivers/gpu/drm/i915/i915_perf.c +12
-0+ +I915_WRITE (GEN7_OACONTROL , + (ctx_id &GEN7_OACONTROL_CTX_MASK ) | + (period_exponent << +GEN7_OACONTROL_TIMER_PERIOD_SHIFT ) | + (periodic ? +GEN7_OACONTROL_TIMER_ENABLE :0 ) | + (report_format << +GEN7_OACONTROL_FORMAT_SHIFT ) | + (ctx_id ? +GEN7_OACONTROL_PER_CTX_ENABLE :0 ) | +GEN7_OACONTROL_ENABLE );So this works by only recording when the OACONTROL context address matches the CCID.
Quoted 6 lines
Rather than hooking into switch context and checking every batch whether you have the exclusive context in case it changed address, you could just pin the exclusive context when told by the user to bind perf to that context. Then it will also have the same address until oa is finished (and releases it vma pin).
Yeah, this was the approach I first went with when the driver was perf based, though we ended up deciding to got with hooking into pinning and updating the OA state in the end.
E.g. for reference:
https://lists.freedesktop.org/archives/intel-gfx/2014-November/055385.html
(wow, sad face after seeing how long I've been kicking this stuff)
I'd prefer to stick with this approach now, unless you see a big problem with it.
Regards,
- Robert
Quoted 5 lines
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 48 lines · Robert Bragg
On Wed, Apr 20, 2016 at 10:11 PM, Chris Wilson
<[1][email protected]> wrote:On Wed, Apr 20, 2016 at 03:23:10PM +0100, Robert Bragg wrote:
> +static voidgen7_update_oacontrol_locked(struct drm_i915_private *dev_priv)
> +{
> + assert_spin_locked(&dev_priv->perf.hook_lock);
> +
> + if (dev_priv->perf.oa.exclusive_stream->enabled) {
> + unsigned longctx_id= 0;
> +
> + if (dev_priv->perf.oa.exclusive_stream->ctx) > + ctx_id =dev_priv->perf.oa.specific_ctx_id; > +
> + if (dev_priv->perf.oa.exclusive_stream->ctx== NULL ||ctx_id) {
> + bool periodic =dev_priv->perf.oa.periodic; > + u32period_exponent=dev_priv->perf.oa.period_exponent;
> + u32report_format=dev_priv->perf.oa.oa_buffer.format;
> +
> + I915_WRITE(GEN7_OACONTROL,
> + (ctx_id&GEN7_OACONTROL_CTX_MASK) | > + (period_exponent<<
> + GEN7_OACONTROL_TIMER_PERIOD_SHIFT) | > + (periodic ?
> + GEN7_OACONTROL_TIMER_ENABLE : 0) | > + (report_format<<
> + GEN7_OACONTROL_FORMAT_SHIFT) | > + (ctx_id?
> + GEN7_OACONTROL_PER_CTX_ENABLE : 0) | > +GEN7_OACONTROL_ENABLE);So this works by only recording when the OACONTROL context address matches the CCID.
Rather than hooking into switch context and checking every batch whether you have the exclusive context in case it changed address, you could just pin the exclusive context when told by the user to bind perf to that context. Then it will also have the same address until oa is finished (and releases it vma pin).
Yeah, this was the approach I first went with when the driver was perf based, though we ended up deciding to got with hooking into pinning and updating the OA state in the end.
Quoted 6 lines
E.g. for reference:
[2]https://lists.freedesktop.org/archives/intel-gfx/2014-November/055385.html (wow, sad face after seeing how long I've been kicking this stuff)I'd prefer to stick with this approach now, unless you see a big problem with it.
Given no reason to have the hook, I don't see why we should. Pinning the context in the GGTT and causing that bit of extra fragmenetation isn't the worst evil here. and is better practice overall to treat the OA register as holding the pin on the object is it referencing, along with lifetime tracking of that register (i.e. unpinning only when we know it has completed its writes). Given that, the pin_notify is inadequate. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 20 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +20
-0+static int alloc_oa_buffer (struct drm_i915_private *dev_priv) +{ +struct drm_i915_gem_object *bo; +int ret; + +BUG_ON (dev_priv->perf.oa.oa_buffer.obj); + + ret =i915_mutex_lock_interruptible (dev_priv->dev); +if (ret) +return ret; + + bo =i915_gem_alloc_object (dev_priv->dev,OA_BUFFER_SIZE ); +if (bo ==NULL ) { +DRM_ERROR ("Failed to allocate OA buffer\n" ); + ret = -ENOMEM ; + goto unlock; + } + dev_priv->perf.oa.oa_buffer.obj = bo; + + ret =i915_gem_object_set_cache_level (bo,I915_CACHE_LLC );
drivers/gpu/drm/i915/i915_perf.c line 540
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+if (ret) + goto err_unref; + +/* PreHSW required 512K alignment, HSW requires 16M */ + ret =i915_gem_obj_ggtt_pin (bo,SZ_16M ,0 ); +if (ret) + goto err_unref; + + dev_priv->perf.oa.oa_buffer.gtt_offset =i915_gem_obj_ggtt_offset (bo); + dev_priv->perf.oa.oa_buffer.addr =vmap_oa_buffer (bo);
Now i915_gem_object_pin_map(bo) instead of manually vmapping it, and i915_gem_object_unpin_map() to release.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 13 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +13
-0+static void gen7_init_oa_buffer (struct drm_i915_private *dev_priv) +{ +/* Pre-DevBDW: OABUFFER must be set with counters off, +* before OASTATUS1, but after OASTATUS2 +*/ +I915_WRITE (GEN7_OASTATUS2 , dev_priv->perf.oa.oa_buffer.gtt_offset | +OA_MEM_SELECT_GGTT );/* head */ +I915_WRITE (GEN7_OABUFFER , dev_priv->perf.oa.oa_buffer.gtt_offset); +I915_WRITE (GEN7_OASTATUS1 , dev_priv->perf.oa.oa_buffer.gtt_offset | +OABUFFER_SIZE_16M );/* tail */ + +/* On Haswell we have to track which OASTATUS1 flags we've +* already seen since they can't be cleared while periodic
drivers/gpu/drm/i915/i915_perf.c line 508
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+* sampling is enabled. +*/ + dev_priv->perf.oa.gen7_latched_oastatus1 =0 ; + +/* We have a sanity check in gen7_append_oa_reports() that +* looks at the report-id field to make sure it's non-zero +* which relies on the assumption that new reports are +* being written to zeroed memory... +*/ +memset (dev_priv->perf.oa.oa_buffer.addr,0 ,SZ_16M );
You allocated zeroed memory.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 18 lines · Chris Wilson
Quoted 17 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +17
-0+static void gen7_init_oa_buffer (struct drm_i915_private *dev_priv) +{ +/* Pre-DevBDW: OABUFFER must be set with counters off, +* before OASTATUS1, but after OASTATUS2 +*/ +I915_WRITE (GEN7_OASTATUS2 , dev_priv->perf.oa.oa_buffer.gtt_offset | +OA_MEM_SELECT_GGTT );/* head */ +I915_WRITE (GEN7_OABUFFER , dev_priv->perf.oa.oa_buffer.gtt_offset); +I915_WRITE (GEN7_OASTATUS1 , dev_priv->perf.oa.oa_buffer.gtt_offset | +OABUFFER_SIZE_16M );/* tail */ + +/* On Haswell we have to track which OASTATUS1 flags we've +* already seen since they can't be cleared while periodic +* sampling is enabled. +*/ + dev_priv->perf.oa.gen7_latched_oastatus1 =0 ; +
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c line 508
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0+/* We have a sanity check in gen7_append_oa_reports() that +* looks at the report-id field to make sure it's non-zero +* which relies on the assumption that new reports are +* being written to zeroed memory... +*/ +memset (dev_priv->perf.oa.oa_buffer.addr,0 ,SZ_16M );You allocated zeroed memory.
yup. currently I have this memset here because we may re-init the buffer if the stream is disabled then re-enabled (via I915_PERF_IOCTL_ENABLE) or if we have to reset the unit on error. In these cases there may be some number of reports in the buffer with non-zero report-id fields while we still want to be sure new reports are being written to zereod memory so that the sanity check that report-id != 0 will continue to be valid.
I've had it in mind to consider optimizing this at some point to minimize how much of the buffer is cleared, maybe just for the _DISABLE/_ENABLE case where I'd expect the buffer will mostly be empty before disabling the stream.
- Robert
-Chris
Quoted 4 lines
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 40 lines · Robert Bragg
On Wed, Apr 20, 2016 at 11:46 PM, Chris Wilson
<[1][email protected]> wrote:On Wed, Apr 20, 2016 at 03:23:10PM +0100, Robert Bragg wrote: > +static void gen7_init_oa_buffer(struct drm_i915_private *dev_priv) > +{ > + /* Pre-DevBDW: OABUFFER must be set with counters off, > + * before OASTATUS1, but after OASTATUS2 > + */ > + I915_WRITE(GEN7_OASTATUS2, dev_priv->perf.oa.oa_buffer.gtt_offset | > + OA_MEM_SELECT_GGTT); /* head */ > + I915_WRITE(GEN7_OABUFFER, dev_priv->perf.oa.oa_buffer.gtt_offset); > + I915_WRITE(GEN7_OASTATUS1, dev_priv->perf.oa.oa_buffer.gtt_offset | > + OABUFFER_SIZE_16M); /* tail */ > + > + /* On Haswell we have to track which OASTATUS1 flags we've > + * already seen since they can't be cleared while periodic > + * sampling is enabled. > + */ > + dev_priv->perf.oa.gen7_latched_oastatus1 = 0; > + > + /* We have a sanity check in gen7_append_oa_reports() that > + * looks at the report-id field to make sure it's non-zero > + * which relies on the assumption that new reports are > + * being written to zeroed memory... > + */ > + memset(dev_priv->perf.oa.oa_buffer.addr, 0, SZ_16M); You allocated zeroed memory.yup. currently I have this memset here because we may re-init the buffer if the stream is disabled then re-enabled (via
I915_PERF_IOCTL_ENABLE) or if we have to reset the unit on error. In these cases there may be some number of reports in the buffer with non-zero report-id fields while we still want to be sure new reports are being written to zereod memory so that the sanity check that report-id != 0 will continue to be valid.
Quoted 4 lines
I've had it in mind to consider optimizing this at some point to minimize how much of the buffer is cleared, maybe just for the _DISABLE/_ENABLE case where I'd expect the buffer will mostly be empty before disabling the stream.
Or just make it clear that you are considering buffer reuse. Having the memset here allows us to use non-shmemfs allocation, it wasn't that I objected I just didn't understand the comment in the context of allocation path.
-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 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 5 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +5
-0+static int i915_oa_read (struct i915_perf_stream *stream, +struct i915_perf_read_state *read_state) +{ +struct drm_i915_private *dev_priv = stream->dev_priv; +
drivers/gpu/drm/i915/i915_perf.c line 799
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +9
-0+return dev_priv->perf.oa.ops.read (stream, read_state); +} + stream->destroy = i915_oa_stream_destroy; + stream->enable = i915_oa_stream_enable; + stream->disable = i915_oa_stream_disable; + stream->can_read = i915_oa_can_read; + stream->wait_unlocked = i915_oa_wait_unlocked; + stream->poll_wait = i915_oa_poll_wait; + stream->read = i915_oa_read;
Why aren't these a const ops table?
-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 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 17 lines · Chris Wilson
Quoted 5 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +5
-0+static int i915_oa_read (struct i915_perf_stream *stream, +struct i915_perf_read_state *read_state) +{ +struct drm_i915_private *dev_priv = stream->dev_priv; +drivers/gpu/drm/i915/i915_perf.c line 799
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +9
-0+return dev_priv->perf.oa.ops.read (stream, read_state); +} + stream->destroy = i915_oa_stream_destroy; + stream->enable = i915_oa_stream_enable; + stream->disable = i915_oa_stream_disable; + stream->can_read = i915_oa_can_read; + stream->wait_unlocked = i915_oa_wait_unlocked; + stream->poll_wait = i915_oa_poll_wait; + stream->read = i915_oa_read;
Quoted 2 lines
Why aren't these a const ops table?
No particular reason; I guess it just seemed straightforward enough at the time. I suppose it avoids some redundant pointer indirection and could suit defining streams in the future that might find it awkward to have static ops (don't have anything like that in mind though) but it's at the expense of a slightly larger stream struct (though also don't see that as a concern currently).
Can change if you like.
Regards,
- Robert
Quoted 5 lines
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 22 lines · Robert Bragg
On Wed, Apr 20, 2016 at 11:52 PM, Chris Wilson <[1][email protected]> wrote: On Wed, Apr 20, 2016 at 03:23:10PM +0100, Robert Bragg wrote: > +static int i915_oa_read(struct i915_perf_stream *stream, > + struct i915_perf_read_state *read_state) > +{ > + struct drm_i915_private *dev_priv = stream->dev_priv; > + > + return dev_priv->perf.oa.ops.read(stream, read_state); > +} > + stream->destroy = i915_oa_stream_destroy; > + stream->enable = i915_oa_stream_enable; > + stream->disable = i915_oa_stream_disable; > + stream->can_read = i915_oa_can_read; > + stream->wait_unlocked = i915_oa_wait_unlocked; > + stream->poll_wait = i915_oa_poll_wait; > + stream->read = i915_oa_read; Why aren't these a const ops table?
Quoted 8 lines
No particular reason; I guess it just seemed straightforward enough at the time. I suppose it avoids some redundant pointer indirection and could suit defining streams in the future that might find it awkward to have static ops (don't have anything like that in mind though) but it's at the expense of a slightly larger stream struct (though also don't see that as a concern currently). Can change if you like.
I think it is safe to say it is considered best practice to have vfunc tables in read-only memory. Certainly raises an eyebrow when they look like they could be modified on the fly.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 37 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +33
-0+static void i915_oa_stream_enable (struct i915_perf_stream *stream) +{ +struct drm_i915_private *dev_priv = stream->dev_priv; + + dev_priv->perf.oa.ops.oa_enable (dev_priv); + +if (dev_priv->perf.oa.periodic) +hrtimer_start (&dev_priv->perf.oa.poll_check_timer, +ns_to_ktime (POLL_PERIOD ), +HRTIMER_MODE_REL_PINNED ); +} +static void i915_oa_stream_disable (struct i915_perf_stream *stream) +{ +struct drm_i915_private *dev_priv = stream->dev_priv; + + dev_priv->perf.oa.ops.oa_disable (dev_priv); + +if (dev_priv->perf.oa.periodic) +hrtimer_cancel (&dev_priv->perf.oa.poll_check_timer); +} +static enum hrtimer_restart oa_poll_check_timer_cb (struct hrtimer *hrtimer) +{ +struct drm_i915_private *dev_priv = +container_of (hrtimer,typeof (*dev_priv), + perf.oa.poll_check_timer); + +if (!dev_priv->perf.oa.ops.oa_buffer_is_empty (dev_priv)) +wake_up (&dev_priv->perf.oa.poll_wq); + +hrtimer_forward_now (hrtimer,ns_to_ktime (POLL_PERIOD )); + +return HRTIMER_RESTART ; +}
drivers/gpu/drm/i915/i915_perf.c void i915_perf_init(struct drm_device *dev) · line 1322
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +7
-0@@ -424,8 +1313,37 @@ void i915_perf_init(struct drm_device *dev) {struct drm_i915_private *dev_priv =to_i915 (dev); +if (!IS_HASWELL (dev)) +return ; + +hrtimer_init (&dev_priv->perf.oa.poll_check_timer, +CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); + dev_priv->perf.oa.poll_check_timer.function = oa_poll_check_timer_cb; +init_waitqueue_head (&dev_priv->perf.oa.poll_wq);
This timer only serves to wake up pollers / wait_unlocked, right? So why is it always running (when the stream is enabled)?
What happens to poll / wait_unlocked if oa.periodic is not set? It seems like those functions would block indefinitely.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 49 lines · Chris Wilson
Quoted 13 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +12
-0+static void i915_oa_stream_enable (struct i915_perf_stream *stream) +{ +struct drm_i915_private *dev_priv = stream->dev_priv; + + dev_priv->perf.oa.ops.oa_enable (dev_priv); + +if (dev_priv->perf.oa.periodic) +hrtimer_start (&dev_priv->perf.oa.poll_check_timer, +ns_to_ktime (POLL_PERIOD ), +HRTIMER_MODE_REL_PINNED ); +} +static void i915_oa_stream_disable (struct i915_perf_stream *stream)drivers/gpu/drm/i915/i915_perf.c
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +9
-0+{ +struct drm_i915_private *dev_priv = stream->dev_priv; + + dev_priv->perf.oa.ops.oa_disable (dev_priv); + +if (dev_priv->perf.oa.periodic) +hrtimer_cancel (&dev_priv->perf.oa.poll_check_timer); +} +static enum hrtimer_restart oa_poll_check_timer_cb(struct hrtimer*hrtimer)
Quoted 14 lines
drivers/gpu/drm/i915/i915_perf.c +12
-0+{ +struct drm_i915_private *dev_priv = +container_of (hrtimer,typeof (*dev_priv), + perf.oa.poll_check_timer); + +if (!dev_priv->perf.oa.ops.oa_buffer_is_empty (dev_priv)) +wake_up (&dev_priv->perf.oa.poll_wq); + +hrtimer_forward_now (hrtimer,ns_to_ktime (POLL_PERIOD )); + +return HRTIMER_RESTART ; +}drivers/gpu/drm/i915/i915_perf.c void i915_perf_init(struct drm_device *dev) · line 1321
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0@@ -424,8 +1313,37 @@ void i915_perf_init(struct drm_device *dev) {struct drm_i915_private *dev_priv =to_i915 (dev); +if (!IS_HASWELL (dev)) +return ; + +hrtimer_init (&dev_priv->perf.oa.poll_check_timer, +CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); + dev_priv->perf.oa.poll_check_timer.function =
oa_poll_check_timer_cb;
Quoted 8 lines
drivers/gpu/drm/i915/i915_perf.c void i915_perf_init(struct drm_device *dev) · line 1322
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+init_waitqueue_head (&dev_priv->perf.oa.poll_wq);This timer only serves to wake up pollers /
wait_unlocked, right? So why is it always running (when the stream is enabled)?What happens to poll /
wait_unlockedif oa.periodic is not set? It seems like those functions would block indefinitely.
Right, it's unecessary. I'll look at limitting it to just while polling or for blocking reads.
Good point about the blocking case too.
I just started testing that scenario yesterday, writting an MI_RPC unit test which opens a stream without requesting periodic sampling, but didn't poll or read in that case so far so didn't hit this yet.
At least for the read() this is partially considered by returning -EIO if attempting a blocking read while the stream is disabled, but it doesn't consider the case that the stream is enabled but periodic sampling isn't enabled.
Regards,
- Robert
Quoted 5 lines
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 54 lines · Robert Bragg
Quoted 49 lines · Chris Wilson
Quoted 13 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +12
-0+static void i915_oa_stream_enable (struct i915_perf_stream *stream) +{ +struct drm_i915_private *dev_priv = stream->dev_priv; + + dev_priv->perf.oa.ops.oa_enable (dev_priv); + +if (dev_priv->perf.oa.periodic) +hrtimer_start (&dev_priv->perf.oa.poll_check_timer, +ns_to_ktime (POLL_PERIOD ), +HRTIMER_MODE_REL_PINNED ); +} +static void i915_oa_stream_disable (struct i915_perf_stream *stream)drivers/gpu/drm/i915/i915_perf.c
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +9
-0+{ +struct drm_i915_private *dev_priv = stream->dev_priv; + + dev_priv->perf.oa.ops.oa_disable (dev_priv); + +if (dev_priv->perf.oa.periodic) +hrtimer_cancel (&dev_priv->perf.oa.poll_check_timer); +} +static enum hrtimer_restart oa_poll_check_timer_cb(struct hrtimer*hrtimer)
Quoted 14 lines
drivers/gpu/drm/i915/i915_perf.c +12
-0+{ +struct drm_i915_private *dev_priv = +container_of (hrtimer,typeof (*dev_priv), + perf.oa.poll_check_timer); + +if (!dev_priv->perf.oa.ops.oa_buffer_is_empty (dev_priv)) +wake_up (&dev_priv->perf.oa.poll_wq); + +hrtimer_forward_now (hrtimer,ns_to_ktime (POLL_PERIOD )); + +return HRTIMER_RESTART ; +}drivers/gpu/drm/i915/i915_perf.c void i915_perf_init(struct drm_device *dev) · line 1321
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0@@ -424,8 +1313,37 @@ void i915_perf_init(struct drm_device *dev) {struct drm_i915_private *dev_priv =to_i915 (dev); +if (!IS_HASWELL (dev)) +return ; + +hrtimer_init (&dev_priv->perf.oa.poll_check_timer, +CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); + dev_priv->perf.oa.poll_check_timer.function =
oa_poll_check_timer_cb;
Quoted 9 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c void i915_perf_init(struct drm_device *dev) · line 1322
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+init_waitqueue_head (&dev_priv->perf.oa.poll_wq);This timer only serves to wake up pollers /
wait_unlocked, right? So why is it always running (when the stream is enabled)?Right, it's unecessary. I'll look at limitting it to just while polling or for blocking reads.
Actually, looking at this, I couldn't see a clean way to synchronized with do_sys_poll() returning to be able to cancel the hrtimer. The .poll fop is only responsible for registering a wait queue via poll_wait() and checking if there are already events pending before any wait.
The current hrtimer frequency was picked as a reasonable default to ensure we pick up samples before an overflow with high frequency OA sampling but also avoids latency in picking up samples written at a lower frequency. Something I've considered a few times before is that we might want to add a property that can influence the latency userspace is happy with, which might also alieviate some of this concern that the hrtimer runs all the time the stream is enabled when it could often be fine to run at a much lower frequency than the current 200Hz.
For now, maybe it's ok to stick with the fixed frequency, and I'll plan to experiment with a property for influencing the maximum latency?
Regards,
- Robert
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 23 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +23
-0+static int hsw_enable_metric_set (struct drm_i915_private *dev_priv) +{ +int ret =i915_oa_select_metric_set_hsw (dev_priv); + +if (ret) +return ret; + +I915_WRITE (GDT_CHICKEN_BITS ,GT_NOA_ENABLE ); + +/* PRM: +* +* OA unit is using “crclk” for its functionality. When trunk +* level clock gating takes place, OA clock would be gated, +* unable to count the events from non-render clock domain. +* Render clock gating must be disabled when OA is enabled to +* count the events from non-render domain. Unit level clock +* gating for RCS should also be disabled. +*/ +I915_WRITE (GEN7_MISCCPCTL , (I915_READ (GEN7_MISCCPCTL ) & + ~GEN7_DOP_CLOCK_GATE_ENABLE )); +I915_WRITE (GEN6_UCGCTL1 , (I915_READ (GEN6_UCGCTL1 ) | +GEN6_CSUNIT_CLOCK_GATE_DISABLE )); +
drivers/gpu/drm/i915/i915_perf.c line 603
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+config_oa_regs (dev_priv, dev_priv->perf.oa.mux_regs, + dev_priv->perf.oa.mux_regs_len); + +/* It takes a fairly long time for a new MUX configuration to +* be be applied after these register writes. This delay +* duration was derived empirically based on the render_basic +* config but hopefully it covers the maximum configuration +* latency... +*/ +mdelay (100 );
You really want to busy spin for 100ms? msleep() perhaps!
Did you look for some register you can observe the change in when the mux is reconfigured? Is even reading one of the OA registers enough?
Quoted 5 lines
drivers/gpu/drm/i915/i915_perf.c +5
-0+config_oa_regs (dev_priv, dev_priv->perf.oa.b_counter_regs, + dev_priv->perf.oa.b_counter_regs_len); + +return 0 ; +}
drivers/gpu/drm/i915/i915_perf.c line 619
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+ +static void hsw_disable_metric_set (struct drm_i915_private *dev_priv) +{ +I915_WRITE (GEN6_UCGCTL1 , (I915_READ (GEN6_UCGCTL1 ) & + ~GEN6_CSUNIT_CLOCK_GATE_DISABLE )); +I915_WRITE (GEN7_MISCCPCTL , (I915_READ (GEN7_MISCCPCTL ) | +GEN7_DOP_CLOCK_GATE_ENABLE )); + +I915_WRITE (GDT_CHICKEN_BITS , (I915_READ (GDT_CHICKEN_BITS ) & + ~GT_NOA_ENABLE ));
You didn't preserve any other chicken bits during enable_metric_set. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 28 lines · Chris Wilson
Quoted 27 lines · Robert Bragg
drivers/gpu/drm/i915/i915_perf.c +27
-0+static int hsw_enable_metric_set (struct drm_i915_private *dev_priv) +{ +int ret =i915_oa_select_metric_set_hsw (dev_priv); + +if (ret) +return ret; + +I915_WRITE (GDT_CHICKEN_BITS ,GT_NOA_ENABLE ); + +/* PRM: +* +* OA unit is using “crclk” for its functionality. When trunk +* level clock gating takes place, OA clock would be gated, +* unable to count the events from non-render clock domain. +* Render clock gating must be disabled when OA is enabled to +* count the events from non-render domain. Unit level clock +* gating for RCS should also be disabled. +*/ +I915_WRITE (GEN7_MISCCPCTL , (I915_READ (GEN7_MISCCPCTL ) & + ~GEN7_DOP_CLOCK_GATE_ENABLE )); +I915_WRITE (GEN6_UCGCTL1 , (I915_READ (GEN6_UCGCTL1 ) | +GEN6_CSUNIT_CLOCK_GATE_DISABLE )); + +config_oa_regs (dev_priv, dev_priv->perf.oa.mux_regs, + dev_priv->perf.oa.mux_regs_len); + +/* It takes a fairly long time for a new MUX configuration to
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c line 603
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0+* be be applied after these register writes. This delay +* duration was derived empirically based on the render_basic +* config but hopefully it covers the maximum configuration +* latency... +*/ +mdelay (100 );You really want to busy spin for 100ms?
msleep()perhaps!
Ah, oops, I forgot to change this, thanks!
Quoted 4 lines
Did you look for some register you can observe the change in when the mux is reconfigured? Is even reading one of the OA registers enough?
Although I can't really comprehend why the delay apparently needs to be quite so long, based on my limited understanding of some of the NOA michroarchitecture involved here it makes some sense to me there would be a delay that's also somewhat variable depending on the particular MUX config and I don't know of a trick for getting explicit feedback of completion unfortunately.
I did bring this up briefly, recently in discussion with others more familiar with the HW side of things, but haven't had much feedback on this so far. afaik other OS drivers aren't currently accounting for a need to have a delay here.
For reference, 100ms was picked as I was experimenting with stepping up the delay by orders of magnitude and found 10ms wasn't enough. Potentially I could experiment further with delays between 10 and 100ms, but I suppose it won't make a big difference.
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +9
-0+config_oa_regs (dev_priv, dev_priv->perf.oa.b_counter_regs, + dev_priv->perf.oa.b_counter_regs_len); + +return 0 ; +} + +static void hsw_disable_metric_set (struct drm_i915_private *dev_priv) +{ + I915_WRITE(GEN6_UCGCTL1, (I915_READ(GEN6_UCGCTL1) &
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c line 619
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0+ ~GEN6_CSUNIT_CLOCK_GATE_DISABLE)); +I915_WRITE (GEN7_MISCCPCTL , (I915_READ (GEN7_MISCCPCTL ) | +GEN7_DOP_CLOCK_GATE_ENABLE )); + +I915_WRITE (GDT_CHICKEN_BITS , (I915_READ (GDT_CHICKEN_BITS ) & + ~GT_NOA_ENABLE ));You didn't preserve any other chicken bits during
enable_metric_set.
Hmm, good point. I think I'll aim to preserve other bits when setting if that works, just in case something else needs to fiddle with the same register later.
Quoted 5 lines
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 16 lines · Robert Bragg
Gen graphics hardware can be set up to periodically write snapshots of performance counters into a circular buffer via its Observation Architecture and this patch exposes that capability to userspace via the i915 perf interface.
Cc Chris Wilson <[email protected]>Signed-off-by Robert Bragg <[email protected]>Signed-off-by Zhenyu Wang <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338 ++++++++++++ include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_perf.c line 603
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +9
-0+ + +/* It takes a fairly long time for a new MUX configuration to +* be be applied after these register writes. This delay +* duration was derived empirically based on the render_basic +* config but hopefully it covers the maximum configuration +* latency... +*/ +mdelay (100 );
With such a HW and SW design, how can we ever expose hope to get any kind of performance when we are trying to monitor different metrics on each draw call? This may be acceptable for system monitoring, but it is problematic for the GL extensions :s
Since it seems like we are going for a perf API, it means that for every change of metrics, we need to flush the commands, wait for the GPU to be done, then program the new set of metrics via an IOCTL, wait 100 ms, and then we may resume rendering ... until the next change. We are talking about a latency of 6-7 frames at 60 Hz here... this is non-negligeable...
I understand that we have a ton of counters and we may hide latency by not allowing using more than half of the counters for every draw call or frame, but even then, this 100ms delay is killing this approach altogether.
To be honest, if it indeed is an HW bug, then the approach that Samuel Pitoiset and I used for Nouveau involving pushing an handle representing a pre-computed configuration to the command buffer so as a software method can be ask the kernel to reprogram the counters with as little idle time as possible, would be useless as waiting for the GPU to be idle would usually not take more than a few ms... which is nothing compared to waiting 100ms.
So, now, the elephant in the room, how can it take that long to apply the change? Are the OA registers double buffered (NVIDIA's are, so as we can reconfigure and start monitoring multiple counters at the same time)?
Maybe this 100ms is the polling period and the HW does not allow changing the configuration in the middle of a polling session. In this case, this delay should be dependent on the polling frequency. But even then, I would really hope that the HW would allow us to tear down everything, reconfigure and start polling again without waiting for the next tick. If not possible, maybe we can change the frequency for the polling clock to make the polling event happen sooner.
HW delays are usually a few microseconds, not milliseconds, that really suggests that something funny is happening and the HW design is not understood properly. If the documentation has nothing on this and the HW teams cannot help, then I suggest a little REing session. I really want to see this work land, but the way I see it right now is that we cannot rely on it because of this bug. Maybe fixing this bug would require changing the architecture, so better address it before landing the patches.
Worst case scenario, do not hesitate to contact me if non of the proposed explanation pans out, I will take the time to read through the OA material and try my REing skills on it. As I said, I really want to see this upstream!
Sorry...
Martin
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Sorry for the delay replying to this, I missed it.
Quoted 47 lines · Martin Peres
Quoted 18 lines · Robert Bragg
Gen graphics hardware can be set up to periodically write snapshots of performance counters into a circular buffer via its Observation Architecture and this patch exposes that capability to userspace via the i915 perf interface.
Cc Chris Wilson <[email protected]>Signed-off-by Robert Bragg <[email protected]>Signed-off-by Zhenyu Wang <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338 ++++++++++++ include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-)drivers/gpu/drm/i915/i915_perf.c line 603
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +9
-0+ + +/* It takes a fairly long time for a new MUX configuration to +* be be applied after these register writes. This delay +* duration was derived empirically based on the render_basic +* config but hopefully it covers the maximum configuration +* latency... +*/ +mdelay (100 );With such a HW and SW design, how can we ever expose hope to get any kind of performance when we are trying to monitor different metrics on each draw call? This may be acceptable for system monitoring, but it is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may resume rendering ... until the next change. We are talking about a latency of
6-7 frames at 60 Hz here... this is non-negligeable...
Quoted 5 lines
I understand that we have a ton of counters and we may hide latency by not allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approach altogether.
Although I'm also really unhappy about introducing this delay recently, the impact of the delay is typically amortized somewhat by keeping a configuration open as long as possible.
Even without this explicit delay here the OA unit isn't suited to being reconfigured on a per draw call basis, though it is able to support per draw call queries with the same config.
The above assessment assumes wanting to change config between draw calls which is not something this driver aims to support - as the HW isn't really designed for that model.
E.g. in the case of INTEL_performance_query, the backend keeps the i915 perf stream open until all OA based query objects are deleted - so you have to be pretty explicit if you want to change config.
Considering the sets available on Haswell:
* Render Metrics Basic
* Compute Metrics Basic
* Compute Metrics Extended
* Memory Reads Distribution
* Memory Writes Distribution
* Metric set SamplerBalance
Each of these configs can expose around 50 counters as a set.
A GL application is most likely just going to use the render basic set, and In the case of a tool like gputop/GPA then changing config would usually be driven by some user interaction to select a set of metrics, where even a 100ms delay will go unnoticed.
In case you aren't familiar with how the GL_INTEL_performance_query side of things works for OA counters; one thing to be aware of is that there's a separate MI_REPORT_PERF_COUNT command that Mesa writes either side of a query which writes all the counters for the current OA config (as configured via this i915 perf interface) to a buffer. In addition to collecting reports via MI_REPORT_PERF_COUNT Mesa also configures the unit for periodic sampling to be able to account for potential counter overflow.
It also might be worth keeping in mind that per draw queries will anyway trash the pipelining of work, since it's necessary to put stalls between the draw calls to avoid conflated metrics (not to do with the details of this driver) so use cases will probably be limited to those that just want the draw call numbers but don't mind ruining overall frame/application performance. Periodic sampling or swap-to-swap queries would be better suited to cases that should minimize their impact.
Quoted 10 lines
To be honest, if it indeed is an HW bug, then the approach that Samuel Pitoiset
and I used for Nouveau involving pushing an handle representing a pre-computed configuration to the command buffer so as a software method can be ask the kernel to reprogram the counters with as little idle time as possible, would be useless as waiting for the GPU to be idle would usually not
take more than a few ms... which is nothing compared to waiting 100ms.
Yeah, I think this is a really quite different programming model to what the OA unit is geared for, even if we can somehow knock out this 100ms MUX config delay.
Quoted 5 lines
So, now, the elephant in the room, how can it take that long to apply the change? Are the OA registers double buffered (NVIDIA's are, so as we can reconfigure and start monitoring multiple counters at the same time)?
Based on my understanding of how the HW works internally I can see how some delay would be expected, but can't currently fathom why it would need to have this order of magnitude, and so the delay is currently simply based on experimentation where I was getting unit test failures at 10ms, for invalid looking reports, but the tests ran reliably at 100ms.
OA configuration state isn't double buffered to allow configuration while in use.
Quoted 12 lines
Maybe this 100ms is the polling period and the HW does not allow changing the configuration in the middle of a polling session. In this case, this delay
should be dependent on the polling frequency. But even then, I would really hope that the HW would allow us to tear down everything, reconfigure and start polling again without waiting for the next tick. If not possible, maybe we
can change the frequency for the polling clock to make the polling event happen
sooner.
The tests currently test periods from 160ns to 168 milliseconds while the delay required falls somewhere between 10 and 100 milliseconds. I think I'd expect the delay to be > all periods tested if this was the link.
Generally this seems unlikely to me, in part considering how the MUX isn't really part of the OA unit that handles periodic sampling. I wouldn't rule out some interaction though so some experimenting along these lines could be interesting.
Quoted 6 lines
HW delays are usually a few microseconds, not milliseconds, that really suggests
that something funny is happening and the HW design is not understood properly.
Yup.
Although I understand more about the HW than I can write up here, I can't currently see why the HW should ever really take this long to apply a MUX config - although I can see why some delay would be required.
It's on my list of things to try and get feedback/ideas on from the OA architect/HW engineers. I brought this up briefly some time ago but we didn't have time to go into details.
Quoted 3 lines
If the documentation has nothing on this and the HW teams cannot help, then I
suggest a little REing session
There's no precisely documented delay requirement. Insofar as REing is the process of inferring how black box HW works through poking it with a stick and seeing how it reacts, then yep more of that may be necessary. At least in this case the HW isn't really a black box (maybe stain glass), where I hopefully have a fairly good sense of how the HW is designed and can prod folks closer to the HW for feedback/ideas.
So far I haven't spent too long investigating this besides recently homing in on needing a delay here when my unit tests were failing.
Quoted 7 lines
I really want to see this work land, but the way I see
it right now is that we cannot rely on it because of this bug. Maybe fixing this bug
would require changing the architecture, so better address it before landing the
patches.
I think it's unlikely to change the architecture; rather we might just find some other things to frob that make the MUX config apply faster (e.g. clock gating issue); we find a way to get explicit feedback of completion so we can minimize the delay or a better understanding that lets us choose a shorter delay in most cases.
The driver is already usable with gputop with this delay and considering how config changes are typically associated with user interaction I wouldn't see this as a show stopper - even though it's not ideal. I think the assertions about it being unusable with GL, were a little overstated based on making frequent OA config changes which is not really how the interface is intended to be used.
Thanks for starting to take a look through the code.
Kind Regards,
- Robert
Quoted 10 lines
Worst case scenario, do not hesitate to contact me if non of the proposed explanation pans out, I will take the time to read through the OA material and try my
REing skills on it. As I said, I really want to see this upstream!Sorry...
Martin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 61 lines · Robert Bragg
Sorry for the delay replying to this, I missed it.
Quoted 53 lines · Martin Peres
Quoted 18 lines · Robert Bragg
Gen graphics hardware can be set up to periodically write snapshots of performance counters into a circular buffer via its Observation Architecture and this patch exposes that capability to userspace via the i915 perf interface.
Cc Chris Wilson <[email protected]>Signed-off-by Robert Bragg <[email protected]>Signed-off-by Zhenyu Wang <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338 ++++++++++++ include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-)drivers/gpu/drm/i915/i915_perf.c line 603
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +9
-0+ + +/* It takes a fairly long time for a new MUX configuration to +* be be applied after these register writes. This delay +* duration was derived empirically based on the render_basic +* config but hopefully it covers the maximum configuration +* latency... +*/ +mdelay (100 );With such a HW and SW design, how can we ever expose hope to get any kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, but it is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may resume rendering ... until the next change. We are talking about a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approach altogether.
So revisiting this to double check how things fail with my latest driver/tests without the delay, I apparently can't reproduce test failures without the delay any more...
I think the explanation is that since first adding the delay to the driver I also made the the driver a bit more careful to not forward spurious reports that look invalid due to a zeroed report id field, and that mechanism keeps the unit tests happy, even though there are still some number of invalid reports generated if we don't wait.
One problem with simply having no delay is that the driver prints an error if it sees an invalid reports so I get a lot of 'Skipping spurious, invalid OA report' dmesg spam. Also this was intended more as a last resort mechanism, and I wouldn't feel too happy about squashing the error message and potentially sweeping other error cases under the carpet.
Experimenting to see if the delay can at least be reduced, I brought the delay up in millisecond increments and found that although I still see a lot of spurious reports only waiting 1 or 5 milliseconds, at 10 milliseconds its reduced quite a bit and at 15 milliseconds I don't seem to have any errors.
15 milliseconds is still a long time, but at least not as long as 100.
Regards,
- Robert
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 93 lines · Robert Bragg
On Tue, May 3, 2016 at 8:34 PM, Robert Bragg <[email protected] <mailto:[email protected]>> wrote:
Sorry for the delay replying to this, I missed it.
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <[email protected] <mailto:[email protected]>> wrote:
On 20/04/16 17:23, Robert Bragg wrote:
Gen graphics hardware can be set up to periodically write snapshots of
performance counters into a circular buffer via its Observation Architecture and this patch exposes that capability to userspace via the
i915 perf interface.Cc: Chris Wilson <[email protected] <mailto:[email protected]>>
Signed-off-by Robert Bragg <[email protected]<mailto:[email protected]>>
Signed-off-by Zhenyu Wang <[email protected]<mailto:[email protected]>>
---
drivers/gpu/drm/i915/i915_drv.h| 56 +-
drivers/gpu/drm/i915/i915_gem_context.c| 24 +-
drivers/gpu/drm/i915/i915_perf.c| 940
+++++++++++++++++++++++++++++++-
drivers/gpu/drm/i915/i915_reg.h| 338 ++++++++++++
include/uapi/drm/i915_drm.h| 70 ++-
5 files changed, 1408 insertions(+), 20 deletions(-)+
+
+ /* It takes a fairly long time for a new MUX
configuration to
+ * be be applied after these register writes. This delay
+ * duration was derived empirically based on the
render_basic
+ * config but hopefully it covers the maximum
configuration
+ * latency...
+ */
+ mdelay(100);With such a HW and SW design, how can we ever expose hope to get any kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, but it is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may
resume rendering ... until the next change. We are talking about a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not
allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approach altogether.So revisiting this to double check how things fail with my latest driver/tests without the delay, I apparently can't reproduce test failures without the delay any more...
I think the explanation is that since first adding the delay to the driver I also made the the driver a bit more careful to not forward spurious reports that look invalid due to a zeroed report id field, and that mechanism keeps the unit tests happy, even though there are still some number of invalid reports generated if we don't wait.
One problem with simply having no delay is that the driver prints an error if it sees an invalid reports so I get a lot of 'Skipping spurious, invalid OA report' dmesg spam. Also this was intended more as a last resort mechanism, and I wouldn't feel too happy about squashing the error message and potentially sweeping other error cases under the carpet.
Quoted 7 lines
Experimenting to see if the delay can at least be reduced, I brought the delay up in millisecond increments and found that although I still see a lot of spurious reports only waiting 1 or 5 milliseconds, at 10 milliseconds its reduced quite a bit and at 15 milliseconds I don't seem to have any errors.
15 milliseconds is still a long time, but at least not as long as 100.
OK, so the issue does not come from the HW after all, great!
Now, my main question is, why are spurious events generated when changing the MUX's value? I can understand that we would need to ignore the reading that came right after the change, but other than this, I am a bit at a loss.
I am a bit swamped with other tasks right now, but I would love to spend more time reviewing your code as I really want to see this upstream!
Martin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 105 lines · Martin Peres
Quoted 103 lines · Robert Bragg
On Tue, May 3, 2016 at 8:34 PM, Robert Bragg <[email protected] <mailto:[email protected]>> wrote:
Sorry for the delay replying to this, I missed it.
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <[email protected] <mailto:[email protected]>> wrote:
On 20/04/16 17:23, Robert Bragg wrote:
Gen graphics hardware can be set up to periodically write snapshots of
performance counters into a circular buffer via its
ObservationArchitecture and this patch exposes that capability to userspace via the i915 perf interface. Cc: Chris Wilson <[email protected] <mailto:[email protected]>> Signed-off-by: Robert Bragg <[email protected] <mailto:[email protected]>> Signed-off-by: Zhenyu Wang <[email protected] <mailto:[email protected]>> --- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338 ++++++++++++ include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-) + + + /* It takes a fairly long time for a new MUX configuration to + * be be applied after these register writes. Thisdelay
+ * duration was derived empirically based on the
render_basic
+ * config but hopefully it covers the maximum
configuration
+ * latency...
+ */
+ mdelay(100);With such a HW and SW design, how can we ever expose hope to get
any
kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, but it is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may
resume rendering ... until the next change. We are talking about a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not
allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approach altogether.So revisiting this to double check how things fail with my latest driver/tests without the delay, I apparently can't reproduce test failures without the delay any more...
I think the explanation is that since first adding the delay to the driver I also made the the driver a bit more careful to not forward spurious reports that look invalid due to a zeroed report id field, and that mechanism keeps the unit tests happy, even though there are still some number of invalid reports generated if we don't wait.
One problem with simply having no delay is that the driver prints an error if it sees an invalid reports so I get a lot of 'Skipping spurious, invalid OA report' dmesg spam. Also this was intended more as a last resort mechanism, and I wouldn't feel too happy about squashing the error message and potentially sweeping other error cases under the carpet.
Experimenting to see if the delay can at least be reduced, I brought the delay up in millisecond increments and found that although I still see a lot of spurious reports only waiting 1 or 5 milliseconds, at 10 milliseconds its reduced quite a bit and at 15 milliseconds I don't seem to have any errors.
Quoted 5 lines
Quoted 2 lines
15 milliseconds is still a long time, but at least not as long as 100.
OK, so the issue does not come from the HW after all, great!
Erm, I'm not sure that's a conclusion we can make here...
The upshot here was really just reducing the delay from 100ms to 15ms. Previously I arrived at a workable delay by jumping the delay in orders of magnitude with 10ms failing, 100ms passing and I didn't try and refine it further. Here I've looked at delays between 10 and 100ms.
The other thing is observing that because the kernel is checking for invalid reports (generated by the hardware) before forwarding to userspace the lack of a delay no longer triggers i-g-t failures because the invalid data won't reach i-g-t any more - though the invalid reports are still a thing to avoid.
Quoted 5 lines
Now, my main question is, why are spurious events generated when changing the MUX's value? I can understand that we would need to ignore the reading that came right after the change, but other than this, I am a bit at a loss.
The MUX selects 16 signals that the OA unit can turn into 16 separate counters by basically counting the signal changes. (there's some fancy fixed function logic that can affect this but that's the general idea).
If the MUX is in the middle of being re-programmed then some subset of those 16 signals are for who knows what.
After programming the MUX we will go on to configure the OA unit and the tests will enable periodic sampling which (if we have no delay) will sample the OA counters that are currently being fed by undefined signals.
So as far as that goes it makes sense to me to expect bad data if we don't wait for the MUX config to land properly. Something I don't really know is how come we're seemingly lucky to have the reports be cleanly invalid with a zero report-id, instead of just having junk data that would be harder to recognise.
Quoted 3 lines
I am a bit swamped with other tasks right now, but I would love to spend more time reviewing your code as I really want to see this upstream!
No worries.
I can hopefully send out my i-g-t tests this afternoon too which should hopefully give us all the pieces to be able seriously consider hopefully landing things soon.
Regards,
- Robert
Quoted 2 lines
Martin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 145 lines · Robert Bragg
Quoted 105 lines · Martin Peres
Quoted 103 lines · Robert Bragg
On Tue, May 3, 2016 at 8:34 PM, Robert Bragg <[email protected] <mailto:[email protected]>> wrote:
Sorry for the delay replying to this, I missed it.
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <[email protected] <mailto:[email protected]>> wrote:
On 20/04/16 17:23, Robert Bragg wrote:
Gen graphics hardware can be set up to periodically write snapshots of
performance counters into a circular buffer via its
ObservationArchitecture and this patch exposes that capability to userspace via the i915 perf interface. Cc: Chris Wilson <[email protected] <mailto:[email protected]>> Signed-off-by: Robert Bragg <[email protected] <mailto:[email protected]>> Signed-off-by: Zhenyu Wang <[email protected] <mailto:[email protected]>> --- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338 ++++++++++++ include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-) + + + /* It takes a fairly long time for a new MUX configuration to + * be be applied after these register writes. Thisdelay
+ * duration was derived empirically based on the
render_basic
+ * config but hopefully it covers the maximum
configuration
+ * latency...
+ */
+ mdelay(100);With such a HW and SW design, how can we ever expose hope to get
any
kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, but it is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may
resume rendering ... until the next change. We are talking about a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not
allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approach altogether.So revisiting this to double check how things fail with my latest driver/tests without the delay, I apparently can't reproduce test failures without the delay any more...
I think the explanation is that since first adding the delay to the driver I also made the the driver a bit more careful to not forward spurious reports that look invalid due to a zeroed report id field, and that mechanism keeps the unit tests happy, even though there are still some number of invalid reports generated if we don't wait.
One problem with simply having no delay is that the driver prints an error if it sees an invalid reports so I get a lot of 'Skipping spurious, invalid OA report' dmesg spam. Also this was intended more as a last resort mechanism, and I wouldn't feel too happy about squashing the error message and potentially sweeping other error cases under the carpet.
Experimenting to see if the delay can at least be reduced, I brought the delay up in millisecond increments and found that although I still see a lot of spurious reports only waiting 1 or 5 milliseconds, at 10 milliseconds its reduced quite a bit and at 15 milliseconds I don't seem to have any errors.
Quoted 5 lines
Quoted 2 lines
15 milliseconds is still a long time, but at least not as long as 100.
OK, so the issue does not come from the HW after all, great!
Erm, I'm not sure that's a conclusion we can make here...
The upshot here was really just reducing the delay from 100ms to 15ms. Previously I arrived at a workable delay by jumping the delay in orders of magnitude with 10ms failing, 100ms passing and I didn't try and refine it further. Here I've looked at delays between 10 and 100ms.
The other thing is observing that because the kernel is checking for invalid reports (generated by the hardware) before forwarding to userspace the lack of a delay no longer triggers i-g-t failures because the invalid data won't reach i-g-t any more - though the invalid reports are still a thing to avoid.
Quoted 5 lines
Now, my main question is, why are spurious events generated when changing the MUX's value? I can understand that we would need to ignore the reading that came right after the change, but other than this, I am a bit at a loss.
The MUX selects 16 signals that the OA unit can turn into 16 separate counters by basically counting the signal changes. (there's some fancy fixed function logic that can affect this but that's the general idea).
If the MUX is in the middle of being re-programmed then some subset of those 16 signals are for who knows what.
After programming the MUX we will go on to configure the OA unit and the tests will enable periodic sampling which (if we have no delay) will sample the OA counters that are currently being fed by undefined signals.
Quoted 5 lines
So as far as that goes it makes sense to me to expect bad data if we don't wait for the MUX config to land properly. Something I don't really know is how come we're seemingly lucky to have the reports be cleanly invalid with a zero report-id, instead of just having junk data that would be harder to recognise.
Yeah this mdelay story sounds realy scary. Few random comments:
- msleep instead of mdelay please
- no dmesg noise above debug level for stuff that we know can happen - dmesg noise counts as igt failures
- reading 0 sounds more like bad synchronization. Have you tried quiescing the entire gpu (to make sure nothing is happen) and disabling OA, then updating, and then restarting? At least on a very quick look I didn't spot that. Random delays freak me out a bit, but wouldn't be surprised if really needed.
Cheers, Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 167 lines · Daniel Vetter
Quoted 1 line · Robert Bragg
On Wed, May 4, 2016 at 10:09 AM, Martin Peres <
Quoted 6 lines
Quoted 4 lines · wrote:
Quoted 2 lines · Robert Bragg
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
On Tue, May 3, 2016 at 8:34 PM, Robert Bragg <[email protected] <mailto:[email protected]>> wrote:
Sorry for the delay replying to this, I missed it.
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
<mailto:[email protected]>> wrote:
On 20/04/16 17:23, Robert Bragg wrote:
Gen graphics hardware can be set up to periodically write snapshots of
performance counters into a circular buffer via its
Observation
Architecture and this patch exposes that capability to userspace via the
i915 perf interface.Cc: Chris Wilson <[email protected] <mailto:[email protected]>>
Signed-off-by Robert Bragg <[email protected]<mailto:[email protected]>>
Signed-off-by Zhenyu Wang <[email protected]<mailto:[email protected]>>
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
--- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338++++++++++++
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-)+
+
+ /* It takes a fairly long time for a new MUX
configuration to
+ * be be applied after these register writes. This
delay
+ * duration was derived empirically based on the
render_basic
+ * config but hopefully it covers the maximum
configuration
+ * latency...
+ */
+ mdelay(100);Quoted 1 line
Quoted 1 line
Quoted 1 line
With such a HW and SW design, how can we ever expose hope to
get
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
any
kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, butit
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may
resume rendering ... until the next change. We are talkingabout
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not
allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approachaltogether.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
So revisiting this to double check how things fail with my latest driver/tests without the delay, I apparently can't reproduce test failures without the delay any more...
I think the explanation is that since first adding the delay to the driver I also made the the driver a bit more careful to not forward spurious reports that look invalid due to a zeroed report id field,
and
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
that mechanism keeps the unit tests happy, even though there are still some number of invalid reports generated if we don't wait.
One problem with simply having no delay is that the driver prints an error if it sees an invalid reports so I get a lot of 'Skipping spurious, invalid OA report' dmesg spam. Also this was intended more
as
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
a last resort mechanism, and I wouldn't feel too happy about squashing the error message and potentially sweeping other error cases under the carpet.
Experimenting to see if the delay can at least be reduced, I brought
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
delay up in millisecond increments and found that although I still
see a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
lot of spurious reports only waiting 1 or 5 milliseconds, at 10 milliseconds its reduced quite a bit and at 15 milliseconds I don't
seem
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
to have any errors.
15 milliseconds is still a long time, but at least not as long as 100.
Quoted 7 lines
Quoted 2 lines
OK, so the issue does not come from the HW after all, great!
Erm, I'm not sure that's a conclusion we can make here...
The upshot here was really just reducing the delay from 100ms to 15ms. Previously I arrived at a workable delay by jumping the delay in orders
of
Quoted 5 lines
magnitude with 10ms failing, 100ms passing and I didn't try and refine it further. Here I've looked at delays between 10 and 100ms.
The other thing is observing that because the kernel is checking for invalid reports (generated by the hardware) before forwarding to
userspace
Quoted 6 lines
the lack of a delay no longer triggers i-g-t failures because the invalid data won't reach i-g-t any more - though the invalid reports are still a thing to avoid.
Quoted 1 line
Now, my main question is, why are spurious events generated when
changing
Quoted 1 line
Quoted 1 line
the MUX's value? I can understand that we would need to ignore the
reading
Quoted 8 lines
Quoted 3 lines
that came right after the change, but other than this, I am a bit at a loss.
The MUX selects 16 signals that the OA unit can turn into 16 separate counters by basically counting the signal changes. (there's some fancy fixed function logic that can affect this but that's the general idea).
Quoted 5 lines
If the MUX is in the middle of being re-programmed then some subset of those 16 signals are for who knows what.
After programming the MUX we will go on to configure the OA unit and the tests will enable periodic sampling which (if we have no delay) will
sample
Quoted 3 lines
the OA counters that are currently being fed by undefined signals.
So as far as that goes it makes sense to me to expect bad data if we
don't
Quoted 1 line
wait for the MUX config to land properly. Something I don't really know
is
Quoted 9 lines
Quoted 1 line
how come we're seemingly lucky to have the reports be cleanly invalid
with
Quoted 1 line
a zero report-id, instead of just having junk data that would be harder
to
Quoted 1 line
recognise.
Yeah this mdelay story sounds realy scary. Few random comments:
- msleep instead of mdelay please
yup this was a mistake I'd forgotten to fix in this series, but is fixed in the last series I sent after chris noticed too.
actually in my latest (yesterday after experimenting further with the delay requirements) I'm using usleep_range for a delay between 15 and 20 milliseconds which seems to be enough.
Quoted 3 lines
- no dmesg noise above debug level for stuff that we know can happen - dmesg noise counts as igt failures
okey. I don't think I have anything above debug level, unless things are going badly wrong.
Just double checking though has made me think twice about a WARN_ON in gen7_oa_read for !oa_buffer_addr, which would be a bad situation but should either be removed (never expected), be a BUG_ON (since the code would deref NULL anyway) or more gracefully return an error if seen.
I currently have some DRM_DRIVER_DEBUG errors for cases where userspace messes up what properties it gives to open a stream - hopefully that sound ok? I've found it quite helpful to have a readable error for otherwise vague EINVAL type errors.
I have a debug message I print if we see an invalid HW report, which *shouldn't* happen but can happen (e.g. if the MUX delay or tail margin aren't well tuned) and it's helpful to have the feedback, in case we end up in a situation where we see this kind of message too frequently which might indicate an issue to investigate.
Quoted 1 line
- reading 0 sounds more like bad synchronization.
I suppose I haven't thoroughly considered if we should return zero in any case - normally that would imply EOF so we get to choose what that implies here. I don't think the driver should ever return 0 from read() currently.
A few concious choices re: read() return values have been:
- never ever return partial records (or rather even if a partial record were literally copied into the userspace buffer, but an error were hit in the middle of copying a full sample then that record wouldn't be accounted for in the byte count returned.)
- Don't throw away records successfully copied, due to a later error. This simplifies error handling paths internally and reporting EAGAIN/ENOSPC/EFAULT errors and means data isn't lost. The precedence for what we return is 1) did we successfully copy some reports? report bytes copied for complete records. 2) did we encounter an error? report that if so. 3) return -EAGAIN. (though for a blocking fd this will be handled internally).
Quoted 1 line
Have you tried quiescing
the entire gpu (to make sure nothing is happen) and disabling OA, then
Quoted 4 lines
updating, and then restarting? At least on a very quick look I didn't spot that. Random delays freak me out a bit, but wouldn't be surprised if really needed.
Experimenting yesterday, it seems I can at least reduce the delay to around 15ms (granted that's still pretty huge), and it's also workable to have userspace sleep for this time (despite the mdelay I originally went with)
Haven't tried this, but yeah could be interesting to experiment if the MUX config lands faster in different situation such as when the HW is idle.
Thanks,
- Robert
Quoted 7 lines
Cheers, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 255 lines · Robert Bragg
Quoted 177 lines · Daniel Vetter
Quoted 1 line · Robert Bragg
On Wed, May 4, 2016 at 10:09 AM, Martin Peres <
Quoted 6 lines
Quoted 4 lines · wrote:
Quoted 2 lines · Robert Bragg
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
On Tue, May 3, 2016 at 8:34 PM, Robert Bragg <[email protected] <mailto:[email protected]>> wrote:
Sorry for the delay replying to this, I missed it.
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
<mailto:[email protected]>> wrote:
On 20/04/16 17:23, Robert Bragg wrote:
Gen graphics hardware can be set up to periodically write snapshots of
performance counters into a circular buffer via its
Observation
Architecture and this patch exposes that capability to userspace via the
i915 perf interface.Cc: Chris Wilson <[email protected] <mailto:[email protected]>>
Signed-off-by Robert Bragg <[email protected]<mailto:[email protected]>>
Signed-off-by Zhenyu Wang <[email protected]<mailto:[email protected]>>
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
--- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338++++++++++++
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-)+
+
+ /* It takes a fairly long time for a new MUX
configuration to
+ * be be applied after these register writes.This
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
delay
+ * duration was derived empirically based on the
render_basic
+ * config but hopefully it covers the maximum
configuration
+ * latency...
+ */
+ mdelay(100);With such a HW and SW design, how can we ever expose hope to
get
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
any
kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, butit
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means
that
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
for every change
of metrics, we need to flush the commands, wait for the GPUto
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may
resume rendering ... until the next change. We are talkingabout
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not
allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approachaltogether.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
So revisiting this to double check how things fail with my latest driver/tests without the delay, I apparently can't reproduce test failures without the delay any more...
I think the explanation is that since first adding the delay to the driver I also made the the driver a bit more careful to not forward spurious reports that look invalid due to a zeroed report id field,
and
Quoted 1 line
Quoted 1 line
Quoted 1 line
that mechanism keeps the unit tests happy, even though there are
still
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
some number of invalid reports generated if we don't wait.
One problem with simply having no delay is that the driver prints an error if it sees an invalid reports so I get a lot of 'Skipping spurious, invalid OA report' dmesg spam. Also this was intended more
as
Quoted 1 line
Quoted 1 line
Quoted 1 line
a last resort mechanism, and I wouldn't feel too happy about
squashing
Quoted 1 line
Quoted 1 line
Quoted 1 line
the error message and potentially sweeping other error cases under
the
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
carpet.
Experimenting to see if the delay can at least be reduced, I brought
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
delay up in millisecond increments and found that although I still
see a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
lot of spurious reports only waiting 1 or 5 milliseconds, at 10 milliseconds its reduced quite a bit and at 15 milliseconds I don't
seem
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to have any errors.
15 milliseconds is still a long time, but at least not as long as
100.
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
OK, so the issue does not come from the HW after all, great!
Erm, I'm not sure that's a conclusion we can make here...
The upshot here was really just reducing the delay from 100ms to 15ms. Previously I arrived at a workable delay by jumping the delay in orders
of
Quoted 1 line
magnitude with 10ms failing, 100ms passing and I didn't try and refine
it
Quoted 4 lines
further. Here I've looked at delays between 10 and 100ms.
The other thing is observing that because the kernel is checking for invalid reports (generated by the hardware) before forwarding to
userspace
Quoted 1 line
the lack of a delay no longer triggers i-g-t failures because the
invalid
Quoted 5 lines
data won't reach i-g-t any more - though the invalid reports are still a thing to avoid.
Quoted 1 line
Now, my main question is, why are spurious events generated when
changing
Quoted 1 line
Quoted 1 line
the MUX's value? I can understand that we would need to ignore the
reading
Quoted 1 line
Quoted 1 line
that came right after the change, but other than this, I am a bit at
a
Quoted 7 lines
Quoted 2 lines
loss.
The MUX selects 16 signals that the OA unit can turn into 16 separate counters by basically counting the signal changes. (there's some fancy fixed function logic that can affect this but that's the general idea).
Quoted 5 lines
If the MUX is in the middle of being re-programmed then some subset of those 16 signals are for who knows what.
After programming the MUX we will go on to configure the OA unit and the tests will enable periodic sampling which (if we have no delay) will
sample
Quoted 3 lines
the OA counters that are currently being fed by undefined signals.
So as far as that goes it makes sense to me to expect bad data if we
don't
Quoted 1 line
wait for the MUX config to land properly. Something I don't really know
is
Quoted 9 lines
Quoted 1 line
how come we're seemingly lucky to have the reports be cleanly invalid
with
Quoted 1 line
a zero report-id, instead of just having junk data that would be harder
to
Quoted 1 line
recognise.
Yeah this mdelay story sounds realy scary. Few random comments:
- msleep instead of mdelay pleaseyup this was a mistake I'd forgotten to fix in this series, but is fixed in the last series I sent after chris noticed too.
actually in my latest (yesterday after experimenting further with the delay requirements) I'm using
usleep_rangefor a delay between 15 and 20 milliseconds which seems to be enough.Quoted 3 lines
- no dmesg noise above debug level for stuff that we know can happen - dmesg noise counts as igt failures
okey. I don't think I have anything above debug level, unless things are going badly wrong.
Just double checking though has made me think twice about a
WARN_ONingen7_oa_readfor !oa_buffer_addr, which would be a bad situation but should either be removed (never expected), be aBUG_ON(since the code would deref NULL anyway) or more gracefully return an error if seen.I currently have some
DRM_DRIVER_DEBUGerrors for cases where userspace messes up what properties it gives to open a stream - hopefully that sound ok? I've found it quite helpful to have a readable error for otherwise vague EINVAL type errors.I have a debug message I print if we see an invalid HW report, which *shouldn't* happen but can happen (e.g. if the MUX delay or tail margin aren't well tuned) and it's helpful to have the feedback, in case we end up in a situation where we see this kind of message too frequently which might indicate an issue to investigate.
Quoted 1 line
- reading 0 sounds more like bad synchronization.
I suppose I haven't thoroughly considered if we should return zero in any case - normally that would imply EOF so we get to choose what that implies here. I don't think the driver should ever return 0 from
read()currently.A few concious choices re:
read()return values have been:- never ever return partial records (or rather even if a partial record were literally copied into the userspace buffer, but an error were hit in the middle of copying a full sample then that record wouldn't be accounted for in the byte count returned.)
- Don't throw away records successfully copied, due to a later error. This simplifies error handling paths internally and reporting EAGAIN/ENOSPC/EFAULT errors and means data isn't lost. The precedence for what we return is 1) did we successfully copy some reports? report bytes copied for complete records. 2) did we encounter an error? report that if so. 3) return
-EAGAIN. (though for a blocking fd this will be handled internally).Quoted 1 line
Have you tried quiescing
the entire gpu (to make sure nothing is happen) and disabling OA, then
Quoted 4 lines
updating, and then restarting? At least on a very quick look I didn't spot that. Random delays freak me out a bit, but wouldn't be surprised if really needed.
Quoted 8 lines
Experimenting yesterday, it seems I can at least reduce the delay to around 15ms (granted that's still pretty huge), and it's also workable to have userspace sleep for this time (despite the mdelay I originally went with)
Haven't tried this, but yeah could be interesting to experiment if the MUX config lands faster in different situation such as when the HW is idle.
Hmm, maybe a stretch, but 15ms is perhaps coincidentally close to the vblank period, the MUX relates to a fabric across the whole gpu... not totally in-plausible there could be an interaction there too. another one to experiment with.
- Robert
Quoted 14 lines
Thanks,
- RobertQuoted 7 lines
Cheers, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 191 lines · Robert Bragg
Quoted 167 lines · Daniel Vetter
Quoted 1 line · Robert Bragg
On Wed, May 4, 2016 at 10:09 AM, Martin Peres <
Quoted 6 lines
Quoted 4 lines · wrote:
Quoted 2 lines · Robert Bragg
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
On Tue, May 3, 2016 at 8:34 PM, Robert Bragg <[email protected] <mailto:[email protected]>> wrote:
Sorry for the delay replying to this, I missed it.
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
<mailto:[email protected]>> wrote:
On 20/04/16 17:23, Robert Bragg wrote:
Gen graphics hardware can be set up to periodically write snapshots of
performance counters into a circular buffer via its
Observation
Architecture and this patch exposes that capability to userspace via the
i915 perf interface.Cc: Chris Wilson <[email protected] <mailto:[email protected]>>
Signed-off-by Robert Bragg <[email protected]<mailto:[email protected]>>
Signed-off-by Zhenyu Wang <[email protected]<mailto:[email protected]>>
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
--- drivers/gpu/drm/i915/i915_drv.h | 56 +- drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_perf.c | 940 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 338++++++++++++
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
include/uapi/drm/i915_drm.h | 70 ++- 5 files changed, 1408 insertions(+), 20 deletions(-)+
+
+ /* It takes a fairly long time for a new MUX
configuration to
+ * be be applied after these register writes. This
delay
+ * duration was derived empirically based on the
render_basic
+ * config but hopefully it covers the maximum
configuration
+ * latency...
+ */
+ mdelay(100);Quoted 1 line
Quoted 1 line
Quoted 1 line
With such a HW and SW design, how can we ever expose hope to
get
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
any
kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, butit
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may
resume rendering ... until the next change. We are talkingabout
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not
allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approachaltogether.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
So revisiting this to double check how things fail with my latest driver/tests without the delay, I apparently can't reproduce test failures without the delay any more...
I think the explanation is that since first adding the delay to the driver I also made the the driver a bit more careful to not forward spurious reports that look invalid due to a zeroed report id field,
and
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
that mechanism keeps the unit tests happy, even though there are still some number of invalid reports generated if we don't wait.
One problem with simply having no delay is that the driver prints an error if it sees an invalid reports so I get a lot of 'Skipping spurious, invalid OA report' dmesg spam. Also this was intended more
as
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
a last resort mechanism, and I wouldn't feel too happy about squashing the error message and potentially sweeping other error cases under the carpet.
Experimenting to see if the delay can at least be reduced, I brought
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
delay up in millisecond increments and found that although I still
see a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
lot of spurious reports only waiting 1 or 5 milliseconds, at 10 milliseconds its reduced quite a bit and at 15 milliseconds I don't
seem
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
to have any errors.
15 milliseconds is still a long time, but at least not as long as 100.
Quoted 7 lines
Quoted 2 lines
OK, so the issue does not come from the HW after all, great!
Erm, I'm not sure that's a conclusion we can make here...
The upshot here was really just reducing the delay from 100ms to 15ms. Previously I arrived at a workable delay by jumping the delay in orders
of
Quoted 5 lines
magnitude with 10ms failing, 100ms passing and I didn't try and refine it further. Here I've looked at delays between 10 and 100ms.
The other thing is observing that because the kernel is checking for invalid reports (generated by the hardware) before forwarding to
userspace
Quoted 6 lines
the lack of a delay no longer triggers i-g-t failures because the invalid data won't reach i-g-t any more - though the invalid reports are still a thing to avoid.
Quoted 1 line
Now, my main question is, why are spurious events generated when
changing
Quoted 1 line
Quoted 1 line
the MUX's value? I can understand that we would need to ignore the
reading
Quoted 8 lines
Quoted 3 lines
that came right after the change, but other than this, I am a bit at a loss.
The MUX selects 16 signals that the OA unit can turn into 16 separate counters by basically counting the signal changes. (there's some fancy fixed function logic that can affect this but that's the general idea).
Quoted 5 lines
If the MUX is in the middle of being re-programmed then some subset of those 16 signals are for who knows what.
After programming the MUX we will go on to configure the OA unit and the tests will enable periodic sampling which (if we have no delay) will
sample
Quoted 3 lines
the OA counters that are currently being fed by undefined signals.
So as far as that goes it makes sense to me to expect bad data if we
don't
Quoted 1 line
wait for the MUX config to land properly. Something I don't really know
is
Quoted 9 lines
Quoted 1 line
how come we're seemingly lucky to have the reports be cleanly invalid
with
Quoted 1 line
a zero report-id, instead of just having junk data that would be harder
to
Quoted 1 line
recognise.
Yeah this mdelay story sounds realy scary. Few random comments:
- msleep instead of mdelay pleaseyup this was a mistake I'd forgotten to fix in this series, but is fixed in the last series I sent after chris noticed too.
actually in my latest (yesterday after experimenting further with the delay requirements) I'm using
usleep_rangefor a delay between 15 and 20 milliseconds which seems to be enough.Quoted 3 lines
- no dmesg noise above debug level for stuff that we know can happen - dmesg noise counts as igt failures
Quoted 7 lines
okey. I don't think I have anything above debug level, unless things are going badly wrong.
Just double checking though has made me think twice about a
WARN_ONingen7_oa_readfor !oa_buffer_addr, which would be a bad situation but should either be removed (never expected), be aBUG_ON(since the code would deref NULL anyway) or more gracefully return an error if seen.
WARN_ON + bail out, or BUG_ON. Silently fixing up without failing loud in dmesg is imo the wrong approach for something that should never happen.
Quoted 4 lines
I currently have some
DRM_DRIVER_DEBUGerrors for cases where userspace messes up what properties it gives to open a stream - hopefully that sound ok? I've found it quite helpful to have a readable error for otherwise vague EINVAL type errors.
Yeah, as long as it's debug-only it's perfectly fine. We actually try to have such a line for each EINVAL, since it's so useful (but then userspace always hits the one case we've missed to document with debug output!).
Quoted 5 lines
I have a debug message I print if we see an invalid HW report, which *shouldn't* happen but can happen (e.g. if the MUX delay or tail margin aren't well tuned) and it's helpful to have the feedback, in case we end up in a situation where we see this kind of message too frequently which might indicate an issue to investigate.
That's fine too.
Quoted 32 lines
Quoted 1 line
- reading 0 sounds more like bad synchronization.
I suppose I haven't thoroughly considered if we should return zero in any case - normally that would imply EOF so we get to choose what that implies here. I don't think the driver should ever return 0 from
read()currently.A few concious choices re:
read()return values have been:- never ever return partial records (or rather even if a partial record were literally copied into the userspace buffer, but an error were hit in the middle of copying a full sample then that record wouldn't be accounted for in the byte count returned.)
- Don't throw away records successfully copied, due to a later error. This simplifies error handling paths internally and reporting EAGAIN/ENOSPC/EFAULT errors and means data isn't lost. The precedence for what we return is 1) did we successfully copy some reports? report bytes copied for complete records. 2) did we encounter an error? report that if so. 3) return
-EAGAIN. (though for a blocking fd this will be handled internally).Quoted 1 line
Have you tried quiescing
the entire gpu (to make sure nothing is happen) and disabling OA, then
Quoted 4 lines
updating, and then restarting? At least on a very quick look I didn't spot that. Random delays freak me out a bit, but wouldn't be surprised if really needed.
Quoted 6 lines
Experimenting yesterday, it seems I can at least reduce the delay to around 15ms (granted that's still pretty huge), and it's also workable to have userspace sleep for this time (despite the mdelay I originally went with)
Haven't tried this, but yeah could be interesting to experiment if the MUX config lands faster in different situation such as when the HW is idle.
In either case I think it'd be good to excessively document what you've discovered. Maybe even split out the msleep into a separate patch, so that the commit message with all the details is easy to find again in the future. Because 2 months down the road someone will read this and go wtf ;-)
Cheers, Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
In reply to Robert BraggQuoted 1 line · Robert Bragg
Sorry for the delay replying to this, I missed it.
No worries!
Quoted 76 lines
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <[email protected] <mailto:[email protected]>> wrote:
On 20/04/16 17:23, Robert Bragg wrote:
Gen graphics hardware can be set up to periodically write snapshots of
performance counters into a circular buffer via its Observation Architecture and this patch exposes that capability to userspace via the
i915 perf interface.Cc: Chris Wilson <[email protected] <mailto:[email protected]>>
Signed-off-by Robert Bragg <[email protected]<mailto:[email protected]>>
Signed-off-by Zhenyu Wang <[email protected]<mailto:[email protected]>>
---
drivers/gpu/drm/i915/i915_drv.h| 56 +-
drivers/gpu/drm/i915/i915_gem_context.c| 24 +-
drivers/gpu/drm/i915/i915_perf.c| 940
+++++++++++++++++++++++++++++++-
drivers/gpu/drm/i915/i915_reg.h| 338 ++++++++++++
include/uapi/drm/i915_drm.h| 70 ++-
5 files changed, 1408 insertions(+), 20 deletions(-)+
+
+ /* It takes a fairly long time for a new MUX
configuration to
+ * be be applied after these register writes. This delay
+ * duration was derived empirically based on the
render_basic
+ * config but hopefully it covers the maximum configuration
+ * latency...
+ */
+ mdelay(100);With such a HW and SW design, how can we ever expose hope to get any kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, but it is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may
resume rendering ... until the next change. We are talking about a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not
allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approach altogether.Although I'm also really unhappy about introducing this delay recently, the impact of the delay is typically amortized somewhat by keeping a configuration open as long as possible.
Even without this explicit delay here the OA unit isn't suited to being reconfigured on a per draw call basis, though it is able to support per draw call queries with the same config.
Quoted 7 lines
The above assessment assumes wanting to change config between draw calls which is not something this driver aims to support - as the HW isn't really designed for that model.
E.g. in the case of
INTEL_performance_query, the backend keeps the i915 perf stream open until all OA based query objects are deleted - so you have to be pretty explicit if you want to change config.
OK, I get your point. However, I still want to state that applications changing the set would see a disastrous effect as a 100 ms is enough to downclock both the CPU and GPU and that would dramatically alter the
metrics. Should we make it clear somewhere, either in the INTEL_performance_query or as a warning in mesa_performance if changing the set while running? I would think the latter would be preferable as it could also cover the case of the AMD extension which, IIRC, does not talk about the performance cost of changing the metrics. With this caveat made clear, it seems reasonable.
Quoted 9 lines
Considering the sets available on Haswell:
* Render Metrics Basic
* Compute Metrics Basic
* Compute Metrics Extended
* Memory Reads Distribution
* Memory Writes Distribution
* Metric set SamplerBalance
Quoted 6 lines
Each of these configs can expose around 50 counters as a set.
A GL application is most likely just going to use the render basic set, and In the case of a tool like gputop/GPA then changing config would usually be driven by some user interaction to select a set of metrics, where even a 100ms delay will go unnoticed.
100 ms is becoming visible, but I agree, it would not be a show stopper for sure.
On the APITRACE side, this should not be an issue, because we do not change the set of metrics while running.
Quoted 9 lines
In case you aren't familiar with how the
GL_INTEL_performance_queryside of things works for OA counters; one thing to be aware of is that there's a separateMI_REPORT_PERF_COUNTcommand that Mesa writes either side of a query which writes all the counters for the current OA config (as configured via this i915 perf interface) to a buffer. In addition to collecting reports viaMI_REPORT_PERF_COUNTMesa also configures the unit for periodic sampling to be able to account for potential counter overflow.
Oh, the overflow case is mean. Doesn't the spec mandate the application to read at least every second? This is the case for the timestamp queries.
Quoted 9 lines
It also might be worth keeping in mind that per draw queries will anyway trash the pipelining of work, since it's necessary to put stalls between the draw calls to avoid conflated metrics (not to do with the details of this driver) so use cases will probably be limited to those that just want the draw call numbers but don't mind ruining overall frame/application performance. Periodic sampling or swap-to-swap queries would be better suited to cases that should minimize their impact.
Yes, I agree that there will always be a cost, but with the design implemented in nouveau (which barely involves the CPU at all), the pipelining is almost unaffected. As in, monitoring every draw call with a different metric would lower the performance of glxgears (worst case I could think off) but still keep thousands of FPS.
Quoted 14 lines
To be honest, if it indeed is an HW bug, then the approach that Samuel Pitoiset
and I used for Nouveau involving pushing an handle representing a pre-computed configuration to the command buffer so as a software method can be ask the kernel to reprogram the counters with as little idle time as
possible, would be useless as waiting for the GPU to be idle would usually not
take more than a few ms... which is nothing compared to waiting 100ms.
Quoted 3 lines
Yeah, I think this is a really quite different programming model to what the OA unit is geared for, even if we can somehow knock out this 100ms MUX config delay.
Too bad :)
Quoted 35 lines
So, now, the elephant in the room, how can it take that long to apply the
change? Are the OA registers double buffered (NVIDIA's are, so as we can reconfigure and start monitoring multiple counters at the same time)?Based on my understanding of how the HW works internally I can see how some delay would be expected, but can't currently fathom why it would need to have this order of magnitude, and so the delay is currently simply based on experimentation where I was getting unit test failures at 10ms, for invalid looking reports, but the tests ran reliably at 100ms.
OA configuration state isn't double buffered to allow configuration while in use.
Maybe this 100ms is the polling period and the HW does not allow changing
the configuration in the middle of a polling session. In this case, this delay
should be dependent on the polling frequency. But even then, I would really
hope that the HW would allow us to tear down everything, reconfigure and start polling again without waiting for the next tick. If not possible, maybe we
can change the frequency for the polling clock to make the polling event happen
sooner.
Quoted 3 lines
The tests currently test periods from 160ns to 168 milliseconds while the delay required falls somewhere between 10 and 100 milliseconds. I think I'd expect the delay to be > all periods tested if this was the link.
Thanks, definitely the kind of information that is valuable for understanding this issue!
Quoted 5 lines
Generally this seems unlikely to me, in part considering how the MUX isn't really part of the OA unit that handles periodic sampling. I wouldn't rule out some interaction though so some experimenting along these lines could be interesting.
That indeed makes it less likely. Interactions increase the BOM!
Quoted 11 lines
HW delays are usually a few microseconds, not milliseconds, that really suggests
that something funny is happening and the HW design is not understood properly.Yup.
Quoted 7 lines
Although I understand more about the HW than I can write up here, I can't currently see why the HW should ever really take this long to apply a MUX config - although I can see why some delay would be required.
It's on my list of things to try and get feedback/ideas on from the OA architect/HW engineers. I brought this up briefly some time ago but we didn't have time to go into details.
Sounds like a good idea!
Quoted 15 lines
If the documentation has nothing on this and the HW teams cannot help, then I
suggest a little REing sessionThere's no precisely documented delay requirement. Insofar as REing is the process of inferring how black box HW works through poking it with a stick and seeing how it reacts, then yep more of that may be necessary. At least in this case the HW isn't really a black box (maybe stain glass), where I hopefully have a fairly good sense of how the HW is designed and can prod folks closer to the HW for feedback/ideas.
Quoted 2 lines
So far I haven't spent too long investigating this besides recently homing in on needing a delay here when my unit tests were failing.
ACK! Thanks for the info!
Quoted 10 lines
I really want to see this work land, but the way I see it right now is that we cannot rely on it because of this bug. Maybe fixing this bug
would require changing the architecture, so better address it before landing the
patches.
Quoted 5 lines
I think it's unlikely to change the architecture; rather we might just find some other things to frob that make the MUX config apply faster (e.g. clock gating issue); we find a way to get explicit feedback of completion so we can minimize the delay or a better understanding that lets us choose a shorter delay in most cases.
Yes, clock gating may be one issue here, even though it would be a funny hw design to clock gate the bus to a register...
Quoted 7 lines
The driver is already usable with gputop with this delay and considering how config changes are typically associated with user interaction I wouldn't see this as a show stopper - even though it's not ideal. I think the assertions about it being unusable with GL, were a little overstated based on making frequent OA config changes which is not really how the interface is intended to be used.
Yeah, but a performance warning in mesa, I would be OK with this change. Thanks for taking the time to explain!
Quoted 6 lines
Thanks for starting to take a look through the code.
Kind Regards,
- Robert
Martin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 5/9] drm/i915: Enable i915 perf stream for Haswell OA unit
Quoted 94 lines · Martin Peres
Quoted 2 lines · Robert Bragg
Sorry for the delay replying to this, I missed it.
No worries!
Quoted 77 lines
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <[email protected] <mailto:[email protected]>> wrote:
On 20/04/16 17:23, Robert Bragg wrote:
Gen graphics hardware can be set up to periodically write snapshots of
performance counters into a circular buffer via its Observation Architecture and this patch exposes that capability to userspace via the
i915 perf interface.Cc: Chris Wilson <[email protected] <mailto:[email protected]>>
Signed-off-by Robert Bragg <[email protected]<mailto:[email protected]>>
Signed-off-by Zhenyu Wang <[email protected]<mailto:[email protected]>>
---
drivers/gpu/drm/i915/i915_drv.h| 56 +-
drivers/gpu/drm/i915/i915_gem_context.c| 24 +-
drivers/gpu/drm/i915/i915_perf.c| 940
+++++++++++++++++++++++++++++++-
drivers/gpu/drm/i915/i915_reg.h| 338 ++++++++++++
include/uapi/drm/i915_drm.h| 70 ++-
5 files changed, 1408 insertions(+), 20 deletions(-)+
+
+ /* It takes a fairly long time for a new MUX
configuration to
+ * be be applied after these register writes. This delay
+ * duration was derived empirically based on the
render_basic
+ * config but hopefully it covers the maximum
configuration
+ * latency...
+ */
+ mdelay(100);With such a HW and SW design, how can we ever expose hope to get any kind of performance when we are trying to monitor different metrics on each
draw call? This may be acceptable for system monitoring, but it is problematic
for the GL extensions :sSince it seems like we are going for a perf API, it means that for every change
of metrics, we need to flush the commands, wait for the GPU to be done, then
program the new set of metrics via an IOCTL, wait 100 ms, and then we may
resume rendering ... until the next change. We are talking about a latency of
6-7 frames at 60 Hz here... this is non-negligeable...I understand that we have a ton of counters and we may hide latency by not
allowing using more than half of the counters for every draw call or frame, but
even then, this 100ms delay is killing this approach altogether.Although I'm also really unhappy about introducing this delay recently, the impact of the delay is typically amortized somewhat by keeping a configuration open as long as possible.
Even without this explicit delay here the OA unit isn't suited to being reconfigured on a per draw call basis, though it is able to support per draw call queries with the same config.
Quoted 8 lines
The above assessment assumes wanting to change config between draw calls which is not something this driver aims to support - as the HW isn't really designed for that model.
E.g. in the case of
INTEL_performance_query, the backend keeps the i915 perf stream open until all OA based query objects are deleted - so you have to be pretty explicit if you want to change config.
Quoted 10 lines
OK, I get your point. However, I still want to state that applications changing the set would see a disastrous effect as a 100 ms is enough to downclock both the CPU and GPU and that would dramatically alter the metrics. Should we make it clear somewhere, either in the
INTEL_performance_queryor as a warning inmesa_performanceif changing the set while running? I would think the latter would be preferable as it could also cover the case of the AMD extension which, IIRC, does not talk about the performance cost of changing the metrics. With this caveat made clear, it seems reasonable.
Yeah a KHR_debug performance warning sounds like a good idea.
Quoted 12 lines
Quoted 11 lines
In case you aren't familiar with how the
GL_INTEL_performance_queryside of things works for OA counters; one thing to be aware of is that there's a separateMI_REPORT_PERF_COUNTcommand that Mesa writes either side of a query which writes all the counters for the current OA config (as configured via this i915 perf interface) to a buffer. In addition to collecting reports viaMI_REPORT_PERF_COUNTMesa also configures the unit for periodic sampling to be able to account for potential counter overflow.
Quoted 3 lines
Oh, the overflow case is mean. Doesn't the spec mandate the application to read at least every second? This is the case for the timestamp queries.
For a Haswell GT3 system with 40EUs @ 1GHz some aggregate EU counters may overflow their 32bits in approximately 40milliseconds. It should be pretty unusual to see a draw call last that long, but not unimaginable. Might also be a good draw call to focus on profiling too :-)
For Gen8+ a bunch of the A counters can be reported with 40bits to mitigate this issue.
Quoted 12 lines
Quoted 11 lines
It also might be worth keeping in mind that per draw queries will anyway trash the pipelining of work, since it's necessary to put stalls between the draw calls to avoid conflated metrics (not to do with the details of this driver) so use cases will probably be limited to those that just want the draw call numbers but don't mind ruining overall frame/application performance. Periodic sampling or swap-to-swap queries would be better suited to cases that should minimize their impact.
Quoted 6 lines
Yes, I agree that there will always be a cost, but with the design implemented in nouveau (which barely involves the CPU at all), the pipelining is almost unaffected. As in, monitoring every draw call with a different metric would lower the performance of glxgears (worst case I could think off) but still keep thousands of FPS.
I guess it just has different trade offs.
While it sounds like we have a typically higher cost to reconfigure OA (at least if touching the MUX) once the config is fixed (which can be done before measuring anything), then I guess the pipelining for queries might be slightly better with MI_REPORT_PERF_COUNT commands than something requiring interrupting + executing work on the cpu to switch config (even if it's cheaper than an OA re-config). I guess nouveau would have the same need to insert GPU pipeline stalls (just gpu syncing with gpu) to avoid conflating neighbouring draw call metrics, and maybe the bubbles from those that can swallow the latency of the software methods.
glxgears might not really exaggerate draw call pipeline stall issues with only 6 cheap primitives per gear. glxgears hammers context switching more so than drawing anything. I think a pessimal case would be an app that depends on large numbers of draw calls per frame that each do enough real work that stalling for their completion is also measurable.
Funnily enough enabling the OA unit with glxgears can be kind of problematic for Gen8+ which automatically writes reports on context switch due to the spam of generating all of those context switch reports.
Quoted 11 lines
Quoted 8 lines
The driver is already usable with gputop with this delay and considering how config changes are typically associated with user interaction I wouldn't see this as a show stopper - even though it's not ideal. I think the assertions about it being unusable with GL, were a little overstated based on making frequent OA config changes which is not really how the interface is intended to be used.
Yeah, but a performance warning in mesa, I would be OK with this change. Thanks for taking the time to explain!
A performance warning sounds like a sensible idea yup.
Regards,
- Robert
Quoted 11 lines
Quoted 8 lines
Thanks for starting to take a look through the code.
Kind Regards,
- RobertMartin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/9 drm/i915: advertise available metrics via sysfs
In reply to Robert BraggEach metric set is given a sysfs entry like:
/sys/class/drm/card0/metrics/<guid>/id
This allows userspace to enumerate the specific sets that are available for the current system. The 'id' file contains an unsigned integer that can be used to open the associated metric set via DRM_IOCTL_I915_PERF_OPEN. The <guid> is a globally unique ID for a specific OA unit configuration that can be reliably used as a key to lookup corresponding counter meta data and normalization equations.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_oa_hsw.c | 45 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_oa_hsw.h | 4 ++++ drivers/gpu/drm/i915/i915_perf.c | 18 ++++++++++++++- 4 files changed, 68 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -2080,6 +2080,8 @@ struct drm_i915_private {struct {bool initialized; +struct kobject *metrics_kobj; +struct mutex lock;struct list_head streams;
drivers/gpu/drm/i915/i915_oa_hsw.c +45 -0
54 lines not on this page · raw message
drivers/gpu/drm/i915/i915_oa_hsw.h +4 -0
@@ -31,4 +31,8 @@ extern int i915_oa_n_builtin_metric_sets_hsw;extern int i915_oa_select_metric_set_hsw (struct drm_i915_private *dev_priv); +extern int i915_perf_init_sysfs_hsw (struct drm_i915_private *dev_priv); + +extern void i915_perf_deinit_sysfs_hsw (struct drm_i915_private *dev_priv); +#endif
drivers/gpu/drm/i915/i915_perf.c +17 -1
@@ -1316,6 +1316,11 @@ void i915_perf_init(struct drm_device *dev)if (!IS_HASWELL (dev))return ; + dev_priv->perf.metrics_kobj = +kobject_create_and_add ("metrics" , &dev->primary->kdev->kobj); +if (!dev_priv->perf.metrics_kobj) +return ; +hrtimer_init (&dev_priv->perf.oa.poll_check_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); dev_priv->perf.oa.poll_check_timer.function = oa_poll_check_timer_cb;
@@ -1343,9 +1348,15 @@ void i915_perf_init(struct drm_device *dev) dev_priv->perf.oa.n_builtin_sets = i915_oa_n_builtin_metric_sets_hsw; - dev_priv->perf.oa.oa_formats = hsw_oa_formats; +if (i915_perf_init_sysfs_hsw (dev_priv)) { +kobject_put (dev_priv->perf.metrics_kobj); + dev_priv->perf.metrics_kobj =NULL ; +return ; + } dev_priv->perf.initialized = true; + +return ; }void i915_perf_fini (struct drm_device *dev)
@@ -1355,6 +1366,11 @@ void i915_perf_fini(struct drm_device *dev)if (!dev_priv->perf.initialized)return ; +i915_perf_deinit_sysfs_hsw (dev_priv); + +kobject_put (dev_priv->perf.metrics_kobj); + dev_priv->perf.metrics_kobj =NULL ; + dev_priv->perf.oa.ops.init_oa_buffer =NULL ; dev_priv->perf.initialized = false;
Signature · 6 lines
2.7.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/9 drm/i915: Add dev.i915.perf_event_paranoid sysctl option
In reply to Robert BraggConsistent with the kernel.perf_event_paranoid sysctl option that can allow non-root users to access system wide cpu metrics, this can optionally allow non-root users to access system wide OA counter metrics from Gen graphics hardware.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_perf.c | 46 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2081,6 +2081,7 @@ struct drm_i915_private {bool initialized;struct kobject *metrics_kobj; +struct ctl_table_header *sysctl_header;struct mutex lock;struct list_head streams;
drivers/gpu/drm/i915/i915_perf.c +45 -1
76 lines not on this page · raw message
Signature · 6 lines
2.7.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/9 drm/i915: add oa_event_min_timer_exponent sysctl
In reply to Robert BraggThe minimal sampling period is now configurable via a dev.i915.oa_min_timer_exponent sysctl parameter.
Following the precedent set by perf, the default is the minimum that won't (on its own) exceed the default kernel.perf_event_max_sample_rate default of 100000 samples/s.
--- drivers/gpu/drm/i915/i915_perf.c | 42 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +30 -12
@@ -71,6 +71,23 @@ static u32 i915_perf_stream_paranoid = true;*/ #define OA_EXPONENT_MAX 31 +/* for sysctl proc_dointvec_minmax of i915_oa_min_timer_exponent */ +static int zero; +static int oa_exponent_max =OA_EXPONENT_MAX ; + +/* Theoretically we can program the OA unit to sample every 160ns but don't +* allow that by default unless root... +* +* The period is derived from the exponent as: +* +* period = 80ns * 2^(exponent + 1) +* +* Referring to perf's kernel.perf_event_max_sample_rate for a precedent +* (100000 by default); with an OA exponent of 6 we get a period of 10.240 +* microseconds - just under 100000Hz +*/ +static u32 i915_oa_min_timer_exponent =6 ; +/* XXX: beware if future OA HW adds new report formats that the current * code assumes all reports have a power-of-two size and ~(size - 1) can * be used as a mask to align the OA tail pointer.
@@ -1250,21 +1267,13 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,return -EINVAL ; } -/* NB: The exponent represents a period as follows: -* -* 80ns * 2^(period_exponent + 1) -* -* Theoretically we can program the OA unit to sample +/* Theoretically we can program the OA unit to sample * every 160ns but don't allow that by default unless * root. -* -* Referring to perf's -* kernel.perf_event_max_sample_rate for a precedent -* (100000 by default); with an OA exponent of 6 we get -* a period of 10.240 microseconds -just under 100000Hz */ -if (value <6 && !capable (CAP_SYS_ADMIN )) { -DRM_ERROR ("Sampling period too high without root privileges\n" ); +if (value < i915_oa_min_timer_exponent && + !capable (CAP_SYS_ADMIN )) { +DRM_ERROR ("OA timer exponent too low without root privileges\n" );return -EACCES ; }
@@ -1326,6 +1335,15 @@ static struct ctl_table oa_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, + { + .procname = "oa_min_timer_exponent", + .data = &i915_oa_min_timer_exponent, + .maxlen = sizeof(i915_oa_min_timer_exponent), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &zero, + .extra2 = &oa_exponent_max, + }, {} };
Signature · 6 lines
2.7.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/9 drm/i915: Add more Haswell OA metric sets
In reply to Robert BraggThis adds 'compute', 'compute extended', 'memory reads', 'memory writes' and 'sampler balance' metric sets for Haswell.
--- drivers/gpu/drm/i915/i915_oa_hsw.c | 483 ++++++++++++++++++++++++++++++++++++- 1 file changed, 482 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_oa_hsw.c +482 -1
@@ -30,9 +30,14 @@enum metric_set_id {METRIC_SET_ID_RENDER_BASIC =1 , +METRIC_SET_ID_COMPUTE_BASIC , +METRIC_SET_ID_COMPUTE_EXTENDED , +METRIC_SET_ID_MEMORY_READS , +METRIC_SET_ID_MEMORY_WRITES , +METRIC_SET_ID_SAMPLER_BALANCE , }; -int i915_oa_n_builtin_metric_sets_hsw =1 ; +int i915_oa_n_builtin_metric_sets_hsw =6 ;static const struct i915_oa_reg b_counter_config_render_basic[] = { {_MMIO (0x2724 ),0x00800000 },
@@ -118,6 +123,332 @@ static int select_render_basic_config(struct drm_i915_private *dev_priv)return 0 ; } +static const struct i915_oa_reg b_counter_config_compute_basic[] = { + {_MMIO (0x2710 ),0x00000000 }, + {_MMIO (0x2714 ),0x00800000 }, + {_MMIO (0x2718 ),0xAAAAAAAA }, + {_MMIO (0x271C ),0xAAAAAAAA }, + {_MMIO (0x2720 ),0x00000000 }, + {_MMIO (0x2724 ),0x00800000 }, + {_MMIO (0x2728 ),0xAAAAAAAA }, + {_MMIO (0x272C ),0xAAAAAAAA }, + {_MMIO (0x2740 ),0x00000000 }, + {_MMIO (0x2744 ),0x00000000 }, + {_MMIO (0x2748 ),0x00000000 }, + {_MMIO (0x274C ),0x00000000 }, + {_MMIO (0x2750 ),0x00000000 }, + {_MMIO (0x2754 ),0x00000000 }, + {_MMIO (0x2758 ),0x00000000 }, + {_MMIO (0x275C ),0x00000000 }, +}; + +static const struct i915_oa_reg mux_config_compute_basic[] = { + {_MMIO (0x253A4 ),0x00000000 }, + {_MMIO (0x2681C ),0x01F00800 }, + {_MMIO (0x26820 ),0x00001000 }, + {_MMIO (0x2781C ),0x01F00800 }, + {_MMIO (0x26520 ),0x00000007 }, + {_MMIO (0x265A0 ),0x00000007 }, + {_MMIO (0x25380 ),0x00000010 }, + {_MMIO (0x2538C ),0x00300000 }, + {_MMIO (0x25384 ),0xAA8AAAAA }, + {_MMIO (0x25404 ),0xFFFFFFFF }, + {_MMIO (0x26800 ),0x00004202 }, + {_MMIO (0x26808 ),0x00605817 }, + {_MMIO (0x2680C ),0x10001005 }, + {_MMIO (0x26804 ),0x00000000 }, + {_MMIO (0x27800 ),0x00000102 }, + {_MMIO (0x27808 ),0x0C0701E0 }, + {_MMIO (0x2780C ),0x000200A0 }, + {_MMIO (0x27804 ),0x00000000 }, + {_MMIO (0x26484 ),0x44000000 }, + {_MMIO (0x26704 ),0x44000000 }, + {_MMIO (0x26500 ),0x00000006 }, + {_MMIO (0x26510 ),0x00000001 }, + {_MMIO (0x26504 ),0x88000000 }, + {_MMIO (0x26580 ),0x00000006 }, + {_MMIO (0x26590 ),0x00000020 }, + {_MMIO (0x26584 ),0x00000000 }, + {_MMIO (0x26104 ),0x55822222 }, + {_MMIO (0x26184 ),0xAA866666 }, + {_MMIO (0x25420 ),0x08320C83 }, + {_MMIO (0x25424 ),0x06820C83 }, + {_MMIO (0x2541C ),0x00000000 }, + {_MMIO (0x25428 ),0x00000C03 }, +}; + +static int select_compute_basic_config (struct drm_i915_private *dev_priv) +{ + dev_priv->perf.oa.mux_regs = + mux_config_compute_basic; + dev_priv->perf.oa.mux_regs_len = +ARRAY_SIZE (mux_config_compute_basic); + + dev_priv->perf.oa.b_counter_regs = + b_counter_config_compute_basic; + dev_priv->perf.oa.b_counter_regs_len = +ARRAY_SIZE (b_counter_config_compute_basic); + +return 0 ; +} + +static const struct i915_oa_reg b_counter_config_compute_extended[] = { + {_MMIO (0x2724 ),0xf0800000 }, + {_MMIO (0x2720 ),0x00000000 }, + {_MMIO (0x2714 ),0xf0800000 }, + {_MMIO (0x2710 ),0x00000000 }, + {_MMIO (0x2770 ),0x0007fe2a }, + {_MMIO (0x2774 ),0x0000ff00 }, + {_MMIO (0x2778 ),0x0007fe6a }, + {_MMIO (0x277c ),0x0000ff00 }, + {_MMIO (0x2780 ),0x0007fe92 }, + {_MMIO (0x2784 ),0x0000ff00 }, + {_MMIO (0x2788 ),0x0007fea2 }, + {_MMIO (0x278c ),0x0000ff00 }, + {_MMIO (0x2790 ),0x0007fe32 }, + {_MMIO (0x2794 ),0x0000ff00 }, + {_MMIO (0x2798 ),0x0007fe9a }, + {_MMIO (0x279c ),0x0000ff00 }, + {_MMIO (0x27a0 ),0x0007ff23 }, + {_MMIO (0x27a4 ),0x0000ff00 }, + {_MMIO (0x27a8 ),0x0007fff3 }, + {_MMIO (0x27ac ),0x0000fffe }, +}; + +static const struct i915_oa_reg mux_config_compute_extended[] = { + {_MMIO (0x2681C ),0x3EB00800 }, + {_MMIO (0x26820 ),0x00900000 }, + {_MMIO (0x25384 ),0x02AAAAAA }, + {_MMIO (0x25404 ),0x03FFFFFF }, + {_MMIO (0x26800 ),0x00142284 }, + {_MMIO (0x26808 ),0x0E629062 }, + {_MMIO (0x2680C ),0x3F6F55CB }, + {_MMIO (0x26810 ),0x00000014 }, + {_MMIO (0x26804 ),0x00000000 }, + {_MMIO (0x26104 ),0x02AAAAAA }, + {_MMIO (0x26184 ),0x02AAAAAA }, + {_MMIO (0x25420 ),0x00000000 }, + {_MMIO (0x25424 ),0x00000000 }, + {_MMIO (0x2541C ),0x00000000 }, + {_MMIO (0x25428 ),0x00000000 }, +}; + +static int select_compute_extended_config (struct drm_i915_private *dev_priv) +{ + dev_priv->perf.oa.mux_regs = + mux_config_compute_extended; + dev_priv->perf.oa.mux_regs_len = +ARRAY_SIZE (mux_config_compute_extended); + + dev_priv->perf.oa.b_counter_regs = + b_counter_config_compute_extended; + dev_priv->perf.oa.b_counter_regs_len = +ARRAY_SIZE (b_counter_config_compute_extended); + +return 0 ; +} + +static const struct i915_oa_reg b_counter_config_memory_reads[] = { + {_MMIO (0x2724 ),0xf0800000 }, + {_MMIO (0x2720 ),0x00000000 }, + {_MMIO (0x2714 ),0xf0800000 }, + {_MMIO (0x2710 ),0x00000000 }, + {_MMIO (0x274c ),0x76543298 }, + {_MMIO (0x2748 ),0x98989898 }, + {_MMIO (0x2744 ),0x000000e4 }, + {_MMIO (0x2740 ),0x00000000 }, + {_MMIO (0x275c ),0x98a98a98 }, + {_MMIO (0x2758 ),0x88888888 }, + {_MMIO (0x2754 ),0x000c5500 }, + {_MMIO (0x2750 ),0x00000000 }, + {_MMIO (0x2770 ),0x0007f81a }, + {_MMIO (0x2774 ),0x0000fc00 }, + {_MMIO (0x2778 ),0x0007f82a }, + {_MMIO (0x277c ),0x0000fc00 }, + {_MMIO (0x2780 ),0x0007f872 }, + {_MMIO (0x2784 ),0x0000fc00 }, + {_MMIO (0x2788 ),0x0007f8ba }, + {_MMIO (0x278c ),0x0000fc00 }, + {_MMIO (0x2790 ),0x0007f87a }, + {_MMIO (0x2794 ),0x0000fc00 }, + {_MMIO (0x2798 ),0x0007f8ea }, + {_MMIO (0x279c ),0x0000fc00 }, + {_MMIO (0x27a0 ),0x0007f8e2 }, + {_MMIO (0x27a4 ),0x0000fc00 }, + {_MMIO (0x27a8 ),0x0007f8f2 }, + {_MMIO (0x27ac ),0x0000fc00 }, +}; + +static const struct i915_oa_reg mux_config_memory_reads[] = { + {_MMIO (0x253A4 ),0x34300000 }, + {_MMIO (0x25440 ),0x2D800000 }, + {_MMIO (0x25444 ),0x00000008 }, + {_MMIO (0x25128 ),0x0E600000 }, + {_MMIO (0x25380 ),0x00000450 }, + {_MMIO (0x25390 ),0x00052C43 }, + {_MMIO (0x25384 ),0x00000000 }, + {_MMIO (0x25400 ),0x00006144 }, + {_MMIO (0x25408 ),0x0A418820 }, + {_MMIO (0x2540C ),0x000820E6 }, + {_MMIO (0x25404 ),0xFF500000 }, + {_MMIO (0x25100 ),0x000005D6 }, + {_MMIO (0x2510C ),0x0EF00000 }, + {_MMIO (0x25104 ),0x00000000 }, + {_MMIO (0x25420 ),0x02108421 }, + {_MMIO (0x25424 ),0x00008421 }, + {_MMIO (0x2541C ),0x00000000 }, + {_MMIO (0x25428 ),0x00000000 }, +}; + +static int select_memory_reads_config (struct drm_i915_private *dev_priv) +{ + dev_priv->perf.oa.mux_regs = + mux_config_memory_reads; + dev_priv->perf.oa.mux_regs_len = +ARRAY_SIZE (mux_config_memory_reads); + + dev_priv->perf.oa.b_counter_regs = + b_counter_config_memory_reads; + dev_priv->perf.oa.b_counter_regs_len = +ARRAY_SIZE (b_counter_config_memory_reads); + +return 0 ; +} + +static const struct i915_oa_reg b_counter_config_memory_writes[] = { + {_MMIO (0x2724 ),0xf0800000 }, + {_MMIO (0x2720 ),0x00000000 }, + {_MMIO (0x2714 ),0xf0800000 }, + {_MMIO (0x2710 ),0x00000000 }, + {_MMIO (0x274c ),0x76543298 }, + {_MMIO (0x2748 ),0x98989898 }, + {_MMIO (0x2744 ),0x000000e4 }, + {_MMIO (0x2740 ),0x00000000 }, + {_MMIO (0x275c ),0xbabababa }, + {_MMIO (0x2758 ),0x88888888 }, + {_MMIO (0x2754 ),0x000c5500 }, + {_MMIO (0x2750 ),0x00000000 }, + {_MMIO (0x2770 ),0x0007f81a }, + {_MMIO (0x2774 ),0x0000fc00 }, + {_MMIO (0x2778 ),0x0007f82a }, + {_MMIO (0x277c ),0x0000fc00 }, + {_MMIO (0x2780 ),0x0007f822 }, + {_MMIO (0x2784 ),0x0000fc00 }, + {_MMIO (0x2788 ),0x0007f8ba }, + {_MMIO (0x278c ),0x0000fc00 }, + {_MMIO (0x2790 ),0x0007f87a }, + {_MMIO (0x2794 ),0x0000fc00 }, + {_MMIO (0x2798 ),0x0007f8ea }, + {_MMIO (0x279c ),0x0000fc00 }, + {_MMIO (0x27a0 ),0x0007f8e2 }, + {_MMIO (0x27a4 ),0x0000fc00 }, + {_MMIO (0x27a8 ),0x0007f8f2 }, + {_MMIO (0x27ac ),0x0000fc00 }, +}; + +static const struct i915_oa_reg mux_config_memory_writes[] = { + {_MMIO (0x253A4 ),0x34300000 }, + {_MMIO (0x25440 ),0x01500000 }, + {_MMIO (0x25444 ),0x00000120 }, + {_MMIO (0x25128 ),0x0C200000 }, + {_MMIO (0x25380 ),0x00000450 }, + {_MMIO (0x25390 ),0x00052C43 }, + {_MMIO (0x25384 ),0x00000000 }, + {_MMIO (0x25400 ),0x00007184 }, + {_MMIO (0x25408 ),0x0A418820 }, + {_MMIO (0x2540C ),0x000820E6 }, + {_MMIO (0x25404 ),0xFF500000 }, + {_MMIO (0x25100 ),0x000005D6 }, + {_MMIO (0x2510C ),0x1E700000 }, + {_MMIO (0x25104 ),0x00000000 }, + {_MMIO (0x25420 ),0x02108421 }, + {_MMIO (0x25424 ),0x00008421 }, + {_MMIO (0x2541C ),0x00000000 }, + {_MMIO (0x25428 ),0x00000000 }, +}; + +static int select_memory_writes_config (struct drm_i915_private *dev_priv) +{ + dev_priv->perf.oa.mux_regs = + mux_config_memory_writes; + dev_priv->perf.oa.mux_regs_len = +ARRAY_SIZE (mux_config_memory_writes); + + dev_priv->perf.oa.b_counter_regs = + b_counter_config_memory_writes; + dev_priv->perf.oa.b_counter_regs_len = +ARRAY_SIZE (b_counter_config_memory_writes); + +return 0 ; +} + +static const struct i915_oa_reg b_counter_config_sampler_balance[] = { + {_MMIO (0x2740 ),0x00000000 }, + {_MMIO (0x2744 ),0x00800000 }, + {_MMIO (0x2710 ),0x00000000 }, + {_MMIO (0x2714 ),0x00800000 }, + {_MMIO (0x2720 ),0x00000000 }, + {_MMIO (0x2724 ),0x00800000 }, +}; + +static const struct i915_oa_reg mux_config_sampler_balance[] = { + {_MMIO (0x2eb9c ),0x01906400 }, + {_MMIO (0x2fb9c ),0x01906400 }, + {_MMIO (0x253a4 ),0x00000000 }, + {_MMIO (0x26b9c ),0x01906400 }, + {_MMIO (0x27b9c ),0x01906400 }, + {_MMIO (0x27104 ),0x00a00000 }, + {_MMIO (0x27184 ),0x00a50000 }, + {_MMIO (0x2e804 ),0x00500000 }, + {_MMIO (0x2e984 ),0x00500000 }, + {_MMIO (0x2eb04 ),0x00500000 }, + {_MMIO (0x2eb80 ),0x00000084 }, + {_MMIO (0x2eb8c ),0x14200000 }, + {_MMIO (0x2eb84 ),0x00000000 }, + {_MMIO (0x2f804 ),0x00050000 }, + {_MMIO (0x2f984 ),0x00050000 }, + {_MMIO (0x2fb04 ),0x00050000 }, + {_MMIO (0x2fb80 ),0x00000084 }, + {_MMIO (0x2fb8c ),0x00050800 }, + {_MMIO (0x2fb84 ),0x00000000 }, + {_MMIO (0x25380 ),0x00000010 }, + {_MMIO (0x2538c ),0x000000c0 }, + {_MMIO (0x25384 ),0xaa550000 }, + {_MMIO (0x25404 ),0xffffc000 }, + {_MMIO (0x26804 ),0x50000000 }, + {_MMIO (0x26984 ),0x50000000 }, + {_MMIO (0x26b04 ),0x50000000 }, + {_MMIO (0x26b80 ),0x00000084 }, + {_MMIO (0x26b90 ),0x00050800 }, + {_MMIO (0x26b84 ),0x00000000 }, + {_MMIO (0x27804 ),0x05000000 }, + {_MMIO (0x27984 ),0x05000000 }, + {_MMIO (0x27b04 ),0x05000000 }, + {_MMIO (0x27b80 ),0x00000084 }, + {_MMIO (0x27b90 ),0x00000142 }, + {_MMIO (0x27b84 ),0x00000000 }, + {_MMIO (0x26104 ),0xa0000000 }, + {_MMIO (0x26184 ),0xa5000000 }, + {_MMIO (0x25424 ),0x00008620 }, + {_MMIO (0x2541c ),0x00000000 }, + {_MMIO (0x25428 ),0x0004a54a }, +}; + +static int select_sampler_balance_config (struct drm_i915_private *dev_priv) +{ + dev_priv->perf.oa.mux_regs = + mux_config_sampler_balance; + dev_priv->perf.oa.mux_regs_len = +ARRAY_SIZE (mux_config_sampler_balance); + + dev_priv->perf.oa.b_counter_regs = + b_counter_config_sampler_balance; + dev_priv->perf.oa.b_counter_regs_len = +ARRAY_SIZE (b_counter_config_sampler_balance); + +return 0 ; +} +int i915_oa_select_metric_set_hsw (struct drm_i915_private *dev_priv) { dev_priv->perf.oa.mux_regs =NULL ;
@@ -128,6 +459,16 @@ int i915_oa_select_metric_set_hsw(struct drm_i915_private *dev_priv)switch (dev_priv->perf.oa.metrics_set) {case METRIC_SET_ID_RENDER_BASIC :return select_render_basic_config (dev_priv); +case METRIC_SET_ID_COMPUTE_BASIC : +return select_compute_basic_config (dev_priv); +case METRIC_SET_ID_COMPUTE_EXTENDED : +return select_compute_extended_config (dev_priv); +case METRIC_SET_ID_MEMORY_READS : +return select_memory_reads_config (dev_priv); +case METRIC_SET_ID_MEMORY_WRITES : +return select_memory_writes_config (dev_priv); +case METRIC_SET_ID_SAMPLER_BALANCE : +return select_sampler_balance_config (dev_priv);default :return -ENODEV ; }
@@ -155,6 +496,116 @@ static struct attribute_group group_render_basic = { .attrs = attrs_render_basic, }; +static ssize_t +show_compute_basic_id (struct device *kdev,struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,METRIC_SET_ID_COMPUTE_BASIC ); +} + +static struct device_attribute dev_attr_compute_basic_id = { + .attr = { .name ="id" , .mode =S_IRUGO }, + .show = show_compute_basic_id, + .store =NULL , +}; + +static struct attribute *attrs_compute_basic[] = { + &dev_attr_compute_basic_id.attr, +NULL , +}; + +static struct attribute_group group_compute_basic = { + .name ="39ad14bc-2380-45c4-91eb-fbcb3aa7ae7b" , + .attrs = attrs_compute_basic, +}; + +static ssize_t +show_compute_extended_id (struct device *kdev,struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,METRIC_SET_ID_COMPUTE_EXTENDED ); +} + +static struct device_attribute dev_attr_compute_extended_id = { + .attr = { .name ="id" , .mode =S_IRUGO }, + .show = show_compute_extended_id, + .store =NULL , +}; + +static struct attribute *attrs_compute_extended[] = { + &dev_attr_compute_extended_id.attr, +NULL , +}; + +static struct attribute_group group_compute_extended = { + .name ="3865be28-6982-49fe-9494-e4d1b4795413" , + .attrs = attrs_compute_extended, +}; + +static ssize_t +show_memory_reads_id (struct device *kdev,struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,METRIC_SET_ID_MEMORY_READS ); +} + +static struct device_attribute dev_attr_memory_reads_id = { + .attr = { .name ="id" , .mode =S_IRUGO }, + .show = show_memory_reads_id, + .store =NULL , +}; + +static struct attribute *attrs_memory_reads[] = { + &dev_attr_memory_reads_id.attr, +NULL , +}; + +static struct attribute_group group_memory_reads = { + .name ="bb5ed49b-2497-4095-94f6-26ba294db88a" , + .attrs = attrs_memory_reads, +}; + +static ssize_t +show_memory_writes_id (struct device *kdev,struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,METRIC_SET_ID_MEMORY_WRITES ); +} + +static struct device_attribute dev_attr_memory_writes_id = { + .attr = { .name ="id" , .mode =S_IRUGO }, + .show = show_memory_writes_id, + .store =NULL , +}; + +static struct attribute *attrs_memory_writes[] = { + &dev_attr_memory_writes_id.attr, +NULL , +}; + +static struct attribute_group group_memory_writes = { + .name ="3358d639-9b5f-45ab-976d-9b08cbfc6240" , + .attrs = attrs_memory_writes, +}; + +static ssize_t +show_sampler_balance_id (struct device *kdev,struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" ,METRIC_SET_ID_SAMPLER_BALANCE ); +} + +static struct device_attribute dev_attr_sampler_balance_id = { + .attr = { .name ="id" , .mode =S_IRUGO }, + .show = show_sampler_balance_id, + .store =NULL , +}; + +static struct attribute *attrs_sampler_balance[] = { + &dev_attr_sampler_balance_id.attr, +NULL , +}; + +static struct attribute_group group_sampler_balance = { + .name ="bc274488-b4b6-40c7-90da-b77d7ad16189" , + .attrs = attrs_sampler_balance, +}; +int i915_perf_init_sysfs_hsw (struct drm_i915_private *dev_priv) {
@@ -163,9 +614,34 @@ i915_perf_init_sysfs_hsw(struct drm_i915_private *dev_priv) ret =sysfs_create_group (dev_priv->perf.metrics_kobj, &group_render_basic);if (ret) goto error_render_basic; + ret =sysfs_create_group (dev_priv->perf.metrics_kobj, &group_compute_basic); +if (ret) + goto error_compute_basic; + ret =sysfs_create_group (dev_priv->perf.metrics_kobj, &group_compute_extended); +if (ret) + goto error_compute_extended; + ret =sysfs_create_group (dev_priv->perf.metrics_kobj, &group_memory_reads); +if (ret) + goto error_memory_reads; + ret =sysfs_create_group (dev_priv->perf.metrics_kobj, &group_memory_writes); +if (ret) + goto error_memory_writes; + ret =sysfs_create_group (dev_priv->perf.metrics_kobj, &group_sampler_balance); +if (ret) + goto error_sampler_balance;return 0 ; +error_sampler_balance: +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_memory_writes); +error_memory_writes: +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_memory_reads); +error_memory_reads: +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_compute_extended); +error_compute_extended: +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_compute_basic); +error_compute_basic: +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_render_basic); error_render_basic:return ret; }
@@ -174,4 +650,9 @@ void i915_perf_deinit_sysfs_hsw(struct drm_i915_private *dev_priv) {sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_render_basic); +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_compute_basic); +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_compute_extended); +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_memory_reads); +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_memory_writes); +sysfs_remove_group (dev_priv->perf.metrics_kobj, &group_sampler_balance); }
Signature · 6 lines
2.7.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ah, something I forgot to highlight in the cover letter is an issue with the "drm/i915: don't whitelist oacontrol in cmd parser" patch in this series...
I was hoping that I could get away with this without breaking any existing userspace, since the only userspace I know that attempts to configure OACONTROL via LRIs is Mesa which attempts to verify that it can successfully write to OACONTROL before exposing its current INTEL_performance_query implementation, and it seems like it should gracefully handle a failure here as if the command parser where disabled.
Something curious here is that this patch seemed to work as expected when my series was recently based on a v4.5 kernel, but since rebasing last week on a couple of different recent nightlies I'm now seeing gnome-shell failing to run.
Incidentally, entirely disabling the command parser seems to work; but removing just OACONTROL seems to cause trouble.
Hopefully I can get a better understanding of what's going on here, though I can at least confirm the problem is triggered via the intel_extensions.c:can_write_oacontrol() check in Mesa. Bypassing this check (with a true or false status) is enough to get gnome-shell running again.
This could be a fiddly compatibility issue if it turns out to not be possible to remove OACONTROL from the cmd parser white list. One basic problem that stems from here is that whenever a GL application starts and this OACONTROL check is done it ends up resetting OACONTROL to zero which disables the OA unit which may be in use via the i915 perf interface.
Regards,
- Robert
Quoted 81 lines · Robert Bragg
I've been working on some i-g-t tests for this new interface and while I still
have some more tests to write, it still seemed worth sending out another updated
series in the mean time.Firstly this includes updates based on Emil's previous comments.
Then there have been a few issue hit while writing tests:
* It seems it can take a fairly long time for the MUX config to apply after the register writes have finished, and now the driver inserts a delay
after
configuration, before enabling periodic sampling.
* I've found that sometimes the HW tail pointer can get ahead of OA buffer writes, especially with higher sampling frequencies, and so now the
driver
maintains a margin behind the HW tail pointer to ensure the most recent reports have some time to land before attempting to copy them to
userspace.
* As a sanity check that a report is valid before it's copied to userspace the
driver checks the report-id field != 0
* The_BUFFER_OVERFLOWrecord has been replaced with a_BUFFER_LOSTrecord with
more specific semantics.
* Since we can't clear the overflow status on Haswell while periodic sampling
is enabled, if an overflow occurs we now restart the unit.
* The maximum OA periodic sampling exponent is now 31
* We verify the head/tail pointers read back from HW look sane before using as
offsets to read reports from the OA buffer. We reset the HW if they look
bad.For reference the work-in-progress i-g-t tests can be found here:
https://github.com/rib/intel-gpu-tools
branch = wip/rib/i915-perf-testsor browsed here:
https://github.com/rib/intel-gpu-tools/commits/wip/rib/i915-perf-testsAlso for reference these patches can be fetched from here:
https://github.com/rib/linux
branch = wip/rib/oa-2016-04-19-nightlyRegards,
- RobertRobert Bragg (9):
drm/i915: Add i915 perf infrastructure drm/i915: rename OACONTROLGEN7_OACONTROLdrm/i915: don't whitelist oacontrol in cmd parser drm/i915: Add 'render basic' Haswell OA unit config drm/i915: Enable i915 perf stream for Haswell OA unit drm/i915: advertise available metrics via sysfs drm/i915: Add dev.i915.perf_event_paranoid sysctl option drm/i915: addoa_event_min_timer_exponentsysctl drm/i915: Add more Haswell OA metric setsdrivers/gpu/drm/i915/Makefile | 4 + drivers/gpu/drm/i915/i915_cmd_parser.c | 33 +- drivers/gpu/drm/i915/i915_dma.c | 8 + drivers/gpu/drm/i915/i915_drv.h | 155 ++++ drivers/gpu/drm/i915/i915_gem_context.c | 24 +- drivers/gpu/drm/i915/i915_oa_hsw.c | 658 ++++++++++++++ drivers/gpu/drm/i915/i915_oa_hsw.h | 38 + drivers/gpu/drm/i915/i915_perf.c | 1439 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_reg.h | 340 +++++++- include/uapi/drm/i915_drm.h | 133 +++ 10 files changed, 2795 insertions(+), 37 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_oa_hsw.c create mode 100644 drivers/gpu/drm/i915/i915_oa_hsw.h create mode 100644 drivers/gpu/drm/i915/i915_perf.c
Quoted 4 lines
--
2.7.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Enable Gen 7 Observation Architecture (rev3)
In reply to Robert Bragg== Series Details ==
== Series Details ==
Series: Enable Gen 7 Observation Architecture (rev3)
URL : https://patchwork.freedesktop.org/series/3024/
State : success
== Summary ==
Series 3024v3 Enable Gen 7 Observation Architecture
http://patchwork.freedesktop.org/api/1.0/series/3024/revisions/3/mbox/
bdw-nuci7 total:113 pass:81 dwarn:0 dfail:0 fail:0 skip:5 bdw-ultra total:194 pass:170 dwarn:0 dfail:0 fail:1 skip:23 bsw-nuc-2 total:193 pass:154 dwarn:0 dfail:0 fail:0 skip:39 byt-nuc total:193 pass:155 dwarn:0 dfail:0 fail:0 skip:38 hsw-brixbox total:137 pass:116 dwarn:0 dfail:0 fail:0 skip:20 ilk-hp8440p total:194 pass:137 dwarn:0 dfail:0 fail:0 skip:57 ivb-t430s total:194 pass:166 dwarn:0 dfail:0 fail:0 skip:28 skl-i7k-2 total:194 pass:168 dwarn:0 dfail:0 fail:1 skip:25 skl-nuci5 total:194 pass:183 dwarn:0 dfail:0 fail:0 skip:11
Results at /archive/results/CI_IGT_test/Patchwork_1962/
eb848ab2b19d25a08ca3b2b5e4b2f74c7f7c962c drm-intel-nightly: 2016y-04m-20d-18h-48m-11s UTC integration manifest c6d8801 drm/i915: Add more Haswell OA metric sets
d369895 drm/i915: add oa_event_min_timer_exponent sysctl
3f46613 drm/i915: Add dev.i915.perf_event_paranoid sysctl option
99927cb drm/i915: advertise available metrics via sysfs
b28c24f drm/i915: Enable i915 perf stream for Haswell OA unit
51e55b1 drm/i915: Add 'render basic' Haswell OA unit config
2d80151 drm/i915: don't whitelist oacontrol in cmd parser
4af4699 drm/i915: rename OACONTROL GEN7_OACONTROL
a92910d drm/i915: Add i915 perf infrastructure
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for Enable Gen 7 Observation Architecture (rev3)
In reply to Robert Bragg== Series Details ==
== Series Details ==
Series: Enable Gen 7 Observation Architecture (rev3)
URL : https://patchwork.freedesktop.org/series/3024/
State : failure
== Summary ==
Series 3024v3 Enable Gen 7 Observation Architecture
http://patchwork.freedesktop.org/api/1.0/series/3024/revisions/3/mbox/
Test drv_getparams_basic:
Subgroup basic-eu-total:
pass -> INCOMPLETE (bdw-nuci7)
Test drv_module_reload_basic:
pass -> INCOMPLETE (hsw-brixbox)
Test gem_busy:
Subgroup basic-bsd1:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup basic-bsd2:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup basic-vebox:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_ctx_param:
Subgroup basic-default:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_ctx_switch:
Subgroup basic-default:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_exec_basic:
Subgroup readonly-blt:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup readonly-bsd:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup readonly-bsd2:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup readonly-default:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_flink_basic:
Subgroup double-flink:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_mmap:
Subgroup basic:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_mmap_gtt:
Subgroup basic-small-bo:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup basic-write-read:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_ringfill:
Subgroup basic-default:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_storedw_loop:
Subgroup basic-bsd1:
pass -> INCOMPLETE (bdw-nuci7)
Test gem_sync:
Subgroup basic-bsd:
pass -> INCOMPLETE (bdw-nuci7)
Test kms_addfb_basic:
Subgroup addfb25-bad-modifier:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup bad-pitch-63:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup no-handle:
pass -> INCOMPLETE (bdw-nuci7)
Test kms_flip:
Subgroup basic-flip-vs-dpms:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup basic-flip-vs-wf_vblank:
fail -> PASS (bsw-nuc-2)
Subgroup basic-plain-flip:
pass -> INCOMPLETE (bdw-nuci7)
Test kms_pipe_crc_basic:
Subgroup bad-source:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup nonblocking-crc-pipe-b:
pass -> TIMEOUT (bdw-nuci7)
Test pm_rpm:
Subgroup basic-rte:
pass -> INCOMPLETE (bdw-nuci7)
Test prime_self_import:
Subgroup basic-llseek-bad:
pass -> INCOMPLETE (bdw-nuci7)
Subgroup basic-with_one_bo:
pass -> INCOMPLETE (bdw-nuci7)bdw-nuci7 total:113 pass:81 dwarn:0 dfail:0 fail:0 skip:5 bdw-ultra total:194 pass:170 dwarn:0 dfail:0 fail:1 skip:23 bsw-nuc-2 total:193 pass:154 dwarn:0 dfail:0 fail:0 skip:39 byt-nuc total:193 pass:155 dwarn:0 dfail:0 fail:0 skip:38 hsw-brixbox total:137 pass:116 dwarn:0 dfail:0 fail:0 skip:20 ilk-hp8440p total:194 pass:137 dwarn:0 dfail:0 fail:0 skip:57 ivb-t430s total:194 pass:166 dwarn:0 dfail:0 fail:0 skip:28 skl-i7k-2 total:194 pass:168 dwarn:0 dfail:0 fail:1 skip:25 skl-nuci5 total:194 pass:183 dwarn:0 dfail:0 fail:0 skip:11
Results at /archive/results/CI_IGT_test/Patchwork_1962/
eb848ab2b19d25a08ca3b2b5e4b2f74c7f7c962c drm-intel-nightly: 2016y-04m-20d-18h-48m-11s UTC integration manifest c6d8801 drm/i915: Add more Haswell OA metric sets
d369895 drm/i915: add oa_event_min_timer_exponent sysctl
3f46613 drm/i915: Add dev.i915.perf_event_paranoid sysctl option
99927cb drm/i915: advertise available metrics via sysfs
b28c24f drm/i915: Enable i915 perf stream for Haswell OA unit
51e55b1 drm/i915: Add 'render basic' Haswell OA unit config
2d80151 drm/i915: don't whitelist oacontrol in cmd parser
4af4699 drm/i915: rename OACONTROL GEN7_OACONTROL
a92910d drm/i915: Add i915 perf infrastructure
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for Enable Gen 7 Observation Architecture (rev3)
In reply to Robert Bragg== Series Details ==
== Series Details ==
Series: Enable Gen 7 Observation Architecture (rev3)
URL : https://patchwork.freedesktop.org/series/3024/
State : warning
== Summary ==
Series 3024v3 Enable Gen 7 Observation Architecture
http://patchwork.freedesktop.org/api/1.0/series/3024/revisions/3/mbox/
Test pm_rpm:
Subgroup basic-pci-d3-state:
pass -> SKIP (bdw-nuci7)bdw-nuci7 total:193 pass:180 dwarn:0 dfail:0 fail:0 skip:13 bdw-ultra total:193 pass:170 dwarn:0 dfail:0 fail:0 skip:23 bsw-nuc-2 total:192 pass:153 dwarn:0 dfail:0 fail:0 skip:39 byt-nuc total:192 pass:154 dwarn:0 dfail:0 fail:0 skip:38 ilk-hp8440p total:193 pass:136 dwarn:0 dfail:0 fail:0 skip:57 ivb-t430s total:193 pass:165 dwarn:0 dfail:0 fail:0 skip:28 skl-i7k-2 total:193 pass:168 dwarn:0 dfail:0 fail:0 skip:25 skl-nuci5 total:193 pass:182 dwarn:0 dfail:0 fail:0 skip:11 snb-dellxps total:193 pass:155 dwarn:0 dfail:0 fail:0 skip:38 snb-x220t total:193 pass:155 dwarn:0 dfail:0 fail:1 skip:37
Results at /archive/results/CI_IGT_test/Patchwork_2006/
340c485ad98d0ec0369a3b18d4a09938f3f5537d drm-intel-nightly: 2016y-04m-22d-17h-32m-25s UTC integration manifest fcf0c57 drm/i915: Add more Haswell OA metric sets
b395ef1 drm/i915: add oa_event_min_timer_exponent sysctl
7f22bd8 drm/i915: Add dev.i915.perf_event_paranoid sysctl option
f62bcec drm/i915: advertise available metrics via sysfs
fe6778e drm/i915: Enable i915 perf stream for Haswell OA unit
e32d18d drm/i915: Add 'render basic' Haswell OA unit config
5b22605 drm/i915: don't whitelist oacontrol in cmd parser
2a3581f drm/i915: rename OACONTROL GEN7_OACONTROL
9563014 drm/i915: Add i915 perf infrastructure
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Enable Gen 7 Observation Architecture (rev3)
In reply to Robert Bragg== Series Details ==
== Series Details ==
Series: Enable Gen 7 Observation Architecture (rev3)
URL : https://patchwork.freedesktop.org/series/3024/
State : success
== Summary ==
Series 3024v3 Enable Gen 7 Observation Architecture
http://patchwork.freedesktop.org/api/1.0/series/3024/revisions/3/mbox/
byt-nuc total:192 pass:154 dwarn:0 dfail:0 fail:0 skip:38 ilk-hp8440p total:193 pass:136 dwarn:0 dfail:0 fail:0 skip:57 ivb-t430s total:193 pass:165 dwarn:0 dfail:0 fail:0 skip:28 snb-dellxps total:193 pass:155 dwarn:0 dfail:0 fail:0 skip:38
Results at /archive/results/CI_IGT_test/Patchwork_2048/
1e81bacf1f7fdbdf83f46b55389713fa13cb1256 drm-intel-nightly: 2016y-04m-24d-10h-36m-11s UTC integration manifest 78cae1b drm/i915: Add more Haswell OA metric sets
7866967 drm/i915: add oa_event_min_timer_exponent sysctl
f9d868d drm/i915: Add dev.i915.perf_event_paranoid sysctl option
030301f drm/i915: advertise available metrics via sysfs
440ee27 drm/i915: Enable i915 perf stream for Haswell OA unit
7b10cf5 drm/i915: Add 'render basic' Haswell OA unit config
1f4d04b drm/i915: don't whitelist oacontrol in cmd parser
9950d98 drm/i915: rename OACONTROL GEN7_OACONTROL
b4467d8 drm/i915: Add i915 perf infrastructure
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx