[Intel-gfx] [PATCH 6/6] drm/i915/perf: Map OA buffer to user space for gen12 performance query
Chris Wilson
chris at chris-wilson.co.uk
Thu Jul 30 09:00:26 UTC 2020
Quoting Umesh Nerlige Ramappa (2020-07-30 01:48:26)
> @@ -3318,12 +3354,87 @@ static int i915_perf_release(struct inode *inode, struct file *file)
> i915_perf_destroy_locked(stream);
> mutex_unlock(&perf->lock);
>
> + /*
> + * User could have multiple vmas from multiple mmaps. We want to zap
> + * them all here.
> + */
> + unmap_mapping_range(file->f_mapping, 0, -1, 1);
I'd prefer to explicitly revoke the mapping before removing the
stream->oa_buffer (i.e. at the start of the release before
i915_perf_destroy). That way it takes far less thought to convince
oneself that there is no window for accessing the stale PTE. Include a
comment to explain that a fresh fault cannot occur as the mmap holds a
reference to the stream (via the vma->vm_file), and so before the user's
munmap, the stream cannot be destroy.
-Chris
More information about the Intel-gfx
mailing list