[Intel-gfx] [PATCH v7 01/11] drm/i915: Add i915 perf infrastructure

Matthew Auld matthew.william.auld at gmail.com
Tue Oct 25 15:58:37 UTC 2016


> +
> +/* Note we copy the properties from userspace outside of the i915 perf
> + * mutex to avoid an awkward lockdep with mmap_sem.
> + *
> + * Note this function only validates properties in isolation it doesn't
> + * validate that the combination of properties makes sense or that all
> + * properties necessary for a particular kind of stream have been set.
> + */
> +static int read_properties_unlocked(struct drm_i915_private *dev_priv,
> +                                   u64 __user *uprops,
> +                                   u32 n_props,
> +                                   struct perf_open_properties *props)
> +{
> +       u64 __user *uprop = uprops;
> +       int i;
> +
> +       memset(props, 0, sizeof(struct perf_open_properties));
> +
> +       if (!n_props) {
> +               DRM_ERROR("No i915 perf properties given");
> +               return -EINVAL;
> +       }
> +
> +       if (n_props > DRM_I915_PERF_PROP_MAX) {
> +               DRM_ERROR("More i915 perf properties specified than exist");
> +               return -EINVAL;
> +       }
> +
> +       for (i = 0; i < n_props; i++) {
> +               u64 id, value;
> +               int ret;
> +
> +               ret = get_user(id, (u64 __user *)uprop);
> +               if (ret)
> +                       return ret;
> +
> +               ret = get_user(value, (u64 __user *)uprop + 1);
> +               if (ret)
> +                       return ret;
Do we really need all of these __user casts, they seem redundant, no?

Otherwise looks good so:
Reviewed-by: Matthew Auld <matthew.auld at intel.com>


More information about the Intel-gfx mailing list