All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Pitoiset <samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/2] pm: fix a potential race condition when creating an engine context
Date: Sun, 10 May 2015 19:16:02 +0200	[thread overview]
Message-ID: <554F9252.8020601@gmail.com> (raw)
In-Reply-To: <1429044239-2223-2-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

* bump *

Ben, could you take a look at the series ?

On 04/14/2015 10:43 PM, Samuel Pitoiset wrote:
> There is always the possiblity that the ppm->context pointer would get
> partially updated and accidentally would equal ctx. This would allow two
> contexts to co-exist, which is not acceptable. Moving the test to the
> critical section takes care of this problem.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
> Signed-off-by: Martin Peres <martin.peres@free.fr>
> ---
>   drm/nouveau/nvkm/engine/pm/base.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drm/nouveau/nvkm/engine/pm/base.c b/drm/nouveau/nvkm/engine/pm/base.c
> index 274457c..4cf36a3 100644
> --- a/drm/nouveau/nvkm/engine/pm/base.c
> +++ b/drm/nouveau/nvkm/engine/pm/base.c
> @@ -358,12 +358,11 @@ nvkm_perfctx_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
>   	mutex_lock(&nv_subdev(ppm)->mutex);
>   	if (ppm->context == NULL)
>   		ppm->context = ctx;
> -	mutex_unlock(&nv_subdev(ppm)->mutex);
> -
>   	if (ctx != ppm->context)
> -		return -EBUSY;
> +		ret = -EBUSY;
> +	mutex_unlock(&nv_subdev(ppm)->mutex);
>   
> -	return 0;
> +	return ret;
>   }
>   
>   struct nvkm_oclass

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

      parent reply	other threads:[~2015-05-10 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-14 20:43 [PATCH 1/2] pm: prevent freeing the wrong engine context Samuel Pitoiset
     [not found] ` <1429044239-2223-1-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-14 20:43   ` [PATCH 2/2] pm: fix a potential race condition when creating an " Samuel Pitoiset
     [not found]     ` <1429044239-2223-2-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-10 17:16       ` Samuel Pitoiset [this message]

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=554F9252.8020601@gmail.com \
    --to=samuel.pitoiset-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /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.