<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:abhijeet.kumar@intel.com" title="Abhijeet Kumar <abhijeet.kumar@intel.com>"> <span class="fn">Abhijeet Kumar</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - rc6 enablement fails in suspend resume stress test"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=105539">bug 105539</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Priority</td>
           <td>medium
           </td>
           <td>high
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Severity</td>
           <td>normal
           </td>
           <td>major
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - rc6 enablement fails in suspend resume stress test"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=105539#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - rc6 enablement fails in suspend resume stress test"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=105539">bug 105539</a>
              from <span class="vcard"><a class="email" href="mailto:abhijeet.kumar@intel.com" title="Abhijeet Kumar <abhijeet.kumar@intel.com>"> <span class="fn">Abhijeet Kumar</span></a>
</span></b>
        <pre>Way to repro on Ubuntu is use the script below and the attached patch which has
RC6 and DC6 counter status 


while true; do
    echo 0 > /sys/class/rtc/rtc0/wakealarm
    echo `date '+%s' -d '+ 3 seconds'` > /sys/class/rtc/rtc0/wakealarm
    dmesg|grep "DC6" |tail -1
    # sleep 1 #with and without commenting this line
    echo freeze >/sys/power/state
done

In failure case both DC6 and RC6 residency counter wouldn't have incremented.
Example-
2018-02-23T03:12:24.348124-08:00 INFO kernel: [ 480.779917] i915 0000:00:02.0:
Abhijeet: PM residency counters DC5=(0001bc43->0001bc45)
DC6=(0001bbbb->0001bbbb) RC6=(15b1c57c->15b1c57c)


in the above stress test , RC6 is getting disabled which is leading to soix
failure. By making below changes , system is able to enter RC6. Our analysis is
that the resume was called, so RC6 was disabled and system tried to enter
suspend again , where RC6 was not enabled from i915_gem_do_execbuffer.

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 5fdd2414ca31..cebf0fb67f81 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1843,6 +1843,7 @@ static int i915_pm_suspend(struct device *kdev)
 {
        struct pci_dev *pdev = to_pci_dev(kdev);
        struct drm_device *dev = pci_get_drvdata(pdev);
+       struct drm_i915_private *dev_priv = to_i915(dev);

        if (!dev) {
                dev_err(kdev, "DRM not initialized, aborting suspend.\n");
@@ -1852,13 +1853,28 @@ static int i915_pm_suspend(struct device *kdev)
        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
                return 0;

+     printk(KERN_ERR "Abhijeet RC6 state =  0x%08x\n",
(I915_READ(GEN6_RC_CONTROL) & GEN6_RC_CTL_HW_ENABLE));
+       intel_enable_gt_powersave(dev_priv);
+
+
        return i915_drm_suspend(dev);
 }</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are on the CC list for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>