Re: [PATCHv2 11/17] nvme: add Clang context annotations for nvme_queue::sq_lock

From: Christoph Hellwig

Date: Fri Jun 26 2026 - 02:48:02 EST


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?