Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Tangudu, Tilak" <tilak.tangudu@intel.com>,
	"Gupta, Anshuman" <anshuman.gupta@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Ewins, Jon" <jon.ewins@intel.com>,
	"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
	"Belgaumkar, Vinay" <vinay.belgaumkar@intel.com>,
	"Wilson, Chris P" <chris.p.wilson@intel.com>,
	"Dixit, Ashutosh" <ashutosh.dixit@intel.com>,
	"Nilawar, Badal" <badal.nilawar@intel.com>,
	"Roper, Matthew D" <matthew.d.roper@intel.com>,
	"Gupta, saurabhg" <saurabhg.gupta@intel.com>,
	"Iddamsetty, Aravind" <aravind.iddamsetty@intel.com>,
	"Sundaresan, Sujaritha" <sujaritha.sundaresan@intel.com>
Subject: Re: [Intel-gfx] [PATCH 04/11] drm/i915: Added is_intel_rpm_allowed helper
Date: Wed, 22 Jun 2022 15:55:03 +0300	[thread overview]
Message-ID: <87zgi4rh7c.fsf@intel.com> (raw)
In-Reply-To: <DM4PR11MB52480BDD4014D227789713F4E2B39@DM4PR11MB5248.namprd11.prod.outlook.com>

On Tue, 21 Jun 2022, "Tangudu, Tilak" <tilak.tangudu@intel.com> wrote:
>> -----Original Message-----
>> From: Gupta, Anshuman <anshuman.gupta@intel.com>
>> Sent: Tuesday, June 21, 2022 7:47 PM
>> To: Tangudu, Tilak <tilak.tangudu@intel.com>; intel-gfx@lists.freedesktop.org;
>> Ewins, Jon <jon.ewins@intel.com>; Vivi, Rodrigo <rodrigo.vivi@intel.com>;
>> Belgaumkar, Vinay <vinay.belgaumkar@intel.com>; Wilson, Chris P
>> <chris.p.wilson@intel.com>; Dixit, Ashutosh <ashutosh.dixit@intel.com>;
>> Nilawar, Badal <badal.nilawar@intel.com>; Roper, Matthew D
>> <matthew.d.roper@intel.com>; Gupta, saurabhg
>> <saurabhg.gupta@intel.com>; Iddamsetty, Aravind
>> <aravind.iddamsetty@intel.com>; Sundaresan, Sujaritha
>> <sujaritha.sundaresan@intel.com>
>> Subject: RE: [PATCH 04/11] drm/i915: Added is_intel_rpm_allowed helper
>> 
>> 
>> 
>> > -----Original Message-----
>> > From: Tangudu, Tilak <tilak.tangudu@intel.com>
>> > Sent: Tuesday, June 21, 2022 6:05 PM
>> > To: intel-gfx@lists.freedesktop.org; Ewins, Jon <jon.ewins@intel.com>;
>> > Vivi, Rodrigo <rodrigo.vivi@intel.com>; Belgaumkar, Vinay
>> > <vinay.belgaumkar@intel.com>; Wilson, Chris P
>> > <chris.p.wilson@intel.com>; Dixit, Ashutosh
>> > <ashutosh.dixit@intel.com>; Nilawar, Badal <badal.nilawar@intel.com>;
>> > Gupta, Anshuman <anshuman.gupta@intel.com>; Tangudu, Tilak
>> > <tilak.tangudu@intel.com>; Roper, Matthew D
>> > <matthew.d.roper@intel.com>; Gupta, saurabhg
>> > <saurabhg.gupta@intel.com>; Iddamsetty, Aravind
>> > <aravind.iddamsetty@intel.com>; Sundaresan, Sujaritha
>> > <sujaritha.sundaresan@intel.com>
>> > Subject: [PATCH 04/11] drm/i915: Added is_intel_rpm_allowed helper
>> >
>> > Added is_intel_rpm_allowed function to query the runtime_pm status and
>> > disllow during suspending and resuming.
>> This seems a hack,
>> Not sure if we have better way to handle it.
>> May be check this in intel_pm_runtime_{get,put} to keep entire code simple ?
> Yes, that would be simple without code refactoring.
> Checked the same with Chris, he suggested unbalancing of wakeref might popup
> If used at intel_pm_runtime_{get,put}  . So used like this,
>  @Wilson, Chris P , Please comment .
> @Vivi, Rodrigo , Any suggestion ?

One option would be to track this in intel_wakeref_t, i.e. _get flags
the case in the returned wakeref and _put skips in that case.

BR,
Jani.


>  
>> >
>> > Signed-off-by: Tilak Tangudu <tilak.tangudu@intel.com>
>> > ---
>> >  drivers/gpu/drm/i915/intel_runtime_pm.c | 15 +++++++++++++++
>> > drivers/gpu/drm/i915/intel_runtime_pm.h |  1 +
>> >  2 files changed, 16 insertions(+)
>> >
>> > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c
>> > b/drivers/gpu/drm/i915/intel_runtime_pm.c
>> > index 6ed5786bcd29..3759a8596084 100644
>> > --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
>> > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
>> > @@ -320,6 +320,21 @@ untrack_all_intel_runtime_pm_wakerefs(struct
>> > intel_runtime_pm *rpm)  }
>> >
>> >  #endif
>> > +static int intel_runtime_pm_status(struct intel_runtime_pm *rpm) {
>> > +return rpm->kdev->power.runtime_status; }
>> This is racy in principal, we need a kdev->power lock here.
>> Regards,
>> Anshuman Gupta.
>> > +
>> > +bool is_intel_rpm_allowed(struct intel_runtime_pm *rpm) { int
>> > +rpm_status;
>> > +
>> > +rpm_status = intel_runtime_pm_status(rpm); if (rpm_status ==
>> > +RPM_RESUMING || rpm_status ==
>> > RPM_SUSPENDING)
>> > +return false;
>> > +else
>> > +return true;
>> > +}
>> >
>> >  static void
>> >  intel_runtime_pm_acquire(struct intel_runtime_pm *rpm, bool wakelock)
>> > diff -- git a/drivers/gpu/drm/i915/intel_runtime_pm.h
>> > b/drivers/gpu/drm/i915/intel_runtime_pm.h
>> > index d9160e3ff4af..99418c3a934a 100644
>> > --- a/drivers/gpu/drm/i915/intel_runtime_pm.h
>> > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.h
>> > @@ -173,6 +173,7 @@ void intel_runtime_pm_init_early(struct
>> > intel_runtime_pm *rpm);  void intel_runtime_pm_enable(struct
>> > intel_runtime_pm *rpm);  void intel_runtime_pm_disable(struct
>> > intel_runtime_pm *rpm);  void intel_runtime_pm_driver_release(struct
>> > intel_runtime_pm *rpm);
>> > +bool is_intel_rpm_allowed(struct intel_runtime_pm *rpm);
>> >
>> >  intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm);
>> > intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm
>> > *rpm);
>> > --
>> > 2.25.1
>> 
>

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-06-22 12:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 12:35 [Intel-gfx] [PATCH 00/11] drm/i915: Add D3Cold-Off support for runtime-pm Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 01/11] drm/i915: Avoid rpm helpers in intel_guc_global_policies_update Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 02/11] drm/i915: Avoid rpm helpers in intel_guc_slpc_set_media_ratio_mode Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 03/11] drm/i915: Avoid rpm helpers in intel_gt_suspend_late Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 04/11] drm/i915: Added is_intel_rpm_allowed helper Tilak Tangudu
2022-06-21 14:16   ` Gupta, Anshuman
2022-06-21 14:22     ` Tangudu, Tilak
2022-06-22 12:55       ` Jani Nikula [this message]
2022-06-22 20:40         ` Rodrigo Vivi
2022-06-23 17:21           ` Tangudu, Tilak
2022-06-23 17:49             ` Jani Nikula
2022-06-21 12:35 ` [Intel-gfx] [PATCH 05/11] drm/i915: Guard rpm helpers in gt helpers functions Tilak Tangudu
2022-06-22 12:52   ` Jani Nikula
2022-06-21 12:35 ` [Intel-gfx] [PATCH 06/11] drm/i915: Avoid rpm helpers in try_context_registration Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 07/11] drm/i915: Guard rc6 helpers with is_intel_rpm_allowed Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 08/11] drm/i915: Guard rpm helpers in rpm_get/put Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 09/11] drm/i915: Add i915_save/load_pci_state helpers Tilak Tangudu
2022-06-21 16:30   ` kernel test robot
2022-06-21 19:44   ` kernel test robot
2022-06-21 22:57   ` kernel test robot
2022-06-22  8:35   ` kernel test robot
2022-06-21 12:35 ` [Intel-gfx] [PATCH 10/11] drm/i915: Guard rpm helpers at gt_park/unpark Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 11/11] drm/i915 : Add D3COLD OFF support Tilak Tangudu
2022-06-21 13:15   ` Gupta, Anshuman
2022-06-21 13:24 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Add D3Cold-Off support for runtime-pm Patchwork
2022-06-23 17:35 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Add D3Cold-Off support for runtime-pm (rev2) 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=87zgi4rh7c.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=aravind.iddamsetty@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=chris.p.wilson@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jon.ewins@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=saurabhg.gupta@intel.com \
    --cc=sujaritha.sundaresan@intel.com \
    --cc=tilak.tangudu@intel.com \
    --cc=vinay.belgaumkar@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