<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:chris@chris-wilson.co.uk" title="Chris Wilson <chris@chris-wilson.co.uk>"> <span class="fn">Chris Wilson</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [CI] igt@perf_pmu@rc6 - dmesg-warn - BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1034 -> BUG: scheduling while atomic: perf_pmu/1513/0x00000004 -> DEBUG_LOCKS_WARN_ON(val > preempt_count())"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=104943">bug 104943</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;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>REOPENED
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [CI] igt@perf_pmu@rc6 - dmesg-warn - BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1034 -> BUG: scheduling while atomic: perf_pmu/1513/0x00000004 -> DEBUG_LOCKS_WARN_ON(val > preempt_count())"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=104943#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [CI] igt@perf_pmu@rc6 - dmesg-warn - BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1034 -> BUG: scheduling while atomic: perf_pmu/1513/0x00000004 -> DEBUG_LOCKS_WARN_ON(val > preempt_count())"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=104943">bug 104943</a>
              from <span class="vcard"><a class="email" href="mailto:chris@chris-wilson.co.uk" title="Chris Wilson <chris@chris-wilson.co.uk>"> <span class="fn">Chris Wilson</span></a>
</span></b>
        <pre>commit 1fe699e30113ed6f6e853ff44710d256072ea627
Author: Tvrtko Ursulin <<a href="mailto:tvrtko.ursulin@intel.com">tvrtko.ursulin@intel.com</a>>
Date:   Tue Feb 6 18:33:11 2018 +0000

    drm/i915/pmu: Fix sleep under atomic in RC6 readout

    We are not allowed to call intel_runtime_pm_get from the PMU counter read
    callback since the former can sleep, and the latter is running under IRQ
    context.

    To workaround this, we record the last known RC6 and while runtime
    suspended estimate its increase by querying the runtime PM core
    timestamps.

    Downside of this approach is that we can temporarily lose a chunk of RC6
    time, from the last PMU read-out to runtime suspend entry, but that will
    eventually catch up, once device comes back online and in the presence of
    PMU queries.

    Also, we have to be careful not to overshoot the RC6 estimate, so once
    resumed after a period of approximation, we only update the counter once
    it catches up. With the observation that RC6 is increasing while the
    device is suspended, this should not pose a problem and can only cause
    slight inaccuracies due clock base differences.

    v2: Simplify by estimating on top of PM core counters. (Imre)

    Signed-off-by: Tvrtko Ursulin <<a href="mailto:tvrtko.ursulin@intel.com">tvrtko.ursulin@intel.com</a>>
    Bugzilla: <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [CI] igt@perf_pmu@rc6 - dmesg-warn - BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1034 -> BUG: scheduling while atomic: perf_pmu/1513/0x00000004 -> DEBUG_LOCKS_WARN_ON(val > preempt_count())"
   href="show_bug.cgi?id=104943">https://bugs.freedesktop.org/show_bug.cgi?id=104943</a>
    Fixes: 6060b6aec03c ("drm/i915/pmu: Add RC6 residency metrics")
    Testcase: igt/perf_pmu/rc6-runtime-pm
    Cc: Tvrtko Ursulin <<a href="mailto:tvrtko.ursulin@intel.com">tvrtko.ursulin@intel.com</a>>
    Cc: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>>
    Cc: Imre Deak <<a href="mailto:imre.deak@intel.com">imre.deak@intel.com</a>>
    Cc: Jani Nikula <<a href="mailto:jani.nikula@linux.intel.com">jani.nikula@linux.intel.com</a>>
    Cc: Joonas Lahtinen <<a href="mailto:joonas.lahtinen@linux.intel.com">joonas.lahtinen@linux.intel.com</a>>
    Cc: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>>
    Cc: David Airlie <<a href="mailto:airlied@linux.ie">airlied@linux.ie</a>>
    Cc: <a href="mailto:intel-gfx@lists.freedesktop.org">intel-gfx@lists.freedesktop.org</a>
    Cc: <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a>
    Reviewed-by: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>>
    Link:
<a href="https://patchwork.freedesktop.org/patch/msgid/20180206183311.17924-1-tvrtko.ursulin@linux.intel.com">https://patchwork.freedesktop.org/patch/msgid/20180206183311.17924-1-tvrtko.ursulin@linux.intel.com</a></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>