[PATCH v3 5/9] net/ixgbe/base: fix lock checker errors

David Marchand david.marchand at redhat.com
Fri Mar 28 09:20:16 CET 2025


On Thu, Mar 27, 2025 at 3:53 PM Bruce Richardson
<bruce.richardson at intel.com> wrote:
>
> When building on FreeBSD, errors are reported in the base code by the
> lock checker (-Wthread-safety). For example:
>
> ../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
>    42 | }
>       | ^
>
> These errors are due to the checker not recognising the lock wrapper
> functions. We can avoid these errors by converting these functions into
> macros.
>
> Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
> Cc: stable at dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>

This is the best solution, given that FreeBSD pthread is instrumented
with clang thread safety annotations.

As a sidenote, I don't see much value with the remaining
malloc/calloc/free wrappers in this osdep.c file.
I suspect this makes some other annotations non working.


-- 
David Marchand



More information about the dev mailing list