<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 12/10/2024 5:39 PM, Thomas Hellström
wrote:<br>
</div>
<blockquote type="cite" cite="mid:41de753b03bb5e86be011277429649d6d644687f.camel@linux.intel.com">
<pre wrap="" class="moz-quote-pre">On Tue, 2024-12-10 at 17:15 +0100, Nirmoy Das wrote:
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">Fix a potential GPU page fault during tt -> system moves by waiting
for
migration jobs to complete before unmapping SG. This ensures that
IOMMU
mappings are not prematurely torn down while a migration job is still
in
progress.
v2: Use intr=false(Matt A)
v3: Update commit message(Matt A)
Closes: <a class="moz-txt-link-freetext" href="https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3466">https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3466</a>
Fixes: 75521e8b56e8 ("drm/xe: Perform dma_map when moving system
buffer objects to TT")
Cc: Thomas Hellström <a class="moz-txt-link-rfc2396E" href="mailto:thomas.hellstrom@linux.intel.com"><thomas.hellstrom@linux.intel.com></a>
Cc: Matthew Brost <a class="moz-txt-link-rfc2396E" href="mailto:matthew.brost@intel.com"><matthew.brost@intel.com></a>
Cc: Lucas De Marchi <a class="moz-txt-link-rfc2396E" href="mailto:lucas.demarchi@intel.com"><lucas.demarchi@intel.com></a>
Cc: <a class="moz-txt-link-rfc2396E" href="mailto:stable@vger.kernel.org"><stable@vger.kernel.org></a> # v6.11+
Cc: Matthew Auld <a class="moz-txt-link-rfc2396E" href="mailto:matthew.auld@intel.com"><matthew.auld@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>
Reviewed-by: Matthew Auld <a class="moz-txt-link-rfc2396E" href="mailto:matthew.auld@intel.com"><matthew.auld@intel.com></a>
---
drivers/gpu/drm/xe/xe_bo.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 06931df876ab..0a41b6c0583a 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -857,8 +857,16 @@ static int xe_bo_move(struct ttm_buffer_object
*ttm_bo, bool evict,
out:
if ((!ttm_bo->resource || ttm_bo->resource->mem_type ==
XE_PL_SYSTEM) &&
- ttm_bo->ttm)
+ ttm_bo->ttm) {
+ long timeout = dma_resv_wait_timeout(ttm_bo-
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">base.resv,
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">+
DMA_RESV_USAGE_BOOKKEEP,
+ false,
+
MAX_SCHEDULE_TIMEOUT);
+ if (timeout < 0)
+ ret = timeout;
+
xe_tt_unmap_sg(ttm_bo->ttm);
+ }
return ret;
}
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">
I assume here we're waiting for the move fence, right? </pre>
</blockquote>
Yes<br>
<blockquote type="cite" cite="mid:41de753b03bb5e86be011277429649d6d644687f.camel@linux.intel.com">
<pre wrap="" class="moz-quote-pre">However if
@evict is true, we should hit the ttm_bo_wait_free_node() path. In what
cases do we hit this without evict being true?</pre>
</blockquote>
evict is false here. It is coming from xe_bo_evict() rather than
ttm_mem_evict_*<br>
<p>Call flow looks like:
ccs_test_migrate()->xe_bo_evict()->ttm_bo_validate()->ttm_bo_handle_move_mem()->xe_bo_move()</p>
<p><br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:41de753b03bb5e86be011277429649d6d644687f.camel@linux.intel.com">
<pre wrap="" class="moz-quote-pre">
Also, shouldn't it be sufficient to wait for DMA_RESV_USAGE_KERNEL
here? </pre>
</blockquote>
<p>Yes, <span style="white-space: pre-wrap">DMA_RESV_USAGE_KERNEL</span>
should be enough as we are waiting for the migration fence.<br>
</p>
<p><br>
</p>
<p>Regards,</p>
<p>Nirmoy<br>
</p>
<blockquote type="cite" cite="mid:41de753b03bb5e86be011277429649d6d644687f.camel@linux.intel.com">
<pre wrap="" class="moz-quote-pre">
Thanks,
Thomas
</pre>
</blockquote>
</body>
</html>