aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_perf_types.h
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2019-10-12 08:23:06 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-10-12 09:08:27 +0100
commit6a45008ab7bb5e13b543de0c141b94aaa71d8397 (patch)
tree15b89fcf32e8284869a55e6d7346b5c3543aaeb3 /drivers/gpu/drm/i915/i915_perf_types.h
parentdrm/i915: Mark up "sentinel" requests (diff)
downloadlinux-dev-6a45008ab7bb5e13b543de0c141b94aaa71d8397.tar.xz
linux-dev-6a45008ab7bb5e13b543de0c141b94aaa71d8397.zip
drm/i915/perf: allow for CS OA configs to be created lazily
Here we introduce a mechanism by which the execbuf part of the i915 driver will be able to request that a batch buffer containing the programming for a particular OA config be created. We'll execute these OA configuration buffers right before executing a set of userspace commands so that a particular user batchbuffer be executed with a given OA configuration. This mechanism essentially allows the userspace driver to go through several OA configuration without having to open/close the i915/perf stream. v2: No need for locking on object OA config object creation (Chris) Flush cpu mapping of OA config (Chris) v3: Properly deal with the perf_metric lock (Chris/Lionel) v4: Fix oa config unref/put when not found (Lionel) v5: Allocate BOs for configurations on the stream instead of globally (Lionel) v6: Fix 64bit division (Chris) v7: Store allocated config BOs into the stream (Lionel) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20191012072308.30312-1-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_perf_types.h')
-rw-r--r--drivers/gpu/drm/i915/i915_perf_types.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_perf_types.h b/drivers/gpu/drm/i915/i915_perf_types.h
index eb8d1ebd5095..337cd7d2ad77 100644
--- a/drivers/gpu/drm/i915/i915_perf_types.h
+++ b/drivers/gpu/drm/i915/i915_perf_types.h
@@ -9,7 +9,7 @@
#include <linux/atomic.h>
#include <linux/device.h>
#include <linux/hrtimer.h>
-#include <linux/list.h>
+#include <linux/llist.h>
#include <linux/poll.h>
#include <linux/sysfs.h>
#include <linux/types.h>
@@ -22,6 +22,7 @@
struct drm_i915_private;
struct file;
struct i915_gem_context;
+struct i915_perf;
struct i915_vma;
struct intel_context;
struct intel_engine_cs;
@@ -37,6 +38,8 @@ struct i915_oa_reg {
};
struct i915_oa_config {
+ struct i915_perf *perf;
+
char uuid[UUID_STRING_LEN + 1];
int id;
@@ -51,7 +54,8 @@ struct i915_oa_config {
struct attribute *attrs[2];
struct device_attribute sysfs_metric_id;
- atomic_t ref_count;
+ struct kref ref;
+ struct rcu_head rcu;
};
struct i915_perf_stream;
@@ -178,6 +182,12 @@ struct i915_perf_stream {
struct i915_oa_config *oa_config;
/**
+ * @oa_config_bos: A list of struct i915_oa_config_bo allocated lazily
+ * each time @oa_config changes.
+ */
+ struct llist_head oa_config_bos;
+
+ /**
* @pinned_ctx: The OA context specific information.
*/
struct intel_context *pinned_ctx;
@@ -331,13 +341,13 @@ struct i915_perf {
/*
* Lock associated with adding/modifying/removing OA configs
- * in dev_priv->perf.metrics_idr.
+ * in perf->metrics_idr.
*/
struct mutex metrics_lock;
/*
- * List of dynamic configurations, you need to hold
- * dev_priv->perf.metrics_lock to access it.
+ * List of dynamic configurations (struct i915_oa_config), you
+ * need to hold perf->metrics_lock to access it.
*/
struct idr metrics_idr;
@@ -350,8 +360,7 @@ struct i915_perf {
/*
* The stream currently using the OA unit. If accessed
* outside a syscall associated to its file
- * descriptor, you need to hold
- * dev_priv->drm.struct_mutex.
+ * descriptor.
*/
struct i915_perf_stream *exclusive_stream;