public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/skl: replace csr_mutex by completion in csr firmware loading
Date: Mon, 15 Jun 2015 12:02:17 +0200	[thread overview]
Message-ID: <20150615100217.GN8341@phenom.ffwll.local> (raw)
In-Reply-To: <1433397575.17509.222.camel@sagar-desktop>

On Thu, Jun 04, 2015 at 11:29:35AM +0530, Sagar Arun Kamble wrote:
> On Thu, 2015-05-21 at 23:29 +0200, Daniel Vetter wrote:
> > On Thu, May 21, 2015 at 10:35:07PM +0530, Animesh Manna wrote:
> > > 
> > > 
> > > On 5/21/2015 5:41 PM, Daniel Vetter wrote:
> > > >On Thu, May 21, 2015 at 03:49:52PM +0530, Animesh Manna wrote:
> > > >>Before enabling dc5/dc6, used wait for completion instead of busy waiting.
> > > >>
> > > >>v1:
> > > >>- Based on review comment from Daniel replaced mutex and related
> > > >>implementation with completion. In current patch not used power
> > > >>domain lock, don't want to block runtime power management if dmc
> > > >>firmware failed to load. Will analyzing further and possibly send
> > > >>as a incremental patch.
> > > >>- Based on review comment from Damien, warning for firmware loading
> > > >>failure is removed.
> > > >>
> > > >>Signed-off-by: Animesh Manna <animesh.manna@intel.com>
> > > >Sorry if this cross with my comments, but upon further digging into this
> > > >code we don't even need a completion at all. As long as we prevent the
> > > >power well from getting disabled by holding a reference for it before we
> > > >launch the firmware loader it'll all be fine. And the async work can then
> > > >just drop that reference when everything is set up.
> > > >
> > > >Yes this means runtime D3 requires the firmware to be loaded, but that's
> > > >imo not a problem.
> > > >
> > > >Also doing it this way is more in-line with how we do all the other async
> > > >setup. But there's another serious issue with this design here, see below.
> > > >
> > > Ok, previously I was thinking more on how to pass the firmware loading status
> > > before enabling low power states (dc5/dc6). Now while thinking about power
> > > management framework I have a fundamental doubt - if got request to disable a power-well
> > > and firmware loading failed for some reason, should we disable the power-well(option1) or
> > > keep it enable(option2). Both the cases will not trigger for dc5/dc6.
> > > 
> > > I understood from your comment to follow option2, I will change the design accordingly
> > > as the current implementation based on option1.
> > > 
> > > To implement option2, I can see there is one mutex present for a power domain, do not have
> > > mutex for each power-well, which need to be added and can be used as you mentioned above.
> > > 
> > > If we want to follow option1, I can think a better way of managing firmware loading.
> > > As firmware is required when display engine goes to low power state, so we can only parse
> > > the packaged firmware during driver initialization. Firmware loading (writing to registers)
> > > can be done in skl_enable_dc6/gen9_enable_dc5 function itself and then trigger for dc5/dc6.
> > > 
> > > Planning to implement option2 and will send for review, please correct me if I understood wrongly.
> > 
> > power wells are reference counted, which means the only thing you need to
> > do is grab such a reference. Then the corresponding power well won't ever
> > get disabled until the async firmware loader has done it's job and
> > released the power well reference again.
> > 
> > See e.g. how the async rps setup grabs a runtime_pm reference (works the
> > same for power wells, they simply nest within the runtime pm stuff). So
> > for option2 no fiddling with mutexes or power well internals needed at all
> > (well the wait_for can be removed afterwards ofc). And we don't need any
> > other mutex, the csr_mutex and crs.state can be removed afterwards too.
> > -Daniel
> 
> Hi Daniel,
> 
> We already are grabbing RPM reference before start of DMC FW load and
> release post load completion.
> 
> DC5/6 can happen without Runtime PM as well. So we need to wait for CSR
> FW load for some time once we disable PW2.

If dc5/6 can happen despite you holding a runtime pm reference, then
you're holding the wrong runtime pm reference. They nest, hence just walk
up the chain of power domains until you have one that does prevent dc5/6.

I guess there's a confusion between runtime pm as the overall concept
(which I'm talking about here, implemented in intel_rpm.c) and the linux
runtime pm api which is only used for the very last level of runtime pm in
i915 to control entry/exit to D3. On top of that we stack the power wells
i915 specific runtime pm api and the corresponding busyness tracking on
the render side.

> Having completion instead of csr.lock+csr.state is  correct thing to do.

I hope the above explanation helps. I can follow up with a sketch patch
too if you want.

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-06-15  9:59 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 10:19 [PATCH] drm/i915/skl: replace csr_mutex by completion in csr firmware loading Animesh Manna
2015-05-21 12:11 ` Daniel Vetter
2015-05-21 17:05   ` Animesh Manna
2015-05-21 21:29     ` Daniel Vetter
2015-06-04  5:59       ` Sagar Arun Kamble
2015-06-04 14:36         ` Dave Gordon
2015-06-15 10:07           ` Daniel Vetter
2015-06-15 18:41             ` Dave Gordon
2015-06-15 10:02         ` Daniel Vetter [this message]
2015-06-29  8:39 ` Daniel Vetter
2015-07-07 12:40   ` [PATCH] drm/i915: Resign firmware loading for dmc Animesh Manna
2015-07-07 13:18     ` Daniel Vetter
2015-07-08 14:24       ` [PATCH 0/6] Redesign the dmc firmware loading Animesh Manna
2015-07-08 14:24         ` [PATCH 1/6] drm/i915/gen9: Removed csr-lock and csr-state Animesh Manna
2015-07-09 18:17           ` Daniel Vetter
2015-07-08 14:24         ` [PATCH 2/6] drm/i915/gen9: Added a async work for fw-loading and dc5/dc6 programming Animesh Manna
2015-07-08 14:24         ` [PATCH 3/6] drm/i915/gen9: Replaced request_firmware_nowait() by request_firmware() Animesh Manna
2015-07-09 18:24           ` Daniel Vetter
2015-07-08 14:24         ` [PATCH 4/6] drm/i915/gen9: Added dmc_present flag to check firmware loading status Animesh Manna
2015-07-09 18:19           ` Daniel Vetter
2015-07-08 14:24         ` [PATCH 5/6] drm/i915/skl: Removed assert for csr-fw-loading during disabling dc6 Animesh Manna
2015-07-08 14:24         ` [PATCH 6/6] drm/i915/gen9: Corrected the sanity check of mmio address range for csr Animesh Manna
2015-07-08 19:39           ` shuang.he
2015-07-09 17:32           ` Daniel Vetter
2015-07-09 20:04         ` [PATCH 01/12] drm/i915: use correct power domain for csr loading Daniel Vetter
2015-07-09 20:04           ` [PATCH 02/12] drm/i915: Only allow rpm on gen9+ with dmc loaded Daniel Vetter
2015-07-10  8:20             ` Animesh Manna
2015-07-10 16:44               ` Daniel Vetter
2015-07-09 20:04           ` [PATCH 03/12] drm/i915: move assert_csr_loaded into intel_rpm.c Daniel Vetter
2015-07-09 20:04           ` [PATCH 04/12] drm/i915: Remove csr.state, csr_lock and related code Daniel Vetter
2015-07-09 20:04           ` [PATCH 05/12] drm/i915: Align line continuations in intel_csr.c Daniel Vetter
2015-07-09 20:04           ` [PATCH 06/12] drm/i915: Simplify csr loading failure printing Daniel Vetter
2015-07-09 20:04           ` [PATCH 07/12] drm/i915/csr: extract parse_csr_fw Daniel Vetter
2015-07-09 20:04           ` [PATCH 08/12] drm/i915: Don't try to load garbage dmc firmware on resume Daniel Vetter
2015-07-09 20:04           ` [PATCH 09/12] drm/i915: Use dev_priv in csr functions Daniel Vetter
2015-07-09 20:04           ` [PATCH 10/12] drm/i915: Use request_firmware and our own async work Daniel Vetter
2015-07-09 20:04           ` [PATCH 11/12] drm/i915: Use flush_work to synchronize with dmc loader Daniel Vetter
2015-07-09 20:04           ` [PATCH 12/12] drm/i915/csr: Simplify stepping computation Daniel Vetter
2015-07-11  9:22             ` shuang.he
2015-07-10  8:12           ` [PATCH 01/12] drm/i915: use correct power domain for csr loading Animesh Manna
2015-07-10 16:46             ` Daniel Vetter
2015-07-08 10:31     ` [PATCH] drm/i915: Resign firmware loading for dmc shuang.he

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=20150615100217.GN8341@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sagar.a.kamble@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