From: Adam Borowski <kilobyte@angband.pl>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: bskeggs@redhat.com, airlied@linux.ie,
dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org, daniel.thompson@linaro.org,
masami.hiramatsu@linaro.org
Subject: Re: [PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API
Date: Sat, 9 Dec 2017 01:01:57 +0100 [thread overview]
Message-ID: <20171209000157.vxqxzcx6gzy7cv2q@angband.pl> (raw)
In-Reply-To: <20171208183034.9027-1-ard.biesheuvel@linaro.org>
On Fri, Dec 08, 2017 at 06:30:34PM +0000, Ard Biesheuvel wrote:
> Commit be55287aa5b ("drm/nouveau/imem/nv50: embed nvkm_instobj directly
> into nv04_instobj") introduced some new calls to the refcount api to
> the nv50 mapping code. In one particular instance, it does the
> following:
>
> if (!refcount_inc_not_zero(&iobj->maps)) {
> ...
> refcount_inc(&iobj->maps);
> }
>
> i.e., it calls refcount_inc() to increment the refcount when it is known
> to be zero, which is explicitly forbidden by the API. Instead, use
> refcount_set() to set it to 1.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
Awesome! Works for me.
> Apologies if this was already found and fixed. I don't usually follow
> the DRM or nouveau mailing lists.
I see nothing relevant in dri-devel and nouveau archives, except my
complaint (GTX 560 Ti (GF114)):
https://lists.freedesktop.org/archives/nouveau/2017-December/029264.html
and Richard Narron seconding it (MSI GeForce 210):
https://lists.freedesktop.org/archives/nouveau/2017-December/029276.html
> drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
> index 1ba7289684aa..db48a1daca0c 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
> @@ -249,7 +249,7 @@ nv50_instobj_acquire(struct nvkm_memory *memory)
> iobj->base.memory.ptrs = &nv50_instobj_fast;
> else
> iobj->base.memory.ptrs = &nv50_instobj_slow;
> - refcount_inc(&iobj->maps);
> + refcount_set(&iobj->maps, 1);
> }
>
> mutex_unlock(&imem->subdev.mutex);
> --
I'm just a dumb user here, my tags don't carry a weight, but Tested-by:.
Meow!
--
// If you believe in so-called "intellectual property", please immediately
// cease using counterfeit alphabets. Instead, contact the nearest temple
// of Amon, whose priests will provide you with scribal services for all
// your writing needs, for Reasonable And Non-Discriminatory prices.
next prev parent reply other threads:[~2017-12-09 0:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 18:30 [PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API Ard Biesheuvel
2017-12-09 0:01 ` Adam Borowski [this message]
2017-12-18 8:27 ` Ard Biesheuvel
[not found] ` <20171218121628.akfvzmlvqvkbtjno@pmoreau.org>
2017-12-18 13:19 ` [Nouveau] " Ard Biesheuvel
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=20171209000157.vxqxzcx6gzy7cv2q@angband.pl \
--to=kilobyte@angband.pl \
--cc=airlied@linux.ie \
--cc=ard.biesheuvel@linaro.org \
--cc=bskeggs@redhat.com \
--cc=daniel.thompson@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu@linaro.org \
--cc=nouveau@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).