Skip to content

Commit 5539acc

Browse files
committed
drm/i915/perf: remove perf.hook_lock
In earlier iterations of the i915-perf driver we had a number of callbacks/hooks from other parts of the i915 driver to e.g. notify us when a legacy context was pinned and these could run asynchronously with respect to the stream file operations and might also run in atomic context. dev_priv->perf.hook_lock had been for serialising access to state needed within these callbacks, but as the code has evolved some of the hooks have gone away or are implemented to avoid needing to lock any state. The remaining use of this lock was actually redundant considering how the gen7 oacontrol state used to be updated as part of a context pin hook. Signed-off-by: Robert Bragg <robert@sixbynine.org> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
1 parent 3a4a72c commit 5539acc

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,8 +2438,6 @@ struct drm_i915_private {
24382438
struct mutex lock;
24392439
struct list_head streams;
24402440

2441-
spinlock_t hook_lock;
2442-
24432441
struct {
24442442
struct i915_perf_stream *exclusive_stream;
24452443

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,9 +1690,17 @@ static void gen8_disable_metric_set(struct drm_i915_private *dev_priv)
16901690
/* NOP */
16911691
}
16921692

1693-
static void gen7_update_oacontrol_locked(struct drm_i915_private *dev_priv)
1693+
static void gen7_oa_enable(struct drm_i915_private *dev_priv)
16941694
{
1695-
lockdep_assert_held(&dev_priv->perf.hook_lock);
1695+
/* Reset buf pointers so we don't forward reports from before now.
1696+
*
1697+
* Think carefully if considering trying to avoid this, since it
1698+
* also ensures status flags and the buffer itself are cleared
1699+
* in error paths, and we have checks for invalid reports based
1700+
* on the assumption that certain fields are written to zeroed
1701+
* memory which this helps maintains.
1702+
*/
1703+
gen7_init_oa_buffer(dev_priv);
16961704

16971705
if (dev_priv->perf.oa.exclusive_stream->enabled) {
16981706
struct i915_gem_context *ctx =
@@ -1715,25 +1723,6 @@ static void gen7_update_oacontrol_locked(struct drm_i915_private *dev_priv)
17151723
I915_WRITE(GEN7_OACONTROL, 0);
17161724
}
17171725

1718-
static void gen7_oa_enable(struct drm_i915_private *dev_priv)
1719-
{
1720-
unsigned long flags;
1721-
1722-
/* Reset buf pointers so we don't forward reports from before now.
1723-
*
1724-
* Think carefully if considering trying to avoid this, since it
1725-
* also ensures status flags and the buffer itself are cleared
1726-
* in error paths, and we have checks for invalid reports based
1727-
* on the assumption that certain fields are written to zeroed
1728-
* memory which this helps maintains.
1729-
*/
1730-
gen7_init_oa_buffer(dev_priv);
1731-
1732-
spin_lock_irqsave(&dev_priv->perf.hook_lock, flags);
1733-
gen7_update_oacontrol_locked(dev_priv);
1734-
spin_unlock_irqrestore(&dev_priv->perf.hook_lock, flags);
1735-
}
1736-
17371726
static void gen8_oa_enable(struct drm_i915_private *dev_priv)
17381727
{
17391728
u32 report_format = dev_priv->perf.oa.oa_buffer.format;
@@ -3014,7 +3003,6 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
30143003

30153004
INIT_LIST_HEAD(&dev_priv->perf.streams);
30163005
mutex_init(&dev_priv->perf.lock);
3017-
spin_lock_init(&dev_priv->perf.hook_lock);
30183006
spin_lock_init(&dev_priv->perf.oa.oa_buffer.ptr_lock);
30193007

30203008
oa_sample_rate_hard_limit =

0 commit comments

Comments
 (0)