<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;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </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#c1">Comment # 1</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 b2f78cda260bc6a1a2d382b1d85a29e69b5b3724
Author: Tvrtko Ursulin <<a href="mailto:tvrtko.ursulin@intel.com">tvrtko.ursulin@intel.com</a>>
Date:   Mon Feb 5 09:34:48 2018 +0000

    drm/i915/pmu: Fix PMU enable vs execlists tasklet race

    Commit 99e48bf98dd0 ("drm/i915: Lock out execlist tasklet while peeking
    inside for busy-stats") added a tasklet_disable call in busy stats
    enabling, but we failed to understand that the PMU enable callback runs
    as an hard IRQ (IPI).

    Consequence of this is that the PMU enable callback can interrupt the
    execlists tasklet, and will then deadlock when it calls
    intel_engine_stats_enable->tasklet_disable.

    To fix this, I realized it is possible to move the engine stats enablement
    and disablement to PMU event init and destroy hooks. This allows for much
    simpler implementation since those hooks run in normal context (can
    sleep).

    v2: Extract engine_event_destroy. (Chris Wilson)

    Signed-off-by: Tvrtko Ursulin <<a href="mailto:tvrtko.ursulin@intel.com">tvrtko.ursulin@intel.com</a>>
    Fixes: 99e48bf98dd0 ("drm/i915: Lock out execlist tasklet while peeking
inside for busy-stats")
    Testcase: igt/perf_pmu/enable-race-*
    Cc: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>>
    Cc: Tvrtko Ursulin <<a href="mailto:tvrtko.ursulin@intel.com">tvrtko.ursulin@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: <a href="mailto:intel-gfx@lists.freedesktop.org">intel-gfx@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/20180205093448.13877-1-tvrtko.ursulin@linux.intel.com">https://patchwork.freedesktop.org/patch/msgid/20180205093448.13877-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 the assignee for the bug.</li>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>