Re: [PATCH RFC 11/24] locking/mutex: Support Clang's capability analysis
From: Bart Van Assche
Date: Fri Feb 07 2025 - 15:58:56 EST
On 2/7/25 12:31 AM, Peter Zijlstra wrote:
Can we please fix up all the existing __cond_lock() code too?
It would be great to get rid of __cond_lock().
In the description of commit 4a557a5d1a61 ("sparse: introduce
conditional lock acquire function attribute") I found the following
URL:
https://lore.kernel.org/all/CAHk-=wjZfO9hGqJ2_hGQG3U_XzSh9_XaXze=HgPdvJbgrvASfA@xxxxxxxxxxxxxx/
That URL points at an e-mail from Linus Torvalds with a patch for sparse
that implements support for __cond_acquires(). It seems to me that the
sparse patch has never been applied to the sparse code base (the git URL
for sparse is available at https://sparse.docs.kernel.org/en/latest/).
Additionally, the most recent commit to the sparse code base is from
more than a year ago (see also
https://git.kernel.org/pub/scm/devel/sparse/sparse.git/).
In other words, switching from __cond_lock() to __cond_acquires()
probably will make sparse report more "context imbalance" warnings.
If this is a concern to anyone, please speak up.
Thanks,
Bart.