@@ -116,9 +116,9 @@ static void user_fence_worker(struct work_struct *w)
}
}
if (!ufence->use_page) {
- if (copy_to_user(ufence->addr, &ufence->value,
- sizeof(ufence->value)))
- drm_warn(&ufence->xe->drm, "copy_to_user failed\n");
+ if (put_user(ufence->value, ufence->addr))
+ drm_warn(&ufence->xe->drm, "put_user failed\n");
+ smp_mb();
}
kthread_unuse_mm(mm);
mmput(mm);
@@ -17,11 +17,13 @@
static int do_compare(u64 addr, u64 value, u64 mask, u16 op)
{
+ u64 __user *ptr = u64_to_user_ptr(addr);
u64 rvalue;
int err;
bool passed;
- err = copy_from_user(&rvalue, u64_to_user_ptr(addr), sizeof(rvalue));
+ smp_mb();
+ err = get_user(rvalue, ptr);
if (err)
return -EFAULT;
Better aligns with atomic semantics than copy to/from user. Suggested-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> --- drivers/gpu/drm/xe/xe_sync.c | 6 +++--- drivers/gpu/drm/xe/xe_wait_user_fence.c | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-)