Re: [PATCH v5 0/6] Enable lock context analysis in the SCSI core and UFS driver

John Garry <[email protected]> Thu, 6 Aug 2026 10:26:48 +0100
Newsgroups gmane.linux.scsi
Organization Oracle Corporation
Message-ID <[email protected]>
On 05/08/2026 22:36, Bart Van Assche wrote:
> i Martin,
> 
> This patch series enables lock context analysis for the SCSI core and the UFS
> driver. The advantages are as follows:
>    - The compiler (only Clang) verifies whether the lock and unlock calls match
>      what has been declared via __must_hold(), __acquires() or __releases().
>      This is useful for catching locking bugs in error paths.
>    - Support for __guarded_by() is enabled. If a member variable is annotated
>      with __guarded_by(lock), the compiler will issue a warning if that member
>      variable is accessed without holding 'lock'.
> 
> Additionally, a patch is included that suppresses KCSAN complaints about SCSI
> host state changes.

Hi Bart,

In future would we enable context analysis for other members of 
Scsi_Host or other core structures which are protected by 
shost->host_lock, like __scsi_find_target() which scans &shost->targets 
and requires that lock to be held? Or __scsi_device_lookup()?

I appreciate that this is just the first series for SCSI, but I am just 
curious on any plans.

Thanks,
John

> 
> More information about lock context analysis is available in the cover letter of
> [PATCH v5 00/36] Compiler-Based Context- and Locking-Analysis
> (https://urldefense.com/v3/__https://lore.kernel.org/ 
> lkml/[email protected]/__;!!ACWV5N9M2RV99hQ!
> J6vIIEsGYaCUO5o4dBP5HeRy8kITKmj51IVOoZN-7h8k2FZDnUuaJGMWAt3E5BL5Xf4r7iNMlthMNat6EJGVFg$<https://urldefense.com/v3/__https://lore.kernel.org/ 
> lkml/[email protected]/__;!!ACWV5N9M2RV99hQ! 
> J6vIIEsGYaCUO5o4dBP5HeRy8kITKmj51IVOoZN-7h8k2FZDnUuaJGMWAt3E5BL5Xf4r7iNMlthMNat6EJGVFg$>).
> 
> Please consider this patch series for the next merge window.