Home | History | Annotate | Download | only in man9
History log of /src/share/man/man9/workqueue.9
RevisionDateAuthorComments
 1.15  08-Sep-2020  riastradh workqueue: Lift unnecessary restriction on workqueue_wait.

Allow multiple concurrent waits at a time, and allow enqueueing work
at the same time (as long as it's not the work we're waiting for).
This way multiple users can use a shared global workqueue and safely
wait for individual work items concurrently, while the workqueue is
still in use for other items (e.g., wg(4) peers).

This has the side effect of taking away a diagnostic measure, but I
think allowing the diagnostic's false positives instead of rejecting
them is worth it. We could cheaply add it back with some false
negatives if it's important.
 1.14  01-Aug-2020  wiz Fix typo.
 1.13  01-Aug-2020  riastradh New workqueue flag WQ_FPU.

Arranges kthread_fpu_enter/exit around calls to the worker. Saves
cost over explicit calls to kthread_fpu_enter/exit in the worker by
only doing it once, since there's often a high cost to flushing the
icache and zeroing the fpu registers.

As proposed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2020/06/20/msg026524.html
 1.12  28-Dec-2017  ozaki-r branches: 1.12.6;
Add workqueue_wait that waits for a specific work to finish

The caller must ensure that no new work is enqueued before calling
workqueue_wait. Note that Note that if the workqueue is WQ_PERCPU, the caller
can enqueue a new work to another queue other than the waiting queue.

Discussed on tech-kern@
 1.11  13-Oct-2015  riastradh branches: 1.11.8;
Semicolon, not comma; use future tense more Englishly.
 1.10  24-Oct-2011  yamt update the description of the priority argument.
 1.9  02-Dec-2010  wiz Remove boilerplate in CODE REFERENCES on file paths.
Describe in intro(9) how to read paths in the CODE REFERENCES section.
 1.8  04-Aug-2009  wiz Use .Nm instead Xr to itself.
 1.7  03-Aug-2009  rmind Relate interfaces by updating "see also" section.
 1.6  03-Aug-2009  rmind Merge workqueue_create(9), workqueue_destroy(9) and workqueue_enqueue(9)
into a single workqueue(9) man page.
 1.5  14-Jul-2007  ad - kcont was removed.
- Replace some references to tsleep.
 1.4  16-Sep-2006  yamt add workqueue_destroy.
 1.3  24-Nov-2005  wiz Article improvements.
 1.2  24-Nov-2005  yamt .Xr kcont and workqueue each other.
 1.1  24-Nov-2005  yamt document workqueue.
 1.11.8.1  16-Jan-2018  martin Pull up following revision(s) (requested by ozaki-r in ticket #497):
tests/rump/rumpkern/Makefile: revision 1.16
tests/rump/kernspace/Makefile: revision 1.6
tests/rump/kernspace/workqueue.c: revision 1.1
tests/rump/kernspace/workqueue.c: revision 1.2
tests/rump/kernspace/workqueue.c: revision 1.3
tests/rump/kernspace/workqueue.c: revision 1.4
tests/rump/kernspace/workqueue.c: revision 1.5
tests/rump/kernspace/workqueue.c: revision 1.6
tests/rump/rumpkern/t_workqueue.c: revision 1.1
sys/sys/workqueue.h: revision 1.10
tests/rump/rumpkern/t_workqueue.c: revision 1.2
tests/rump/kernspace/kernspace.h: revision 1.5
tests/rump/kernspace/kernspace.h: revision 1.6
sys/net/if_bridge.c: revision 1.147
distrib/sets/lists/debug/mi: revision 1.225
sys/kern/subr_workqueue.c: revision 1.34
share/man/man9/workqueue.9: revision 1.12
sys/net/if_spppsubr.c: revision 1.178
distrib/sets/lists/tests/mi: revision 1.763
Add simple test for workqueue(9)
Add declaration. build fix
sorry, I forgot to commit this file.
Tweak use of cv_timedwait
- Handle its return value
- Specify more appropriate time-out periods (2 ticks is too short)
Fix a race condition on taking the mutex
The workqueue worker can take the mutex before the tester tries to take it after
calling workqueue_enqueue. If it happens, the worker calls cv_broadcast before
the tester calls cv_timedwait and the tester will wait until the cv timed out
Take the mutex before calling workqueue_enqueue so that the tester surely calls
cv_timedwait before the worker calls cv_broadcast.
The fix stabilizes the test, t_workqueue/workqueue1.
Add workqueue_wait that waits for a specific work to finish
The caller must ensure that no new work is enqueued before calling
workqueue_wait. Note that Note that if the workqueue is WQ_PERCPU, the caller
can enqueue a new work to another queue other than the waiting queue.
Discussed on tech-kern@
Ensure the timer isn't running by using workqueue_wait
Functionalize some routines to add new tests easily (NFC)
Add a test case for workqueue_wait
Fix build
 1.12.6.1  18-Apr-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1830):

sys/kern/subr_workqueue.c: revision 1.40
sys/kern/subr_workqueue.c: revision 1.41
sys/kern/subr_workqueue.c: revision 1.42
sys/kern/subr_workqueue.c: revision 1.43
sys/kern/subr_workqueue.c: revision 1.44
sys/kern/subr_workqueue.c: revision 1.45
sys/kern/subr_workqueue.c: revision 1.46
tests/rump/kernspace/workqueue.c: revision 1.7
sys/kern/subr_workqueue.c: revision 1.47
tests/rump/kernspace/workqueue.c: revision 1.8
tests/rump/kernspace/workqueue.c: revision 1.9
tests/rump/rumpkern/t_workqueue.c: revision 1.3
tests/rump/rumpkern/t_workqueue.c: revision 1.4
tests/rump/kernspace/kernspace.h: revision 1.9
tests/rump/rumpkern/Makefile: revision 1.20
sys/kern/subr_workqueue.c: revision 1.39
share/man/man9/workqueue.9: revision 1.15
(all via patch)

workqueue: Lift unnecessary restriction on workqueue_wait.

Allow multiple concurrent waits at a time, and allow enqueueing work
at the same time (as long as it's not the work we're waiting for).

This way multiple users can use a shared global workqueue and safely
wait for individual work items concurrently, while the workqueue is
still in use for other items (e.g., wg(4) peers).

This has the side effect of taking away a diagnostic measure, but I
think allowing the diagnostic's false positives instead of rejecting
them is worth it. We could cheaply add it back with some false
negatives if it's important.
workqueue(9): workqueue_wait and workqueue_destroy may sleep.

But might not, so assert sleepable up front.
workqueue(9): Sprinkle dtrace probes.
tests/rump/rumpkern: Use PROGDPLIBS, not explicit -L/-l.

This way we relink the t_* test programs whenever changes under
tests/rump/kernspace change libkernspace.a.

workqueue(9) tests: Nix trailing whitespace.

workqueue(9) tests: Destroy struct work immediately on entry.

workqueue(9) tests: Add test for PR kern/57574.

workqueue(9): Avoid touching running work items in workqueue_wait.

As soon as the workqueue function has called, it is forbidden to
touch the struct work passed to it -- the function might free or
reuse the data structure it is embedded in.

So workqueue_wait is forbidden to search the queue for the batch of
running work items. Instead, use a generation number which is odd
while the thread is processing a batch of work and even when not.
There's still a small optimization available with the struct work
pointer to wait for: if we find the work item in one of the per-CPU
_pending_ queues, then after we wait for a batch of work to complete
on that CPU, we don't need to wait for work on any other CPUs.
PR kern/57574

workqueue(9): Sprinkle dtrace probes for workqueue_wait edge cases.

Let's make it easy to find out whether these are hit.

workqueue(9): Stop violating queue(3) internals.

workqueue(9): Avoid unnecessary mutex_exit/enter cycle each loop.

workqueue(9): Sort includes.
No functional change intended.

workqueue(9): Factor out wq->wq_flags & WQ_FPU in workqueue_worker.
No functional change intended. Makes it clearer that s is
initialized when used.

RSS XML Feed