Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3602733rdb; Wed, 27 Dec 2023 12:57:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXTvXKQwYRCHBOPd7htB4G6GTup7OLd5g4iS1NmcbbV6aHUrD2grc+BibQzsdSOP3e2Utb X-Received: by 2002:a05:6e02:1a6d:b0:35f:fc19:1d09 with SMTP id w13-20020a056e021a6d00b0035ffc191d09mr8408934ilv.57.1703710625294; Wed, 27 Dec 2023 12:57:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703710625; cv=none; d=google.com; s=arc-20160816; b=MCOSSWabgb9raYPq8SjafISJWhDA3HM15ScLDhbvc9dbT6WLNJxkDrPWc6P2STVnE2 WIBewSBGiARhCBNo/KKwjjaifxBa/DCJOHbmmRU5SXtXzsGe76K2c/8Pbs2SyuRRWAmQ o5hNk4pP2tj2A7If8okA/4xK53JW31GvqsKrP7wGgs69QJ6jyE78iuuC+CcYyyq+GWdM 5+mS61SpoN8CHOc4ivdtbblKRl6N31EXO5+fF4xRrdX7gu64WnSRPizziaUmL718brMk waqA0z37a49Ujy17BM/GdMl9bLZWGmGZlD7MzmzHafe0SHtNQ0bghjYMd3PJJzM53T8x /Zpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:subject:cc:to:from:date:dkim-signature; bh=T9a73hus1Dyt1ckaAcynhQopcAWbiRvmR8oL3fiJS6I=; fh=wv+l5JUYF/q352kNetAtjkAMyxKN1vT9H3V0dcfTtpc=; b=NlkKbLATUH6ntbNnC4V+sb9K955ukxAU38FXPWTEZlYbdQT02Hzgp92/h7IpDJ8s6E dQCTIQ2k5wgI7ykZkFRZGLaAbA07FcpU5xCd1GelkLy1rD2JVz4Nk8V0+kGARyGwDi4l 0eK3s9a+kbZLqHoMjkY1vpaK6bdAwX3kZwDHsKQliidOtiXWYNrY8AvYx41qCY3Ks7lZ KWJp2qXxszXGD1U5WeTuWhbMBU256KMpGt6vaC5r+h5asXSX1nDbj0cF3DJk/h77VPSh BmiACJSWPGHyGT6m1euysU3t62MfXs4bXn9XKggagQfC+DwRt1dXSwuVXzvqDdQjsZWV wQHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=PMcAMj5E; spf=pass (google.com: domain of linux-kernel+bounces-12255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z74-20020a63334d000000b005cdf7f7bb12si9314641pgz.426.2023.12.27.12.57.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 12:57:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=PMcAMj5E; spf=pass (google.com: domain of linux-kernel+bounces-12255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A159283D8D for ; Wed, 27 Dec 2023 20:57:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F417B47F73; Wed, 27 Dec 2023 20:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="PMcAMj5E" X-Original-To: linux-kernel@vger.kernel.org Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92D2147F71 for ; Wed, 27 Dec 2023 20:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:message-id:mime-version; bh=T9a73hus1Dyt1ckaAcynhQopcAWbiRvmR8oL3fiJS6I=; b=PMcAMj5EA4xBOTYKXT8VtULXIPqHckG6O8o1IkjCUQpxPF119mP7SLmJ WNUx5DQxsM/fyRcVgvazyI2fHYlGGIwUufoy5+qJpbAAwPzEHaIbK6Tip MBROdBl38k13HcKfF2w3F9gh2yd/sxfI44TI6OS8x0Jci4NOXWU9k5Ciz w=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.04,310,1695679200"; d="scan'208";a="144161046" Received: from 231.85.89.92.rev.sfr.net (HELO hadrien) ([92.89.85.231]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2023 21:56:47 +0100 Date: Wed, 27 Dec 2023 21:56:46 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Ben Skeggs , Lyude Paul cc: linux-kernel@vger.kernel.org, oe-kbuild-all@lists.linux.dev Subject: drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c:258:2-8: preceding lock on line 251 (fwd) Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Hello, There is no bug here, but it could be nice to refer to the lock in the same way at all call sites (see line 258. julia ---------- Forwarded message ---------- Date: Wed, 27 Dec 2023 22:34:45 +0800 From: kernel test robot To: oe-kbuild@lists.linux.dev Cc: lkp@intel.com, Julia Lawall Subject: drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c:258:2-8: preceding lock on line 251 BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev CC: linux-kernel@vger.kernel.org TO: Ben Skeggs CC: Lyude Paul tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: fbafc3e621c3f4ded43720fdb1d6ce1728ec664e commit: f48dd2936138882d7755cbbc5d9984015c75980c drm/nouveau/fifo: add new engine context tracking date: 1 year, 2 months ago :::::: branch date: 2 days ago :::::: commit date: 1 year, 2 months ago config: loongarch-randconfig-r062-20231222 (https://download.01.org/0day-ci/archive/20231227/202312272217.k0uoS8R5-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 13.2.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Reported-by: Julia Lawall | Closes: https://lore.kernel.org/r/202312272217.k0uoS8R5-lkp@intel.com/ cocci warnings: (new ones prefixed by >>) >> drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c:258:2-8: preceding lock on line 251 vim +258 drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c f48dd293613888 Ben Skeggs 2022-06-01 240 f48dd293613888 Ben Skeggs 2022-06-01 241 int f48dd293613888 Ben Skeggs 2022-06-01 242 nvkm_chan_cctx_get(struct nvkm_chan *chan, struct nvkm_engn *engn, struct nvkm_cctx **pcctx, f48dd293613888 Ben Skeggs 2022-06-01 243 struct nvkm_client *client) f48dd293613888 Ben Skeggs 2022-06-01 244 { f48dd293613888 Ben Skeggs 2022-06-01 245 struct nvkm_cgrp *cgrp = chan->cgrp; f48dd293613888 Ben Skeggs 2022-06-01 246 struct nvkm_vctx *vctx; f48dd293613888 Ben Skeggs 2022-06-01 247 struct nvkm_cctx *cctx; f48dd293613888 Ben Skeggs 2022-06-01 248 int ret; f48dd293613888 Ben Skeggs 2022-06-01 249 f48dd293613888 Ben Skeggs 2022-06-01 250 /* Look for an existing channel context for this engine+VEID. */ f48dd293613888 Ben Skeggs 2022-06-01 @251 mutex_lock(&cgrp->mutex); f48dd293613888 Ben Skeggs 2022-06-01 252 cctx = nvkm_list_find(cctx, &chan->cctxs, head, f48dd293613888 Ben Skeggs 2022-06-01 253 cctx->vctx->ectx->engn == engn && cctx->vctx->vmm == chan->vmm); f48dd293613888 Ben Skeggs 2022-06-01 254 if (cctx) { f48dd293613888 Ben Skeggs 2022-06-01 255 refcount_inc(&cctx->refs); f48dd293613888 Ben Skeggs 2022-06-01 256 *pcctx = cctx; f48dd293613888 Ben Skeggs 2022-06-01 257 mutex_unlock(&chan->cgrp->mutex); f48dd293613888 Ben Skeggs 2022-06-01 @258 return 0; f48dd293613888 Ben Skeggs 2022-06-01 259 } f48dd293613888 Ben Skeggs 2022-06-01 260 f48dd293613888 Ben Skeggs 2022-06-01 261 /* Nope - create a fresh one. But, sub-context first. */ f48dd293613888 Ben Skeggs 2022-06-01 262 ret = nvkm_cgrp_vctx_get(cgrp, engn, chan, &vctx, client); f48dd293613888 Ben Skeggs 2022-06-01 263 if (ret) { f48dd293613888 Ben Skeggs 2022-06-01 264 CHAN_ERROR(chan, "vctx %d[%s]: %d", engn->id, engn->engine->subdev.name, ret); f48dd293613888 Ben Skeggs 2022-06-01 265 goto done; f48dd293613888 Ben Skeggs 2022-06-01 266 } f48dd293613888 Ben Skeggs 2022-06-01 267 f48dd293613888 Ben Skeggs 2022-06-01 268 /* Now, create the channel context - to track engine binding. */ f48dd293613888 Ben Skeggs 2022-06-01 269 CHAN_TRACE(chan, "ctor cctx %d[%s]", engn->id, engn->engine->subdev.name); f48dd293613888 Ben Skeggs 2022-06-01 270 if (!(cctx = *pcctx = kzalloc(sizeof(*cctx), GFP_KERNEL))) { f48dd293613888 Ben Skeggs 2022-06-01 271 nvkm_cgrp_vctx_put(cgrp, &vctx); f48dd293613888 Ben Skeggs 2022-06-01 272 ret = -ENOMEM; f48dd293613888 Ben Skeggs 2022-06-01 273 goto done; f48dd293613888 Ben Skeggs 2022-06-01 274 } f48dd293613888 Ben Skeggs 2022-06-01 275 f48dd293613888 Ben Skeggs 2022-06-01 276 cctx->vctx = vctx; f48dd293613888 Ben Skeggs 2022-06-01 277 refcount_set(&cctx->refs, 1); f48dd293613888 Ben Skeggs 2022-06-01 278 refcount_set(&cctx->uses, 0); f48dd293613888 Ben Skeggs 2022-06-01 279 list_add_tail(&cctx->head, &chan->cctxs); f48dd293613888 Ben Skeggs 2022-06-01 280 done: f48dd293613888 Ben Skeggs 2022-06-01 281 mutex_unlock(&cgrp->mutex); f48dd293613888 Ben Skeggs 2022-06-01 282 return ret; f48dd293613888 Ben Skeggs 2022-06-01 283 } f48dd293613888 Ben Skeggs 2022-06-01 284 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki