From: Imre Deak <imre.deak@intel.com>
To: "Jani Nikula" <jani.nikula@linux.intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/4] drm/i915: Get rid of the _unchecked() runime pm stuff
Date: Tue, 11 Feb 2025 14:01:32 +0200 [thread overview]
Message-ID: <Z6s7-iqzVMSWMFXt@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <87ed043iy2.fsf@intel.com>
On Tue, Feb 11, 2025 at 11:54:29AM +0200, Jani Nikula wrote:
> On Tue, 11 Feb 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Seem to me that intel_runtime_pm.c already handles the
> > CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n case perfectly fine
> > internally, so I don't understand why it's being leaked into
> > all the callers as well. Get rid of all this the externally
> > visible _unchecked() stuff.
>
> I think I've sent a similar patch in the past, and I think Imre
> explained the rationale was that passing the wakeref around for
> non-debug builds increases code size by 1k or something.
Yes, in non-debug builds the
intel_runtime_pm_put(rpm, wakeref) calls are converted to
intel_runtime_pm_put_unchecked(rpm),
and the
intel_display_power_put(display, domain, wakeref) calls are converted to
intel_display_power_put_unchecked(display, domain).
The rational was that these are called from many (184) places, thus
saving ~2.5kB in code.
> Yet this optimization makes the code harder to read.
Ok, agree with this one and I'm not sure if the optimization justifies
it. I think the same could be achieved simpler (only a wakeref pointer
passed to intel_display_power_put(), deducing both display and domain
from the wakeref), so on the patch:
Reviewed-by: Imre Deak <imre.deak@intel.com>
> I'm a bit divided on this one.
>
> Cc: Imre
>
>
> BR,
> Jani.
>
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > .../drm/i915/display/intel_display_power.c | 24 ---------------
> > .../drm/i915/display/intel_display_power.h | 30 -------------------
> > drivers/gpu/drm/i915/intel_gvt.c | 3 --
> > drivers/gpu/drm/i915/intel_runtime_pm.c | 19 ------------
> > drivers/gpu/drm/i915/intel_runtime_pm.h | 9 ------
> > 5 files changed, 85 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
> > index d93f43d145a9..20296ab450bf 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > @@ -809,7 +809,6 @@ intel_display_power_flush_work_sync(struct intel_display *display)
> > drm_WARN_ON(display->drm, power_domains->async_put_wakeref);
> > }
> >
> > -#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
> > /**
> > * intel_display_power_put - release a power domain reference
> > * @display: display device instance
> > @@ -829,29 +828,6 @@ void intel_display_power_put(struct intel_display *display,
> > __intel_display_power_put(display, domain);
> > intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
> > }
> > -#else
> > -/**
> > - * intel_display_power_put_unchecked - release an unchecked power domain reference
> > - * @display: display device instance
> > - * @domain: power domain to reference
> > - *
> > - * This function drops the power domain reference obtained by
> > - * intel_display_power_get() and might power down the corresponding hardware
> > - * block right away if this is the last reference.
> > - *
> > - * This function is only for the power domain code's internal use to suppress wakeref
> > - * tracking when the corresponding debug kconfig option is disabled, should not
> > - * be used otherwise.
> > - */
> > -void intel_display_power_put_unchecked(struct intel_display *display,
> > - enum intel_display_power_domain domain)
> > -{
> > - struct drm_i915_private *dev_priv = to_i915(display->drm);
> > -
> > - __intel_display_power_put(display, domain);
> > - intel_runtime_pm_put_unchecked(&dev_priv->runtime_pm);
> > -}
> > -#endif
> >
> > void
> > intel_display_power_get_in_set(struct intel_display *display,
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h b/drivers/gpu/drm/i915/display/intel_display_power.h
> > index a3a5c1be8bab..52b8a89b96eb 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_power.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_power.h
> > @@ -195,7 +195,6 @@ void __intel_display_power_put_async(struct intel_display *display,
> > intel_wakeref_t wakeref,
> > int delay_ms);
> > void intel_display_power_flush_work(struct intel_display *display);
> > -#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
> > void intel_display_power_put(struct intel_display *display,
> > enum intel_display_power_domain domain,
> > intel_wakeref_t wakeref);
> > @@ -215,35 +214,6 @@ intel_display_power_put_async_delay(struct intel_display *display,
> > {
> > __intel_display_power_put_async(display, domain, wakeref, delay_ms);
> > }
> > -#else
> > -void intel_display_power_put_unchecked(struct intel_display *display,
> > - enum intel_display_power_domain domain);
> > -
> > -static inline void
> > -intel_display_power_put(struct intel_display *display,
> > - enum intel_display_power_domain domain,
> > - intel_wakeref_t wakeref)
> > -{
> > - intel_display_power_put_unchecked(display, domain);
> > -}
> > -
> > -static inline void
> > -intel_display_power_put_async(struct intel_display *display,
> > - enum intel_display_power_domain domain,
> > - intel_wakeref_t wakeref)
> > -{
> > - __intel_display_power_put_async(display, domain, INTEL_WAKEREF_DEF, -1);
> > -}
> > -
> > -static inline void
> > -intel_display_power_put_async_delay(struct intel_display *display,
> > - enum intel_display_power_domain domain,
> > - intel_wakeref_t wakeref,
> > - int delay_ms)
> > -{
> > - __intel_display_power_put_async(display, domain, INTEL_WAKEREF_DEF, delay_ms);
> > -}
> > -#endif
> >
> > void
> > intel_display_power_get_in_set(struct intel_display *display,
> > diff --git a/drivers/gpu/drm/i915/intel_gvt.c b/drivers/gpu/drm/i915/intel_gvt.c
> > index dae9dce7d1b3..164be5b8acb3 100644
> > --- a/drivers/gpu/drm/i915/intel_gvt.c
> > +++ b/drivers/gpu/drm/i915/intel_gvt.c
> > @@ -310,10 +310,7 @@ EXPORT_SYMBOL_NS_GPL(__intel_context_do_pin, "I915_GVT");
> > EXPORT_SYMBOL_NS_GPL(__intel_context_do_unpin, "I915_GVT");
> > EXPORT_SYMBOL_NS_GPL(intel_ring_begin, "I915_GVT");
> > EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_get, "I915_GVT");
> > -#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
> > EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_put, "I915_GVT");
> > -#endif
> > -EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_put_unchecked, "I915_GVT");
> > EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_for_reg, "I915_GVT");
> > EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_get, "I915_GVT");
> > EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_put, "I915_GVT");
> > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> > index 8d9f4c410546..070bafb0a460 100644
> > --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> > @@ -322,24 +322,6 @@ intel_runtime_pm_put_raw(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
> > __intel_runtime_pm_put(rpm, wref, false);
> > }
> >
> > -/**
> > - * intel_runtime_pm_put_unchecked - release an unchecked runtime pm reference
> > - * @rpm: the intel_runtime_pm structure
> > - *
> > - * This function drops the device-level runtime pm reference obtained by
> > - * intel_runtime_pm_get() and might power down the corresponding
> > - * hardware block right away if this is the last reference.
> > - *
> > - * This function exists only for historical reasons and should be avoided in
> > - * new code, as the correctness of its use cannot be checked. Always use
> > - * intel_runtime_pm_put() instead.
> > - */
> > -void intel_runtime_pm_put_unchecked(struct intel_runtime_pm *rpm)
> > -{
> > - __intel_runtime_pm_put(rpm, INTEL_WAKEREF_DEF, true);
> > -}
> > -
> > -#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
> > /**
> > * intel_runtime_pm_put - release a runtime pm reference
> > * @rpm: the intel_runtime_pm structure
> > @@ -353,7 +335,6 @@ void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
> > {
> > __intel_runtime_pm_put(rpm, wref, true);
> > }
> > -#endif
> >
> > /**
> > * intel_runtime_pm_enable - enable runtime pm
> > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.h b/drivers/gpu/drm/i915/intel_runtime_pm.h
> > index 7428bd8fa67f..6eee55e3ff0b 100644
> > --- a/drivers/gpu/drm/i915/intel_runtime_pm.h
> > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.h
> > @@ -204,16 +204,7 @@ intel_wakeref_t intel_runtime_pm_get_raw(struct intel_runtime_pm *rpm);
> > for ((wf) = intel_runtime_pm_get_if_active(rpm); (wf); \
> > intel_runtime_pm_put((rpm), (wf)), (wf) = NULL)
> >
> > -void intel_runtime_pm_put_unchecked(struct intel_runtime_pm *rpm);
> > -#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
> > void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref);
> > -#else
> > -static inline void
> > -intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
> > -{
> > - intel_runtime_pm_put_unchecked(rpm);
> > -}
> > -#endif
> > void intel_runtime_pm_put_raw(struct intel_runtime_pm *rpm, intel_wakeref_t wref);
> >
> > #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
>
> --
> Jani Nikula, Intel
next prev parent reply other threads:[~2025-02-11 12:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 0:01 [PATCH 0/4] drm/i915: More display power conversions Ville Syrjala
2025-02-11 0:01 ` [PATCH 1/4] drm/i915: Fix CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n build Ville Syrjala
2025-02-11 9:32 ` Jani Nikula
2025-02-11 0:01 ` [PATCH 2/4] drm/i915: Continue intel_display_power struct intel_display conversion Ville Syrjala
2025-02-11 9:35 ` Jani Nikula
2025-02-11 0:01 ` [PATCH 3/4] drm/i915/gvt: Stop using intel_runtime_pm_put_unchecked() Ville Syrjala
2025-02-11 9:38 ` Jani Nikula
2025-02-11 0:01 ` [PATCH 4/4] drm/i915: Get rid of the _unchecked() runime pm stuff Ville Syrjala
2025-02-11 9:54 ` Jani Nikula
2025-02-11 12:01 ` Imre Deak [this message]
2025-02-11 1:14 ` ✗ Fi.CI.SPARSE: warning for drm/i915: More display power conversions Patchwork
2025-02-11 3:07 ` ✓ i915.CI.BAT: success " Patchwork
2025-02-11 10:41 ` ✗ i915.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z6s7-iqzVMSWMFXt@ideak-desk.fi.intel.com \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox