Misc locking fixes and GEM debugging
Subsystems (4)
cover Misc locking fixes and GEM debugging
From: Tvrtko Ursulin <[email protected]>
A collection of patches addressing locking inversions, missing locking, un-needed atomic waiting, more precision for the latter and adding some infrastructure to catch some of these during driver development.
Tvrtko Ursulin (12):
drm/i915: Add wait_for_us
drm/i915: Do not wait atomically for display clocks drm/i915/guc: Do not wait for firmware load atomically drm/i915/lrc: Do not wait atomically when stopping engines drm/i915: Kconfig for extra driver debugging drm/i915: Do not lie about atomic wait granularity drm/i915: GEM operations need to be done under the big lock drm/i915: Fix struct mutex vs. RPS lock inversion drm/i915/ilk: Move register read under spinlock drm/i915: Introduce dedicated object VMA iterator drm/i915: Introduce dedicated safe object VMA iterator drm/i915: Add BKL asserts to get page helpers
drivers/gpu/drm/i915/Kconfig | 6 ++++++ drivers/gpu/drm/i915/Kconfig.debug | 12 +++++++++++ drivers/gpu/drm/i915/i915_debugfs.c | 8 +++---- drivers/gpu/drm/i915/i915_drv.h | 24 +++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem.c | 30 +++++++++++++------------- drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/i915_gem_shrinker.c | 5 ++--- drivers/gpu/drm/i915/i915_gem_stolen.c | 3 +++ drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +- drivers/gpu/drm/i915/intel_display.c | 20 +++++++++--------- drivers/gpu/drm/i915/intel_dp.c | 3 +-- drivers/gpu/drm/i915/intel_drv.h | 36 +++++++++++++++++++++++++------- drivers/gpu/drm/i915/intel_guc_loader.c | 6 +++--- drivers/gpu/drm/i915/intel_lrc.c | 2 +- drivers/gpu/drm/i915/intel_pm.c | 15 +++++++------ drivers/gpu/drm/i915/intel_psr.c | 2 +- 16 files changed, 122 insertions(+), 54 deletions(-) create mode 100644 drivers/gpu/drm/i915/Kconfig.debug
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/12 drm/i915: Add wait_for_us
From: Tvrtko Ursulin <[email protected]>
This is for callers who want micro-second precision but are not waiting from the atomic context.
--- drivers/gpu/drm/i915/intel_dp.c | 3 +-- drivers/gpu/drm/i915/intel_drv.h | 9 +++++---- drivers/gpu/drm/i915/intel_psr.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +1 -2
@@ -1788,11 +1788,10 @@ static void wait_panel_status(struct intel_dp *intel_dp,I915_READ (pp_stat_reg), I915_READ(pp_ctrl_reg)); -if (_wait_for ((I915_READ (pp_stat_reg) & mask) == value,5000 ,10 )) { +if (_wait_for ((I915_READ (pp_stat_reg) & mask) == value,5000000 ,10000 ))DRM_ERROR ("Panel status timeout: status %08x control %08x\n" ,I915_READ (pp_stat_reg),I915_READ (pp_ctrl_reg)); - }DRM_DEBUG_KMS ("Wait complete\n" ); }
drivers/gpu/drm/i915/intel_drv.h +5 -4
@@ -45,8 +45,8 @@* having timed out, since the timeout could be due to preemption or similar and * we've never had a chance to check the condition before the timeout. */ -#define _wait_for (COND ,MS ,W ) ({ \ - unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \ +#define _wait_for (COND ,US ,W ) ({ \ + unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \ int ret__ = 0; \ while (!(COND)) { \ if (time_after(jiffies, timeout__)) { \
@@ -55,7 +55,7 @@break ; \ } \if ((W ) &&drm_can_sleep ()) { \ -usleep_range ((W )*1000 , (W )*2000 ); \ +usleep_range ((W ), (W )*2 ); \ }else { \cpu_relax (); \ } \
@@ -63,7 +63,8 @@ ret__; \ }) -#define wait_for (COND ,MS ) _wait_for(COND, MS, 1) +#define wait_for (COND ,MS ) _wait_for(COND, (MS) * 1000, 1000) +#define wait_for_us (COND ,US ) _wait_for(COND, US, 1)#define wait_for_atomic (COND ,MS ) _wait_for(COND, MS, 0)#define wait_for_atomic_us (COND ,US ) _wait_for((COND), \ DIV_ROUND_UP((US), 1000), 0)
drivers/gpu/drm/i915/intel_psr.c +1 -1
@@ -492,7 +492,7 @@ static void hsw_psr_disable(struct intel_dp *intel_dp)/* Wait till PSR is idle */ if (_wait_for ((I915_READ (EDP_PSR_STATUS_CTL ) & -EDP_PSR_STATUS_STATE_MASK ) ==0 ,2000 ,10 )) +EDP_PSR_STATUS_STATE_MASK ) ==0 ,2000000 ,10000 ))DRM_ERROR ("Timed out waiting for PSR Idle State\n" ); dev_priv->psr.active = false;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/12] drm/i915: Add wait_for_us
Quoted 4 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This is for callers who want micro-second precision but are not waiting from the atomic context.
linux/time.h provides us with USEC_PER_MSEC that would help to break up these large numbers better for human consumption.
2000 -> 2*USEC_PER_SEC
10 -> 10*USEC_PER_MSEC
Maybe:
#define wait_for_seconds(x) ((x)*USEC_PER_SEC) #define wait_for_milliseconds(x) ((x)*USEC_PER_MSEC)
if (_wait_for((I915_READ(pp_stat_reg) & mask) == value,
wait_for_seconds(5) /* timeout */, wait_for_millseconds(10) /* interval */))
drivers/gpu/drm/i915/intel_drv.h line 57
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -55,7 +55,7 @@break ; \ } \if ((W ) &&drm_can_sleep ()) { \
Note after the atomic conversion, we can also do the !atomic assert here and kill the drm_can_sleep() check
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/12] drm/i915: Add wait_for_us
Quoted 12 lines · Chris Wilson
Quoted 4 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This is for callers who want micro-second precision but are not waiting from the atomic context.
linux/time.hprovides us withUSEC_PER_MSECthat would help to break up these large numbers better for human consumption.2000 -> 2*USEC_PER_SEC
10 -> 10*USEC_PER_MSEC
Quoted 8 lines
Maybe:
#define
wait_for_seconds(x)((x)*USEC_PER_SEC) #definewait_for_milliseconds(x)((x)*USEC_PER_MSEC)if (_wait_for((I915_READ(pp_stat_reg) & mask) == value,
wait_for_seconds(5) /* timeout */, wait_for_millseconds(10) /* interval */))
There are only two callers where it would be a bit interesting so it just feels like needless change to me at the moment. Better to keep the established conventions for these two macros.
Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h line 57
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -55,7 +55,7 @@break ; \ } \if ((W ) &&drm_can_sleep ()) { \Note after the atomic conversion, we can also do the !atomic assert here and kill the
drm_can_sleep()check
Noted. Maybe I'll put a comment somewhere.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/12] drm/i915: Add wait_for_us
Quoted 20 lines · Tvrtko Ursulin
Quoted 17 lines · Chris Wilson
Quoted 4 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This is for callers who want micro-second precision but are not waiting from the atomic context.
linux/time.hprovides us withUSEC_PER_MSECthat would help to break up these large numbers better for human consumption.2000 -> 2*USEC_PER_SEC
10 -> 10*USEC_PER_MSECMaybe:
#define
wait_for_seconds(x)((x)*USEC_PER_SEC) #definewait_for_milliseconds(x)((x)*USEC_PER_MSEC)
Quoted 7 lines
Quoted 3 lines
if (_wait_for((I915_READ(pp_stat_reg) & mask) == value,
wait_for_seconds(5) /* timeout */, wait_for_millseconds(10) /* interval */))There are only two callers where it would be a bit interesting so it just feels like needless change to me at the moment. Better to keep the established conventions for these two macros.
I am a bit more concerned that there are any users of _wait_for() outside of the header.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/12] drm/i915: Add wait_for_us
In reply to Tvrtko UrsulinQuoted 54 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This is for callers who want micro-second precision but are not waiting from the atomic context.
Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 3 +-- drivers/gpu/drm/i915/intel_drv.h | 9 +++++---- drivers/gpu/drm/i915/intel_psr.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_dp.c +1
-2@@ -1788,11 +1788,10 @@ static void wait_panel_status(struct intel_dp *intel_dp,I915_READ (pp_stat_reg), I915_READ(pp_ctrl_reg)); -if (_wait_for ((I915_READ (pp_stat_reg) & mask) == value,5000 ,10 )) { +if (_wait_for ((I915_READ (pp_stat_reg) & mask) == value,5000000 ,10000 ))DRM_ERROR ("Panel status timeout: status %08x control %08x\n" ,I915_READ (pp_stat_reg),I915_READ (pp_ctrl_reg)); - }DRM_DEBUG_KMS ("Wait complete\n" ); }drivers/gpu/drm/i915/intel_drv.h +3
-3@@ -45,8 +45,8 @@* having timed out, since the timeout could be due to preemption or similar and * we've never had a chance to check the condition before the timeout. */ -#define _wait_for (COND ,MS ,W ) ({ \ - unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \ +#define _wait_for (COND ,US ,W ) ({ \ + unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \ int ret__ = 0; \ while (!(COND)) { \ if (time_after(jiffies, timeout__)) { \@@ -55,7 +55,7 @@break ; \ } \if ((W ) &&drm_can_sleep ()) { \ -usleep_range ((W )*1000 , (W )*2000 ); \ +usleep_range ((W ), (W )*2 ); \ }else { \cpu_relax (); \ } \
drivers/gpu/drm/i915/intel_drv.h line 70
Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -63,7 +63,8 @@ ret__; \ }) -#define wait_for (COND ,MS ) _wait_for(COND, MS, 1) +#define wait_for (COND ,MS ) _wait_for(COND, (MS) * 1000, 1000) +#define wait_for_us (COND ,US ) _wait_for(COND, US, 1)#define wait_for_atomic (COND ,MS ) _wait_for(COND, MS, 0)#define wait_for_atomic_us (COND ,US ) _wait_for((COND), \ DIV_ROUND_UP((US), 1000), 0)
Don't these latter two macros need to be altered since the underlying _wait_for() now takes times in us rather than ms?
.Dave.
Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +0
-0
drivers/gpu/drm/i915/intel_psr.c static void hsw_psr_disable(struct intel_dp *intel_dp) · line 498
Quoted 8 lines
drivers/gpu/drm/i915/intel_psr.c +1
-1@@ -492,7 +492,7 @@ static void hsw_psr_disable(struct intel_dp *intel_dp)/* Wait till PSR is idle */ if (_wait_for ((I915_READ (EDP_PSR_STATUS_CTL ) & -EDP_PSR_STATUS_STATE_MASK ) ==0 ,2000 ,10 )) +EDP_PSR_STATUS_STATE_MASK ) ==0 ,2000000 ,10000 ))DRM_ERROR ("Timed out waiting for PSR Idle State\n" ); dev_priv->psr.active = false;
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/12] drm/i915: Add wait_for_us
Quoted 63 lines · Dave Gordon
Quoted 62 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This is for callers who want micro-second precision but are not waiting from the atomic context.
Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 3 +-- drivers/gpu/drm/i915/intel_drv.h | 9 +++++---- drivers/gpu/drm/i915/intel_psr.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_dp.c +1
-2@@ -1788,11 +1788,10 @@ static void wait_panel_status(struct intel_dp *intel_dp,I915_READ (pp_stat_reg), I915_READ(pp_ctrl_reg)); -if (_wait_for ((I915_READ (pp_stat_reg) & mask) == value,5000 ,10 )) { +if (_wait_for ((I915_READ (pp_stat_reg) & mask) == value,5000000 ,10000 ))DRM_ERROR ("Panel status timeout: status %08x control %08x\n" ,I915_READ (pp_stat_reg),I915_READ (pp_ctrl_reg)); - }DRM_DEBUG_KMS("Wait complete\n");}
drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -45,8 +45,8 @@* having timed out, since the timeout could be due to preemption or similar and
* we've never had a chance to check the condition before the timeout. */drivers/gpu/drm/i915/intel_drv.h +3
-3-#define _wait_for (COND ,MS ,W ) ({ \ - unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \ +#define _wait_for (COND ,US ,W ) ({ \ + unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \ int ret__ = 0; \ while (!(COND)) { \ if (time_after(jiffies, timeout__)) { \@@ -55,7 +55,7 @@break ; \ } \if ((W ) &&drm_can_sleep ()) { \ -usleep_range ((W )*1000 , (W )*2000 ); \ +usleep_range ((W ), (W )*2 ); \ }else { \cpu_relax (); \ } \@@ -63,7 +63,8 @@ ret__; \ })
Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h line 70
Quoted 6 lines
drivers/gpu/drm/i915/intel_drv.h +2
-1-#define wait_for (COND ,MS ) _wait_for(COND, MS, 1) +#define wait_for (COND ,MS ) _wait_for(COND, (MS) * 1000, 1000) +#define wait_for_us (COND ,US ) _wait_for(COND, US, 1)#define wait_for_atomic (COND ,MS ) _wait_for(COND, MS, 0)#define wait_for_atomic_us (COND ,US ) _wait_for((COND), \ DIV_ROUND_UP((US), 1000), 0)Don't these latter two macros need to be altered since the underlying
_wait_for()now takes times in us rather than ms?
Yes you are right, thanks! (Consequence of re-ordering and re-basing.)
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/12 drm/i915: Add wait_for_us
In reply to Dave GordonFrom: Tvrtko Ursulin <[email protected]>
This is for callers who want micro-second precision but are not waiting from the atomic context.
v2:
* Fix atomic waits. (Dave Gordon)
* Use USEC_PER_SEC and USEC_PER_MSEC. (Chris Wilson)
--- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- drivers/gpu/drm/i915/intel_drv.h | 15 ++++++++------- drivers/gpu/drm/i915/intel_psr.c | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -1788,11 +1788,11 @@ static void wait_panel_status(struct intel_dp *intel_dp,I915_READ (pp_stat_reg), I915_READ(pp_ctrl_reg)); -if (_wait_for ((I915_READ (pp_stat_reg) & mask) == value,5000 ,10 )) { +if (_wait_for ((I915_READ (pp_stat_reg) & mask) == value, +5 *USEC_PER_SEC ,10 *USEC_PER_MSEC ))DRM_ERROR ("Panel status timeout: status %08x control %08x\n" ,I915_READ (pp_stat_reg),I915_READ (pp_ctrl_reg)); - }DRM_DEBUG_KMS ("Wait complete\n" ); }
drivers/gpu/drm/i915/intel_drv.h +8 -7
@@ -45,8 +45,8 @@* having timed out, since the timeout could be due to preemption or similar and * we've never had a chance to check the condition before the timeout. */ -#define _wait_for (COND ,MS ,W ) ({ \ - unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \ +#define _wait_for (COND ,US ,W ) ({ \ + unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \ int ret__ = 0; \ while (!(COND)) { \ if (time_after(jiffies, timeout__)) { \
@@ -55,7 +55,7 @@break ; \ } \if ((W ) &&drm_can_sleep ()) { \ -usleep_range ((W )*1000 , (W )*2000 ); \ +usleep_range ((W ), (W )*2 ); \ }else { \cpu_relax (); \ } \
@@ -63,10 +63,11 @@ ret__; \ }) -#define wait_for (COND ,MS ) _wait_for(COND, MS, 1) -#define wait_for_atomic (COND ,MS ) _wait_for(COND, MS, 0) -#define wait_for_atomic_us (COND ,US ) _wait_for((COND), \ - DIV_ROUND_UP((US), 1000), 0) +#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 1000) +#define wait_for_us (COND ,US ) _wait_for((COND), (US), 1) + +#define wait_for_atomic (COND ,MS ) _wait_for((COND), (MS) * 1000, 0) +#define wait_for_atomic_us (COND ,US ) _wait_for((COND), (US), 0)#define KHz (x) (1000 * (x))#define MHz (x) KHz(1000 * (x))
drivers/gpu/drm/i915/intel_psr.c +2 -1
@@ -507,7 +507,8 @@ static void hsw_psr_disable(struct intel_dp *intel_dp)/* Wait till PSR is idle */ if (_wait_for ((I915_READ (EDP_PSR_STATUS_CTL ) & -EDP_PSR_STATUS_STATE_MASK ) ==0 ,2000 ,10 )) +EDP_PSR_STATUS_STATE_MASK ) ==0 , +2 *USEC_PER_SEC ,10 *USEC_PER_MSEC ))DRM_ERROR ("Timed out waiting for PSR Idle State\n" ); dev_priv->psr.active = false;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/12 drm/i915: Do not wait atomically for display clocks
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Looks like this code does not need to wait atomically since it otherwise takes the mutex.
--- drivers/gpu/drm/i915/intel_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -4
@@ -9753,8 +9753,8 @@ static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) val |=LCPLL_CD_SOURCE_FCLK ;I915_WRITE (LCPLL_CTL , val); -if (wait_for_atomic_us (I915_READ (LCPLL_CTL ) & -LCPLL_CD_SOURCE_FCLK_DONE ,1 )) +if (wait_for_us (I915_READ (LCPLL_CTL ) & +LCPLL_CD_SOURCE_FCLK_DONE ,1 ))DRM_ERROR ("Switching to FCLK failed\n" ); val =I915_READ (LCPLL_CTL );
@@ -9788,8 +9788,8 @@ static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) val &= ~LCPLL_CD_SOURCE_FCLK ;I915_WRITE (LCPLL_CTL , val); -if (wait_for_atomic_us ((I915_READ (LCPLL_CTL ) & -LCPLL_CD_SOURCE_FCLK_DONE ) ==0 ,1 )) +if (wait_for_us ((I915_READ (LCPLL_CTL ) & +LCPLL_CD_SOURCE_FCLK_DONE ) ==0 ,1 ))DRM_ERROR ("Switching back to LCPLL failed\n" );mutex_lock (&dev_priv->rps.hw_lock);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 02/12] drm/i915: Do not wait atomically for display clocks
Quoted 17 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Looks like this code does not need to wait atomically since it otherwise takes the mutex.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Ville Syrjälä <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) · line 9757
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +2
-2@@ -9753,8 +9753,8 @@ static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) val |=LCPLL_CD_SOURCE_FCLK ;I915_WRITE (LCPLL_CTL , val); -if (wait_for_atomic_us (I915_READ (LCPLL_CTL ) & -LCPLL_CD_SOURCE_FCLK_DONE ,1 )) +if (wait_for_us (I915_READ (LCPLL_CTL ) & +LCPLL_CD_SOURCE_FCLK_DONE ,1 ))
Thinking about wait_for_seconds and friends from before, does this read better as
if (wait_for(I915_READ(LCPLL_CTL) & LCPLL_CD_SOURCE_FCLK_DONE,
wait_for_microseconds(1))
?
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 02/12] drm/i915: Do not wait atomically for display clocks
Quoted 29 lines · Chris Wilson
Quoted 17 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Looks like this code does not need to wait atomically since it otherwise takes the mutex.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Ville Syrjälä <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0drivers/gpu/drm/i915/intel_display.c static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) · line 9757
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +2
-2@@ -9753,8 +9753,8 @@ static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) val |=LCPLL_CD_SOURCE_FCLK ;I915_WRITE (LCPLL_CTL , val); -if (wait_for_atomic_us (I915_READ (LCPLL_CTL ) & -LCPLL_CD_SOURCE_FCLK_DONE ,1 )) +if (wait_for_us (I915_READ (LCPLL_CTL ) & +LCPLL_CD_SOURCE_FCLK_DONE ,1 ))Thinking about
wait_for_secondsand friends from before, does this read better as
Quoted 4 lines
if (wait_for(I915_READ(LCPLL_CTL) &
LCPLL_CD_SOURCE_FCLK_DONE,
wait_for_microseconds(1))
?
-Chris
No, not really, because it confuses a function (or macro) that tests for a condition with one that converts between different units of time, yet they both have names beginning wait_for...
And people might expect a function called wait_for_microseconds() to actually wait for some number of microseconds!
There's an ambiguity in English anyway e.g. "wait for a bus" (event) vs "wait for 10 minutes" (duration). But there's no need to propagate natural-language foolishness into code.
What we're really trying to express is
({ while (!condition && !timedout)
delay(interval)
resultis timedout; })
but there's still a question about, why should the granularity of the delay be related to the precision of the timespec? With these patches, we've got a situation where if the timeout is specified in us, the delay between rechecking the condition is 1us, but if the timeout is in ms, there's a 1ms recheck interval.
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 02/12] drm/i915: Do not wait atomically for display clocks
Quoted 35 lines · Dave Gordon
Quoted 29 lines · Chris Wilson
Quoted 17 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Looks like this code does not need to wait atomically since it otherwise takes the mutex.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Ville Syrjälä <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0drivers/gpu/drm/i915/intel_display.c static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) · line 9757
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +2
-2@@ -9753,8 +9753,8 @@ static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) val |=LCPLL_CD_SOURCE_FCLK ;I915_WRITE (LCPLL_CTL , val); -if (wait_for_atomic_us (I915_READ (LCPLL_CTL ) & -LCPLL_CD_SOURCE_FCLK_DONE ,1 )) +if (wait_for_us (I915_READ (LCPLL_CTL ) & +LCPLL_CD_SOURCE_FCLK_DONE ,1 ))Thinking about
wait_for_secondsand friends from before, does this read better asQuoted 4 lines
if (wait_for(I915_READ(LCPLL_CTL) &
LCPLL_CD_SOURCE_FCLK_DONE,
wait_for_microseconds(1))
?
-Chris
Quoted 6 lines
No, not really, because it confuses a function (or macro) that tests for a condition with one that converts between different units of time, yet they both have names beginning
wait_for...And people might expect a function called
wait_for_microseconds()to actually wait for some number of microseconds!
So, suggest an improvement. ms_to_us, msec_to_usec, MSEC_TO_USEC, SEC_TO_USEC, timeout_in_microseconds, timeout_in_millseconds, timeout_in_seconds. But since this is specific to the wait_for interface, they need to reflect that, so wait_timeout_in_seconds, but that is too general (now we are treading on wait_event territory), so back to wait_for_seconds_timeout()?
On the other hand, msecs_to_jiffies().
My question is whether having a universal wait_for() macro is preferrable over having both wait_for() and wait_for_us() and passing in million+ numbers.
Quoted 3 lines
There's an ambiguity in English anyway e.g. "wait for a bus" (event) vs "wait for 10 minutes" (duration). But there's no need to propagate natural-language foolishness into code.
Oh, you are misinterpreting the name. It was meant to be wait_for (the interface name) + _units.
Quoted 11 lines
What we're really trying to express is
({ while (!condition && !timedout)
delay(interval)
resultis timedout; })but there's still a question about, why should the granularity of the delay be related to the precision of the timespec? With these patches, we've got a situation where if the timeout is specified in us, the delay between rechecking the condition is 1us, but if the timeout is in ms, there's a 1ms recheck interval.
Why not? The original intent was for checking status changes across tens of microseconds where we wanted a coarse granularity and there was no impetus for high accuracy. Then this was copy-pasted into a new routine for microsecond resoluation, and again there was no demand for fine control over the interval. Nor has anyone really looked at whether 1us is a good figure for the "high resolution" waits - except for a couple of instances where a different value has been seemingly arbitrarily chosen. We have talked about using timeout/N or an exponential interval.
If I had chosen wait_until() as the name, that would have saved a few brain cells. But I can't see a way to avoid the name proliferation for _atomic, _with_interval like wait_event. At the least, we can trim that down by avoiding encoding the units into the macro name. We also probably don't yet need the _with_interval, so the only question is whether it is possible to have a single macro suitable for waits from 1us to 1s (and a second macro wait_for_atomic that operates in microseconds for good reason).
ret = wait_for(I915_READ(LCPLL_CTL) & LCPLL_CD_SOURCE_FCLK_DONE, 1);
and
ret = wait_for((I915_READ(dpll_reg) & port_mask) == expected_mask,
secs_to_usecs(1));
Is it possible to have a single dtrt macro to cover such a range? -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/12 drm/i915/guc: Do not wait for firmware load atomically
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
It does not look like this code needs to wait atomically?
Higher in the call chain it calls the GEM API and I do not see that the section is under any spin locks or such.
--- drivers/gpu/drm/i915/intel_guc_loader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_guc_loader.c +3 -3
@@ -199,7 +199,7 @@ static void set_guc_init_params(struct drm_i915_private *dev_priv)* the value matches either of two values representing completion * of the GuC boot process. * -* This is used for polling the GuC status in a wait_for_atomic() +* This is used for polling the GuC status in a wait_for() * loop below. */ static inline bool guc_ucode_response(struct drm_i915_private *dev_priv,
@@ -259,14 +259,14 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv)I915_WRITE (DMA_CTRL ,_MASKED_BIT_ENABLE (UOS_MOVE |START_DMA ));/* -* Spin-wait for the DMA to complete & the GuC to start up. +* Wait for the DMA to complete & the GuC to start up. * NB: Docs recommend not using the interrupt for completion. * Measurements indicate this should take no more than 20ms, so a * timeout here indicates that the GuC has failed and is unusable. * (Higher levels of the driver will attempt to fall back to * execlist mode if this happens.) */ - ret =wait_for_atomic (guc_ucode_response (dev_priv, &status),100 ); + ret =wait_for (guc_ucode_response (dev_priv, &status),100 );DRM_DEBUG_DRIVER ("DMA status 0x%x, GuC status 0x%x\n" ,I915_READ (DMA_CTRL ), status);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/12] drm/i915/guc: Do not wait for firmware load atomically
Quoted 33 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
It does not look like this code needs to wait atomically?
Higher in the call chain it calls the GEM API and I do not see that the section is under any spin locks or such.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Alex Dai <[email protected]>--- drivers/gpu/drm/i915/intel_guc_loader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_guc_loader.c +2
-2@@ -199,7 +199,7 @@ static void set_guc_init_params(struct drm_i915_private *dev_priv)* the value matches either of two values representing completion * of the GuC boot process. * -* This is used for polling the GuC status in a wait_for_atomic() +* This is used for polling the GuC status in a wait_for() * loop below. */ static inline bool guc_ucode_response(struct drm_i915_private *dev_priv,@@ -259,14 +259,14 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv)I915_WRITE (DMA_CTRL ,_MASKED_BIT_ENABLE (UOS_MOVE |START_DMA ));/* -* Spin-wait for the DMA to complete & the GuC to start up. +* Wait for the DMA to complete & the GuC to start up. * NB: Docs recommend not using the interrupt for completion.
drivers/gpu/drm/i915/intel_guc_loader.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv) · line 272
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_loader.c +1
-1* Measurements indicate this should take no more than 20ms, so a * timeout here indicates that the GuC has failed and is unusable. * (Higher levels of the driver will attempt to fall back to * execlist mode if this happens.) */ - ret =wait_for_atomic (guc_ucode_response (dev_priv, &status),100 ); + ret =wait_for (guc_ucode_response (dev_priv, &status),100 );DRM_DEBUG_DRIVER ("DMA status 0x%x, GuC status 0x%x\n" ,I915_READ (DMA_CTRL ), status);
LGTM.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/12 drm/i915/lrc: Do not wait atomically when stopping engines
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
I do not see that this needs to be done atomically and up to one second is quite a long time to busy loop.
--- drivers/gpu/drm/i915/intel_lrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -1
@@ -1049,7 +1049,7 @@ void intel_logical_ring_stop(struct intel_engine_cs *ring)/* TODO: Is this correct with Execlists enabled? */ I915_WRITE_MODE (ring,_MASKED_BIT_ENABLE (STOP_RING )); -if (wait_for_atomic ((I915_READ_MODE (ring) &MODE_IDLE ) !=0 ,1000 )) { +if (wait_for ((I915_READ_MODE (ring) &MODE_IDLE ) !=0 ,1000 )) {DRM_ERROR ("%s :timed out trying to stop ring\n" , ring->name);return ; }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/12 drm/i915: Kconfig for extra driver debugging
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
v2: Added a submenu based on an idea by Chris Wilson.
--- drivers/gpu/drm/i915/Kconfig | 6 ++++++ drivers/gpu/drm/i915/Kconfig.debug | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 drivers/gpu/drm/i915/Kconfig.debug
drivers/gpu/drm/i915/Kconfig +6 -0
@@ -47,3 +47,9 @@ config DRM_I915_PRELIMINARY_HW_SUPPORT option changes the default for that module option. If in doubt, say "N". + +menu "drm/i915 Debugging" +depends on DRM_I915 +depends on EXPERT +source drivers/gpu/drm/i915/Kconfig.debug +endmenu
drivers/gpu/drm/i915/Kconfig.debug new file +12 -0
@@ -0,0 +1,12 @@ +config DRM_I915_DEBUG + bool "Enable additional driver debugging" + depends on DRM_I915 + default n + help + Choose this option to turn on extra driver debugging that may affect + performance but will catch some internal issues. + + Recommended for driver developers only. + + If in doubt, say "N". +
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/12 drm/i915: Do not lie about atomic wait granularity
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Currently the wait_for_atomic_us only allows for a millisecond granularity which is not nice towards callers requesting small micro-second waits.
Re-implement it so micro-second granularity is really supported and not just in the name of the macro.
v2:
* Warn when used from non-atomic context (if possible).
* Warn on too long atomic waits.
--- drivers/gpu/drm/i915/intel_drv.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +24 -3
@@ -63,11 +63,32 @@ ret__; \ }) +#if defined(CONFIG_DRM_I915_DEBUG ) && defined(CONFIG_PREEMPT_COUNT ) +#define _WAIT_FOR_ATOMIC_CHECK WARN_ON_ONCE(!in_atomic()) +#else +#define _WAIT_FOR_ATOMIC_CHECK do { } while(0) +#endif + +#define _wait_for_atomic (COND ,US ) ({ \ + unsigned long end__; \ + int ret__ = 0; \ + _WAIT_FOR_ATOMIC_CHECK; \ + BUILD_BUG_ON((US) > 50000); \ + end__ = (local_clock() >> 10) + (US) + 1; \ + while (!(COND)) { \ + if (time_after((unsigned long)(local_clock() >> 10), end__)) { \ + ret__ = -ETIMEDOUT; \ + break; \ + } \ + cpu_relax(); \ + } \ + ret__; \ +}) +#define wait_for (COND ,MS ) _wait_for(COND, (MS) * 1000, 1000)#define wait_for_us (COND ,US ) _wait_for(COND, US, 1) -#define wait_for_atomic (COND ,MS ) _wait_for(COND, MS, 0) -#define wait_for_atomic_us (COND ,US ) _wait_for((COND), \ - DIV_ROUND_UP((US), 1000), 0) +#define wait_for_atomic (COND ,MS ) _wait_for_atomic(COND, (MS) * 1000) +#define wait_for_atomic_us (COND ,US ) _wait_for_atomic((COND), (US))#define KHz (x) (1000 * (x))#define MHz (x) KHz(1000 * (x))
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 06/12] drm/i915: Do not lie about atomic wait granularity
Quoted 9 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Currently the
wait_for_atomic_usonly allows for a millisecond granularity which is not nice towards callers requesting small micro-second waits.Re-implement it so micro-second granularity is really supported and not just in the name of the macro.
Quoted 6 lines
v2:
* Warn when used from non-atomic context (if possible).
* Warn on too long atomic waits.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>
This also warns if we attempt to use a variable timeout as well, which is a bonus.
drivers/gpu/drm/i915/intel_drv.h line 66
Quoted 12 lines
drivers/gpu/drm/i915/intel_drv.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -63,11 +63,32 @@ ret__; \ }) +#if defined(CONFIG_DRM_I915_DEBUG ) && defined(CONFIG_PREEMPT_COUNT )
Ok, that took a little bit of digging to verify.
/* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */
drivers/gpu/drm/i915/intel_drv.h line 70
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +4
-0+#define _WAIT_FOR_ATOMIC_CHECK WARN_ON_ONCE(!in_atomic()) +#else +#define _WAIT_FOR_ATOMIC_CHECK do { } while(0) +#endif
Hmm, not often that we do indent inside #if, but when it is, it is more typically '# define'
Quoted 5 lines
drivers/gpu/drm/i915/intel_drv.h +5
-0+#define _wait_for_atomic (COND ,US ) ({ \ + unsigned long end__; \ + int ret__ = 0; \ + _WAIT_FOR_ATOMIC_CHECK; \ + BUILD_BUG_ON((US) > 50000); \
drivers/gpu/drm/i915/intel_drv.h line 86
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +10
-0+ end__ = (local_clock () >>10 ) + (US ) +1 ; \ +while (!(COND )) { \ +if (time_after ((unsigned long )(local_clock () >>10 ), end__)) { \ + ret__ = -ETIMEDOUT ; \ +break ; \ + } \ +cpu_relax (); \ + } \ + ret__; \ +})
Ok,
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 6/12 drm/i915: Do not lie about atomic wait granularity
From: Tvrtko Ursulin <[email protected]>
Currently the wait_for_atomic_us only allows for a millisecond granularity which is not nice towards callers requesting small micro-second waits.
Re-implement it so micro-second granularity is really supported and not just in the name of the macro.
v2:
* Warn when used from non-atomic context (if possible).
* Warn on too long atomic waits.
v3:
* Added comment explaining CONFIG_PREEMPT_COUNT.
* Fixed pre-processor indentation. (Chris Wilson)
--- drivers/gpu/drm/i915/intel_drv.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +29 -2
@@ -44,6 +44,10 @@* contexts. Note that it's important that we check the condition again after * having timed out, since the timeout could be due to preemption or similar and * we've never had a chance to check the condition before the timeout. +* +* TODO: When modesetting has fully transitioned to atomic, the below +* drm_can_sleep() can be removed and in_atomic()/!in_atomic() asserts +* added. */ #define _wait_for (COND ,US ,W ) ({ \ unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \
@@ -66,8 +70,31 @@#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 1000)#define wait_for_us (COND ,US ) _wait_for((COND), (US), 1) -#define wait_for_atomic (COND ,MS ) _wait_for((COND), (MS) * 1000, 0) -#define wait_for_atomic_us (COND ,US ) _wait_for((COND), (US), 0) +/* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */ +#if defined(CONFIG_DRM_I915_DEBUG ) && defined(CONFIG_PREEMPT_COUNT ) +# define _WAIT_FOR_ATOMIC_CHECK WARN_ON_ONCE(!in_atomic()) +#else +# define _WAIT_FOR_ATOMIC_CHECK do { } while(0) +#endif + +#define _wait_for_atomic (COND ,US ) ({ \ + unsigned long end__; \ + int ret__ = 0; \ + _WAIT_FOR_ATOMIC_CHECK; \ + BUILD_BUG_ON((US) > 50000); \ + end__ = (local_clock() >> 10) + (US) + 1; \ + while (!(COND)) { \ + if (time_after((unsigned long)(local_clock() >> 10), end__)) { \ + ret__ = -ETIMEDOUT; \ + break; \ + } \ + cpu_relax(); \ + } \ + ret__; \ +}) + +#define wait_for_atomic (COND ,MS ) _wait_for_atomic((COND), (MS) * 1000) +#define wait_for_atomic_us (COND ,US ) _wait_for_atomic((COND), (US))#define KHz (x) (1000 * (x))#define MHz (x) KHz(1000 * (x))
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/12 drm/i915: GEM operations need to be done under the big lock
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
VMA creation and GEM list management need the big lock.
v2:
Mutex unlock ended on the wrong path somehow. (0-day, Julia Lawall)
Not to mention drm_gem_object_unreference was there in existing code with no mutex held.
v3:
Some callers of i915_gem_object_create_stolen_for_preallocated already hold the lock so move the mutex into the other caller as well.
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 3 +++ drivers/gpu/drm/i915/intel_display.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +3 -0
@@ -635,6 +635,9 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,if (!drm_mm_initialized (&dev_priv->mm.stolen))return NULL ; +if (WARN_ON_ONCE (!mutex_is_locked (&dev->struct_mutex))) +return NULL ; +DRM_DEBUG_KMS ("creating preallocated stolen object: stolen_offset=%x, gtt_offset=%x, size=%x\n" , stolen_offset, gtt_offset, size);
drivers/gpu/drm/i915/intel_display.c +6 -2
@@ -2551,12 +2551,16 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,if (size_aligned *2 > dev_priv->gtt.stolen_usable_size)return false; +mutex_lock (&dev->struct_mutex); + obj =i915_gem_object_create_stolen_for_preallocated (dev, base_aligned, base_aligned, size_aligned); -if (!obj) +if (!obj) { +mutex_unlock (&dev->struct_mutex);return false; + } obj->tiling_mode = plane_config->tiling;if (obj->tiling_mode ==I915_TILING_X )
@@ -2569,12 +2573,12 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc, mode_cmd.modifier[0 ] = fb->modifier[0 ]; mode_cmd.flags =DRM_MODE_FB_MODIFIERS ; -mutex_lock (&dev->struct_mutex);if (intel_framebuffer_init (dev,to_intel_framebuffer (fb), &mode_cmd, obj)) {DRM_DEBUG_KMS ("intel fb init failed\n" ); goto out_unref_obj; } +mutex_unlock (&dev->struct_mutex);DRM_DEBUG_KMS ("initial plane fb obj %p\n" , obj);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/12] drm/i915: GEM operations need to be done under the big lock
Quoted 28 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
VMA creation and GEM list management need the big lock.
v2:
Mutex unlock ended on the wrong path somehow. (0-day, Julia Lawall)
Not to mention
drm_gem_object_unreferencewas there in existing code with no mutex held.v3:
Some callers of
i915_gem_object_create_stolen_for_preallocatedalready hold the lock so move the mutex into the other caller as well.Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/i915_gem_stolen.c | 3 +++ drivers/gpu/drm/i915/intel_display.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gem_stolen.c +0
-0
drivers/gpu/drm/i915/i915_gem_stolen.c i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, · line 639
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_stolen.c +2
-0@@ -635,6 +635,9 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,if (!drm_mm_initialized (&dev_priv->mm.stolen))return NULL ; +if (WARN_ON_ONCE (!mutex_is_locked (&dev->struct_mutex))) +return NULL ;
I'm not keen on !mutex_is_locked(), since it can also just be another thread holding the struct_mutex that grants us protection from this check. At least lockdep checks that the caller holds the lock. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 7/12 drm/i915: GEM operations need to be done under the big lock
From: Tvrtko Ursulin <[email protected]>
VMA creation and GEM list management need the big lock.
v2:
Mutex unlock ended on the wrong path somehow. (0-day, Julia Lawall)
Not to mention drm_gem_object_unreference was there in existing code with no mutex held.
v3:
Some callers of i915_gem_object_create_stolen_for_preallocated already hold the lock so move the mutex into the other caller as well.
v4:
Changed to lockdep_assert_held. (Chris Wilson)
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 2 ++ drivers/gpu/drm/i915/intel_display.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +2 -0
@@ -635,6 +635,8 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,if (!drm_mm_initialized (&dev_priv->mm.stolen))return NULL ; +lockdep_assert_held (&dev->struct_mutex); +DRM_DEBUG_KMS ("creating preallocated stolen object: stolen_offset=%x, gtt_offset=%x, size=%x\n" , stolen_offset, gtt_offset, size);
drivers/gpu/drm/i915/intel_display.c +6 -2
@@ -2551,12 +2551,16 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,if (size_aligned *2 > dev_priv->gtt.stolen_usable_size)return false; +mutex_lock (&dev->struct_mutex); + obj =i915_gem_object_create_stolen_for_preallocated (dev, base_aligned, base_aligned, size_aligned); -if (!obj) +if (!obj) { +mutex_unlock (&dev->struct_mutex);return false; + } obj->tiling_mode = plane_config->tiling;if (obj->tiling_mode ==I915_TILING_X )
@@ -2569,12 +2573,12 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc, mode_cmd.modifier[0 ] = fb->modifier[0 ]; mode_cmd.flags =DRM_MODE_FB_MODIFIERS ; -mutex_lock (&dev->struct_mutex);if (intel_framebuffer_init (dev,to_intel_framebuffer (fb), &mode_cmd, obj)) {DRM_DEBUG_KMS ("intel fb init failed\n" ); goto out_unref_obj; } +mutex_unlock (&dev->struct_mutex);DRM_DEBUG_KMS ("initial plane fb obj %p\n" , obj);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 07/12] drm/i915: GEM operations need to be done under the big lock
Quoted 13 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
VMA creation and GEM list management need the big lock.
v2:
Mutex unlock ended on the wrong path somehow. (0-day, Julia Lawall)
Not to mention
drm_gem_object_unreferencewas there in existing code with no mutex held.v3:
Quoted 7 lines
Some callers of
i915_gem_object_create_stolen_for_preallocatedalready hold the lock so move the mutex into the other caller as well.v4:
Changed to
lockdep_assert_held. (Chris Wilson)
To appease Daniel, I was thinking could we smarten up
include/linux/lockdep.h +11 -0
@@ -422,8 +422,19 @@ struct lock_class_key { };#define lockdep_depth (tsk) (0) +#ifdef CONFIG_POOR_MANS_LOCKDEP +#define __lockdep_check (l) \ + ({ __builtin_types_compatible_p(typeof(*l), struct mutex) ? \ + mutex_is_locked((struct mutex *)l) : \ + __builtin_types_compatible_p(typeof(*l), spinlock_t) ? \ + spin_is_locked((spinlock_t *)l) : \ + 0; }) +#define lockdep_assert_held (l) do { WARN_ON(!__lockdep_check(l)); } while (0) +#define lockdep_assert_held_once (l) do { WARN_ON_ONCE(!__lockdep_check(l)); } while (0) +#else #define lockdep_assert_held (l) do { (void)(l); } while (0)#define lockdep_assert_held_once (l) do { (void)(l); } while (0) +#endif #define lockdep_recursing (tsk) (0)
lib/Kconfig.debug +11 -0
@@ -1025,6 +1025,17 @@ config LOCKDEP select KALLSYMS select KALLSYMS_ALL +config POOR_MANS_LOCKDEP + bool "Lock debugging: cheap warning upon forgotten locks" + depends on !LOCKDEP + default n + help + This feature enables the kernel to WARN if it detects an inconsistency + in the locking. It is vastly less capable than PROVE_LOCKING but only + has a small runtime penalty. It may be useful for situations where + the overhead of lockdep is too great, but information can be gleaned + from the noise of enabling a WARN widescale. + config LOCK_STAT bool "Lock usage statistics" depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
into something that may fly upstream? Then we do get accurate lockdep warnings, and we could even enable the WARNs by distro-default (instead of lockdep).
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v4 07/12] drm/i915: GEM operations need to be done under the big lock
In reply to Tvrtko UrsulinQuoted 17 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
VMA creation and GEM list management need the big lock.
v2:
Mutex unlock ended on the wrong path somehow. (0-day, Julia Lawall)
Not to mention
drm_gem_object_unreferencewas there in existing code with no mutex held.v3:
Some callers of
i915_gem_object_create_stolen_for_preallocatedalready hold the lock so move the mutex into the other caller as well.
Quoted 6 lines
v4:
Changed to
lockdep_assert_held. (Chris Wilson)Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>
Also
:)
Daniel, what did you think of having a config option to turn lockdep_assert_held into WARN_ON(!mutex_is_locked()) when lockdep is not fully-enabled?
-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 v4 07/12] drm/i915: GEM operations need to be done under the big lock
Quoted 25 lines · Chris Wilson
Quoted 17 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
VMA creation and GEM list management need the big lock.
v2:
Mutex unlock ended on the wrong path somehow. (0-day, Julia Lawall)
Not to mention
drm_gem_object_unreferencewas there in existing code with no mutex held.v3:
Some callers of
i915_gem_object_create_stolen_for_preallocatedalready hold the lock so move the mutex into the other caller as well.Quoted 6 lines
v4:
Changed to
lockdep_assert_held. (Chris Wilson)Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>
Quoted 7 lines
Also
Reviewed-by Chris Wilson <[email protected]>:)
Daniel, what did you think of having a config option to turn
lockdep_assert_heldinto WARN_ON(!mutex_is_locked()) when lockdep is not fully-enabled?
I like, and kinda would even go as far as making it the default. But that might upset some performance concious folks, so Kconfig seems fine. Cany you please submit that to a wider audience? Then we'd never have to have this discussion again ;-)
Thanks, 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: [PATCH 07/12] drm/i915: GEM operations need to be done under the big lock
In reply to Tvrtko UrsulinQuoted 11 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
VMA creation and GEM list management need the big lock.
v2:
Mutex unlock ended on the wrong path somehow. (0-day, Julia Lawall)
Not to mention
drm_gem_object_unreferencewas there in existing code with no mutex held.
Quoted 7 lines
v3:
Some callers of
i915_gem_object_create_stolen_for_preallocatedalready hold the lock so move the mutex into the other caller as well.Signed-off-by Tvrtko Ursulin <[email protected]>
-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 8/12 drm/i915: Fix struct mutex vs. RPS lock inversion
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
RPS lock must be taken before the struct_mutex to avoid locking inversion. So stop grabbing it for the whole powersave initialization and instead only take it during the sections which need it.
Also, struct_mutex is not needed any more since dedicated RPS lock was added in:
commit 4fc688ce79772496503d22263d61b071a8fb596e
Author: Jesse Barnes <[email protected]>
Date: Fri Nov 2 11:14:01 2012 -0700
drm/i915: protect RPS/RC6 related accesses (including PCU) with a new mutex
Based on prototype patch by Chris Wilson and a subsequent mailing list discussion involving Ville, Imre, Chris and Daniel.
v2: More details in the commit.
--- drivers/gpu/drm/i915/intel_display.c | 4 ---- drivers/gpu/drm/i915/intel_pm.c | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -4
@@ -15995,9 +15995,7 @@ void intel_modeset_gem_init(struct drm_device *dev)struct drm_i915_gem_object *obj;int ret; -mutex_lock (&dev->struct_mutex);intel_init_gt_powersave (dev); -mutex_unlock (&dev->struct_mutex);intel_modeset_init_hw (dev);
@@ -16077,9 +16075,7 @@ void intel_modeset_cleanup(struct drm_device *dev)intel_cleanup_overlay (dev); -mutex_lock (&dev->struct_mutex);intel_cleanup_gt_powersave (dev); -mutex_unlock (&dev->struct_mutex);intel_teardown_gmbus (dev); }
drivers/gpu/drm/i915/intel_pm.c +5 -4
@@ -5175,8 +5175,6 @@ static void cherryview_setup_pctx(struct drm_device *dev)u32 pcbr;int pctx_size =32 *1024 ; -WARN_ON (!mutex_is_locked (&dev->struct_mutex)); - pcbr =I915_READ (VLV_PCBR );if ((pcbr >>VLV_PCBR_ADDR_SHIFT ) ==0 ) {DRM_DEBUG_DRIVER ("BIOS didn't set up PCBR, fixing up\n" );
@@ -5198,7 +5196,7 @@ static void valleyview_setup_pctx(struct drm_device *dev)u32 pcbr;int pctx_size =24 *1024 ; -WARN_ON (!mutex_is_locked (&dev->struct_mutex)); +mutex_lock (&dev->struct_mutex); pcbr =I915_READ (VLV_PCBR );if (pcbr) {
@@ -5226,7 +5224,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) pctx =i915_gem_object_create_stolen (dev, pctx_size);if (!pctx) {DRM_DEBUG ("not enough stolen space for PCTX, disabling\n" ); -return ; + goto out; } pctx_paddr = dev_priv->mm.stolen_base + pctx->stolen->start;
@@ -5235,6 +5233,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) out:DRM_DEBUG_DRIVER ("PCBR: 0x%08x\n" ,I915_READ (VLV_PCBR )); dev_priv->vlv_pctx = pctx; +mutex_unlock (&dev->struct_mutex); }static void valleyview_cleanup_pctx (struct drm_device *dev)
@@ -5244,8 +5243,10 @@ static void valleyview_cleanup_pctx(struct drm_device *dev)if (WARN_ON (!dev_priv->vlv_pctx))return ; +mutex_lock (&dev->struct_mutex);drm_gem_object_unreference (&dev_priv->vlv_pctx->base); dev_priv->vlv_pctx =NULL ; +mutex_unlock (&dev->struct_mutex); }static void valleyview_init_gt_powersave (struct drm_device *dev)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/12] drm/i915: Fix struct mutex vs. RPS lock inversion
Quoted 47 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
RPS lock must be taken before the
struct_mutexto avoid locking inversion. So stop grabbing it for the whole powersave initialization and instead only take it during the sections which need it.Also,
struct_mutexis not needed any more since dedicated RPS lock was added in:commit
4fc688ce79772496503d22263d61b071a8fb596e
Author: Jesse Barnes <[email protected]>
Date: Fri Nov 2 11:14:01 2012 -0700drm/i915: protect RPS/RC6 related accesses (including PCU) with a new mutex
Based on prototype patch by Chris Wilson and a subsequent mailing list discussion involving Ville, Imre, Chris and Daniel.
v2: More details in the commit.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Ville Syrjälä <[email protected]>Cc Imre Deak <[email protected]>Cc Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 4 ---- drivers/gpu/drm/i915/intel_pm.c | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-2@@ -15995,9 +15995,7 @@ void intel_modeset_gem_init(struct drm_device *dev)struct drm_i915_gem_object *obj;int ret; -mutex_lock (&dev->struct_mutex);intel_init_gt_powersave (dev); -mutex_unlock (&dev->struct_mutex);intel_modeset_init_hw (dev);
drivers/gpu/drm/i915/intel_display.c void intel_modeset_cleanup(struct drm_device *dev) · line 16082
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0
-2@@ -16077,9 +16075,7 @@ void intel_modeset_cleanup(struct drm_device *dev)intel_cleanup_overlay (dev); -mutex_lock (&dev->struct_mutex);intel_cleanup_gt_powersave (dev); -mutex_unlock (&dev->struct_mutex);
The whitespace no longer conveys meaning, it used to be to clearly mark the mutex section.
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -5235,6 +5233,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) out:DRM_DEBUG_DRIVER ("PCBR: 0x%08x\n" ,I915_READ (VLV_PCBR )); dev_priv->vlv_pctx = pctx; +mutex_unlock (&dev->struct_mutex); }static void valleyview_cleanup_pctx (struct drm_device *dev)
drivers/gpu/drm/i915/intel_display.c static void valleyview_cleanup_pctx(struct drm_device *dev) · line 5249
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +2
-0@@ -5244,8 +5243,10 @@ static void valleyview_cleanup_pctx(struct drm_device *dev)if (WARN_ON (!dev_priv->vlv_pctx))return ; +mutex_lock (&dev->struct_mutex);drm_gem_object_unreference (&dev_priv->vlv_pctx->base); dev_priv->vlv_pctx =NULL ; +mutex_unlock (&dev->struct_mutex);
This made me smile.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/12] drm/i915: Fix struct mutex vs. RPS lock inversion
Quoted 49 lines · Chris Wilson
Quoted 48 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
RPS lock must be taken before the
struct_mutexto avoid locking inversion. So stop grabbing it for the whole powersave initialization and instead only take it during the sections which need it.Also,
struct_mutexis not needed any more since dedicated RPS lock was added in:commit
4fc688ce79772496503d22263d61b071a8fb596e
Author: Jesse Barnes <[email protected]>
Date: Fri Nov 2 11:14:01 2012 -0700drm/i915: protect RPS/RC6 related accesses (including PCU) with a new mutex
Based on prototype patch by Chris Wilson and a subsequent mailing list discussion involving Ville, Imre, Chris and Daniel.
v2: More details in the commit.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Ville Syrjälä <[email protected]>Cc Imre Deak <[email protected]>Cc Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 4 ---- drivers/gpu/drm/i915/intel_pm.c | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-2@@ -15995,9 +15995,7 @@ void intel_modeset_gem_init(struct drm_device *dev)struct drm_i915_gem_object *obj;int ret; -mutex_lock (&dev->struct_mutex);intel_init_gt_powersave (dev); -mutex_unlock (&dev->struct_mutex);intel_modeset_init_hw (dev);@@ -16077,9 +16075,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c void intel_modeset_cleanup(struct drm_device *dev) · line 16082
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +0
-2intel_cleanup_overlay (dev); -mutex_lock (&dev->struct_mutex);intel_cleanup_gt_powersave (dev); -mutex_unlock (&dev->struct_mutex);The whitespace no longer conveys meaning, it used to be to clearly mark the mutex section.
Guess I can remove more lines of code and get credits for that. :D
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -5235,6 +5233,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) out:DRM_DEBUG_DRIVER ("PCBR: 0x%08x\n" ,I915_READ (VLV_PCBR )); dev_priv->vlv_pctx = pctx; +mutex_unlock (&dev->struct_mutex); }static void valleyview_cleanup_pctx (struct drm_device *dev)@@ -5244,8 +5243,10 @@ static void valleyview_cleanup_pctx(struct drm_device *dev)if (WARN_ON (!dev_priv->vlv_pctx))return ;
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c static void valleyview_cleanup_pctx(struct drm_device *dev) · line 5249
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +2
-0+mutex_lock (&dev->struct_mutex);drm_gem_object_unreference (&dev_priv->vlv_pctx->base); dev_priv->vlv_pctx =NULL ; +mutex_unlock (&dev->struct_mutex);This made me smile.
Yeah mechanical- want unreference_unlocked instead?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/12] drm/i915: Fix struct mutex vs. RPS lock inversion
Quoted 7 lines · Tvrtko Ursulin
Quoted 5 lines · Chris Wilson
Quoted 4 lines · Tvrtko Ursulin
drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -5244,8 +5243,10 @@ static void valleyview_cleanup_pctx(struct drm_device *dev)if (WARN_ON (!dev_priv->vlv_pctx))return ;
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c static void valleyview_cleanup_pctx(struct drm_device *dev) · line 5249
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +2
-0+mutex_lock (&dev->struct_mutex);drm_gem_object_unreference (&dev_priv->vlv_pctx->base); dev_priv->vlv_pctx =NULL ; +mutex_unlock (&dev->struct_mutex);This made me smile.
Yeah mechanical- want
unreference_unlockedinstead?
_unlocked() has the advantage of not suggesting that dev_priv->vlv_pctx needs to be part of the locked transaction (that's the bit that caused a double take).
But it really doesn't matter.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 8/12 drm/i915: Fix struct mutex vs. RPS lock inversion
In reply to Chris WilsonFrom: Tvrtko Ursulin <[email protected]>
RPS lock must be taken before the struct_mutex to avoid locking inversion. So stop grabbing it for the whole powersave initialization and instead only take it during the sections which need it.
Also, struct_mutex is not needed any more since dedicated RPS lock was added in:
commit 4fc688ce79772496503d22263d61b071a8fb596e
Author: Jesse Barnes <[email protected]>
Date: Fri Nov 2 11:14:01 2012 -0700
drm/i915: protect RPS/RC6 related accesses (including PCU) with a new mutex
Based on prototype patch by Chris Wilson and a subsequent mailing list discussion involving Ville, Imre, Chris and Daniel.
v2: More details in the commit.
v3: Use drm_gem_object_unreference_unlocked. (Chris Wilson)
--- drivers/gpu/drm/i915/intel_display.c | 4 ---- drivers/gpu/drm/i915/intel_pm.c | 9 ++++----- 2 files changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -4
@@ -15973,9 +15973,7 @@ void intel_modeset_gem_init(struct drm_device *dev)struct drm_i915_gem_object *obj;int ret; -mutex_lock (&dev->struct_mutex);intel_init_gt_powersave (dev); -mutex_unlock (&dev->struct_mutex);intel_modeset_init_hw (dev);
@@ -16055,9 +16053,7 @@ void intel_modeset_cleanup(struct drm_device *dev)intel_cleanup_overlay (dev); -mutex_lock (&dev->struct_mutex);intel_cleanup_gt_powersave (dev); -mutex_unlock (&dev->struct_mutex);intel_teardown_gmbus (dev); }
drivers/gpu/drm/i915/intel_pm.c +4 -5
@@ -5175,8 +5175,6 @@ static void cherryview_setup_pctx(struct drm_device *dev)u32 pcbr;int pctx_size =32 *1024 ; -WARN_ON (!mutex_is_locked (&dev->struct_mutex)); - pcbr =I915_READ (VLV_PCBR );if ((pcbr >>VLV_PCBR_ADDR_SHIFT ) ==0 ) {DRM_DEBUG_DRIVER ("BIOS didn't set up PCBR, fixing up\n" );
@@ -5198,7 +5196,7 @@ static void valleyview_setup_pctx(struct drm_device *dev)u32 pcbr;int pctx_size =24 *1024 ; -WARN_ON (!mutex_is_locked (&dev->struct_mutex)); +mutex_lock (&dev->struct_mutex); pcbr =I915_READ (VLV_PCBR );if (pcbr) {
@@ -5226,7 +5224,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) pctx =i915_gem_object_create_stolen (dev, pctx_size);if (!pctx) {DRM_DEBUG ("not enough stolen space for PCTX, disabling\n" ); -return ; + goto out; } pctx_paddr = dev_priv->mm.stolen_base + pctx->stolen->start;
@@ -5235,6 +5233,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) out:DRM_DEBUG_DRIVER ("PCBR: 0x%08x\n" ,I915_READ (VLV_PCBR )); dev_priv->vlv_pctx = pctx; +mutex_unlock (&dev->struct_mutex); }static void valleyview_cleanup_pctx (struct drm_device *dev)
@@ -5244,7 +5243,7 @@ static void valleyview_cleanup_pctx(struct drm_device *dev)if (WARN_ON (!dev_priv->vlv_pctx))return ; -drm_gem_object_unreference (&dev_priv->vlv_pctx->base); +drm_gem_object_unreference_unlocked (&dev_priv->vlv_pctx->base); dev_priv->vlv_pctx =NULL ; }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 08/12] drm/i915: Fix struct mutex vs. RPS lock inversion
Quoted 22 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
RPS lock must be taken before the
struct_mutexto avoid locking inversion. So stop grabbing it for the whole powersave initialization and instead only take it during the sections which need it.Also,
struct_mutexis not needed any more since dedicated RPS lock was added in:commit
4fc688ce79772496503d22263d61b071a8fb596e
Author: Jesse Barnes <[email protected]>
Date: Fri Nov 2 11:14:01 2012 -0700drm/i915: protect RPS/RC6 related accesses (including PCU) with a new mutex
Based on prototype patch by Chris Wilson and a subsequent mailing list discussion involving Ville, Imre, Chris and Daniel.
v2: More details in the commit.
Quoted 7 lines
v3: Use
drm_gem_object_unreference_unlocked. (Chris Wilson)Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Ville Syrjälä <[email protected]>Cc Imre Deak <[email protected]>Cc Daniel Vetter <[email protected]>
-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 9/12 drm/i915/ilk: Move register read under spinlock
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Code does read-modify-write but the read was outside the lock.
It is fine since the caller holds struct mutex, but if we correct this we open up the opportunity for decreasing the mutex duration time since the call to ironlake_enable_drps does not need it any longer since it is covered by the mchdev_lock lock.
--- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +4 -2
@@ -4112,11 +4112,13 @@ bool ironlake_set_drps(struct drm_device *dev, u8 val)static void ironlake_enable_drps (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -u32 rgvmodectl =I915_READ (MEMMODECTL ); +u32 rgvmodectl;u8 fmax, fmin, fstart, vstart;spin_lock_irq (&mchdev_lock); + rgvmodectl =I915_READ (MEMMODECTL ); +/* Enable temp reporting */ I915_WRITE16 (PMMISC ,I915_READ (PMMISC ) |MCPPCE_EN );I915_WRITE16 (TSC1 ,I915_READ (TSC1 ) |TSE );
@@ -6189,8 +6191,8 @@ void intel_enable_gt_powersave(struct drm_device *dev)return ;if (IS_IRONLAKE_M (dev)) { -mutex_lock (&dev->struct_mutex);ironlake_enable_drps (dev); +mutex_lock (&dev->struct_mutex);intel_init_emon (dev);mutex_unlock (&dev->struct_mutex); }else if (INTEL_INFO (dev)->gen >=6 ) {
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 09/12] drm/i915/ilk: Move register read under spinlock
Quoted 4 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Code does read-modify-write but the read was outside the lock.
Quoted 8 lines
It is fine since the caller holds struct mutex, but if we correct this we open up the opportunity for decreasing the mutex duration time since the call to
ironlake_enable_drpsdoes not need it any longer since it is covered by themchdev_locklock.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Daniel Vetter <[email protected]>
Makes sense,
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/12 drm/i915: Introduce dedicated object VMA iterator
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Purpose is to catch places which iterate the object VMA list without holding the big lock.
Implemented by open coding list_for_each_entry to make the macro compatible with existing call sites.
v2: Error capture runs without the mutex so iterate directly from there.
v3: Replace WARN_ON with lockdep_assert_held. (Chris Wilson, Daniel Vetter)
v4: Moved under dedicated CONFIG_DRM_I915_DEBUG and back to WARN_ON.
--- drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++---- drivers/gpu/drm/i915/i915_drv.h | 11 +++++++++++ drivers/gpu/drm/i915/i915_gem.c | 24 ++++++++++++------------ drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/i915_gem_shrinker.c | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +4 -4
@@ -117,7 +117,7 @@ static u64 i915_gem_obj_total_ggtt_size(struct drm_i915_gem_object *obj)u64 size =0 ;struct i915_vma *vma; -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (i915_is_ggtt (vma->vm) &&drm_mm_node_allocated (&vma->node)) size += vma->node.size;
@@ -155,7 +155,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");if (obj->base.name)seq_printf (m," (name: %d)" , obj->base.name); -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (vma->pin_count >0 ) pin_count++; }
@@ -164,7 +164,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)seq_printf (m," (display)" );if (obj->fence_reg !=I915_FENCE_REG_NONE )seq_printf (m," (fence: %d)" , obj->fence_reg); -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {seq_printf (m," (%sgtt offset: %08llx, size: %08llx" ,i915_is_ggtt (vma->vm) ?"g" :"pp" , vma->node.start, vma->node.size);
@@ -342,7 +342,7 @@ static int per_file_stats(int id, void *ptr, void *data) stats->shared += obj->base.size;if (USES_FULL_PPGTT (obj->base.dev)) { -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {struct i915_hw_ppgtt *ppgtt;if (!drm_mm_node_allocated (&vma->node))
drivers/gpu/drm/i915/i915_drv.h +11 -0
@@ -2861,6 +2861,17 @@ struct drm_i915_gem_object *i915_gem_object_create_from_data(void i915_gem_free_object (struct drm_gem_object *obj);void i915_gem_vma_destroy (struct i915_vma *vma); +#ifdef CONFIG_DRM_I915_DEBUG +#define i915_gem_obj_for_each_vma (vma, obj) \ + for (WARN_ON_ONCE(!mutex_is_locked(&(obj)->base.dev->struct_mutex)), \ + vma = list_first_entry(&(obj)->vma_list, typeof(*vma), vma_link);\ + &vma->vma_link != (&(obj)->vma_list); \ + vma = list_next_entry(vma, vma_link)) +#else +#define i915_gem_obj_for_each_vma (vma, obj) \ + list_for_each_entry((vma), &(obj)->vma_list, vma_link) +#endif +/* Flags used by pin/bind&friends. */ #define PIN_MAPPABLE (1<<0)#define PIN_NONBLOCK (1<<1)
drivers/gpu/drm/i915/i915_gem.c +12 -12
@@ -2454,7 +2454,7 @@ i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring)list_move_tail (&obj->global_list, &to_i915 (obj->base.dev)->mm.bound_list); -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (!list_empty (&vma->mm_list))list_move_tail (&vma->mm_list, &vma->vm->inactive_list); }
@@ -3873,7 +3873,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,*/ } -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (!drm_mm_node_allocated (&vma->node))continue ;
@@ -3883,7 +3883,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, } } -list_for_each_entry (vma, &obj->vma_list, vma_link) +i915_gem_obj_for_each_vma (vma, obj) vma->node.color = cache_level; obj->cache_level = cache_level;
@@ -4613,7 +4613,7 @@ struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj, struct i915_address_space *vm) {struct i915_vma *vma; -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (vma->ggtt_view.type ==I915_GGTT_VIEW_NORMAL && vma->vm == vm)return vma;
@@ -4630,7 +4630,7 @@ struct i915_vma *i915_gem_obj_to_ggtt_view(struct drm_i915_gem_object *obj,if (WARN_ONCE (!view,"no view specified" ))return ERR_PTR (-EINVAL ); -list_for_each_entry (vma, &obj->vma_list, vma_link) +i915_gem_obj_for_each_vma (vma, obj)if (vma->vm == ggtt &&i915_ggtt_view_equal (&vma->ggtt_view, view))return vma;
@@ -5201,7 +5201,7 @@ u64 i915_gem_obj_offset(struct drm_i915_gem_object *o,WARN_ON (vm == &dev_priv->mm.aliasing_ppgtt->base); -list_for_each_entry (vma, &o->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, o) {if (i915_is_ggtt (vma->vm) && vma->ggtt_view.type !=I915_GGTT_VIEW_NORMAL )continue ;
@@ -5220,7 +5220,7 @@ u64 i915_gem_obj_ggtt_offset_view(struct drm_i915_gem_object *o,struct i915_address_space *ggtt =i915_obj_to_ggtt (o);struct i915_vma *vma; -list_for_each_entry (vma, &o->vma_list, vma_link) +i915_gem_obj_for_each_vma (vma, o)if (vma->vm == ggtt &&i915_ggtt_view_equal (&vma->ggtt_view, view))return vma->node.start;
@@ -5234,7 +5234,7 @@ bool i915_gem_obj_bound(struct drm_i915_gem_object *o, {struct i915_vma *vma; -list_for_each_entry (vma, &o->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, o) {if (i915_is_ggtt (vma->vm) && vma->ggtt_view.type !=I915_GGTT_VIEW_NORMAL )continue ;
@@ -5251,7 +5251,7 @@ bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o,struct i915_address_space *ggtt =i915_obj_to_ggtt (o);struct i915_vma *vma; -list_for_each_entry (vma, &o->vma_list, vma_link) +i915_gem_obj_for_each_vma (vma, o)if (vma->vm == ggtt &&i915_ggtt_view_equal (&vma->ggtt_view, view) &&drm_mm_node_allocated (&vma->node))
@@ -5264,7 +5264,7 @@ bool i915_gem_obj_bound_any(struct drm_i915_gem_object *o) {struct i915_vma *vma; -list_for_each_entry (vma, &o->vma_list, vma_link) +i915_gem_obj_for_each_vma (vma, o)if (drm_mm_node_allocated (&vma->node))return true;
@@ -5281,7 +5281,7 @@ unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o,BUG_ON (list_empty (&o->vma_list)); -list_for_each_entry (vma, &o->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, o) {if (i915_is_ggtt (vma->vm) && vma->ggtt_view.type !=I915_GGTT_VIEW_NORMAL )continue ;
@@ -5294,7 +5294,7 @@ unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o,bool i915_gem_obj_is_pinned (struct drm_i915_gem_object *obj) {struct i915_vma *vma; -list_for_each_entry (vma, &obj->vma_list, vma_link) +i915_gem_obj_for_each_vma (vma, obj)if (vma->pin_count >0 )return true;
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
@@ -3237,7 +3237,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev) vm = &dev_priv->gtt.base;list_for_each_entry (obj, &dev_priv->mm.bound_list, global_list) { flush = false; -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (vma->vm != vm)continue ;
drivers/gpu/drm/i915/i915_gem_shrinker.c +1 -1
@@ -52,7 +52,7 @@ static int num_vma_bound(struct drm_i915_gem_object *obj)struct i915_vma *vma;int count =0 ; -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (drm_mm_node_allocated (&vma->node)) count++;if (vma->pin_count)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Introduce dedicated object VMA iterator
Quoted 68 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Purpose is to catch places which iterate the object VMA list without holding the big lock.
Implemented by open coding
list_for_each_entryto make the macro compatible with existing call sites.v2: Error capture runs without the mutex so iterate directly from there.
v3: ReplaceWARN_ONwithlockdep_assert_held. (Chris Wilson, Daniel Vetter)
v4: Moved under dedicatedCONFIG_DRM_I915_DEBUGand back toWARN_ON.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Daniel Vetter <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++---- drivers/gpu/drm/i915/i915_drv.h | 11 +++++++++++ drivers/gpu/drm/i915/i915_gem.c | 24 ++++++++++++------------ drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/i915_gem_shrinker.c | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/i915_debugfs.c +4
-4@@ -117,7 +117,7 @@ static u64 i915_gem_obj_total_ggtt_size(struct drm_i915_gem_object *obj)u64 size =0 ;struct i915_vma *vma; -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (i915_is_ggtt (vma->vm) &&drm_mm_node_allocated (&vma->node)) size += vma->node.size;@@ -155,7 +155,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");if (obj->base.name)seq_printf (m," (name: %d)" , obj->base.name); -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (vma->pin_count >0 ) pin_count++; }@@ -164,7 +164,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)seq_printf (m," (display)" );if (obj->fence_reg !=I915_FENCE_REG_NONE )seq_printf (m," (fence: %d)" , obj->fence_reg); -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {seq_printf (m," (%sgtt offset: %08llx, size: %08llx" ,i915_is_ggtt (vma->vm) ?"g" :"pp" , vma->node.start, vma->node.size);@@ -342,7 +342,7 @@ static int per_file_stats(int id, void *ptr, void *data) stats->shared += obj->base.size;if (USES_FULL_PPGTT (obj->base.dev)) { -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {struct i915_hw_ppgtt *ppgtt;if (!drm_mm_node_allocated (&vma->node))drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_object *i915_gem_object_create_from_data( · line 2865
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -2861,6 +2861,17 @@ struct drm_i915_gem_object *i915_gem_object_create_from_data(void i915_gem_free_object (struct drm_gem_object *obj);void i915_gem_vma_destroy (struct i915_vma *vma); +#ifdef CONFIG_DRM_I915_DEBUG +#define i915_gem_obj_for_each_vma (vma, obj) \
This is the wrong name, i915_gem_object is the object on which we are iterating over, so i915_gem_object_.
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_object *i915_gem_object_create_from_data( · line 2866
Quoted 1 line
drivers/gpu/drm/i915/i915_drv.h +1
-0+ for (WARN_ON_ONCE(!mutex_is_locked(&(obj)->base.dev->struct_mutex)), \
I disagree that we should be doing i915-specific lockdep debugging and *ignoring* the core facilities. If we locked at RCU, they introduced a new set of _protected/_check interfaces, an idea that could also be used here to add this or something like this to the core. Something like
#define list_for_each_entry_check(pos, list, member, lock) \
for (typeof(*lock) == typeof(struct mutex) ? assert_lockdep_held(lock) : assert_spin_locked(lock); \
pos = list_first_entry(head, typeof(*pos), member); \
&pos->member != (head); \
pos = list_next_entry(pos, member))#define i915_gem_object_for_each_vma(vma, obj) \ list_for_each_entry_check(vma, &(obj)->vma_list, vma_link, &(obj)->base.dev->struct_mutex)
could be lifted easily, and makes i915_gem_object_for_each_vma() easier to understand (i.e. serves better as documentation).
Quoted 16 lines
drivers/gpu/drm/i915/i915_drv.h +8
-0+ vma =list_first_entry (&(obj)->vma_list,typeof (*vma), vma_link);\ + &vma->vma_link != (&(obj)->vma_list); \ + vma = list_next_entry(vma, vma_link)) +#else +#define i915_gem_obj_for_each_vma (vma, obj) \ + list_for_each_entry((vma), &(obj)->vma_list, vma_link) +#endif +/* Flags used by pin/bind&friends. */ #define PIN_MAPPABLE (1<<0)#define PIN_NONBLOCK (1<<1)drivers/gpu/drm/i915/i915_gem.c +0
-0
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring) · line 2457
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1
-1@@ -2454,7 +2454,7 @@ i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring)list_move_tail (&obj->global_list, &to_i915 (obj->base.dev)->mm.bound_list); -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {
This and the majority of the conversions simply should not exist and only do so because of what I consider to be bad API. After they are removed, there are only a few list iterators left. That said, there is value in documenting the current locking.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Introduce dedicated object VMA iterator
Quoted 72 lines · Chris Wilson
Quoted 71 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Purpose is to catch places which iterate the object VMA list without holding the big lock.
Implemented by open coding
list_for_each_entryto make the macro compatible with existing call sites.v2: Error capture runs without the mutex so iterate directly from there.
v3: ReplaceWARN_ONwithlockdep_assert_held. (Chris Wilson, Daniel Vetter)
v4: Moved under dedicatedCONFIG_DRM_I915_DEBUGand back toWARN_ON.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Daniel Vetter <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++---- drivers/gpu/drm/i915/i915_drv.h | 11 +++++++++++ drivers/gpu/drm/i915/i915_gem.c | 24 ++++++++++++------------ drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/i915_gem_shrinker.c | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/i915_debugfs.c +4
-4@@ -117,7 +117,7 @@ static u64 i915_gem_obj_total_ggtt_size(struct drm_i915_gem_object *obj)u64 size =0 ;struct i915_vma *vma; -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (i915_is_ggtt (vma->vm) &&drm_mm_node_allocated (&vma->node)) size += vma->node.size;@@ -155,7 +155,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");if (obj->base.name)seq_printf (m," (name: %d)" , obj->base.name); -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {if (vma->pin_count >0 ) pin_count++; }@@ -164,7 +164,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)seq_printf (m," (display)" );if (obj->fence_reg !=I915_FENCE_REG_NONE )seq_printf (m," (fence: %d)" , obj->fence_reg); -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {seq_printf (m," (%sgtt offset: %08llx, size: %08llx" ,i915_is_ggtt (vma->vm) ?"g" :"pp" , vma->node.start, vma->node.size);@@ -342,7 +342,7 @@ static int per_file_stats(int id, void *ptr, void *data) stats->shared += obj->base.size;if (USES_FULL_PPGTT (obj->base.dev)) { -list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {struct i915_hw_ppgtt *ppgtt;if (!drm_mm_node_allocated (&vma->node))drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -2861,6 +2861,17 @@ struct drm_i915_gem_object *i915_gem_object_create_from_data(void i915_gem_free_object (struct drm_gem_object *obj);void i915_gem_vma_destroy (struct i915_vma *vma);
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_object *i915_gem_object_create_from_data( · line 2865
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+#ifdef CONFIG_DRM_I915_DEBUG +#define i915_gem_obj_for_each_vma (vma, obj) \This is the wrong name,
i915_gem_objectis the object on which we are iterating over, soi915_gem_object_.
To me obj is just a shorthand for object, sorry. :) It sounds like bad naming if obj and object mean something functionally different. Imagine if request, req and rq meant something different. :D
Quoted 14 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_object *i915_gem_object_create_from_data( · line 2866
Quoted 1 line
drivers/gpu/drm/i915/i915_drv.h +1
-0+ for (WARN_ON_ONCE(!mutex_is_locked(&(obj)->base.dev->struct_mutex)), \I disagree that we should be doing i915-specific lockdep debugging and *ignoring* the core facilities. If we locked at RCU, they introduced a new set of _protected/_check interfaces, an idea that could also be used here to add this or something like this to the core. Something like
#define
list_for_each_entry_check(pos, list, member, lock)\for (typeof(*lock) == typeof(struct mutex) ? assert_lockdep_held(lock) : assert_spin_locked(lock); \ pos = list_first_entry(head, typeof(*pos), member); \ &pos->member != (head); \ pos = list_next_entry(pos, member))
Quoted 5 lines
#define i915_gem_object_for_each_vma(vma, obj) \ list_for_each_entry_check(vma, &(obj)->vma_list, vma_link, &(obj)->base.dev->struct_mutex)could be lifted easily, and makes
i915_gem_object_for_each_vma()easier to understand (i.e. serves better as documentation).
Don't know, needs buy-in from the relevant people, and depends on how useful to outside of i915 it would be. And if you can make lockdep_assert_held work in this context.
But I am also not sure all i915 debugging should be tied to lockdep debugging so to me it is not so clear-cut.
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i915/i915_drv.h +8
-0+ vma =list_first_entry (&(obj)->vma_list,typeof (*vma), vma_link);\ + &vma->vma_link != (&(obj)->vma_list); \ + vma = list_next_entry(vma, vma_link)) +#else +#define i915_gem_obj_for_each_vma (vma, obj) \ + list_for_each_entry((vma), &(obj)->vma_list, vma_link) +#endif +/* Flags used by pin/bind&friends. */ #define PIN_MAPPABLE (1<<0)#define PIN_NONBLOCK (1<<1)drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -2454,7 +2454,7 @@ i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring)list_move_tail (&obj->global_list, &to_i915 (obj->base.dev)->mm.bound_list);
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring) · line 2457
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem.c +1
-1-list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {This and the majority of the conversions simply should not exist and only do so because of what I consider to be bad API. After they are
Bad API or what you really meant was GEM internals should not do it? What is the harm anyway? More use, if it is painless, means less likelyhood for copy&paste errors in the future.
Quoted 2 lines
removed, there are only a few list iterators left. That said, there is value in documenting the current locking.
The last bit meaning exactly?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Introduce dedicated object VMA iterator
Quoted 10 lines · Tvrtko Ursulin
Quoted 9 lines · Chris Wilson
#define
list_for_each_entry_check(pos, list, member, lock)\for (typeof(*lock) == typeof(struct mutex) ? assert_lockdep_held(lock) : assert_spin_locked(lock); \ pos = list_first_entry(head, typeof(*pos), member); \ &pos->member != (head); \ pos = list_next_entry(pos, member))#define i915_gem_object_for_each_vma(vma, obj) \ list_for_each_entry_check(vma, &(obj)->vma_list, vma_link, &(obj)->base.dev->struct_mutex)
Quoted 6 lines
Quoted 2 lines
could be lifted easily, and makes
i915_gem_object_for_each_vma()easier to understand (i.e. serves better as documentation).Don't know, needs buy-in from the relevant people, and depends on how useful to outside of i915 it would be. And if you can make
lockdep_assert_heldwork in this context.
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
@@ -140,7 +140,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");if (obj->base.name)seq_printf (m," (name: %d)" , obj->base.name); -list_for_each_entry (vma, &obj->vma_list, obj_link) { +i915_gem_object_for_each_vma (vma, obj) {if (vma->pin_count >0 ) pin_count++; }
drivers/gpu/drm/i915/i915_drv.h +32 -0
@@ -3565,4 +3565,36 @@ int remap_io_mapping(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn, unsigned long size, struct io_mapping *iomap); +static __always_inline void __list_check_mutex(struct mutex *lock) +{ +lockdep_assert_held (lock); +} + +static __always_inline void __list_check_spin(struct spinlock *lock) +{ +assert_spin_locked (lock); +} + +static __always_inline void __list_check_bug(void *_lock) +{ +BUILD_BUG_ON ("unknown lock type" ); +} + +#define __list_check (lock) \ + ({ __builtin_types_compatible_p(typeof(*lock), struct mutex) ? \ + __list_check_mutex((struct mutex *)lock) : \ + __builtin_types_compatible_p(typeof(*lock), struct spinlock) ? \ + __list_check_spin((struct spinlock *)lock) : \ + __list_check_bug(lock); \ + 0; }) + +#define list_for_each_entry_check (pos, head, member, lock) \ + for (__list_check(lock), \ + pos = list_first_entry(head, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_next_entry(pos, member)) + +#define i915_gem_object_for_each_vma (vma, obj) \ + list_for_each_entry_check(vma, &(obj)->vma_list, obj_link, &(obj)->base.dev->struct_mutex) +#endif
Quoted 28 lines
But I am also not sure all i915 debugging should be tied to lockdep debugging so to me it is not so clear-cut.
Quoted 19 lines
Quoted 19 lines
(quoted diff) +8
-0+ vma = list_first_entry(&(obj)->vma_list, typeof(*vma), vma_link);\ + &vma->vma_link != (&(obj)->vma_list); \ + vma = list_next_entry(vma, vma_link)) +#else + #define i915_gem_obj_for_each_vma(vma, obj) \ + list_for_each_entry((vma), &(obj)->vma_list, vma_link) +#endif + /* Flags used by pin/bind&friends. */ #define PIN_MAPPABLE (1<<0) #define PIN_NONBLOCK (1<<1)drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -2454,7 +2454,7 @@ i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring)list_move_tail (&obj->global_list, &to_i915 (obj->base.dev)->mm.bound_list);Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring) · line 2457
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem.c +1
-1-list_for_each_entry (vma, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma (vma, obj) {This and the majority of the conversions simply should not exist and only do so because of what I consider to be bad API. After they are
Quoted 3 lines
Bad API or what you really meant was GEM internals should not do it? What is the harm anyway? More use, if it is painless, means less likelyhood for copy&paste errors in the future.
I mean we have many functions that walk the vma_list that have no purpose.
Quoted 4 lines
Quoted 2 lines
removed, there are only a few list iterators left. That said, there is value in documenting the current locking.
The last bit meaning exactly?
This patch (its precusor) did not find a bug, it generated a false-positive warning. It does have some usefulness for providing locking annotation. And in the future when the locking changes, it will be useful in verifying the callsites remain correct.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/12] drm/i915: Introduce dedicated object VMA iterator
Quoted 62 lines · Chris Wilson
Quoted 16 lines · Tvrtko Ursulin
Quoted 11 lines · Chris Wilson
#define
list_for_each_entry_check(pos, list, member, lock)\for (typeof(*lock) == typeof(struct mutex) ? assert_lockdep_held(lock) : assert_spin_locked(lock); \ pos = list_first_entry(head, typeof(*pos), member); \ &pos->member != (head); \ pos = list_next_entry(pos, member))#define i915_gem_object_for_each_vma(vma, obj) \ list_for_each_entry_check(vma, &(obj)->vma_list, vma_link, &(obj)->base.dev->struct_mutex)could be lifted easily, and makes
i915_gem_object_for_each_vma()easier to understand (i.e. serves better as documentation).Don't know, needs buy-in from the relevant people, and depends on how useful to outside of i915 it would be. And if you can make
lockdep_assert_heldwork in this context.drivers/gpu/drm/i915/i915_debugfs.c +1
-1@@ -140,7 +140,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");if (obj->base.name)seq_printf (m," (name: %d)" , obj->base.name); -list_for_each_entry (vma, &obj->vma_list, obj_link) { +i915_gem_object_for_each_vma (vma, obj) {if (vma->pin_count >0 ) pin_count++; }drivers/gpu/drm/i915/i915_drv.h +23
-0@@ -3565,4 +3565,36 @@ int remap_io_mapping(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn, unsigned long size, struct io_mapping *iomap); +static __always_inline void __list_check_mutex(struct mutex *lock) +{ +lockdep_assert_held (lock); +} + +static __always_inline void __list_check_spin(struct spinlock *lock) +{ +assert_spin_locked (lock); +} + +static __always_inline void __list_check_bug(void *_lock) +{ +BUILD_BUG_ON ("unknown lock type" ); +} + +#define __list_check (lock) \ + ({ __builtin_types_compatible_p(typeof(*lock), struct mutex) ? \ + __list_check_mutex((struct mutex *)lock) : \ + __builtin_types_compatible_p(typeof(*lock), struct spinlock) ? \ + __list_check_spin((struct spinlock *)lock) : \ + __list_check_bug(lock); \ + 0; }) +
drivers/gpu/drm/i915/i915_drv.h int remap_io_mapping(struct vm_area_struct *vma, · line 3600
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +9
-0+#define list_for_each_entry_check (pos, head, member, lock) \ + for (__list_check(lock), \ + pos = list_first_entry(head, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_next_entry(pos, member)) + +#define i915_gem_object_for_each_vma (vma, obj) \ + list_for_each_entry_check(vma, &(obj)->vma_list, obj_link, &(obj)->base.dev->struct_mutex) +#endif
Nice! Want to take it over? ;)
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/12 drm/i915: Introduce dedicated safe object VMA iterator
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Purpose is to catch places which iterate the object VMA list without holding the big lock.
Implemented by open coding list_for_each_entry_safe to make the macro compatible with existing call sites.
v2: Replace WARN_ON with lockdep_assert_held. (Chris Wilson, Daniel Vetter)
v3: Moved under dedicated CONFIG_DRM_I915_DEBUG and back to WARN_ON.
--- drivers/gpu/drm/i915/i915_drv.h | 10 ++++++++++ drivers/gpu/drm/i915/i915_gem.c | 6 +++--- drivers/gpu/drm/i915/i915_gem_shrinker.c | 3 +-- drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +10 -0
@@ -2867,9 +2867,19 @@ void i915_gem_vma_destroy(struct i915_vma *vma); vma =list_first_entry (&(obj)->vma_list,typeof (*vma), vma_link);\ &vma->vma_link != (&(obj)->vma_list); \ vma = list_next_entry(vma, vma_link)) + +#define i915_gem_obj_for_each_vma_safe (vma, next, obj) \ + for (WARN_ON_ONCE(!mutex_is_locked(&(obj)->base.dev->struct_mutex)), \ + vma = list_first_entry(&(obj)->vma_list, typeof(*vma), vma_link), \ + next = list_next_entry(vma, vma_link); \ + &vma->vma_link != (&(obj)->vma_list); \ + vma = next, next = list_next_entry(next, vma_link))#else #define i915_gem_obj_for_each_vma (vma, obj) \ list_for_each_entry((vma), &(obj)->vma_list, vma_link) + +#define i915_gem_obj_for_each_vma_safe (vma, next, obj) \ + list_for_each_entry_safe((vma), (next), &(obj)->vma_list, vma_link)#endif /* Flags used by pin/bind&friends. */
drivers/gpu/drm/i915/i915_gem.c +3 -3
@@ -272,7 +272,7 @@ drop_pages(struct drm_i915_gem_object *obj)int ret;drm_gem_object_reference (&obj->base); -list_for_each_entry_safe (vma, next, &obj->vma_list, vma_link) +i915_gem_obj_for_each_vma_safe (vma, next, obj)if (i915_vma_unbind (vma))break ;
@@ -3810,7 +3810,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,* catch the issue of the CS prefetch crossing page boundaries and * reading an invalid PTE on older architectures. */ -list_for_each_entry_safe (vma, next, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma_safe (vma, next, obj) {if (!drm_mm_node_allocated (&vma->node))continue ;
@@ -4556,7 +4556,7 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)trace_i915_gem_object_destroy (obj); -list_for_each_entry_safe (vma, next, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma_safe (vma, next, obj) {int ret; vma->pin_count =0 ;
drivers/gpu/drm/i915/i915_gem_shrinker.c +1 -2
@@ -175,8 +175,7 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,drm_gem_object_reference (&obj->base);/* For the unbound phase, this should be a no-op! */ -list_for_each_entry_safe (vma, v, - &obj->vma_list, vma_link) +i915_gem_obj_for_each_vma_safe (vma, v, obj)if (i915_vma_unbind (vma))break ;
drivers/gpu/drm/i915/i915_gem_userptr.c +1 -1
@@ -78,7 +78,7 @@ static void cancel_userptr(struct work_struct *work) was_interruptible = dev_priv->mm.interruptible; dev_priv->mm.interruptible = false; -list_for_each_entry_safe (vma, tmp, &obj->vma_list, vma_link) { +i915_gem_obj_for_each_vma_safe (vma, tmp, obj) {int ret =i915_vma_unbind (vma);WARN_ON (ret && ret != -EIO ); }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/12 drm/i915: Add BKL asserts to get page helpers
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Purpose is catching illegal callers.
v2: Replace WARN_ON with lockdep_assert_held. (Chris Wilson, Daniel Vetter)
v3: Moved under dedicated CONFIG_DRM_I915_DEBUG and back to WARN_ON.
--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2933,6 +2933,9 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n);static inline struct page *i915_gem_object_get_page (struct drm_i915_gem_object *obj,int n) { +#ifdef CONFIG_DRM_I915_DEBUG +WARN_ON_ONCE (!mutex_is_locked (&obj->base.dev->struct_mutex)); +#endif if (WARN_ON (n >= obj->base.size >>PAGE_SHIFT ))return NULL ;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/12] drm/i915: Add BKL asserts to get page helpers
Quoted 19 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Purpose is catching illegal callers.
v2: Replace
WARN_ONwithlockdep_assert_held. (Chris Wilson, Daniel Vetter)
v3: Moved under dedicatedCONFIG_DRM_I915_DEBUGand back toWARN_ON.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Daniel Vetter <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n); · line 2938
Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2933,6 +2933,9 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n);static inline struct page *i915_gem_object_get_page (struct drm_i915_gem_object *obj,int n) { +#ifdef CONFIG_DRM_I915_DEBUG +WARN_ON_ONCE (!mutex_is_locked (&obj->base.dev->struct_mutex)); +#endif
But lockdep gives us useful debug information!
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/12] drm/i915: Add BKL asserts to get page helpers
Quoted 15 lines · Chris Wilson
Quoted 14 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Purpose is catching illegal callers.
v2: Replace
WARN_ONwithlockdep_assert_held. (Chris Wilson, Daniel Vetter)
v3: Moved under dedicatedCONFIG_DRM_I915_DEBUGand back toWARN_ON.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Daniel Vetter <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ 1 file changed, 3 insertions(+)
Quoted 13 lines
drivers/gpu/drm/i915/i915_drv.h i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n); · line 2938
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2933,6 +2933,9 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n);static inline struct page *i915_gem_object_get_page (struct drm_i915_gem_object *obj,int n) { +#ifdef CONFIG_DRM_I915_DEBUG +WARN_ON_ONCE (!mutex_is_locked (&obj->base.dev->struct_mutex)); +#endif But lockdep gives us useful debug information!
But you can't stick in a for loop. That applies to the previous patch so this one is consistent with what CONFIG_DRM_I915_DEBUG does.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Misc locking fixes and GEM debugging
In reply to Tvrtko Ursulin== Summary ==
== Summary ==
Series 3006v1 Misc locking fixes and GEM debugging
http://patchwork.freedesktop.org/api/1.0/series/3006/revisions/1/mbox/
Test kms_pipe_crc_basic:
Subgroup read-crc-pipe-b-frame-sequence:
dmesg-warn -> PASS (skl-i5k-2)
Subgroup suspend-read-crc-pipe-b:
dmesg-warn -> PASS (byt-nuc)bdw-nuci7 total:156 pass:147 dwarn:0 dfail:0 fail:0 skip:9 bdw-ultra total:159 pass:147 dwarn:0 dfail:0 fail:0 skip:12 bsw-nuc-2 total:159 pass:129 dwarn:0 dfail:0 fail:0 skip:30 byt-nuc total:159 pass:136 dwarn:0 dfail:0 fail:0 skip:23 hsw-brixbox total:159 pass:146 dwarn:0 dfail:0 fail:0 skip:13 hsw-gt2 total:159 pass:149 dwarn:0 dfail:0 fail:0 skip:10 hsw-xps12 total:156 pass:146 dwarn:0 dfail:0 fail:0 skip:10 ilk-hp8440p total:159 pass:111 dwarn:0 dfail:0 fail:0 skip:48 ivb-t430s total:159 pass:145 dwarn:0 dfail:0 fail:0 skip:14 skl-i5k-2 total:159 pass:144 dwarn:1 dfail:0 fail:0 skip:14 snb-dellxps total:159 pass:137 dwarn:0 dfail:0 fail:0 skip:22 snb-x220t total:159 pass:137 dwarn:0 dfail:0 fail:1 skip:21
Results at /archive/results/CI_IGT_test/Patchwork_1340/
5d3deb0902a962218ad9b0e583e4d1bbdec29f9a drm-intel-nightly: 2016y-02m-01d-20h-05m-03s UTC integration manifest bb47195bb06eab046c89691d0a527ea47d5d8e3d drm/i915: Add BKL asserts to get page helpers c828ee3e795e318601e4b773b376a90e8f9fff30 drm/i915: Introduce dedicated safe object VMA iterator e2a01dfe5c15750e306f99c7a7eb74a3ede4e4a1 drm/i915: Introduce dedicated object VMA iterator cee676163abdbeae5b22ac87e99a3640c57ed717 drm/i915/ilk: Move register read under spinlock a94d4b0b39db5fb4eeadeaeb953f8bc76acece31 drm/i915: Fix struct mutex vs. RPS lock inversion fb1d051d6427b5536a2ad7022181dd5f87ef3f8e drm/i915: GEM operations need to be done under the big lock 3bf2524d60496461a3918c283f9f473f6330197d drm/i915: Do not lie about atomic wait granularity e9c67ede8f4a9063b6bf350f0084aa5d3fa3f41f drm/i915: Kconfig for extra driver debugging 9f3db6eb03d2ebc1266de2d998f2e194d2b9dd90 drm/i915/lrc: Do not wait atomically when stopping engines ca58ad5e9250cee3d0e3d1aa52e005bd5950407b drm/i915/guc: Do not wait for firmware load atomically 7de26a409b7911a17c7d2e231313b91a683c49cb drm/i915: Do not wait atomically for display clocks 666b46edb2e312b0afffca09b0d986b44f3b8775 drm/i915: Add wait_for_us
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx