Re: [PATCHv2 07/17] nvme: add Clang context annotations for nvme_subsystem::lock
From: Christoph Hellwig
Date: Mon Jun 29 2026 - 09:02:25 EST
On Fri, Jun 26, 2026 at 08:09:52PM +0530, Nilay Shroff wrote:
>>
> yes correct, but this one is tricky as the list has to be inited
> with non-zero value. Another way to fix this is by adding
> context_unsafe wrapper around INIT_LIST_HEAD(). Again overuse of
> those unsafe wrappers hinders readability.
>
> Would it make sense to introduce a helper, e.g. INIT_LIST_HEAD_UNSAFE(),
> that simply wraps INIT_LIST_HEAD() with context_unsafe()? It would document
> that this should only be used in cases where the caller knows the object
> has not yet been published and therefore no concurrent access is possible,
> such as during object initialization.
I'll leave that to Marco and other core people, but I think this
would be a lot better than the current version.