History log of /src/sys/compat/linuxkpi/common/include/linux/spinlock.h (Results 1 – 25 of 42)
Revision Date Author Comments
# 31393810 20-Jan-2026 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: add scoped_guard(), spinlock guard support

The "cleanup.h" implementation got a bit more complicated.

For one we now use a macro to concatenate a prefix, the name, and a
suffix for variab

LinuxKPI: add scoped_guard(), spinlock guard support

The "cleanup.h" implementation got a bit more complicated.

For one we now use a macro to concatenate a prefix, the name, and a
suffix for variable and function declarations. This was triggered
by the fact that the "guard_" prefix we used was confusing. We now
use a generic "cleanup_" which is only encoded in the single place
rather than all over the file.

As already indicated by the comment the DEFINE_LOCK_GUARD_0()
macro got split up and a _1 version which also takes a type got
implemented and is used for a spinlock variant used by rtw89(4)
via the new scoped_guard() bits.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54808

show more ...


# ac341353 12-Aug-2025 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Define `raw_spinlock_t` in <linux/spinlock.h>

For now, it is synonymous to `spinlock_t`. The DRM generic code uses the
`struct raw_spinlock` and not `raw_spinlock_t`, that's why the
defini

linuxkpi: Define `raw_spinlock_t` in <linux/spinlock.h>

For now, it is synonymous to `spinlock_t`. The DRM generic code uses the
`struct raw_spinlock` and not `raw_spinlock_t`, that's why the
definition is a struct embedding a `struct mtx`, compared to
`spinlock_t` which is a simpler typedef.

The DRM generic code started to use it in Linux 6.10.

Reviewed by: bz, christos
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54489

show more ...


# f3e25c01 28-Feb-2025 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Add `local_irq_{save,restore}()`

These are no-ops.

The i915 DRM driver started to use it in Linux 6.8.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https

linuxkpi: Add `local_irq_{save,restore}()`

These are no-ops.

The i915 DRM driver started to use it in Linux 6.8.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49380

show more ...


# cff79fd0 17-May-2024 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: Fix spin_lock_init

Some linux code re-init some spinlock so add MTX_NEW to mtx_init.

Reported by: David Wolfskill <david@catwhisker.org>
Fixes: ae38a1a1bfdf ("linuxkpi: spinlock: Simplif

linuxkpi: Fix spin_lock_init

Some linux code re-init some spinlock so add MTX_NEW to mtx_init.

Reported by: David Wolfskill <david@catwhisker.org>
Fixes: ae38a1a1bfdf ("linuxkpi: spinlock: Simplify code")

show more ...


# ae38a1a1 15-May-2024 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: spinlock: Simplify code

Just use a typedef for spinlock_t, no need to create a useless
structure.

Reviewed by: bz, emaste
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Re

linuxkpi: spinlock: Simplify code

Just use a typedef for spinlock_t, no need to create a useless
structure.

Reviewed by: bz, emaste
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D45205

show more ...


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# ad83dd2b 31-Mar-2023 John Baldwin <jhb@FreeBSD.org>

LinuxKPI: Appease -Wunused-but-set-variable warnings from GCC.

- Mark assert dummy variables as __unused.

- Use a dummy (void) cast of the flags argument passed to
spin_unlock_irqrestore so it ge

LinuxKPI: Appease -Wunused-but-set-variable warnings from GCC.

- Mark assert dummy variables as __unused.

- Use a dummy (void) cast of the flags argument passed to
spin_unlock_irqrestore so it gets treated as used.

Reviewed by: manu, hselasky
Differential Revision: https://reviews.freebsd.org/D39349

show more ...


# 11ef1d97 26-Jan-2022 Vladimir Kondratyev <wulf@FreeBSD.org>

Revert "LinuxKPI: Allow spin_lock_irqsave to be called within a critical section"

This change results in deadlocks on UP systems

This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024.

Reque

Revert "LinuxKPI: Allow spin_lock_irqsave to be called within a critical section"

This change results in deadlocks on UP systems

This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024.

Requested by: kib, hselasky

show more ...


# 02ea6033 18-Jan-2022 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Allow spin_lock_irqsave to be called within a critical section

with spinning on spin_trylock. dma-buf part of drm-kmod depends on this
property and absence of it support results in "mi_swi

LinuxKPI: Allow spin_lock_irqsave to be called within a critical section

with spinning on spin_trylock. dma-buf part of drm-kmod depends on this
property and absence of it support results in "mi_switch: switch in a
critical section" assertions [1][2].

[1] https://github.com/freebsd/drm-kmod/issues/116
[2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261166

MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D33887

show more ...


# 307f78f3 19-Dec-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Constantly use _LINUXKPI_ prefix in include guards

MFC after: 1 week
Reviewed by: bz, emaste, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33562


# f1a7639a 04-Dec-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Add some typical header pollution

To reduce amount of drm-kmod patching

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33297


# 086cfe4d 15-Jul-2021 Neel Chauhan <nc@FreeBSD.org>

linuxkpi: Add spin_trylock_irqsave() macro

This is needed by the drm-kmod 5.6 update.

Reviewed by: hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30706


# c77ec79b 05-Jul-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Change flags parameter type of atomic_dec_and_lock_irqsave

On Linux atomic_dec_and_lock_irqsave is a wrapper macro which provides
a reference to third parameter rather than parameter value

LinuxKPI: Change flags parameter type of atomic_dec_and_lock_irqsave

On Linux atomic_dec_and_lock_irqsave is a wrapper macro which provides
a reference to third parameter rather than parameter value itself to
implementation routine called _atomic_dec_and_lock_irqsave [1].

While here, implement a fast path.

[1] https://github.com/torvalds/linux/blob/master/include/linux/spinlock.h#L476

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D30781

show more ...


# 46ae23a4 09-Jun-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: avoid userret: Returning with with pinned thread

Some code manually calls local_bh_disable() and spin_lock() but
then calls spin_unlock_bh() (or vice versa).
Our code then calls local_bh_d

LinuxKPI: avoid userret: Returning with with pinned thread

Some code manually calls local_bh_disable() and spin_lock() but
then calls spin_unlock_bh() (or vice versa).
Our code then calls local_bh_disable() again from spin_lock()
which means we have the thread pin count increased twice and that
means we get out of synch and are still pinned when returning to
user space.

Avoid this by adding the explicit local_bh_{enable,disable}() to
the spin_[un]lock_bh() versions.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30711

show more ...


# e657f3de 26-Apr-2021 Neel Chauhan <nc@FreeBSD.org>

linuxkpi: Remove unneeded {} in atomic_dec_and_lock_irqsave()


# c8de6e20 26-Apr-2021 Neel Chauhan <nc@FreeBSD.org>

linuxkpi: Elimiate brackets on return in spinlock.h


# ce65353a 26-Apr-2021 Neel Chauhan <nc@FreeBSD.org>

linuxkpi: Implement atomic_dec_and_lock_irqsave()

This is needed by the drm-kmod 5.5 update.

Reviewed by: hselasky, manu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29988


# ac341353 12-Aug-2025 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Define `raw_spinlock_t` in <linux/spinlock.h>

For now, it is synonymous to `spinlock_t`. The DRM generic code uses the
`struct raw_spinlock` and not `raw_spinlock_t`, that's why the
defini

linuxkpi: Define `raw_spinlock_t` in <linux/spinlock.h>

For now, it is synonymous to `spinlock_t`. The DRM generic code uses the
`struct raw_spinlock` and not `raw_spinlock_t`, that's why the
definition is a struct embedding a `struct mtx`, compared to
`spinlock_t` which is a simpler typedef.

The DRM generic code started to use it in Linux 6.10.

Reviewed by: bz, christos
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54489

show more ...


# f3e25c01 28-Feb-2025 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Add `local_irq_{save,restore}()`

These are no-ops.

The i915 DRM driver started to use it in Linux 6.8.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https

linuxkpi: Add `local_irq_{save,restore}()`

These are no-ops.

The i915 DRM driver started to use it in Linux 6.8.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49380

show more ...


# cff79fd0 17-May-2024 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: Fix spin_lock_init

Some linux code re-init some spinlock so add MTX_NEW to mtx_init.

Reported by: David Wolfskill <david@catwhisker.org>
Fixes: ae38a1a1bfdf ("linuxkpi: spinlock: Simplif

linuxkpi: Fix spin_lock_init

Some linux code re-init some spinlock so add MTX_NEW to mtx_init.

Reported by: David Wolfskill <david@catwhisker.org>
Fixes: ae38a1a1bfdf ("linuxkpi: spinlock: Simplify code")

show more ...


# ae38a1a1 15-May-2024 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: spinlock: Simplify code

Just use a typedef for spinlock_t, no need to create a useless
structure.

Reviewed by: bz, emaste
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Re

linuxkpi: spinlock: Simplify code

Just use a typedef for spinlock_t, no need to create a useless
structure.

Reviewed by: bz, emaste
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D45205

show more ...


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# ad83dd2b 31-Mar-2023 John Baldwin <jhb@FreeBSD.org>

LinuxKPI: Appease -Wunused-but-set-variable warnings from GCC.

- Mark assert dummy variables as __unused.

- Use a dummy (void) cast of the flags argument passed to
spin_unlock_irqrestore so it ge

LinuxKPI: Appease -Wunused-but-set-variable warnings from GCC.

- Mark assert dummy variables as __unused.

- Use a dummy (void) cast of the flags argument passed to
spin_unlock_irqrestore so it gets treated as used.

Reviewed by: manu, hselasky
Differential Revision: https://reviews.freebsd.org/D39349

show more ...


# 11ef1d97 26-Jan-2022 Vladimir Kondratyev <wulf@FreeBSD.org>

Revert "LinuxKPI: Allow spin_lock_irqsave to be called within a critical section"

This change results in deadlocks on UP systems

This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024.

Reque

Revert "LinuxKPI: Allow spin_lock_irqsave to be called within a critical section"

This change results in deadlocks on UP systems

This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024.

Requested by: kib, hselasky

show more ...


# 02ea6033 18-Jan-2022 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Allow spin_lock_irqsave to be called within a critical section

with spinning on spin_trylock. dma-buf part of drm-kmod depends on this
property and absence of it support results in "mi_swi

LinuxKPI: Allow spin_lock_irqsave to be called within a critical section

with spinning on spin_trylock. dma-buf part of drm-kmod depends on this
property and absence of it support results in "mi_switch: switch in a
critical section" assertions [1][2].

[1] https://github.com/freebsd/drm-kmod/issues/116
[2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261166

MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D33887

show more ...


12