Page MenuHomeFreeBSD

D39130.id118944.diff
No OneTemporary

D39130.id118944.diff

diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -928,7 +928,8 @@
cpuset.9 CPU_OR_ATOMIC.9 \
cpuset.9 CPU_COPY_STORE_REL.9
MLINKS+=critical_enter.9 critical.9 \
- critical_enter.9 critical_exit.9
+ critical_enter.9 critical_exit.9 \
+ critical_enter.9 CRITICAL_ASSERT.9
MLINKS+=crypto_buffer.9 crypto_apply.9 \
crypto_buffer.9 crypto_apply_buf.9 \
crypto_buffer.9 crypto_buffer_contiguous_segment.9 \
diff --git a/share/man/man9/critical_enter.9 b/share/man/man9/critical_enter.9
--- a/share/man/man9/critical_enter.9
+++ b/share/man/man9/critical_enter.9
@@ -23,7 +23,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 5, 2005
+.Dd January 30, 2023
.Dt CRITICAL_ENTER 9
.Os
.Sh NAME
@@ -37,14 +37,18 @@
.Fn critical_enter "void"
.Ft void
.Fn critical_exit "void"
+.In sys/kassert.h
+.Fn CRITICAL_ASSERT "struct thread *td"
.Sh DESCRIPTION
These functions are used to prevent preemption in a critical region of code.
All that is guaranteed is that the thread currently executing on a CPU will
not be preempted.
-Specifically, a thread in a critical region will not migrate to another
-CPU while it is in a critical region.
+Specifically, a thread in a critical region will not migrate to another CPU
+while it is in a critical region, nor will the current CPU switch to a
+different thread.
The current CPU may still trigger faults and exceptions during a critical
section; however, these faults are usually fatal.
+The CPU might also receive and handle interrupts within a critical section.
.Pp
The
.Fn critical_enter
@@ -68,6 +72,16 @@
semaphores, or other synchronization primitives.
One exception to this is that spin mutexes include a critical section,
so in certain cases critical sections may be interlocked with spin mutexes.
+.Pp
+The
+.Fn CRITICAL_ASSERT
+macro verifies that the provided thread
+.Fa td
+is currently executing in a critical section.
+It is a wrapper around
+.Xr KASSERT 9 .
+.Sh SEE ALSO
+.Xr KASSERT 9
.Sh HISTORY
These functions were introduced in
.Fx 5.0 .

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 27, 8:14 PM (4 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32203645
Default Alt Text
D39130.id118944.diff (2 KB)

Event Timeline