Skip to contentSkip to conversation

drm/i915: fix comment referencing imaginary functions

PATCH In review Matthew Auld 6 participants 9 messages Aug 24, 2016 – Oct 25, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: fix comment referencing imaginary functions

The comment which documents the proper usage of the *_FW family of macros makes reference to intel_uncore_forcewake_irq{unlock, lock}, which is just confusing, seeing as such a set of functions don't even exist and never have for that matter(according to git). Let's fix that by replacing them with intel_uncore_forcewake_{get, put}.

---
 drivers/gpu/drm/i915/i915_drv.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index ff96b7a..c285d61 100644
@@ -3792,8 +3792,8 @@ __raw_write(64, q)
  * critical sections inside IRQ handlers where forcewake is explicitly
  * controlled.
  * Think twice, and think again, before using these.
- * Note: Should only be used between intel_uncore_forcewake_irqlock() and
- * intel_uncore_forcewake_irqunlock().
+ * Note: Should only be used between intel_uncore_forcewake_get and
+ * intel_uncore_forcewake_put.
  */
 #define I915_READ_FW(reg__) __raw_i915_read32(dev_priv, (reg__))
 #define I915_WRITE_FW(reg__, val__) __raw_i915_write32(dev_priv, (reg__), (val__))
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: fix comment referencing imaginary functions

== Series Details ==

== Series Details ==

Series: drm/i915: fix comment referencing imaginary functions
URL : https://patchwork.freedesktop.org/series/11527/
State : failure

== Summary ==

Series 11527v1 drm/i915: fix comment referencing imaginary functions
http://patchwork.freedesktop.org/api/1.0/series/11527/revisions/1/mbox/

Test kms_cursor_legacy:

        Subgroup basic-cursor-vs-flip-varying-size:
                pass       -> FAIL       (fi-bsw-n3050)
        Subgroup basic-flip-vs-cursor-legacy:
                fail       -> PASS       (fi-hsw-4770k)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-b:
                pass       -> SKIP       (fi-hsw-4770r)
        Subgroup nonblocking-crc-pipe-c:
                skip       -> PASS       (fi-hsw-4770r)
        Subgroup read-crc-pipe-c:
                pass       -> SKIP       (fi-hsw-4770r)
fi-bdw-5557u     total:252  pass:235  dwarn:0   dfail:0   fail:2   skip:15 
fi-bsw-n3050     total:252  pass:202  dwarn:0   dfail:0   fail:4   skip:46 
fi-hsw-4770k     total:252  pass:222  dwarn:6   dfail:1   fail:1   skip:22 
fi-hsw-4770r     total:252  pass:222  dwarn:0   dfail:0   fail:2   skip:28 
fi-ivb-3520m     total:252  pass:220  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u     total:252  pass:236  dwarn:0   dfail:0   fail:2   skip:14 
fi-skl-6700k     total:252  pass:216  dwarn:4   dfail:0   fail:4   skip:28 
fi-snb-2520m     total:252  pass:203  dwarn:4   dfail:0   fail:2   skip:43 
fi-snb-2600      total:252  pass:203  dwarn:4   dfail:0   fail:2   skip:43 

Results at /archive/results/CI_IGT_test/Patchwork_2422/

6737eeadd55aa09ac998698461138309ab623dbb drm-intel-nightly: 2016y-08m-24d-15h-53m-53s UTC integration manifest a58a4c2 drm/i915: fix comment referencing imaginary functions

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#2 lore raw
In reply to Matthew Auld
Quoted 8 lines · Matthew Auld

The comment which documents the proper usage of the *_FW family of macros makes reference to intel_uncore_forcewake_irq{unlock, lock}, which is just confusing, seeing as such a set of functions don't even exist and never have for that matter(according to git). Let's fix that by replacing them with intel_uncore_forcewake_{get, put}.

Quoted 21 lines
---
 drivers/gpu/drm/i915/i915_drv.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h renamed from drivers/gpu/drm/i916/i915_drv.h +2 -2
index ff96b7a..c285d61 100644
@@ -3792,8 +3792,8 @@ __raw_write(64, q)
  * critical sections inside IRQ handlers where forcewake is explicitly
  * controlled.
  * Think twice, and think again, before using these.
- * Note: Should only be used between intel_uncore_forcewake_irqlock() and
- * intel_uncore_forcewake_irqunlock().
+ * Note: Should only be used between intel_uncore_forcewake_get and
+ * intel_uncore_forcewake_put.
  */
 #define I915_READ_FW(reg__) __raw_i915_read32(dev_priv, (reg__))
 #define I915_WRITE_FW(reg__, val__) __raw_i915_write32(dev_priv, (reg__), (val__))
Signature · 1 line
2.7.4
Signature · 6 lines
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 10 lines · Arkadiusz Hiler
Quoted 8 lines · Matthew Auld

The comment which documents the proper usage of the *_FW family of macros makes reference to intel_uncore_forcewake_irq{unlock, lock}, which is just confusing, seeing as such a set of functions don't even exist and never have for that matter(according to git). Let's fix that by replacing them with intel_uncore_forcewake_{get, put}.

The downside is that this now doesn't mention the locking required to prevent machine hangs on some platforms.
-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
#4 lore raw
Quoted 8 lines · Chris Wilson
Quoted 7 lines · Arkadiusz Hiler
Quoted 6 lines · Matthew Auld

The comment which documents the proper usage of the *_FW family of macros makes reference to intel_uncore_forcewake_irq{unlock, lock}, which is just confusing, seeing as such a set of functions don't even exist and never have for that matter(according to git). Let's fix that by replacing them with intel_uncore_forcewake_{get, put}.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

The downside is that this now doesn't mention the locking required to prevent machine hangs on some platforms.

"intel_uncore_forcewake_get will acquire forcewake reference and also take a uncore.lock to guarantee explicit access by one thread only. As some registers don't need forcewake held, intel_uncore_forcewake_{get,put} can be omitted. If you do so, be warned that on some gens (gen7), concurrent access to the same cacheline by multiple cpu threads with the gpu can risk a system hang. You need to grab uncore spinlock explicitly to guard against this."

Would that be accurate addition?

-Mika

Quoted 8 lines

-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

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 25 lines · Mika Kuoppala
Quoted 8 lines · Chris Wilson
Quoted 7 lines · Arkadiusz Hiler
Quoted 6 lines · Matthew Auld

The comment which documents the proper usage of the *_FW family of macros makes reference to intel_uncore_forcewake_irq{unlock, lock}, which is just confusing, seeing as such a set of functions don't even exist and never have for that matter(according to git). Let's fix that by replacing them with intel_uncore_forcewake_{get, put}.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

The downside is that this now doesn't mention the locking required to prevent machine hangs on some platforms.

"intel_uncore_forcewake_get will acquire forcewake reference and also take a uncore.lock to guarantee explicit access by one thread only. As some registers don't need forcewake held, intel_uncore_forcewake_{get,put} can be omitted. If you do so, be warned that on some gens (gen7), concurrent access to the same cacheline by multiple cpu threads with the gpu can risk a system hang. You need to grab uncore spinlock explicitly to guard against this."

Quoted 1 line

Would that be accurate addition?

intel_uncore_forcewake_get() doesn't acquire the spinlock for you, just for itself.

The full sequence would be

spin_lock_irq(&dev_priv->uncore.lock);
intel_uncore_forcewake_get__locked()
...
intel_uncore_forcewake_put__locked()
spin_unlock_irq(&dev_priv->uncore.lock);

We very rarely do that either (a) presuming that we are serialised by some other lock, (b) don't care because it is safe or (c) completely forgotten about the risks.
-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
#6 lore raw
Quoted 11 lines · Chris Wilson
Quoted 10 lines · Mika Kuoppala
Quoted 8 lines · Chris Wilson
Quoted 7 lines · Arkadiusz Hiler
Quoted 6 lines · Matthew Auld

The comment which documents the proper usage of the *_FW family of macros makes reference to intel_uncore_forcewake_irq{unlock, lock}, which is just confusing, seeing as such a set of functions don't even exist and never have for that matter(according to git). Let's fix that by replacing them with intel_uncore_forcewake_{get, put}.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

The downside is that this now doesn't mention the locking required to prevent machine hangs on some platforms.

Previous version neither mentioned that clearly. Imaginary functions with irq in name is more confusing than helpful in my opinion. The assumption that those were mistaken for {get,put} is easy enough to make.

Quoted 22 lines
Quoted 10 lines

"intel_uncore_forcewake_get will acquire forcewake reference and also take a uncore.lock to guarantee explicit access by one thread only. As some registers don't need forcewake held, intel_uncore_forcewake_{get,put} can be omitted. If you do so, be warned that on some gens (gen7), concurrent access to the same cacheline by multiple cpu threads with the gpu can risk a system hang. You need to grab uncore spinlock explicitly to guard against this."

Would that be accurate addition?

intel_uncore_forcewake_get() doesn't acquire the spinlock for you, just for itself.

The full sequence would be

spin_lock_irq(&dev_priv->uncore.lock);
intel_uncore_forcewake_get()
...
intel_uncore_forcewake_put()
spin_unlock_irq(&dev_priv->uncore.lock);

Quoted 4 lines

We very rarely do that either (a) presuming that we are serialised by some other lock, (b) don't care because it is safe or (c) completely forgotten about the risks.
-Chris

Then all that should be mentioned?

My take on it:

These are untraced mmio-accessors that are only valid to be used inside critical sections inside IRQ handlers where forcewake is explicitly controlled.

Think twice, and think again, before using these.

Those possibly should be used between:

spin_lock_irq(&dev_priv->uncore.lock);
intel_uncore_forcewake_get();

and

intel_uncore_forcewake_put();
spin_unlock_irq(&dev_priv->uncore.lock);

Note: some registers may not need forcewake held, so intel_uncore_forcewake_{get,put} can be omitted.

Code may be serialised by different lock, so immediate spin_{lock,unlock}_irq() may not be necessary.

--
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
Quoted 17 lines

These are untraced mmio-accessors that are only valid to be used inside critical sections inside IRQ handlers where forcewake is explicitly controlled.

Think twice, and think again, before using these.

Those possibly should be used between:

spin_lock_irq(&dev_priv->uncore.lock);
intel_uncore_forcewake_get();

and

intel_uncore_forcewake_put();
spin_unlock_irq(&dev_priv->uncore.lock);

Quoted 5 lines

Note: some registers may not need forcewake held, so intel_uncore_forcewake_{get,put} can be omitted.

Code may be serialised by different lock, so immediate spin_{lock,unlock}_irq() may not be necessary.

Maybe roll that up into a new patch? Assuming Chris is happy...
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw
Quoted 17 lines · Matthew Auld
Quoted 17 lines

These are untraced mmio-accessors that are only valid to be used inside critical sections inside IRQ handlers where forcewake is explicitly controlled.

Think twice, and think again, before using these.

Those possibly should be used between:

spin_lock_irq(&dev_priv->uncore.lock);
intel_uncore_forcewake_get();

and

intel_uncore_forcewake_put();
spin_unlock_irq(&dev_priv->uncore.lock);

Quoted 7 lines
Quoted 5 lines

Note: some registers may not need forcewake held, so intel_uncore_forcewake_{get,put} can be omitted.

Code may be serialised by different lock, so immediate spin_{lock,unlock}_irq() may not be necessary.

Maybe roll that up into a new patch? Assuming Chris is happy...

s/inside IRQ handlers/, such as inside IRQ handlers,/

As an example, these accessors can possibly be used between:

can be omitted, see intel_uncore_forcewake_for_reg().

Certain architectures will die if the same cacheline is concurrently accessed by different clients (e.g. Ivybridge). Access to registers should therefore generally be serialised, by either the dev_priv->uncore.lock or a more localised lock guarding all access to that bank of registers.

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx