<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Hi Matt, <br>
    </p>
    <div class="moz-cite-prefix">On 3/18/2024 3:21 PM, Matthew Brost
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:ZfhN8C+KN+Idi4nz@DUT025-TGLU.fm.intel.com">
      <pre class="moz-quote-pre" wrap="">On Mon, Mar 18, 2024 at 02:50:00PM +0100, Nirmoy Das wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Add a warn for NULL job when sync->type is
DRM_XE_SYNC_TYPE_USER_FENCE. This should be a programming
error and should never happen so warn and let the kernel crash
if that ever happens.

Cc: Matthew Auld <a class="moz-txt-link-rfc2396E" href="mailto:matthew.auld@intel.com"><matthew.auld@intel.com></a>
Cc: Matthew Brost <a class="moz-txt-link-rfc2396E" href="mailto:matthew.brost@intel.com"><matthew.brost@intel.com></a>
Signed-off-by: Nirmoy Das <a class="moz-txt-link-rfc2396E" href="mailto:nirmoy.das@intel.com"><nirmoy.das@intel.com></a>
---
 drivers/gpu/drm/xe/xe_sync.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
index 02c9577fe418..2b45950aa0af 100644
--- a/drivers/gpu/drm/xe/xe_sync.c
+++ b/drivers/gpu/drm/xe/xe_sync.c
@@ -255,6 +255,7 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct xe_sched_job *job,
                        dma_fence_put(fence);
                }
        } else if (sync->type == DRM_XE_SYNC_TYPE_USER_FENCE) {
+               XE_WARN_ON(job);
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
For a warn on you this inverted - a WARN_ON(true) will pop.</pre>
    </blockquote>
    Thanks,  that was stupid of me. I meant <span style="white-space: pre-wrap">to do "WARN_ON</span>(!job)"
    <pre class="moz-quote-pre" wrap="">
</pre>
    <blockquote type="cite" cite="mid:ZfhN8C+KN+Idi4nz@DUT025-TGLU.fm.intel.com">
      <pre class="moz-quote-pre" wrap="">

But I think we should actually use an xe_assert here which has this
opposite behavior - pops on xe_assert(xe, false).

So the I think it should be:

xe_assert(xe, job);</pre>
    </blockquote>
    <p>xe_assert needed a xe device struct which I can't find a better
      way to retrieve than to pass it on as new argument<br>
    </p>
    <p>I think that is bit too much change for it. I will resend with  <span style="white-space: pre-wrap">WARN_ON</span>(!job).</p>
    <p><br>
    </p>
    <p>Regards,</p>
    <p>Nirmoy<br>
    </p>
    <blockquote type="cite" cite="mid:ZfhN8C+KN+Idi4nz@DUT025-TGLU.fm.intel.com">
      <pre class="moz-quote-pre" wrap="">

Matt

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">           job->user_fence.used = true;
                job->user_fence.addr = sync->addr;
                job->user_fence.value = sync->timeline_value;
-- 
2.42.0

</pre>
      </blockquote>
    </blockquote>
  </body>
</html>