<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/compat/linuxkpi/common/include/linux/spinlock.h, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>LinuxKPI: add supporting #includes</title>
<updated>2026-03-21T21:16:43+00:00</updated>
<author>
<name>Bjoern A. Zeeb</name>
<email>bz@FreeBSD.org</email>
</author>
<published>2026-03-19T20:29:29+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1d18872c2519d7ca726ddc49735180ab1d8916e0'/>
<id>1d18872c2519d7ca726ddc49735180ab1d8916e0</id>
<content type='text'>
Compiling drm-kmod on !X86 does not include asm/smp.h which includes
preempt.h on FreeBSD.  In order to compile drm-kmod on other
architectures add the secondary #includes for preempt.h to
spinlock.h and hardirq.h (which now also gets included from highmem.h)
to connect the #include chain.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
PR:		279864
Reviewed by:	jhibbits, emaste
Differential Revision: https://reviews.freebsd.org/D55974
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Compiling drm-kmod on !X86 does not include asm/smp.h which includes
preempt.h on FreeBSD.  In order to compile drm-kmod on other
architectures add the secondary #includes for preempt.h to
spinlock.h and hardirq.h (which now also gets included from highmem.h)
to connect the #include chain.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
PR:		279864
Reviewed by:	jhibbits, emaste
Differential Revision: https://reviews.freebsd.org/D55974
</pre>
</div>
</content>
</entry>
<entry>
<title>LinuxKPI: add scoped_guard(), spinlock guard support</title>
<updated>2026-02-09T21:49:45+00:00</updated>
<author>
<name>Bjoern A. Zeeb</name>
<email>bz@FreeBSD.org</email>
</author>
<published>2026-01-20T22:54:30+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=31393810a168b74cf13ace0e1d35dae6b4a12bf5'/>
<id>31393810a168b74cf13ace0e1d35dae6b4a12bf5</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>linuxkpi: Define `raw_spinlock_t` in &lt;linux/spinlock.h&gt;</title>
<updated>2026-01-07T21:38:36+00:00</updated>
<author>
<name>Jean-Sébastien Pédron</name>
<email>dumbbell@FreeBSD.org</email>
</author>
<published>2025-08-12T21:55:04+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ac341353a0434408eec6388f3451be8517252c5f'/>
<id>ac341353a0434408eec6388f3451be8517252c5f</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>linuxkpi: Add `local_irq_{save,restore}()`</title>
<updated>2025-04-07T17:36:12+00:00</updated>
<author>
<name>Jean-Sébastien Pédron</name>
<email>dumbbell@FreeBSD.org</email>
</author>
<published>2025-02-28T21:59:47+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f3e25c012d9e3326bee57a4b61e716f244e0a32f'/>
<id>f3e25c012d9e3326bee57a4b61e716f244e0a32f</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>linuxkpi: Fix spin_lock_init</title>
<updated>2024-05-17T05:58:59+00:00</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2024-05-17T04:52:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=cff79fd02636f34010d8b835cc9e55401fa76e74'/>
<id>cff79fd02636f34010d8b835cc9e55401fa76e74</id>
<content type='text'>
Some linux code re-init some spinlock so add MTX_NEW to mtx_init.

Reported by:	David Wolfskill &lt;david@catwhisker.org&gt;
Fixes:		ae38a1a1bfdf ("linuxkpi: spinlock: Simplify code")
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some linux code re-init some spinlock so add MTX_NEW to mtx_init.

Reported by:	David Wolfskill &lt;david@catwhisker.org&gt;
Fixes:		ae38a1a1bfdf ("linuxkpi: spinlock: Simplify code")
</pre>
</div>
</content>
</entry>
<entry>
<title>linuxkpi: spinlock: Simplify code</title>
<updated>2024-05-16T07:39:36+00:00</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2024-05-15T09:00:04+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ae38a1a1bfdf320089c254e4dbffdf4769d89110'/>
<id>ae38a1a1bfdf320089c254e4dbffdf4769d89110</id>
<content type='text'>
Just use a typedef for spinlock_t, no need to create a useless
structure.

Reviewed by:		bz, emaste
Sponsored by:		Beckhoff Automation GmbH &amp; Co. KG
Differential Revision:	https://reviews.freebsd.org/D45205
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Just use a typedef for spinlock_t, no need to create a useless
structure.

Reviewed by:		bz, emaste
Sponsored by:		Beckhoff Automation GmbH &amp; Co. KG
Differential Revision:	https://reviews.freebsd.org/D45205
</pre>
</div>
</content>
</entry>
<entry>
<title>sys: Remove $FreeBSD$: two-line .h pattern</title>
<updated>2023-08-16T17:54:11+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=95ee2897e98f5d444f26ed2334cc7c439f9c16c6'/>
<id>95ee2897e98f5d444f26ed2334cc7c439f9c16c6</id>
<content type='text'>
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
</pre>
</div>
</content>
</entry>
<entry>
<title>LinuxKPI: Appease -Wunused-but-set-variable warnings from GCC.</title>
<updated>2023-03-31T17:56:33+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2023-03-31T17:56:33+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ad83dd2b2b6bb56c002a93fcf800b30f2ec448d5'/>
<id>ad83dd2b2b6bb56c002a93fcf800b30f2ec448d5</id>
<content type='text'>
- 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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- 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
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "LinuxKPI: Allow spin_lock_irqsave to be called within a critical section"</title>
<updated>2022-01-26T22:27:01+00:00</updated>
<author>
<name>Vladimir Kondratyev</name>
<email>wulf@FreeBSD.org</email>
</author>
<published>2022-01-26T22:27:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=11ef1d975f61f728a25727fcb89b340b5433713c'/>
<id>11ef1d975f61f728a25727fcb89b340b5433713c</id>
<content type='text'>
This change results in deadlocks on UP systems

This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024.

Requested by:	kib, hselasky
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change results in deadlocks on UP systems

This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024.

Requested by:	kib, hselasky
</pre>
</div>
</content>
</entry>
<entry>
<title>LinuxKPI: Allow spin_lock_irqsave to be called within a critical section</title>
<updated>2022-01-18T20:14:12+00:00</updated>
<author>
<name>Vladimir Kondratyev</name>
<email>wulf@FreeBSD.org</email>
</author>
<published>2022-01-18T20:14:12+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=02ea6033020e11afec6472bf560b0ddebd0fa97a'/>
<id>02ea6033020e11afec6472bf560b0ddebd0fa97a</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
</feed>
