From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"Wilson, Chris P" <chris.p.wilson@intel.com>,
"Gupta, saurabhg" <saurabhg.gupta@intel.com>
Subject: Re: [Intel-gfx] [PATCH 04/11] drm/i915: Added is_intel_rpm_allowed helper
Date: Wed, 22 Jun 2022 16:40:32 -0400 [thread overview]
Message-ID: <YrN+QL4K0zRMA8Ey@intel.com> (raw)
In-Reply-To: <87zgi4rh7c.fsf@intel.com>
On Wed, Jun 22, 2022 at 03:55:03PM +0300, Jani Nikula wrote:
> 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.
yeap, this seems to be the quick path at this moment...
Imre, do you see any other quick option?
In general I don't like much the big wakeref infra we end up
creating here because all of the historical unbalanced cases we got.
We should be able to get something cleaner and use the rpm infra as
other drivers are using, or improve in the rpm side itself whatever
we feel that we are missing to deal with these cases.
But back to this specific case/usage here we might need to duplicate
some functions to be called just from the inside the resuming/suspending
path... and/or moving the gets & puts upper on the stack...
The quick hacks will solve our short term problems and continue bloating
our rpm infra.
>
> 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
next prev parent reply other threads:[~2022-06-22 20:40 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
2022-06-22 20:40 ` Rodrigo Vivi [this message]
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=YrN+QL4K0zRMA8Ey@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=chris.p.wilson@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=saurabhg.gupta@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