* [PATCH] drm/i915: Prepare GEM for suspend earlier
@ 2018-05-22 15:49 Chris Wilson
2018-05-22 16:31 ` ✗ Fi.CI.BAT: failure for drm/i915: Prepare GEM for suspend earlier (rev3) Patchwork
2018-05-22 16:55 ` [PATCH] drm/i915: Prepare GEM for suspend earlier Chris Wilson
0 siblings, 2 replies; 11+ messages in thread
From: Chris Wilson @ 2018-05-22 15:49 UTC (permalink / raw)
To: intel-gfx
In order to prepare the GPU for sleeping, we may want to submit commands
to it. This is a complicated process that may even require some swapping
in from shmemfs, if the GPU was in the wrong state. As such, we need to
do this preparation step synchronously before the rest of the system has
started to turn off (e.g. swapin fails if scsi is suspended).
Fortunately, we are provided with a such a hook, pm_ops.prepare().
v2: Compile cleanup
v3: Add manual calls to i915_drm_prepare() before i915_drm_suspend().
Testcase: igt/drv_suspend after igt/gem_tiled_swapping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.c | 55 +++++++++++++++++++++++++++------
1 file changed, 45 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 9c449b8d8eab..8642f9a1aff2 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1553,12 +1553,30 @@ static bool suspend_to_idle(struct drm_i915_private *dev_priv)
return false;
}
+static int i915_drm_prepare(struct drm_device *dev)
+{
+ struct drm_i915_private *i915 = to_i915(dev);
+ int err;
+
+ disable_rpm_wakeref_asserts(i915);
+
+ err = i915_gem_suspend(i915);
+ if (err) {
+ dev_err(&i915->drm.pdev->dev,
+ "GEM idle failed, suspend/resume might fail\n");
+ goto out;
+ }
+out:
+ enable_rpm_wakeref_asserts(i915);
+
+ return err;
+}
+
static int i915_drm_suspend(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev;
pci_power_t opregion_target_state;
- int error;
/* ignore lid events during suspend */
mutex_lock(&dev_priv->modeset_restore_lock);
@@ -1575,13 +1593,6 @@ static int i915_drm_suspend(struct drm_device *dev)
pci_save_state(pdev);
- error = i915_gem_suspend(dev_priv);
- if (error) {
- dev_err(&pdev->dev,
- "GEM idle failed, resume might fail\n");
- goto out;
- }
-
intel_display_suspend(dev);
intel_dp_mst_suspend(dev);
@@ -1609,10 +1620,9 @@ static int i915_drm_suspend(struct drm_device *dev)
intel_csr_ucode_suspend(dev_priv);
-out:
enable_rpm_wakeref_asserts(dev_priv);
- return error;
+ return 0;
}
static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
@@ -1695,6 +1705,10 @@ static int i915_suspend_switcheroo(struct drm_device *dev, pm_message_t state)
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0;
+ error = i915_drm_prepare(dev);
+ if (error)
+ return error;
+
error = i915_drm_suspend(dev);
if (error)
return error;
@@ -2081,6 +2095,22 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg)
return ret;
}
+static int i915_pm_prepare(struct device *kdev)
+{
+ struct pci_dev *pdev = to_pci_dev(kdev);
+ struct drm_device *dev = pci_get_drvdata(pdev);
+
+ if (!dev) {
+ dev_err(kdev, "DRM not initialized, aborting suspend.\n");
+ return -ENODEV;
+ }
+
+ if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+ return 0;
+
+ return i915_drm_prepare(dev);
+}
+
static int i915_pm_suspend(struct device *kdev)
{
struct pci_dev *pdev = to_pci_dev(kdev);
@@ -2153,6 +2183,10 @@ static int i915_pm_freeze(struct device *kdev)
int ret;
if (dev->switch_power_state != DRM_SWITCH_POWER_OFF) {
+ ret = i915_drm_prepare(dev);
+ if (ret)
+ return ret;
+
ret = i915_drm_suspend(dev);
if (ret)
return ret;
@@ -2731,6 +2765,7 @@ const struct dev_pm_ops i915_pm_ops = {
* S0ix (via system suspend) and S3 event handlers [PMSG_SUSPEND,
* PMSG_RESUME]
*/
+ .prepare = i915_pm_prepare,
.suspend = i915_pm_suspend,
.suspend_late = i915_pm_suspend_late,
.resume_early = i915_pm_resume_early,
--
2.17.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* ✗ Fi.CI.BAT: failure for drm/i915: Prepare GEM for suspend earlier (rev3)
2018-05-22 15:49 [PATCH] drm/i915: Prepare GEM for suspend earlier Chris Wilson
@ 2018-05-22 16:31 ` Patchwork
2018-05-22 16:55 ` [PATCH] drm/i915: Prepare GEM for suspend earlier Chris Wilson
1 sibling, 0 replies; 11+ messages in thread
From: Patchwork @ 2018-05-22 16:31 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: Prepare GEM for suspend earlier (rev3)
URL : https://patchwork.freedesktop.org/series/43575/
State : failure
== Summary ==
= CI Bug Log - changes from CI_DRM_4221 -> Patchwork_9088 =
== Summary - FAILURE ==
Serious unknown changes coming with Patchwork_9088 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_9088, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/43575/revisions/3/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_9088:
=== IGT changes ===
==== Possible regressions ====
igt@drv_module_reload@basic-reload-inject:
{fi-kbl-guc}: PASS -> FAIL +3
igt@gem_exec_suspend@basic-s4-devices:
fi-cfl-s3: PASS -> FAIL
fi-byt-n2820: PASS -> FAIL
fi-cfl-u: PASS -> FAIL
fi-snb-2600: PASS -> FAIL
fi-bxt-j4205: PASS -> FAIL
fi-kbl-7567u: PASS -> FAIL
fi-hsw-4200u: PASS -> FAIL
fi-bdw-gvtdvm: PASS -> FAIL
fi-kbl-r: PASS -> FAIL
fi-snb-2520m: PASS -> FAIL
fi-bxt-dsi: PASS -> FAIL
fi-ivb-3520m: PASS -> FAIL
fi-hsw-4770: PASS -> FAIL
fi-ilk-650: PASS -> FAIL
fi-bsw-n3050: PASS -> FAIL
fi-ivb-3770: PASS -> FAIL
fi-hsw-peppy: PASS -> FAIL
fi-hsw-4770r: PASS -> FAIL
fi-kbl-7500u: PASS -> FAIL
fi-bdw-5557u: PASS -> FAIL
fi-cfl-8700k: PASS -> FAIL
fi-byt-j1900: PASS -> FAIL
fi-kbl-7560u: PASS -> FAIL
igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
fi-skl-guc: PASS -> FAIL +2
{fi-cfl-guc}: PASS -> FAIL +3
==== Warnings ====
igt@gem_exec_gttfill@basic:
fi-pnv-d510: SKIP -> PASS
igt@gem_render_tiled_blits@basic:
{fi-cfl-guc}: PASS -> SKIP +24
igt@gem_ringfill@basic-default:
fi-skl-guc: PASS -> SKIP +24
igt@kms_force_connector_basic@force-edid:
fi-ivb-3520m: PASS -> SKIP +3
igt@prime_vgem@basic-wait-default:
{fi-kbl-guc}: PASS -> SKIP +32
== Known issues ==
Here are the changes found in Patchwork_9088 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_exec_suspend@basic-s4-devices:
fi-skl-6260u: PASS -> FAIL (fdo#105900)
fi-skl-6700k2: PASS -> FAIL (fdo#105900)
fi-glk-j4005: PASS -> FAIL (fdo#105900)
fi-skl-gvtdvm: PASS -> FAIL (fdo#105900)
fi-cnl-psr: PASS -> FAIL (fdo#105900)
fi-skl-guc: PASS -> FAIL (fdo#104699, fdo#105900)
fi-skl-6770hq: PASS -> FAIL (fdo#105900)
fi-skl-6600u: PASS -> FAIL (fdo#105900)
fi-cnl-y3: PASS -> FAIL (fdo#105900)
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
fi-cnl-psr: PASS -> DMESG-WARN (fdo#104951)
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
fi-cnl-y3: PASS -> DMESG-FAIL (fdo#103191, fdo#104724)
==== Possible fixes ====
igt@kms_flip@basic-flip-vs-dpms:
fi-bxt-dsi: INCOMPLETE (fdo#103927) -> PASS
igt@kms_pipe_crc_basic@nonblocking-crc-pipe-c-frame-sequence:
fi-cfl-s3: FAIL (fdo#103481) -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103481 https://bugs.freedesktop.org/show_bug.cgi?id=103481
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104699 https://bugs.freedesktop.org/show_bug.cgi?id=104699
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951
fdo#105900 https://bugs.freedesktop.org/show_bug.cgi?id=105900
== Participating hosts (44 -> 39) ==
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-skl-6700hq
== Build changes ==
* Linux: CI_DRM_4221 -> Patchwork_9088
CI_DRM_4221: d83aef98e4f2e35440222c69ef80a68daf1abb4e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4490: 0b381c7d1067a4fe520b72d4d391d4920834cbe0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9088: 9ab7370cff43fb22409904f2bab54ed3f9b2222c @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4490: 6ab75f7eb5e1dccbb773e1739beeb2d7cbd6ad0d @ git://anongit.freedesktop.org/piglit
== Kernel 32bit build ==
Warning: Kernel 32bit buildtest failed:
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9088/build_32bit.log
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CHK scripts/mod/devicetable-offsets.h
CHK include/generated/compile.h
CHK kernel/config_data.h
CC [M] drivers/gpu/drm/i915/i915_query.o
In file included from ./include/asm-generic/barrier.h:20:0,
from ./arch/x86/include/asm/barrier.h:86,
from ./include/linux/nospec.h:8,
from drivers/gpu/drm/i915/i915_query.c:7:
drivers/gpu/drm/i915/i915_query.c: In function ‘i915_query_ioctl’:
./include/linux/compiler.h:339:38: error: call to ‘__compiletime_assert_119’ declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
./include/linux/compiler.h:319:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix(); \
^~~~~~
./include/linux/compiler.h:339:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:45:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:69:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^~~~~~~~~~~~~~~~
./include/linux/nospec.h:53:2: note: in expansion of macro ‘BUILD_BUG_ON’
BUILD_BUG_ON(sizeof(_i) > sizeof(long)); \
^~~~~~~~~~~~
drivers/gpu/drm/i915/i915_query.c:118:15: note: in expansion of macro ‘array_index_nospec’
func_idx = array_index_nospec(func_idx,
^~~~~~~~~~~~~~~~~~
scripts/Makefile.build:312: recipe for target 'drivers/gpu/drm/i915/i915_query.o' failed
make[4]: *** [drivers/gpu/drm/i915/i915_query.o] Error 1
scripts/Makefile.build:559: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:559: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:559: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1060: recipe for target 'drivers' failed
make: *** [drivers] Error 2
== Linux commits ==
9ab7370cff43 drm/i915: Prepare GEM for suspend earlier
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9088/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/i915: Prepare GEM for suspend earlier
2018-05-22 15:49 [PATCH] drm/i915: Prepare GEM for suspend earlier Chris Wilson
2018-05-22 16:31 ` ✗ Fi.CI.BAT: failure for drm/i915: Prepare GEM for suspend earlier (rev3) Patchwork
@ 2018-05-22 16:55 ` Chris Wilson
1 sibling, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2018-05-22 16:55 UTC (permalink / raw)
To: intel-gfx
Quoting Chris Wilson (2018-05-22 16:49:02)
> In order to prepare the GPU for sleeping, we may want to submit commands
> to it. This is a complicated process that may even require some swapping
> in from shmemfs, if the GPU was in the wrong state. As such, we need to
> do this preparation step synchronously before the rest of the system has
> started to turn off (e.g. swapin fails if scsi is suspended).
> Fortunately, we are provided with a such a hook, pm_ops.prepare().
>
> v2: Compile cleanup
> v3: Add manual calls to i915_drm_prepare() before i915_drm_suspend().
Revision 2 passed, but revision 3 fails. I don't understand... :(
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/i915: Prepare GEM for suspend earlier
2018-05-25 10:51 ` Ville Syrjälä
2018-05-25 11:02 ` Chris Wilson
@ 2018-05-25 13:55 ` Chris Wilson
1 sibling, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2018-05-25 13:55 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: intel-gfx
Quoting Ville Syrjälä (2018-05-25 11:51:13)
> On Fri, May 25, 2018 at 10:26:29AM +0100, Chris Wilson wrote:
> > In order to prepare the GPU for sleeping, we may want to submit commands
> > to it. This is a complicated process that may even require some swapping
> > in from shmemfs, if the GPU was in the wrong state. As such, we need to
> > do this preparation step synchronously before the rest of the system has
> > started to turn off (e.g. swapin fails if scsi is suspended).
> > Fortunately, we are provided with a such a hook, pm_ops.prepare().
> >
> > v2: Compile cleanup
> > v3: Fewer asserts, fewer problems?
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106640
> > Testcase: igt/drv_suspend after igt/gem_tiled_swapping
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> > drivers/gpu/drm/i915/i915_drv.c | 41 +++++++++++++++++++++++++--------
> > 1 file changed, 31 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 9c449b8d8eab..9d6ac7f44812 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -1553,12 +1553,24 @@ static bool suspend_to_idle(struct drm_i915_private *dev_priv)
> > return false;
> > }
> >
> > +static int i915_drm_prepare(struct drm_device *dev)
> > +{
> > + struct drm_i915_private *i915 = to_i915(dev);
> > + int err;
> > +
> > + err = i915_gem_suspend(i915);
> > + if (err)
> > + dev_err(&i915->drm.pdev->dev,
> > + "GEM idle failed, suspend/resume might fail\n");
> > +
> > + return err;
> > +}
> > +
> > static int i915_drm_suspend(struct drm_device *dev)
> > {
> > struct drm_i915_private *dev_priv = to_i915(dev);
> > struct pci_dev *pdev = dev_priv->drm.pdev;
> > pci_power_t opregion_target_state;
> > - int error;
> >
> > /* ignore lid events during suspend */
> > mutex_lock(&dev_priv->modeset_restore_lock);
> > @@ -1575,13 +1587,6 @@ static int i915_drm_suspend(struct drm_device *dev)
> >
> > pci_save_state(pdev);
> >
> > - error = i915_gem_suspend(dev_priv);
> > - if (error) {
> > - dev_err(&pdev->dev,
> > - "GEM idle failed, resume might fail\n");
> > - goto out;
> > - }
> > -
> > intel_display_suspend(dev);
> >
> > intel_dp_mst_suspend(dev);
> > @@ -1609,10 +1614,9 @@ static int i915_drm_suspend(struct drm_device *dev)
> >
> > intel_csr_ucode_suspend(dev_priv);
> >
> > -out:
> > enable_rpm_wakeref_asserts(dev_priv);
> >
> > - return error;
> > + return 0;
> > }
> >
> > static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
> > @@ -2081,6 +2085,22 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg)
> > return ret;
> > }
> >
> > +static int i915_pm_prepare(struct device *kdev)
> > +{
> > + struct pci_dev *pdev = to_pci_dev(kdev);
> > + struct drm_device *dev = pci_get_drvdata(pdev);
> > +
> > + if (!dev) {
> > + dev_err(kdev, "DRM not initialized, aborting suspend.\n");
> > + return -ENODEV;
> > + }
>
> How can this happen?
>
> IIRC I actually wrote a patch once to move the gem suspend to happen
> after display suspend. The idea being that shutting down the display(s)
> may require gem services (MI_OVERLAY_OFF being the prime example I
> had in mind at the time). Just wondering if we can split the gem suspend
> somehow to allow that, or would we need to just move display suspend
> earlier as well?
Ville accepted that this didn't really change the status quo (on irc)
and so was ok with postponing such fixes until later. I added
+ /*
+ * NB intel_display_suspend() may issue new requests after we've
+ * ostensibly marked the GPU as ready-to-sleep here. We need to
+ * split out that work and pull it forward so that after point,
+ * the GPU is not woken again.
+ */
to record the issue so that hopefully we might fix it before any one
notices.
I pulled in Mika's review from a later thread and pushed so I can close
the bug.
Thanks for the review,
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/i915: Prepare GEM for suspend earlier
2018-05-25 10:51 ` Ville Syrjälä
@ 2018-05-25 11:02 ` Chris Wilson
2018-05-25 13:55 ` Chris Wilson
1 sibling, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2018-05-25 11:02 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: intel-gfx
Quoting Ville Syrjälä (2018-05-25 11:51:13)
> On Fri, May 25, 2018 at 10:26:29AM +0100, Chris Wilson wrote:
> > In order to prepare the GPU for sleeping, we may want to submit commands
> > to it. This is a complicated process that may even require some swapping
> > in from shmemfs, if the GPU was in the wrong state. As such, we need to
> > do this preparation step synchronously before the rest of the system has
> > started to turn off (e.g. swapin fails if scsi is suspended).
> > Fortunately, we are provided with a such a hook, pm_ops.prepare().
> >
> > v2: Compile cleanup
> > v3: Fewer asserts, fewer problems?
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106640
> > Testcase: igt/drv_suspend after igt/gem_tiled_swapping
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> > drivers/gpu/drm/i915/i915_drv.c | 41 +++++++++++++++++++++++++--------
> > 1 file changed, 31 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 9c449b8d8eab..9d6ac7f44812 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -1553,12 +1553,24 @@ static bool suspend_to_idle(struct drm_i915_private *dev_priv)
> > return false;
> > }
> >
> > +static int i915_drm_prepare(struct drm_device *dev)
> > +{
> > + struct drm_i915_private *i915 = to_i915(dev);
> > + int err;
> > +
> > + err = i915_gem_suspend(i915);
> > + if (err)
> > + dev_err(&i915->drm.pdev->dev,
> > + "GEM idle failed, suspend/resume might fail\n");
> > +
> > + return err;
> > +}
> > +
> > static int i915_drm_suspend(struct drm_device *dev)
> > {
> > struct drm_i915_private *dev_priv = to_i915(dev);
> > struct pci_dev *pdev = dev_priv->drm.pdev;
> > pci_power_t opregion_target_state;
> > - int error;
> >
> > /* ignore lid events during suspend */
> > mutex_lock(&dev_priv->modeset_restore_lock);
> > @@ -1575,13 +1587,6 @@ static int i915_drm_suspend(struct drm_device *dev)
> >
> > pci_save_state(pdev);
> >
> > - error = i915_gem_suspend(dev_priv);
> > - if (error) {
> > - dev_err(&pdev->dev,
> > - "GEM idle failed, resume might fail\n");
> > - goto out;
> > - }
> > -
> > intel_display_suspend(dev);
> >
> > intel_dp_mst_suspend(dev);
> > @@ -1609,10 +1614,9 @@ static int i915_drm_suspend(struct drm_device *dev)
> >
> > intel_csr_ucode_suspend(dev_priv);
> >
> > -out:
> > enable_rpm_wakeref_asserts(dev_priv);
> >
> > - return error;
> > + return 0;
> > }
> >
> > static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
> > @@ -2081,6 +2085,22 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg)
> > return ret;
> > }
> >
> > +static int i915_pm_prepare(struct device *kdev)
> > +{
> > + struct pci_dev *pdev = to_pci_dev(kdev);
> > + struct drm_device *dev = pci_get_drvdata(pdev);
> > +
> > + if (!dev) {
> > + dev_err(kdev, "DRM not initialized, aborting suspend.\n");
> > + return -ENODEV;
> > + }
>
> How can this happen?
Just copypaste, and not wanting to have to answer too many questions.
> IIRC I actually wrote a patch once to move the gem suspend to happen
> after display suspend. The idea being that shutting down the display(s)
> may require gem services (MI_OVERLAY_OFF being the prime example I
> had in mind at the time). Just wondering if we can split the gem suspend
> somehow to allow that, or would we need to just move display suspend
> earlier as well?
That would require doing that portion of display shutdown earlier. The
problem is in starting GPU activity from within the async suspend is
error prone. For overlay, it's not much of an issue, we could just
submit the command and wait on it synchronously, as those systems don't
have the fiddly things like contexts and rc6 to contend with ;)
I can't think of a different way of slicing gem suspend, as it's core
operation is to switch the GPU to the kernel context, and that involves
submitting a GPU command. After gem suspend, we shouldn't tolerate any
more requests.
I am splitting the reset at the end of gem suspend into suspend_late
though (mainly so that we don't do it for SUSPEND_TEST_DEVICES as it
conflicts nastily with reset failure testing).
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/i915: Prepare GEM for suspend earlier
2018-05-25 9:26 ` Chris Wilson
@ 2018-05-25 10:51 ` Ville Syrjälä
2018-05-25 11:02 ` Chris Wilson
2018-05-25 13:55 ` Chris Wilson
0 siblings, 2 replies; 11+ messages in thread
From: Ville Syrjälä @ 2018-05-25 10:51 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
On Fri, May 25, 2018 at 10:26:29AM +0100, Chris Wilson wrote:
> In order to prepare the GPU for sleeping, we may want to submit commands
> to it. This is a complicated process that may even require some swapping
> in from shmemfs, if the GPU was in the wrong state. As such, we need to
> do this preparation step synchronously before the rest of the system has
> started to turn off (e.g. swapin fails if scsi is suspended).
> Fortunately, we are provided with a such a hook, pm_ops.prepare().
>
> v2: Compile cleanup
> v3: Fewer asserts, fewer problems?
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106640
> Testcase: igt/drv_suspend after igt/gem_tiled_swapping
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_drv.c | 41 +++++++++++++++++++++++++--------
> 1 file changed, 31 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 9c449b8d8eab..9d6ac7f44812 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1553,12 +1553,24 @@ static bool suspend_to_idle(struct drm_i915_private *dev_priv)
> return false;
> }
>
> +static int i915_drm_prepare(struct drm_device *dev)
> +{
> + struct drm_i915_private *i915 = to_i915(dev);
> + int err;
> +
> + err = i915_gem_suspend(i915);
> + if (err)
> + dev_err(&i915->drm.pdev->dev,
> + "GEM idle failed, suspend/resume might fail\n");
> +
> + return err;
> +}
> +
> static int i915_drm_suspend(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = to_i915(dev);
> struct pci_dev *pdev = dev_priv->drm.pdev;
> pci_power_t opregion_target_state;
> - int error;
>
> /* ignore lid events during suspend */
> mutex_lock(&dev_priv->modeset_restore_lock);
> @@ -1575,13 +1587,6 @@ static int i915_drm_suspend(struct drm_device *dev)
>
> pci_save_state(pdev);
>
> - error = i915_gem_suspend(dev_priv);
> - if (error) {
> - dev_err(&pdev->dev,
> - "GEM idle failed, resume might fail\n");
> - goto out;
> - }
> -
> intel_display_suspend(dev);
>
> intel_dp_mst_suspend(dev);
> @@ -1609,10 +1614,9 @@ static int i915_drm_suspend(struct drm_device *dev)
>
> intel_csr_ucode_suspend(dev_priv);
>
> -out:
> enable_rpm_wakeref_asserts(dev_priv);
>
> - return error;
> + return 0;
> }
>
> static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
> @@ -2081,6 +2085,22 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg)
> return ret;
> }
>
> +static int i915_pm_prepare(struct device *kdev)
> +{
> + struct pci_dev *pdev = to_pci_dev(kdev);
> + struct drm_device *dev = pci_get_drvdata(pdev);
> +
> + if (!dev) {
> + dev_err(kdev, "DRM not initialized, aborting suspend.\n");
> + return -ENODEV;
> + }
How can this happen?
IIRC I actually wrote a patch once to move the gem suspend to happen
after display suspend. The idea being that shutting down the display(s)
may require gem services (MI_OVERLAY_OFF being the prime example I
had in mind at the time). Just wondering if we can split the gem suspend
somehow to allow that, or would we need to just move display suspend
earlier as well?
> +
> + if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
> + return 0;
> +
> + return i915_drm_prepare(dev);
> +}
> +
> static int i915_pm_suspend(struct device *kdev)
> {
> struct pci_dev *pdev = to_pci_dev(kdev);
> @@ -2731,6 +2751,7 @@ const struct dev_pm_ops i915_pm_ops = {
> * S0ix (via system suspend) and S3 event handlers [PMSG_SUSPEND,
> * PMSG_RESUME]
> */
> + .prepare = i915_pm_prepare,
> .suspend = i915_pm_suspend,
> .suspend_late = i915_pm_suspend_late,
> .resume_early = i915_pm_resume_early,
> --
> 2.17.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] drm/i915: Prepare GEM for suspend earlier
2018-05-25 6:53 Chris Wilson
@ 2018-05-25 9:26 ` Chris Wilson
2018-05-25 10:51 ` Ville Syrjälä
0 siblings, 1 reply; 11+ messages in thread
From: Chris Wilson @ 2018-05-25 9:26 UTC (permalink / raw)
To: intel-gfx
In order to prepare the GPU for sleeping, we may want to submit commands
to it. This is a complicated process that may even require some swapping
in from shmemfs, if the GPU was in the wrong state. As such, we need to
do this preparation step synchronously before the rest of the system has
started to turn off (e.g. swapin fails if scsi is suspended).
Fortunately, we are provided with a such a hook, pm_ops.prepare().
v2: Compile cleanup
v3: Fewer asserts, fewer problems?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106640
Testcase: igt/drv_suspend after igt/gem_tiled_swapping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.c | 41 +++++++++++++++++++++++++--------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 9c449b8d8eab..9d6ac7f44812 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1553,12 +1553,24 @@ static bool suspend_to_idle(struct drm_i915_private *dev_priv)
return false;
}
+static int i915_drm_prepare(struct drm_device *dev)
+{
+ struct drm_i915_private *i915 = to_i915(dev);
+ int err;
+
+ err = i915_gem_suspend(i915);
+ if (err)
+ dev_err(&i915->drm.pdev->dev,
+ "GEM idle failed, suspend/resume might fail\n");
+
+ return err;
+}
+
static int i915_drm_suspend(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev;
pci_power_t opregion_target_state;
- int error;
/* ignore lid events during suspend */
mutex_lock(&dev_priv->modeset_restore_lock);
@@ -1575,13 +1587,6 @@ static int i915_drm_suspend(struct drm_device *dev)
pci_save_state(pdev);
- error = i915_gem_suspend(dev_priv);
- if (error) {
- dev_err(&pdev->dev,
- "GEM idle failed, resume might fail\n");
- goto out;
- }
-
intel_display_suspend(dev);
intel_dp_mst_suspend(dev);
@@ -1609,10 +1614,9 @@ static int i915_drm_suspend(struct drm_device *dev)
intel_csr_ucode_suspend(dev_priv);
-out:
enable_rpm_wakeref_asserts(dev_priv);
- return error;
+ return 0;
}
static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
@@ -2081,6 +2085,22 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg)
return ret;
}
+static int i915_pm_prepare(struct device *kdev)
+{
+ struct pci_dev *pdev = to_pci_dev(kdev);
+ struct drm_device *dev = pci_get_drvdata(pdev);
+
+ if (!dev) {
+ dev_err(kdev, "DRM not initialized, aborting suspend.\n");
+ return -ENODEV;
+ }
+
+ if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+ return 0;
+
+ return i915_drm_prepare(dev);
+}
+
static int i915_pm_suspend(struct device *kdev)
{
struct pci_dev *pdev = to_pci_dev(kdev);
@@ -2731,6 +2751,7 @@ const struct dev_pm_ops i915_pm_ops = {
* S0ix (via system suspend) and S3 event handlers [PMSG_SUSPEND,
* PMSG_RESUME]
*/
+ .prepare = i915_pm_prepare,
.suspend = i915_pm_suspend,
.suspend_late = i915_pm_suspend_late,
.resume_early = i915_pm_resume_early,
--
2.17.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] drm/i915: Prepare GEM for suspend earlier
@ 2018-05-25 6:53 Chris Wilson
2018-05-25 9:26 ` Chris Wilson
0 siblings, 1 reply; 11+ messages in thread
From: Chris Wilson @ 2018-05-25 6:53 UTC (permalink / raw)
To: intel-gfx
In order to prepare the GPU for sleeping, we may want to submit commands
to it. This is a complicated process that may even require some swapping
in from shmemfs, if the GPU was in the wrong state. As such, we need to
do this preparation step synchronously before the rest of the system has
started to turn off (e.g. swapin fails if scsi is suspended).
Fortunately, we are provided with a such a hook, pm_ops.prepare().
v2: Compile cleanup
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106640
Testcase: igt/drv_suspend after igt/gem_tiled_swapping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.c | 47 ++++++++++++++++++++++++++-------
1 file changed, 37 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 9c449b8d8eab..a0beabd49f62 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1553,12 +1553,30 @@ static bool suspend_to_idle(struct drm_i915_private *dev_priv)
return false;
}
+static int i915_drm_prepare(struct drm_device *dev)
+{
+ struct drm_i915_private *i915 = to_i915(dev);
+ int err;
+
+ disable_rpm_wakeref_asserts(i915);
+
+ err = i915_gem_suspend(i915);
+ if (err) {
+ dev_err(&i915->drm.pdev->dev,
+ "GEM idle failed, suspend/resume might fail\n");
+ goto out;
+ }
+out:
+ enable_rpm_wakeref_asserts(i915);
+
+ return err;
+}
+
static int i915_drm_suspend(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev;
pci_power_t opregion_target_state;
- int error;
/* ignore lid events during suspend */
mutex_lock(&dev_priv->modeset_restore_lock);
@@ -1575,13 +1593,6 @@ static int i915_drm_suspend(struct drm_device *dev)
pci_save_state(pdev);
- error = i915_gem_suspend(dev_priv);
- if (error) {
- dev_err(&pdev->dev,
- "GEM idle failed, resume might fail\n");
- goto out;
- }
-
intel_display_suspend(dev);
intel_dp_mst_suspend(dev);
@@ -1609,10 +1620,9 @@ static int i915_drm_suspend(struct drm_device *dev)
intel_csr_ucode_suspend(dev_priv);
-out:
enable_rpm_wakeref_asserts(dev_priv);
- return error;
+ return 0;
}
static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
@@ -2081,6 +2091,22 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg)
return ret;
}
+static int i915_pm_prepare(struct device *kdev)
+{
+ struct pci_dev *pdev = to_pci_dev(kdev);
+ struct drm_device *dev = pci_get_drvdata(pdev);
+
+ if (!dev) {
+ dev_err(kdev, "DRM not initialized, aborting suspend.\n");
+ return -ENODEV;
+ }
+
+ if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+ return 0;
+
+ return i915_drm_prepare(dev);
+}
+
static int i915_pm_suspend(struct device *kdev)
{
struct pci_dev *pdev = to_pci_dev(kdev);
@@ -2731,6 +2757,7 @@ const struct dev_pm_ops i915_pm_ops = {
* S0ix (via system suspend) and S3 event handlers [PMSG_SUSPEND,
* PMSG_RESUME]
*/
+ .prepare = i915_pm_prepare,
.suspend = i915_pm_suspend,
.suspend_late = i915_pm_suspend_late,
.resume_early = i915_pm_resume_early,
--
2.17.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/i915: Prepare GEM for suspend earlier
2018-05-22 14:17 Chris Wilson
2018-05-24 17:27 ` kbuild test robot
@ 2018-05-24 17:34 ` kbuild test robot
1 sibling, 0 replies; 11+ messages in thread
From: kbuild test robot @ 2018-05-24 17:34 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, kbuild-all
[-- Attachment #1: Type: text/plain, Size: 18923 bytes --]
Hi Chris,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.17-rc6 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-Prepare-GEM-for-suspend-earlier/20180524-231951
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x000-201820 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/gpu//drm/i915/i915_drv.c: In function 'i915_drm_suspend':
>> drivers/gpu//drm/i915/i915_drv.c:1624:1: error: label 'out' defined but not used [-Werror=unused-label]
out:
^~~
Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:clear_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:constant_test_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
Cyclomatic Complexity 1 arch/x86/include/asm/arch_hweight.h:__arch_hweight32
Cyclomatic Complexity 1 arch/x86/include/asm/arch_hweight.h:__arch_hweight8
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
Cyclomatic Complexity 1 include/linux/list.h:list_empty
Cyclomatic Complexity 1 arch/x86/include/asm/mem_encrypt.h:sme_active
Cyclomatic Complexity 1 include/linux/mem_encrypt.h:sme_get_me_mask
Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_inc
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_dec
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_inc
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_dec
Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 3 include/linux/err.h:IS_ERR_OR_NULL
Cyclomatic Complexity 1 include/linux/lockdep.h:lock_is_held
Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock_irq
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irq
Cyclomatic Complexity 1 include/linux/jiffies.h:_msecs_to_jiffies
Cyclomatic Complexity 3 include/linux/jiffies.h:msecs_to_jiffies
Cyclomatic Complexity 3 include/linux/ktime.h:ktime_compare
Cyclomatic Complexity 1 include/linux/ktime.h:ktime_after
Cyclomatic Complexity 1 include/linux/workqueue.h:queue_delayed_work
Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 3 include/linux/slab.h:kmalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata
Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
Cyclomatic Complexity 1 include/linux/device.h:dev_pm_set_driver_flags
Cyclomatic Complexity 1 include/linux/pci.h:pci_disable_msi
Cyclomatic Complexity 1 include/linux/pci.h:pci_enable_msi
Cyclomatic Complexity 1 arch/x86/include/asm/pci.h:pci_domain_nr
Cyclomatic Complexity 1 include/linux/pci.h:pci_get_drvdata
Cyclomatic Complexity 1 include/linux/pci.h:pci_set_drvdata
Cyclomatic Complexity 1 arch/x86/include/asm/dma-mapping.h:get_arch_dma_ops
Cyclomatic Complexity 4 include/linux/dma-mapping.h:get_dma_ops
Cyclomatic Complexity 3 include/linux/dma-mapping.h:dma_check_mask
Cyclomatic Complexity 4 include/linux/dma-mapping.h:dma_supported
Cyclomatic Complexity 2 include/linux/dma-mapping.h:dma_set_coherent_mask
Cyclomatic Complexity 1 include/linux/vgaarb.h:vga_client_register
Cyclomatic Complexity 2 include/linux/fb.h:alloc_apertures
Cyclomatic Complexity 1 include/linux/vga_switcheroo.h:vga_switcheroo_unregister_client
Cyclomatic Complexity 1 include/linux/vga_switcheroo.h:vga_switcheroo_register_client
Cyclomatic Complexity 1 include/linux/vga_switcheroo.h:vga_switcheroo_process_delayed_switch
Cyclomatic Complexity 1 include/drm/drm_print.h:drm_debug_printer
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_utils.h:onoff
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_device_info.h:sseu_subslice_total
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_ringbuffer.h:intel_engine_flag
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_uncore.h:intel_wait_for_register
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_gpu_error.h:i915_reset_error_state
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_gvt.h:intel_gvt_init
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_gvt.h:intel_gvt_cleanup
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_gvt.h:intel_gvt_sanitize_options
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.h:to_i915
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:kdev_to_i915
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:intel_info
Cyclomatic Complexity 1 include/drm/drm_fb_helper.h:drm_fb_helper_remove_conflicting_framebuffers
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:disable_rpm_wakeref_asserts
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:enable_rpm_wakeref_asserts
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.h:i915_queue_hangcheck
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:intel_vgpu_active
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.h:i915_gem_drain_freed_objects
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.h:i915_gem_drain_workqueue
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:mkwrite_device_info
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:i915_error_injected
Cyclomatic Complexity 6 drivers/gpu//drm/i915/i915_drv.c:intel_is_virt_pch
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_switcheroo_can_switch
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_kick_out_vgacon
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:intel_init_dpio
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:intel_gt_reset_engine
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:vlv_save_gunit_s0ix_state
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:vlv_restore_gunit_s0ix_state
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_gem_reject_pin_ioctl
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:i915_engines_cleanup
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_kick_out_firmware_fb
Cyclomatic Complexity 14 drivers/gpu//drm/i915/i915_drv.c:intel_virt_detect_pch
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:vlv_check_no_gt_access
Cyclomatic Complexity 42 drivers/gpu//drm/i915/i915_drv.c:i915_getparam_ioctl
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_driver_lastclose
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_driver_postclose
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_driver_open
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_workqueues_cleanup
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:i915_workqueues_init
Cyclomatic Complexity 59 drivers/gpu//drm/i915/i915_drv.c:intel_pch_type
Cyclomatic Complexity 10 drivers/gpu//drm/i915/i915_drv.c:intel_detect_pch
Cyclomatic Complexity 8 drivers/gpu//drm/i915/i915_drv.c:intel_detect_preproduction_hw
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_get_bridge_dev
Cyclomatic Complexity 7 drivers/gpu//drm/i915/i915_drv.c:intel_alloc_mchbar_resource
Cyclomatic Complexity 7 drivers/gpu//drm/i915/i915_drv.c:intel_setup_mchbar
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:i915_mmio_setup
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:intel_sanitize_options
Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_drv.c:vlv_wait_for_pw_status
Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_drv.c:vlv_allow_gt_wake
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:vlv_wait_for_gt_wells
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:i915_drm_resume
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_pm_resume
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_pm_thaw
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_pm_restore
Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_drv.c:intel_suspend_encoders
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:suspend_to_idle
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_drm_suspend
>> drivers/gpu//drm/i915/i915_drv.c:1627:9: error: 'error' is used uninitialized in this function [-Werror=uninitialized]
return error;
^~~~~
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_vga_set_decode
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_gem_fini
Cyclomatic Complexity 6 drivers/gpu//drm/i915/i915_drv.c:i915_driver_register
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_welcome_messages
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_driver_cleanup_hw
Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_drv.c:intel_teardown_mchbar
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_mmio_cleanup
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_driver_cleanup_mmio
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_driver_cleanup_early
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_driver_release
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_driver_unregister
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_drm_prepare
Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_drv.c:i915_pm_suspend
Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_drv.c:i915_pm_prepare
Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_drv.c:i915_pm_freeze
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:__i915_inject_load_failure
Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_drv.c:i915_driver_init_early
Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_drv.c:i915_driver_init_mmio
Cyclomatic Complexity 14 drivers/gpu//drm/i915/i915_drv.c:i915_driver_init_hw
Cyclomatic Complexity 11 drivers/gpu//drm/i915/i915_drv.c:i915_load_modeset_init
Cyclomatic Complexity 6 drivers/gpu//drm/i915/i915_drv.c:__i915_printk
Cyclomatic Complexity 13 drivers/gpu//drm/i915/i915_drv.c:i915_driver_load
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_driver_unload
Cyclomatic Complexity 15 drivers/gpu//drm/i915/i915_drv.c:i915_reset
Cyclomatic Complexity 6 drivers/gpu//drm/i915/i915_drv.c:i915_reset_engine
Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_drv.c:vlv_force_gfx_clock
Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_drv.c:vlv_resume_prepare
Cyclomatic Complexity 9 drivers/gpu//drm/i915/i915_drv.c:i915_drm_resume_early
Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_drv.c:i915_resume_switcheroo
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_pm_resume_early
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_pm_thaw_early
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.c:i915_pm_restore_early
Cyclomatic Complexity 18 drivers/gpu//drm/i915/i915_drv.c:intel_runtime_resume
Cyclomatic Complexity 6 drivers/gpu//drm/i915/i915_drv.c:vlv_suspend_complete
Cyclomatic Complexity 14 drivers/gpu//drm/i915/i915_drv.c:i915_drm_suspend_late
Cyclomatic Complexity 8 drivers/gpu//drm/i915/i915_drv.c:i915_suspend_switcheroo
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_switcheroo_set_state
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_pm_suspend_late
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.c:i915_pm_poweroff_late
Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_drv.c:i915_pm_freeze_late
Cyclomatic Complexity 23 drivers/gpu//drm/i915/i915_drv.c:intel_runtime_suspend
Cyclomatic Complexity 4 drivers/gpu//drm/i915/selftests/mock_drm.c:mock_file
Cyclomatic Complexity 1 drivers/gpu//drm/i915/selftests/mock_drm.c:mock_file_free
cc1: all warnings being treated as errors
vim +/out +1624 drivers/gpu//drm/i915/i915_drv.c
156987f3e drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2018-05-22 1574
5e365c391 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-10-23 1575 static int i915_drm_suspend(struct drm_device *dev)
ba8bbcf6f drivers/char/drm/i915_drv.c Jesse Barnes 2007-11-22 1576 {
fac5e23e3 drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2016-07-04 1577 struct drm_i915_private *dev_priv = to_i915(dev);
52a05c302 drivers/gpu/drm/i915/i915_drv.c David Weinehall 2016-08-22 1578 struct pci_dev *pdev = dev_priv->drm.pdev;
e5747e3ad drivers/gpu/drm/i915/i915_drv.c Jesse Barnes 2014-06-12 1579 pci_power_t opregion_target_state;
d58189385 drivers/gpu/drm/i915/i915_drv.c Daniel Vetter 2015-02-23 1580 int error;
61caf87cb drivers/gpu/drm/i915/i915_drv.c Rafael J. Wysocki 2010-02-18 1581
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1582 /* ignore lid events during suspend */
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1583 mutex_lock(&dev_priv->modeset_restore_lock);
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1584 dev_priv->modeset_restore = MODESET_SUSPENDED;
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1585 mutex_unlock(&dev_priv->modeset_restore_lock);
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1586
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 1587 disable_rpm_wakeref_asserts(dev_priv);
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 1588
c67a470b1 drivers/gpu/drm/i915/i915_drv.c Paulo Zanoni 2013-08-19 1589 /* We do a lot of poking in a lot of registers, make sure they work
c67a470b1 drivers/gpu/drm/i915/i915_drv.c Paulo Zanoni 2013-08-19 1590 * properly. */
da7e29bd5 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-02-18 1591 intel_display_set_init_power(dev_priv, true);
cb10799c1 drivers/gpu/drm/i915/i915_drv.c Paulo Zanoni 2013-01-25 1592
5bcf719b7 drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2010-12-07 1593 drm_kms_helper_poll_disable(dev);
5bcf719b7 drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2010-12-07 1594
52a05c302 drivers/gpu/drm/i915/i915_drv.c David Weinehall 2016-08-22 1595 pci_save_state(pdev);
ba8bbcf6f drivers/char/drm/i915_drv.c Jesse Barnes 2007-11-22 1596
6b72d4862 drivers/gpu/drm/i915/i915_drv.c Maarten Lankhorst 2015-06-01 1597 intel_display_suspend(dev);
7d708ee40 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2013-04-17 1598
0e32b39ce drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2014-05-02 1599 intel_dp_mst_suspend(dev);
09b64267c drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2014-07-23 1600
b963291cf drivers/gpu/drm/i915/i915_drv.c Daniel Vetter 2014-09-30 1601 intel_runtime_pm_disable_interrupts(dev_priv);
1d0d343ab drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-08-18 1602 intel_hpd_cancel_work(dev_priv);
0e32b39ce drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2014-05-02 1603
07f9cd0b3 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-08-18 1604 intel_suspend_encoders(dev_priv);
07f9cd0b3 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-08-18 1605
712bf3644 drivers/gpu/drm/i915/i915_drv.c Ville Syrjälä 2016-10-31 1606 intel_suspend_hw(dev_priv);
5669fcacc drivers/gpu/drm/i915/i915_drv.c Jesse Barnes 2009-02-17 1607
275a991c0 drivers/gpu/drm/i915/i915_drv.c Tvrtko Ursulin 2016-11-16 1608 i915_gem_suspend_gtt_mappings(dev_priv);
828c79087 drivers/gpu/drm/i915/i915_drv.c Ben Widawsky 2013-10-16 1609
af6dc7425 drivers/gpu/drm/i915/i915_drv.c Tvrtko Ursulin 2016-12-01 1610 i915_save_state(dev_priv);
9e06dd39f drivers/gpu/drm/i915/i915_drv.c Jesse Barnes 2009-06-22 1611
bc87229f3 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-11-18 1612 opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
6f9f4b7a2 drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2016-05-23 1613 intel_opregion_notify_adapter(dev_priv, opregion_target_state);
e5747e3ad drivers/gpu/drm/i915/i915_drv.c Jesse Barnes 2014-06-12 1614
68f60946c drivers/gpu/drm/i915/i915_drv.c Hans de Goede 2017-02-10 1615 intel_uncore_suspend(dev_priv);
03d92e477 drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2016-05-23 1616 intel_opregion_unregister(dev_priv);
8ee1c3db9 drivers/gpu/drm/i915/i915_drv.c Matthew Garrett 2008-08-05 1617
82e3b8c13 drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2014-08-13 1618 intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true);
3fa016a0b drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2012-03-28 1619
62d5d69b4 drivers/gpu/drm/i915/i915_drv.c Mika Kuoppala 2014-02-25 1620 dev_priv->suspend_count++;
62d5d69b4 drivers/gpu/drm/i915/i915_drv.c Mika Kuoppala 2014-02-25 1621
f74ed08d5 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2016-04-18 1622 intel_csr_ucode_suspend(dev_priv);
f514c2d84 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-10-28 1623
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 @1624 out:
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 1625 enable_rpm_wakeref_asserts(dev_priv);
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 1626
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 @1627 return error;
84b79f8d2 drivers/gpu/drm/i915/i915_drv.c Rafael J. Wysocki 2010-02-07 1628 }
84b79f8d2 drivers/gpu/drm/i915/i915_drv.c Rafael J. Wysocki 2010-02-07 1629
:::::: The code at line 1624 was first introduced by commit
:::::: 1f814daca43a2d99248fd754eacfb8ba12449235 drm/i915: add support for checking if we hold an RPM reference
:::::: TO: Imre Deak <imre.deak@intel.com>
:::::: CC: Imre Deak <imre.deak@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29889 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/i915: Prepare GEM for suspend earlier
2018-05-22 14:17 Chris Wilson
@ 2018-05-24 17:27 ` kbuild test robot
2018-05-24 17:34 ` kbuild test robot
1 sibling, 0 replies; 11+ messages in thread
From: kbuild test robot @ 2018-05-24 17:27 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7176 bytes --]
Hi Chris,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.17-rc6 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-Prepare-GEM-for-suspend-earlier/20180524-231951
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x015-201820 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
drivers/gpu//drm/i915/i915_drv.c: In function 'i915_drm_suspend':
drivers/gpu//drm/i915/i915_drv.c:1624:1: warning: label 'out' defined but not used [-Wunused-label]
out:
^~~
>> drivers/gpu//drm/i915/i915_drv.c:1627:9: warning: 'error' is used uninitialized in this function [-Wuninitialized]
return error;
^~~~~
vim +/error +1627 drivers/gpu//drm/i915/i915_drv.c
156987f3e drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2018-05-22 1574
5e365c391 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-10-23 1575 static int i915_drm_suspend(struct drm_device *dev)
ba8bbcf6f drivers/char/drm/i915_drv.c Jesse Barnes 2007-11-22 1576 {
fac5e23e3 drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2016-07-04 1577 struct drm_i915_private *dev_priv = to_i915(dev);
52a05c302 drivers/gpu/drm/i915/i915_drv.c David Weinehall 2016-08-22 1578 struct pci_dev *pdev = dev_priv->drm.pdev;
e5747e3ad drivers/gpu/drm/i915/i915_drv.c Jesse Barnes 2014-06-12 1579 pci_power_t opregion_target_state;
d58189385 drivers/gpu/drm/i915/i915_drv.c Daniel Vetter 2015-02-23 1580 int error;
61caf87cb drivers/gpu/drm/i915/i915_drv.c Rafael J. Wysocki 2010-02-18 1581
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1582 /* ignore lid events during suspend */
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1583 mutex_lock(&dev_priv->modeset_restore_lock);
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1584 dev_priv->modeset_restore = MODESET_SUSPENDED;
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1585 mutex_unlock(&dev_priv->modeset_restore_lock);
b8efb17b3 drivers/gpu/drm/i915/i915_drv.c Zhang Rui 2013-02-05 1586
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 1587 disable_rpm_wakeref_asserts(dev_priv);
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 1588
c67a470b1 drivers/gpu/drm/i915/i915_drv.c Paulo Zanoni 2013-08-19 1589 /* We do a lot of poking in a lot of registers, make sure they work
c67a470b1 drivers/gpu/drm/i915/i915_drv.c Paulo Zanoni 2013-08-19 1590 * properly. */
da7e29bd5 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-02-18 1591 intel_display_set_init_power(dev_priv, true);
cb10799c1 drivers/gpu/drm/i915/i915_drv.c Paulo Zanoni 2013-01-25 1592
5bcf719b7 drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2010-12-07 1593 drm_kms_helper_poll_disable(dev);
5bcf719b7 drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2010-12-07 1594
52a05c302 drivers/gpu/drm/i915/i915_drv.c David Weinehall 2016-08-22 1595 pci_save_state(pdev);
ba8bbcf6f drivers/char/drm/i915_drv.c Jesse Barnes 2007-11-22 1596
6b72d4862 drivers/gpu/drm/i915/i915_drv.c Maarten Lankhorst 2015-06-01 1597 intel_display_suspend(dev);
7d708ee40 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2013-04-17 1598
0e32b39ce drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2014-05-02 1599 intel_dp_mst_suspend(dev);
09b64267c drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2014-07-23 1600
b963291cf drivers/gpu/drm/i915/i915_drv.c Daniel Vetter 2014-09-30 1601 intel_runtime_pm_disable_interrupts(dev_priv);
1d0d343ab drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-08-18 1602 intel_hpd_cancel_work(dev_priv);
0e32b39ce drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2014-05-02 1603
07f9cd0b3 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-08-18 1604 intel_suspend_encoders(dev_priv);
07f9cd0b3 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2014-08-18 1605
712bf3644 drivers/gpu/drm/i915/i915_drv.c Ville Syrjälä 2016-10-31 1606 intel_suspend_hw(dev_priv);
5669fcacc drivers/gpu/drm/i915/i915_drv.c Jesse Barnes 2009-02-17 1607
275a991c0 drivers/gpu/drm/i915/i915_drv.c Tvrtko Ursulin 2016-11-16 1608 i915_gem_suspend_gtt_mappings(dev_priv);
828c79087 drivers/gpu/drm/i915/i915_drv.c Ben Widawsky 2013-10-16 1609
af6dc7425 drivers/gpu/drm/i915/i915_drv.c Tvrtko Ursulin 2016-12-01 1610 i915_save_state(dev_priv);
9e06dd39f drivers/gpu/drm/i915/i915_drv.c Jesse Barnes 2009-06-22 1611
bc87229f3 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-11-18 1612 opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
6f9f4b7a2 drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2016-05-23 1613 intel_opregion_notify_adapter(dev_priv, opregion_target_state);
e5747e3ad drivers/gpu/drm/i915/i915_drv.c Jesse Barnes 2014-06-12 1614
68f60946c drivers/gpu/drm/i915/i915_drv.c Hans de Goede 2017-02-10 1615 intel_uncore_suspend(dev_priv);
03d92e477 drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2016-05-23 1616 intel_opregion_unregister(dev_priv);
8ee1c3db9 drivers/gpu/drm/i915/i915_drv.c Matthew Garrett 2008-08-05 1617
82e3b8c13 drivers/gpu/drm/i915/i915_drv.c Chris Wilson 2014-08-13 1618 intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true);
3fa016a0b drivers/gpu/drm/i915/i915_drv.c Dave Airlie 2012-03-28 1619
62d5d69b4 drivers/gpu/drm/i915/i915_drv.c Mika Kuoppala 2014-02-25 1620 dev_priv->suspend_count++;
62d5d69b4 drivers/gpu/drm/i915/i915_drv.c Mika Kuoppala 2014-02-25 1621
f74ed08d5 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2016-04-18 1622 intel_csr_ucode_suspend(dev_priv);
f514c2d84 drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-10-28 1623
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 @1624 out:
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 1625 enable_rpm_wakeref_asserts(dev_priv);
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 1626
1f814daca drivers/gpu/drm/i915/i915_drv.c Imre Deak 2015-12-16 @1627 return error;
84b79f8d2 drivers/gpu/drm/i915/i915_drv.c Rafael J. Wysocki 2010-02-07 1628 }
84b79f8d2 drivers/gpu/drm/i915/i915_drv.c Rafael J. Wysocki 2010-02-07 1629
:::::: The code at line 1627 was first introduced by commit
:::::: 1f814daca43a2d99248fd754eacfb8ba12449235 drm/i915: add support for checking if we hold an RPM reference
:::::: TO: Imre Deak <imre.deak@intel.com>
:::::: CC: Imre Deak <imre.deak@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31948 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] drm/i915: Prepare GEM for suspend earlier
@ 2018-05-22 14:17 Chris Wilson
2018-05-24 17:27 ` kbuild test robot
2018-05-24 17:34 ` kbuild test robot
0 siblings, 2 replies; 11+ messages in thread
From: Chris Wilson @ 2018-05-22 14:17 UTC (permalink / raw)
To: intel-gfx
In order to prepare the GPU for sleeping, we may want to submit commands
to it. This is a complicated process that may even require some swapping
in from shmemfs, if the GPU was in the wrong state. As such, we need to
do this preparation step synchronously before the rest of the system has
started to turn off (e.g. swapin fails if scsi is suspended).
Fortunately, we are provided with a such a hook, pm_ops.prepare().
Testcase: igt/drv_suspend after igt/gem_tiled_swapping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.c | 43 +++++++++++++++++++++++++++------
1 file changed, 36 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 9c449b8d8eab..256642fb8315 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1553,6 +1553,25 @@ static bool suspend_to_idle(struct drm_i915_private *dev_priv)
return false;
}
+static int i915_drm_prepare(struct drm_device *dev)
+{
+ struct drm_i915_private *i915 = to_i915(dev);
+ int err;
+
+ disable_rpm_wakeref_asserts(i915);
+
+ err = i915_gem_suspend(i915);
+ if (err) {
+ dev_err(&i915->drm.pdev->dev,
+ "GEM idle failed, suspend/resume might fail\n");
+ goto out;
+ }
+out:
+ enable_rpm_wakeref_asserts(i915);
+
+ return err;
+}
+
static int i915_drm_suspend(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = to_i915(dev);
@@ -1575,13 +1594,6 @@ static int i915_drm_suspend(struct drm_device *dev)
pci_save_state(pdev);
- error = i915_gem_suspend(dev_priv);
- if (error) {
- dev_err(&pdev->dev,
- "GEM idle failed, resume might fail\n");
- goto out;
- }
-
intel_display_suspend(dev);
intel_dp_mst_suspend(dev);
@@ -2081,6 +2093,22 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg)
return ret;
}
+static int i915_pm_prepare(struct device *kdev)
+{
+ struct pci_dev *pdev = to_pci_dev(kdev);
+ struct drm_device *dev = pci_get_drvdata(pdev);
+
+ if (!dev) {
+ dev_err(kdev, "DRM not initialized, aborting suspend.\n");
+ return -ENODEV;
+ }
+
+ if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+ return 0;
+
+ return i915_drm_prepare(dev);
+}
+
static int i915_pm_suspend(struct device *kdev)
{
struct pci_dev *pdev = to_pci_dev(kdev);
@@ -2731,6 +2759,7 @@ const struct dev_pm_ops i915_pm_ops = {
* S0ix (via system suspend) and S3 event handlers [PMSG_SUSPEND,
* PMSG_RESUME]
*/
+ .prepare = i915_pm_prepare,
.suspend = i915_pm_suspend,
.suspend_late = i915_pm_suspend_late,
.resume_early = i915_pm_resume_early,
--
2.17.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-05-25 13:55 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22 15:49 [PATCH] drm/i915: Prepare GEM for suspend earlier Chris Wilson
2018-05-22 16:31 ` ✗ Fi.CI.BAT: failure for drm/i915: Prepare GEM for suspend earlier (rev3) Patchwork
2018-05-22 16:55 ` [PATCH] drm/i915: Prepare GEM for suspend earlier Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2018-05-25 6:53 Chris Wilson
2018-05-25 9:26 ` Chris Wilson
2018-05-25 10:51 ` Ville Syrjälä
2018-05-25 11:02 ` Chris Wilson
2018-05-25 13:55 ` Chris Wilson
2018-05-22 14:17 Chris Wilson
2018-05-24 17:27 ` kbuild test robot
2018-05-24 17:34 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.