AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
	amd-gfx list <amd-gfx@lists.freedesktop.org>
Subject: Re: [pull] radeon and amdgpu drm-next-4.9
Date: Sat, 17 Sep 2016 12:23:33 +0200	[thread overview]
Message-ID: <20160917102333.GA1422@wunner.de> (raw)
In-Reply-To: <CADnq5_NZ1+tgEoZKUgWxTYKCtNbvr4cCttpNMzbyGroHdePz=w@mail.gmail.com>

On Fri, Sep 16, 2016 at 06:07:36PM -0400, Alex Deucher wrote:
> On Fri, Sep 16, 2016 at 5:38 PM, Lukas Wunner <lukas@wunner.de> wrote:
> > On Fri, Sep 16, 2016 at 04:42:43PM -0400, Alex Deucher wrote:
> >>       drm/amdgpu: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF
> >>       drm/radeon: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF
> >
> > Those two are unnecessary, it can't happen that the ->suspend hook
> > is executed with the device runtime suspended.
> >
> > Since commit d14d2a8453d6 ("drm: Remove dev_pm_ops from drm_class"),
> > DRM devices are afforded direct_complete, i.e. if the GPU is runtime
> > suspended upon system sleep, it is left in this state.  The only
> > callbacks that are executed are the ->prepare and the ->complete hook.
> > All the callbacks in-between, like ->suspend, are skipped.
> >
> > Even if direct_complete is not afforded for some reason, the PM core
> > will automatically runtime resume the device before executing ->suspend.
> >
> > That ->suspend is skipped in the DRM_SWITCH_POWER_OFF case was done
> > because the device is suspended behind the PM core's back if runpm=0
> > is set.  (And it doesn't work properly because the PCI core will
> > invalidate the saved_state during ->resume_noirq.  That could be
> > solved by returning 1 from the ->prepare hook in the DRM_SWITCH_POWER_OFF
> > case, but that's a different story.)
> >
> > (Sorry for not raising this earlier, I'm not subscribed to amd-gfx.)
> 
> Thanks for the heads up.  They shouldn't hurt anything and it matches
> what other drivers do.  If you feel strongly about it, I can revert
> them later.

Well, superfluous code shouldn't be included just because it doesn't hurt
or because others didn't know better either, or removed because of
someone else's feelings. ;-)

You can find the runtime resume before execution of the driver ->suspend
callback in drivers/pci/pci-driver.c:pci_pm_suspend():

        const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
	...
        pm_runtime_resume(dev);
	...
        if (pm->suspend) {
		...
		error = pm->suspend(dev);

The device is prevented from auto-suspending because of a runtime PM ref
acquired beforehand in drivers/base/power/main.c:device_prepare().

Best regards,

Lukas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-09-17 10:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-16 20:42 [pull] radeon and amdgpu drm-next-4.9 Alex Deucher
2016-09-16 21:38 ` Lukas Wunner
2016-09-16 22:07   ` Alex Deucher
2016-09-17 10:23     ` Lukas Wunner [this message]
     [not found]       ` <20160917102333.GA1422-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-09-19 16:19         ` Alex Deucher
  -- strict thread matches above, loose matches on Subject: below --
2016-10-14 17:18 Alex Deucher
2016-10-06 17:00 Alex Deucher
2016-09-28 21:05 Alex Deucher
2016-09-22 19:21 Alex Deucher
2016-08-24 21:46 Alex Deucher

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=20160917102333.GA1422@wunner.de \
    --to=lukas@wunner.de \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    /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