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 00ACB30C177 for ; Fri, 26 Jun 2026 06:47:27 +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=1782456449; cv=none; b=qW7z2E34LTLF00cpoaLMjf/EklCgzOP4rCYg5GzwNcubq21g1NbQG6r7KzrqvIjB/nwYALc2nzt5hVDP/e+a+vxbUa7kHjuvL6IGt7QxdspzsrPSs7dCJnH/moepY3aIAMcZOWDrPhXqUxrAjjgONjzGQgBEr++MY6I0zkmYdcM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782456449; c=relaxed/simple; bh=52XeiBa97cunzx6fo8YK77XFT5n7UpiBT84mnpY64Ew=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ME/Xk2Wqs7LymKSqf7uNwHXeMc2ip4HcnHvVeEIchS06QkwUeDHjdBv098lJrpcqO8D45/a/xQzvqMM9Cqv0wJGNEyvIDunaGEZL4HQe40h1fbuaGUpeObdqK7RNwPIRUDoQleRsLfcccXO6GUXNe1H06DeWxBymcS8YcnNaPQ8= 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 5199B68B05; Fri, 26 Jun 2026 08:47:22 +0200 (CEST) Date: Fri, 26 Jun 2026 08:47:21 +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 11/17] nvme: add Clang context annotations for nvme_queue::sq_lock Message-ID: <20260626064721.GA11106@lst.de> References: <20260614131541.2017845-1-nilay@linux.ibm.com> <20260614131541.2017845-12-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-12-nilay@linux.ibm.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Sun, Jun 14, 2026 at 06:45:26PM +0530, Nilay Shroff wrote: > Accesses to sq_tail used solely for tracing are annotated with > context_unsafe(), as they only require a lockless snapshot of the > value. Likewise, nvme_init_queue() and nvme_free_queue() operate on > queues that have not yet been published or are no longer reachable, > and therefore do not require sq_lock protection. Similarly, > nvme_alloc_sq_cmds() allocates memory for nvme_queue::sq_cmds for > the queue which is not yet published or in use and hence it's safe > to annotate all these helpers using context_unsafe. Accessing scalar fields without lock is pretty common. Don't we have an annotation that only requires the guarding lock for writes?