<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO - i915 slab shrink cause a panic"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=109005#c7">Comment # 7</a>
              on <a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO - i915 slab shrink cause a panic"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=109005">bug 109005</a>
              from <span class="vcard"><a class="email" href="mailto:bin.yang@intel.com" title="Yang Bin <bin.yang@intel.com>"> <span class="fn">Yang Bin</span></a>
</span></b>
        <pre>I had reproduced this issue successfully and found the root cause as below.

i915_gem_wait_for_idle() waits for all requests being completed and
calls i915_retire_requests() to retire them. It assumes the
active_requests should be zero finally.

In i915_retire_requests(), it will retire all requests on the active
rings. Unfortunately, active_requests is increased in
i915_request_alloc() and reduced in i915_request_retire(), but the
request is added into active rings in i915_request_add().

If i915_gem_wait_for_idle() is called between i915_request_alloc()
and i915_request_add(), this request will not be retired. Then, the
active_requests will not be zero in the end.

Normally, i915_request_alloc() and i915_request_add() will be called
in sequence with drm.struct_mutex locked. But in
intel_vgpu_create_workload(), it will pre-allocate the request and
call i915_request_add() in the workload thread for performance
optimization. The above issue will be triggered.

I had submitted a RFC patch and continue to discuss it in maillist. Please
refer to <a href="https://lkml.org/lkml/2018/12/20/78">https://lkml.org/lkml/2018/12/20/78</a></pre>
        </div>
      </p>


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

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