diff mbox series

[2/7] drm/i915/vblank: fix context imbalance warnings

Message ID 111de5bee15f408de65b19ece4b68a7ac66b30cf.1724342644.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: conversion to struct intel_display | expand

Commit Message

Jani Nikula Aug. 22, 2024, 4:04 p.m. UTC
When building for xe, we get the context imbalance warning as the actual
locking/unlocking is not compiled:

../drivers/gpu/drm/i915/display/intel_vblank.c:306:13: warning: context imbalance in 'intel_vblank_section_enter' - wrong count at exit
../drivers/gpu/drm/i915/display/intel_vblank.c:314:13: warning: context imbalance in 'intel_vblank_section_exit' - wrong count at exit

Fix by adding separata stubs for xe without __acquires/__releases
annotation.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_vblank.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Rodrigo Vivi Aug. 22, 2024, 9:38 p.m. UTC | #1
On Thu, Aug 22, 2024 at 07:04:50PM +0300, Jani Nikula wrote:
> When building for xe, we get the context imbalance warning as the actual
> locking/unlocking is not compiled:
> 
> ../drivers/gpu/drm/i915/display/intel_vblank.c:306:13: warning: context imbalance in 'intel_vblank_section_enter' - wrong count at exit
> ../drivers/gpu/drm/i915/display/intel_vblank.c:314:13: warning: context imbalance in 'intel_vblank_section_exit' - wrong count at exit
> 
> Fix by adding separata stubs for xe without __acquires/__releases
> annotation.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_vblank.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c
> index 551e9ca9bb99..2073e8075af4 100644
> --- a/drivers/gpu/drm/i915/display/intel_vblank.c
> +++ b/drivers/gpu/drm/i915/display/intel_vblank.c
> @@ -303,21 +303,27 @@ int intel_crtc_scanline_to_hw(struct intel_crtc *crtc, int scanline)
>   * all register accesses to the same cacheline to be serialized,
>   * otherwise they may hang.
>   */
> +#ifdef I915
>  static void intel_vblank_section_enter(struct drm_i915_private *i915)
>  	__acquires(i915->uncore.lock)
>  {
> -#ifdef I915
>  	spin_lock(&i915->uncore.lock);
> -#endif
>  }
>  
>  static void intel_vblank_section_exit(struct drm_i915_private *i915)
>  	__releases(i915->uncore.lock)
>  {
> -#ifdef I915
>  	spin_unlock(&i915->uncore.lock);
> -#endif
>  }
> +#else
> +static void intel_vblank_section_enter(struct drm_i915_private *i915)
> +{
> +}
> +
> +static void intel_vblank_section_exit(struct drm_i915_private *i915)
> +{
> +}
> +#endif
>  
>  static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
>  				     bool in_vblank_irq,
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c
index 551e9ca9bb99..2073e8075af4 100644
--- a/drivers/gpu/drm/i915/display/intel_vblank.c
+++ b/drivers/gpu/drm/i915/display/intel_vblank.c
@@ -303,21 +303,27 @@  int intel_crtc_scanline_to_hw(struct intel_crtc *crtc, int scanline)
  * all register accesses to the same cacheline to be serialized,
  * otherwise they may hang.
  */
+#ifdef I915
 static void intel_vblank_section_enter(struct drm_i915_private *i915)
 	__acquires(i915->uncore.lock)
 {
-#ifdef I915
 	spin_lock(&i915->uncore.lock);
-#endif
 }
 
 static void intel_vblank_section_exit(struct drm_i915_private *i915)
 	__releases(i915->uncore.lock)
 {
-#ifdef I915
 	spin_unlock(&i915->uncore.lock);
-#endif
 }
+#else
+static void intel_vblank_section_enter(struct drm_i915_private *i915)
+{
+}
+
+static void intel_vblank_section_exit(struct drm_i915_private *i915)
+{
+}
+#endif
 
 static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
 				     bool in_vblank_irq,