Re: git: cff79fd02636 - main - linuxkpi: Fix spin_lock_init

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 17 May 2024 21:41:39 UTC
On Fri, 17 May 2024, Emmanuel Vadot wrote:

> The branch main has been updated by manu:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=cff79fd02636f34010d8b835cc9e55401fa76e74
>
> commit cff79fd02636f34010d8b835cc9e55401fa76e74
> Author:     Emmanuel Vadot <manu@FreeBSD.org>
> AuthorDate: 2024-05-17 04:52:53 +0000
> Commit:     Emmanuel Vadot <manu@FreeBSD.org>
> CommitDate: 2024-05-17 05:58:59 +0000
>
>    linuxkpi: Fix spin_lock_init
>
>    Some linux code re-init some spinlock so add MTX_NEW to mtx_init.

Sorry, I should have realized during the review; we no longer run the
memset(0) on them when (re-)initializing.


>    Reported by:    David Wolfskill <david@catwhisker.org>
>    Fixes:          ae38a1a1bfdf ("linuxkpi: spinlock: Simplify code")
> ---
> sys/compat/linuxkpi/common/include/linux/spinlock.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h
> index 3f6eb4bb70f6..2992e41c9c02 100644
> --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h
> +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h
> @@ -140,7 +140,7 @@ typedef struct mtx spinlock_t;
> #define	spin_lock_name(name)		_spin_lock_name(name, __FILE__, __LINE__)
>
> #define	spin_lock_init(lock)	mtx_init(lock, spin_lock_name("lnxspin"), \
> -				  NULL, MTX_DEF | MTX_NOWITNESS)
> +				  NULL, MTX_DEF | MTX_NOWITNESS | MTX_NEW)
>
> #define	spin_lock_destroy(_l)	mtx_destroy(_l)
As mentioned elsewhere; it is funny this exists^^^

-- 
Bjoern A. Zeeb                                                     r15:7