lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 9 Sep 2022 05:12:19 -0400
From:   Rodrigo Vivi <rodrigo.vivi@...el.com>
To:     Mauro Carvalho Chehab <mchehab@...nel.org>
CC:     Matthew Brost <matthew.brost@...el.com>,
        Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
        <linux-doc@...r.kernel.org>,
        Andi Shyti <andi.shyti@...ux.intel.com>,
        Jonathan Corbet <corbet@....net>,
        David Airlie <airlied@...ux.ie>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
        "Chris Wilson" <chris.p.wilson@...el.com>,
        <intel-gfx@...ts.freedesktop.org>,
        "John Harrison" <John.C.Harrison@...el.com>
Subject: Re: [PATCH v3 35/37] drm/i915: add descriptions for some RPM macros
 at intel_gt_pm.h

On Fri, Sep 09, 2022 at 09:34:42AM +0200, Mauro Carvalho Chehab wrote:
> The intel_gt_pm.h file contains some convenient macros to be used
> in GT code in order to get/put runtime PM references and for
> checking them.
> 
> Add descriptions based on the ones at intel_wakeref.h and
> intel_runtime_pm.c.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@...nel.org>

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

> ---
> 
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH v3 00/37] at: https://lore.kernel.org/all/cover.1662708705.git.mchehab@kernel.org/
> 
>  Documentation/gpu/i915.rst            |  2 ++
>  drivers/gpu/drm/i915/gt/intel_gt_pm.h | 51 +++++++++++++++++++++++++++
>  2 files changed, 53 insertions(+)
> 
> diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst
> index 7f5cd01ed398..59c532fe0332 100644
> --- a/Documentation/gpu/i915.rst
> +++ b/Documentation/gpu/i915.rst
> @@ -446,6 +446,8 @@ Graphics Translation Tables
>  Other GT functionality
>  ----------------------
>  
> +.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gt_pm.h
> +
>  .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_context.h
>  
>  .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gsc.h
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.h b/drivers/gpu/drm/i915/gt/intel_gt_pm.h
> index 6c9a46452364..7847e15d102e 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.h
> @@ -11,21 +11,57 @@
>  #include "intel_gt_types.h"
>  #include "intel_wakeref.h"
>  
> +/**
> + * intel_gt_pm_is_awake: Query whether the runtime PM is awake held
> + *
> + * @gt: pointer to the graphics engine
> + *
> + * Returns: true if a runtime pm reference is currently held and the GT is
> + * awake.
> + */
>  static inline bool intel_gt_pm_is_awake(const struct intel_gt *gt)
>  {
>  	return intel_wakeref_is_active(&gt->wakeref);
>  }
>  
> +/**
> + * intel_gt_pm_get: grab a runtime PM reference ensuring that GT is powered up
> + * @gt: pointer to the graphics engine
> + *
> + * Any runtime pm reference obtained by this function must have a symmetric
> + * call to intel_gt_pm_put() to release the reference again.
> + *
> + * Note that this is allowed to fail, in which case the runtime-pm wakeref
> + * will be released and the acquisition unwound.
> + */
>  static inline void intel_gt_pm_get(struct intel_gt *gt)
>  {
>  	intel_wakeref_get(&gt->wakeref);
>  }
>  
> +/**
> + * __intel_gt_pm_get: Acquire the runtime PM reference again
> + * @gt: pointer to the graphics engine which contains the wakeref
> + *
> + * Increment the PM reference counter, only valid if it is already held by
> + * the caller.
> + *
> + * See intel_gt_pm_get().
> + */
>  static inline void __intel_gt_pm_get(struct intel_gt *gt)
>  {
>  	__intel_wakeref_get(&gt->wakeref);
>  }
>  
> +/**
> + * intel_gt_pm_get_if_awake: Acquire the runtime PM reference if active
> + * @gt: pointer to the graphics engine which contains the PM reference
> + *
> + * Acquire a hold on the PM reference, but only if the GT is already
> + * active.
> + *
> + * Returns: true if the wakeref was acquired, false otherwise.
> + */
>  static inline bool intel_gt_pm_get_if_awake(struct intel_gt *gt)
>  {
>  	return intel_wakeref_get_if_active(&gt->wakeref);
> @@ -36,6 +72,14 @@ static inline void intel_gt_pm_might_get(struct intel_gt *gt)
>  	intel_wakeref_might_get(&gt->wakeref);
>  }
>  
> +/**
> + * intel_gt_pm_put: Release the runtime PM reference
> + * @gt: pointer to the graphics engine which contains the PM reference
> + *
> + * Release our hold on the runtime PM for GT.
> + *
> + * It might power down the GT right away if this is the last reference.
> + */
>  static inline void intel_gt_pm_put(struct intel_gt *gt)
>  {
>  	intel_wakeref_put(&gt->wakeref);
> @@ -51,6 +95,13 @@ static inline void intel_gt_pm_might_put(struct intel_gt *gt)
>  	intel_wakeref_might_put(&gt->wakeref);
>  }
>  
> +/**
> + * with_intel_gt_pm - get a GT reference ensuring that GT is powered up,
> + *	run some code and then put the reference away.
> + *
> + * @gt: pointer to the gt
> + * @tmp: pointer to a temporary wakeref.
> + */
>  #define with_intel_gt_pm(gt, tmp) \
>  	for (tmp = 1, intel_gt_pm_get(gt); tmp; \
>  	     intel_gt_pm_put(gt), tmp = 0)
> -- 
> 2.37.3
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ