All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Subject: Re: [Intel-gfx] [PATCH 3/5] drm/i915: Update client name on context create
Date: Mon, 16 Dec 2019 12:57:13 +0000	[thread overview]
Message-ID: <157650103330.2428.3298175573227609640@skylake-alporthouse-com> (raw)
In-Reply-To: <20191216120704.958-4-tvrtko.ursulin@linux.intel.com>

Quoting Tvrtko Ursulin (2019-12-16 12:07:02)
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index 46b4d1d643f8..cd4ba6486f35 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -2178,7 +2178,9 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
>  {
>         struct drm_i915_private *i915 = to_i915(dev);
>         struct drm_i915_gem_context_create_ext *args = data;
> +       struct drm_i915_file_private *file_priv = file->driver_priv;
>         struct create_ext ext_data;
> +       struct pid *pid;
>         int ret;
>  
>         if (!DRIVER_CAPS(i915)->has_logical_contexts)
> @@ -2191,14 +2193,30 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
>         if (ret)
>                 return ret;
>  
> -       ext_data.fpriv = file->driver_priv;
> +       ext_data.fpriv = file_priv;
> +       pid = get_task_pid(current, PIDTYPE_PID);
>         if (client_is_banned(ext_data.fpriv)) {
>                 DRM_DEBUG("client %s[%d] banned from creating ctx\n",
> -                         current->comm,
> -                         pid_nr(get_task_pid(current, PIDTYPE_PID)));
> +                         current->comm, pid_nr(pid));
> +               put_pid(pid);
>                 return -EIO;
>         }
>  
> +       /*
> +        * Borrow the context idr_lock to protect the client remove-add cycle.
> +        */
> +       if (mutex_lock_interruptible(&file_priv->context_idr_lock))

put_pid(pid); /* I'm helping! */

> +               return -EINTR;

> +       if (pid_nr(file_priv->client.pid) != pid_nr(pid)) {
> +               i915_gem_remove_client(file_priv);
> +               ret = i915_gem_add_client(i915, file_priv, current,
> +                                         file_priv->client.id);
> +       }
> +       mutex_unlock(&file_priv->context_idr_lock);
> +       put_pid(pid);
> +       if (ret)
> +               return ret;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-12-16 12:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 12:06 [Intel-gfx] [PATCH 0/5] Per client engine busyness Tvrtko Ursulin
2019-12-16 12:07 ` [Intel-gfx] [PATCH 1/5] drm/i915: Track per-context " Tvrtko Ursulin
2019-12-16 12:40   ` Chris Wilson
2019-12-16 13:09     ` Tvrtko Ursulin
2020-01-30 18:05       ` Tvrtko Ursulin
2020-01-30 21:42         ` Chris Wilson
2019-12-16 12:07 ` [Intel-gfx] [PATCH 2/5] drm/i915: Expose list of clients in sysfs Tvrtko Ursulin
2019-12-16 12:51   ` Chris Wilson
2019-12-16 18:34     ` Tvrtko Ursulin
2019-12-16 12:53   ` Chris Wilson
2019-12-16 13:13     ` Tvrtko Ursulin
2019-12-17 17:21     ` Tvrtko Ursulin
2019-12-17 17:26       ` Chris Wilson
2019-12-16 12:55   ` Chris Wilson
2019-12-16 13:16     ` Tvrtko Ursulin
2019-12-16 13:17   ` Chris Wilson
2019-12-16 13:28     ` Tvrtko Ursulin
2019-12-16 13:41       ` Chris Wilson
2019-12-16 12:07 ` [Intel-gfx] [PATCH 3/5] drm/i915: Update client name on context create Tvrtko Ursulin
2019-12-16 12:57   ` Chris Wilson [this message]
2019-12-16 12:07 ` [Intel-gfx] [PATCH 4/5] drm/i915: Expose per-engine client busyness Tvrtko Ursulin
2019-12-16 12:07 ` [Intel-gfx] [PATCH 5/5] drm/i915: Add sysfs toggle to enable per-client engine stats Tvrtko Ursulin
2019-12-16 13:09 ` [Intel-gfx] [PATCH 0/5] Per client engine busyness Chris Wilson
2019-12-16 13:20   ` Tvrtko Ursulin
2019-12-16 17:45 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-12-16 17:58 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=157650103330.2428.3298175573227609640@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.