From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932871AbdLRNTs (ORCPT ); Mon, 18 Dec 2017 08:19:48 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:40615 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932741AbdLRNTp (ORCPT ); Mon, 18 Dec 2017 08:19:45 -0500 X-Google-Smtp-Source: ACJfBotJZkYbfC+LI5WEmYgdmTaoWJUgfk8LNOINQmIk1D4t/w8dqBp78wAhiNeZJUv4KXxjhnz8Z3us+hZk0TCOMWE= MIME-Version: 1.0 In-Reply-To: <20171218121628.akfvzmlvqvkbtjno@pmoreau.org> References: <20171208183034.9027-1-ard.biesheuvel@linaro.org> <20171218121628.akfvzmlvqvkbtjno@pmoreau.org> From: Ard Biesheuvel Date: Mon, 18 Dec 2017 14:19:43 +0100 Message-ID: Subject: Re: [Nouveau] [PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API To: Ard Biesheuvel , Ben Skeggs , David Airlie , dri-devel , nouveau@lists.freedesktop.org, "linux-kernel@vger.kernel.org" , Daniel Thompson , Masami Hiramatsu , "ollapse-all>:" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vBIDJqb6031119 On 18 December 2017 at 13:16, Pierre Moreau wrote: > Hey Ard, > > It seems that Ben already committed a similar patch to his tree (see [0]). I do > not know whether he is planning to have it part of a pull request of fixes for > 4.15. > Hi Pierre, Thanks for the reply. If a fix has been queued, I don't mind leaving it up to Ben to decide when it gets sent onwards. -- Ard. > [0]: https://github.com/skeggsb/nouveau/commit/9068f1df2394f0e4ab2b2a28cac06b462fe0a0aa > > On 2017-12-18 — 09:27, Ard Biesheuvel wrote: >> On 8 December 2017 at 19:30, 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 >> > --- >> > >> > Apologies if this was already found and fixed. I don't usually follow >> > the DRM or nouveau mailing lists. >> > >> > 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); >> > -- >> > 2.11.0 >> > >> >> Ping? >> _______________________________________________ >> Nouveau mailing list >> Nouveau@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/nouveau