The taskq, timeout and SMR barrier routines require that the thing
that is being synchronized with is able to make progress. Consequently,
the callers of these routines must not hold locks that can prevent
that progress. The patch below documents this.

OK?

Index: smr_call.9
===================================================================
RCS file: src/share/man/man9/smr_call.9,v
retrieving revision 1.3
diff -u -p -r1.3 smr_call.9
--- smr_call.9  25 Feb 2020 16:53:25 -0000      1.3
+++ smr_call.9  20 Jun 2022 16:11:53 -0000
@@ -96,6 +96,12 @@ but the system is forced to process the 
 The use of this function is discouraged because of the heavy impact
 on system performance.
 .Pp
+To avoid deadlocks, the caller of
+.Fn smr_barrier
+or
+.Fn smr_flush
+must not hold locks that can block the processing of SMR callbacks.
+.Pp
 The SMR implementation does not limit the number of deferred calls.
 It is important to prevent arbitrary call rate of
 .Fn smr_call .
Index: task_add.9
===================================================================
RCS file: src/share/man/man9/task_add.9,v
retrieving revision 1.22
diff -u -p -r1.22 task_add.9
--- task_add.9  8 Jun 2020 00:29:51 -0000       1.22
+++ task_add.9  20 Jun 2022 16:11:53 -0000
@@ -108,6 +108,13 @@ from the list of pending tasks on the
 .Fa tq
 taskq, or waits until any running task has completed.
 .Pp
+The caller of
+.Fn taskq_barrier
+or
+.Fn taskq_del_barrier
+must not hold locks that can block the taskq.
+Otherwise, the system can deadlock.
+.Pp
 It is the responsibility of the caller to provide the
 .Fn task_set ,
 .Fn task_add ,
Index: timeout.9
===================================================================
RCS file: src/share/man/man9/timeout.9,v
retrieving revision 1.54
diff -u -p -r1.54 timeout.9
--- timeout.9   31 Mar 2022 17:27:23 -0000      1.54
+++ timeout.9   20 Jun 2022 16:11:53 -0000
@@ -195,6 +195,13 @@ ensures that any current execution of th
 .Fa to
 has completed before returning.
 .Pp
+The caller of
+.Fn timeout_barrier
+or
+.Fn timeout_del_barrier
+must not hold locks that can block processing in the timeout's context.
+Otherwise, the system can deadlock.
+.Pp
 The
 .Fn timeout_pending
 macro can be used to check if a timeout is scheduled to run.

Reply via email to