From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 0AC323D4137 for ; Fri, 26 Jun 2026 06:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782456560; cv=none; b=YAbG34DEi5RDwXRPIPPgo7DM3s+d0X9ROdc5OFyurLJBf2zW75be3ApGK0c7LQkH/VJ+dDLBDpOWu8LD/Y7On5bS0i7Y8JGuoffUW9ErKBBL84vO+WHcUQqR1kKqyufPSI+yvIAsuki6SIy5Z9TMBPW2Av10Xb4i9Q2X+7ePNhg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782456560; c=relaxed/simple; bh=uTAZlKlJuNGw3mkVbe8FNKyDxXb50ae82ksMjAHLTCI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lLOzLzCV7QBMcNp/+gIoj3A802BMQFk43vAiUJ5O+7vgbqYQt8ziLZ3H/+aZauJkm3yjUQix1Pv+nfCsWqpHK0F9pOutmJPG9jZoe2t01VIh29hGRdmTSZKv1YW5zC7RFYHwYq1xylCMvIVR7hT6V0H/Gj1624Uiu7X2isjx9Zk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 7520E68B05; Fri, 26 Jun 2026 08:49:16 +0200 (CEST) Date: Fri, 26 Jun 2026 08:49:16 +0200 From: Christoph Hellwig To: Nilay Shroff Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, hch@lst.de, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, elver@google.com, gjoyce@linux.ibm.com Subject: Re: [PATCHv2 14/17] nvme: fix Clang context analysis warning in rdma.c Message-ID: <20260626064916.GC11106@lst.de> References: <20260614131541.2017845-1-nilay@linux.ibm.com> <20260614131541.2017845-15-nilay@linux.ibm.com> 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 Content-Disposition: inline In-Reply-To: <20260614131541.2017845-15-nilay@linux.ibm.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Sun, Jun 14, 2026 at 06:45:29PM +0530, Nilay Shroff wrote: > After adding Clang lock context annotations in rdma.c, Clang reports > the following warning when context analysis is enabled: > > drivers/nvme/host/rdma.c:972:24: warning: passing pointer to variable 'list' requires holding mutex 'nvme_rdma_ctrl_mutex' > [-Wthread-safety-pointer] > 972 | if (list_empty(&ctrl->list)) > | ^ > > The warning is triggered because ctrl->list is annotated as being > protected by nvme_rdma_ctrl_mutex, but list_empty(&ctrl->list) is > invoked without holding that mutex. Does switching to list_empty_careful fix this? If not, does list_empty_careful need annotations to make this work?