<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 2021-11-09 10:26 p.m., Felix
Kuehling wrote:<br>
</div>
<blockquote type="cite" cite="mid:d4bc4acf-ff14-5370-16bd-8cec6253c09c@amd.com">
<br>
On 2021-11-09 6:04 p.m., Philip Yang wrote:
<br>
<blockquote type="cite">If unmapping partial range, the parent
prange list op is update
<br>
notifier, child range list op is unmap range, need check child
range to
<br>
set drain retry fault flag.
<br>
<br>
Signed-off-by: Philip Yang <a class="moz-txt-link-rfc2396E" href="mailto:Philip.Yang@amd.com"><Philip.Yang@amd.com></a>
<br>
</blockquote>
<br>
I think this could be simplified by simply setting
svms->drain_pagefaults in svm_range_unmap_from_cpu. The mmap
lock ensures that this is serialized with the deferred list worker
reading and clearing svms->drain_pagefaults. You can also use
READ_ONCE and WRITE_ONCE to be safe.
<br>
</blockquote>
<p>Good idea, change will be in v2 patch.</p>
<p>Thanks,</p>
<p>Philip<br>
</p>
<blockquote type="cite" cite="mid:d4bc4acf-ff14-5370-16bd-8cec6253c09c@amd.com">
<br>
Regards,
<br>
Felix
<br>
<br>
<br>
<blockquote type="cite">---
<br>
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 13 ++++++++++++-
<br>
1 file changed, 12 insertions(+), 1 deletion(-)
<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
<br>
index 77239b06b236..64f642935600 100644
<br>
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
<br>
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
<br>
@@ -2049,8 +2049,19 @@ svm_range_add_list_work(struct
svm_range_list *svms, struct svm_range *prange,
<br>
* before the range is freed to avoid straggler interrupts
on
<br>
* unmapped memory causing "phantom faults".
<br>
*/
<br>
- if (op == SVM_OP_UNMAP_RANGE)
<br>
+ if (op == SVM_OP_UNMAP_RANGE) {
<br>
+ pr_debug("set range drain_pagefaults true\n");
<br>
svms->drain_pagefaults = true;
<br>
+ } else {
<br>
+ struct svm_range *pchild;
<br>
+
<br>
+ list_for_each_entry(pchild, &prange->child_list,
child_list)
<br>
+ if (pchild->work_item.op == SVM_OP_UNMAP_RANGE)
{
<br>
+ pr_debug("set child drain_pagefaults true\n");
<br>
+ svms->drain_pagefaults = true;
<br>
+ }
<br>
+ }
<br>
+
<br>
/* if prange is on the deferred list */
<br>
if (!list_empty(&prange->deferred_list)) {
<br>
pr_debug("update exist prange 0x%p work op %d\n",
prange, op);
<br>
</blockquote>
</blockquote>
</body>
</html>