Up to [local] / src / sys / kern
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.35 / (download) - annotate - [select for diffs], Tue May 14 08:26:13 2024 UTC (3 weeks, 6 days ago) by jsg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.34: +1 -3 lines
Diff to previous 1.34 (colored)
remove prototypes with no matching function
Revision 1.34 / (download) - annotate - [select for diffs], Sat Jul 29 06:52:08 2023 UTC (10 months, 1 week ago) by anton
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE,
OPENBSD_7_5,
OPENBSD_7_4_BASE,
OPENBSD_7_4
Changes since 1.33: +3 -2 lines
Diff to previous 1.33 (colored)
Avoid accessing curproc early during boot when kcov is enabled as it might be unassigned until all secondary processors are up and running.
Revision 1.33 / (download) - annotate - [select for diffs], Mon Aug 15 11:38:35 2022 UTC (21 months, 3 weeks ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE,
OPENBSD_7_3,
OPENBSD_7_2_BASE,
OPENBSD_7_2
Changes since 1.32: +7 -1 lines
Diff to previous 1.32 (colored)
Revert previous. It was not ok'ed by dlg@.
Revision 1.32 / (download) - annotate - [select for diffs], Mon Aug 15 09:10:36 2022 UTC (21 months, 3 weeks ago) by mvs
Branch: MAIN
Changes since 1.31: +1 -7 lines
Diff to previous 1.31 (colored)
Stop doing lockless `t_flags' check within task_add(9) and task_del(9). This doesn't work on MP systems. We do locked `t_flags' check just after lockless check, so just remove it. ok dlg@
Revision 1.31 / (download) - annotate - [select for diffs], Sat Aug 1 08:40:20 2020 UTC (3 years, 10 months ago) by anton
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE,
OPENBSD_7_1,
OPENBSD_7_0_BASE,
OPENBSD_7_0,
OPENBSD_6_9_BASE,
OPENBSD_6_9,
OPENBSD_6_8_BASE,
OPENBSD_6_8
Changes since 1.30: +15 -1 lines
Diff to previous 1.30 (colored)
Add support for remote coverage to kcov. Remote coverage is collected from threads other than the one currently having kcov enabled. A thread with kcov enabled occasionally delegates work to another thread, collecting coverage from such threads improves the ability of syzkaller to correlate side effects in the kernel caused by issuing a syscall. Remote coverage is divided into subsystems. The only supported subsystem right now collects coverage from scheduled tasks and timeouts on behalf of a kcov enabled thread. In order to make this work `struct task' and `struct timeout' must be extended with a new field keeping track of the process that scheduled the task/timeout. Both aforementioned structures have therefore increased with the size of a pointer on all architectures. The kernel API is documented in a new kcov_remote_register(9) manual. Remote coverage is also supported by kcov on NetBSD and Linux. ok mpi@
Revision 1.30 / (download) - annotate - [select for diffs], Thu Jun 11 06:06:55 2020 UTC (4 years ago) by dlg
Branch: MAIN
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)
whitespace and speeling fix in a comment. no functional change.
Revision 1.29 / (download) - annotate - [select for diffs], Thu Jun 11 06:03:54 2020 UTC (4 years ago) by dlg
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)
make taskq_barrier wait for pending tasks, not just the running tasks. I wrote taskq_barrier with the behaviour described in the manpage: taskq_barrier() guarantees that any task that was running on the tq taskq when the barrier was called has finished by the time the barrier returns. Note that it talks about the currently running task, not pending tasks. It just so happens that the original implementation just used task_add to put a condvar on the list and waited for it to run. Because task_add uses TAILQ_INSERT_TAIL, you ended up waiting for all pending to work to run too, not just the currently running task. The new implementation took advantage of already holding the lock and used TAILQ_INSERT_HEAD to put the barrier work at the front of the queue so it would run next, which is closer to the stated behaviour. Using the tail insert here restores the previous accidental behaviour. jsg@ points out the following: > The linux functions like flush_workqueue() we use this for in drm want > to wait on all scheduled work not just currently running. > > ie a comment from one of the linux functions: > > /** > * flush_workqueue - ensure that any scheduled work has run to completion. > * @wq: workqueue to flush > * > * This function sleeps until all work items which were queued on entry > * have finished execution, but it is not livelocked by new incoming ones. > */ > > our implementation of this in drm is > > void > flush_workqueue(struct workqueue_struct *wq) > { > if (cold) > return; > > taskq_barrier((struct taskq *)wq); > } I don't think it's worth complicating the taskq API, so I'm just going to make taskq_barrier wait for pending work too. tested by tb@ ok jsg@
Revision 1.28 / (download) - annotate - [select for diffs], Sun Jun 7 23:23:30 2020 UTC (4 years ago) by dlg
Branch: MAIN
Changes since 1.27: +131 -62 lines
Diff to previous 1.27 (colored)
add support for running taskq_barrier from a task inside the taskq. this is required for an upcoming drm update, where the linux workqueue api that supports this is mapped to our taskq api. this main way taskqs support that is to have the taskq worker threads record thir curproc on the taskq, so taskq_barrier calls can iterate over that list looking for their own curproc. if a barriers curproc is in the list, it must be running inside the taskq, and should pretend that it's a barrier task. this also supports concurrent barrier calls by having the taskq recognise the situation and have the barriers work together rather than deadlocking. they end up trying to share the work of getting the barrier tasks onto the workers. once all the workers (or in tq barriers) have rendezvoused the barrier calls unwind, and the last one out lets the other barriers and barrier tasks return. all this barrier logic is implemented in the barrier code, it takes the existing multiworker handling out of the actual taskq loop. thanks to jsg@ for testing this and previous versions of the diff. ok visa@ kettenis@
Revision 1.27 / (download) - annotate - [select for diffs], Thu Dec 19 17:40:11 2019 UTC (4 years, 5 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE,
OPENBSD_6_7
Changes since 1.26: +5 -4 lines
Diff to previous 1.26 (colored)
Convert infinite sleeps to {m,t}sleep_nsec(9). ok visa@
Revision 1.26 / (download) - annotate - [select for diffs], Sun Jun 23 12:56:10 2019 UTC (4 years, 11 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE,
OPENBSD_6_6
Changes since 1.25: +24 -1 lines
Diff to previous 1.25 (colored)
Make taskq_barrier(9) work for multi-threaded task queues. ok visa@
Revision 1.25 / (download) - annotate - [select for diffs], Sun Apr 28 04:20:40 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.24: +65 -5 lines
Diff to previous 1.24 (colored)
add WITNESS support to barriers modelled on the timeout stuff visa did. if a taskq takes a lock, and something holding that lock calls taskq_barrier, there's a potential deadlock. detect this as a lock order problem when witness is enable. task_del conditionally followed by taskq_barrier is a common pattern, so add a taskq_del_barrier wrapper for it that unconditionally checks for the deadlock, like timeout_del_barrier. ok visa@
Revision 1.24 / (download) - annotate - [select for diffs], Mon Apr 1 03:23:45 2019 UTC (5 years, 2 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE,
OPENBSD_6_5
Changes since 1.23: +5 -31 lines
Diff to previous 1.23 (colored)
deprecate TASKQ_CANTSLEEP since nothing uses it anymore if we ever want it back, it's in the attic. ok mpi@ visa@ kettenis@
Revision 1.23 / (download) - annotate - [select for diffs], Sun Dec 16 03:36:02 2018 UTC (5 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.22: +1 -3 lines
Diff to previous 1.22 (colored)
add task_pending jsg@ wants this for drm, and i've had a version of it in diffs sine 2016, but obviously havent needed to use it just yet. task_pending is modelled on timeout_pending, and tells you if the task is on a list waiting to execute. ok jsg@
Revision 1.22 / (download) - annotate - [select for diffs], Thu Dec 14 00:45:16 2017 UTC (6 years, 5 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE,
OPENBSD_6_4,
OPENBSD_6_3_BASE,
OPENBSD_6_3
Changes since 1.21: +6 -12 lines
Diff to previous 1.21 (colored)
replace the bare sleep state handling in barriers with wait cond code
Revision 1.21 / (download) - annotate - [select for diffs], Mon Nov 13 23:52:49 2017 UTC (6 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.20: +27 -1 lines
Diff to previous 1.20 (colored)
add taskq_barrier taskq_barrier guarantees that any task that was running on the taskq has finished by the time taskq_barrier returns. it is similar to intr_barrier. this is needed for use in ifq_barrier as part of an upcoming change.
Revision 1.20 / (download) - annotate - [select for diffs], Mon Oct 30 14:01:42 2017 UTC (6 years, 7 months ago) by visa
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)
Let witness(4) differentiate between taskq mutexes to avoid reporting an error in a scenario like the following: 1. mtx_enter(&tqa->tq_mtx); 2. IRQ 3. mtx_enter(&tqb->tq_mtx); Found by Hrvoje Popovski, OK mpi@
Revision 1.19 / (download) - annotate - [select for diffs], Tue Feb 14 10:31:15 2017 UTC (7 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE,
OPENBSD_6_2,
OPENBSD_6_1_BASE,
OPENBSD_6_1
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)
Convert most of the manual checks for CPU hogging to sched_pause(). The distinction between preempt() and yield() stays as it is usueful to know if a thread decided to yield by itself or if the kernel told him to go away. ok tedu@, guenther@
Revision 1.18 / (download) - annotate - [select for diffs], Thu Aug 11 01:32:31 2016 UTC (7 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.17: +4 -4 lines
Diff to previous 1.17 (colored)
shuffle some code to make it more symmetrical. no functional change.
Revision 1.17 / (download) - annotate - [select for diffs], Tue Dec 8 11:48:54 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE,
OPENBSD_6_0,
OPENBSD_5_9_BASE,
OPENBSD_5_9
Changes since 1.16: +8 -8 lines
Diff to previous 1.16 (colored)
tweak whitespace in struct definition. no functional change.
Revision 1.16 / (download) - annotate - [select for diffs], Tue Dec 8 11:44:12 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)
use struct task_list instead of TAILQ_HEAD(, task)
Revision 1.15 / (download) - annotate - [select for diffs], Thu Nov 19 13:19:24 2015 UTC (8 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)
dont try and wakeup other threads to handle pending work when we know there's only one thread in the taskq. wakeups are much more expensive than a simple compare. from haesbart
Revision 1.14 / (download) - annotate - [select for diffs], Mon Feb 9 03:15:41 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE,
OPENBSD_5_8,
OPENBSD_5_7_BASE,
OPENBSD_5_7
Changes since 1.13: +46 -16 lines
Diff to previous 1.13 (colored)
we want to defer work traditionally (in openbsd) handled in an interrupt context to a taskq running in a thread. however, there is a concern that if we do that then we allow accidental use of sleeping APIs in this work, which will make it harder to move the work back to interrupts in the future. guenther and kettenis came up with the idea of marking a proc with CANTSLEEP which the sleep paths can check and panic on. this builds on that so you create taskqs that run with CANTSLEEP set except when they need to sleep for more tasks to run. the taskq_create api is changed to take a flags argument so users can specify CANTSLEEP. MPSAFE is also passed via this flags field now. this means archs that defined IPL_MPSAFE to 0 can now create mpsafe taskqs too. lots of discussion at s2k15 ok guenther@ miod@ mpi@ tedu@ pelikan@
Revision 1.13 / (download) - annotate - [select for diffs], Tue Jan 27 03:17:36 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.12: +4 -6 lines
Diff to previous 1.12 (colored)
remove the second void * argument on tasks. when workqs were introduced, we provided a second argument so you could pass a thing and some context to work on it in. there were very few things that took advantage of the second argument, so when i introduced pools i suggested removing it. since tasks were meant to replace workqs, it was requested that we keep the second argument to make porting from workqs to tasks easier. now that workqs are gone, i had a look at the use of the second argument again and found only one good use of it (vdsp(4) on sparc64 if you're interested) and a tiny handful of questionable uses. the vast majority of tasks only used a single argument. i have since modified all tasks that used two args to only use one, so now we can remove the second argument. so this is a mechanical change. all tasks only passed NULL as their second argument, so we can just remove it. ok krw@
Revision 1.12 / (download) - annotate - [select for diffs], Sat Nov 1 23:58:28 2014 UTC (9 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)
add a few sizes to free
Revision 1.11 / (download) - annotate - [select for diffs], Wed Oct 8 15:28:39 2014 UTC (9 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.10: +4 -2 lines
Diff to previous 1.10 (colored)
make workq/taskq runner threads yield when they've hogged the cpu ok deraadt@ dlg@ phessler@
Revision 1.10 / (download) - annotate - [select for diffs], Sat Jul 12 18:43:32 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE,
OPENBSD_5_6
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)
add a size argument to free. will be used soon, but for now default to 0. after discussions with beck deraadt kettenis.
Revision 1.9 / (download) - annotate - [select for diffs], Wed Jun 11 08:47:53 2014 UTC (10 years ago) by blambert
Branch: MAIN
Changes since 1.8: +13 -1 lines
Diff to previous 1.8 (colored)
Create system taskq ("systqmp") which runs without the kernel lock; currently unused. ok dlg@ manpage improvement and ok jmc@
Revision 1.8 / (download) - annotate - [select for diffs], Wed Dec 11 22:39:49 2013 UTC (10 years, 6 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE,
OPENBSD_5_5
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)
Fix typo; that teaches me to steal other people's diffs!
Revision 1.7 / (download) - annotate - [select for diffs], Tue Dec 10 17:08:01 2013 UTC (10 years, 6 months ago) by kettenis
Branch: MAIN
Changes since 1.6: +15 -1 lines
Diff to previous 1.6 (colored)
Add infrastructure to create un-biglocked task queues. Stolen from blambert@ who is slacking to much. ok dlg@
Revision 1.6 / (download) - annotate - [select for diffs], Mon Nov 18 20:21:51 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)
simplify kthread_create(). no more stdarg ok matthew guenther mikeb
Revision 1.5 / (download) - annotate - [select for diffs], Wed Oct 30 02:11:32 2013 UTC (10 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.4: +4 -8 lines
Diff to previous 1.4 (colored)
deprecate taskq_systq() and replace it with extern struct taskq *const systq defined in task.h this reduces the cost of using the system taskq and looks less ugly. requested by and ok kettenis@
Revision 1.4 / (download) - annotate - [select for diffs], Tue Oct 29 23:39:02 2013 UTC (10 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)
since taskq_create is only callable from autoconf or process context, it is safe to ask malloc to wait for memory. pointed out by millert@
Revision 1.3 / (download) - annotate - [select for diffs], Tue Oct 29 04:34:21 2013 UTC (10 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.2: +1 -3 lines
Diff to previous 1.2 (colored)
sys/task.h includes sys/queue.h, so kern/kern_task.c doesnt need to do that again. kern/kern_task.c doesnt use pools so we dont need sys/pool.h either.
Revision 1.2 / (download) - annotate - [select for diffs], Tue Oct 29 04:32:08 2013 UTC (10 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.1: +4 -4 lines
Diff to previous 1.1 (colored)
use unsigned int instead of u_int to reduce the depend on types.h. might make jsg a little happier.
Revision 1.1 / (download) - annotate - [select for diffs], Tue Oct 29 04:23:16 2013 UTC (10 years, 7 months ago) by dlg
Branch: MAIN
introduce tasks and taskqs as an alternative to workqs. tasks are modelled on the timeout api, so users familiar with timeout_set, timeout_add, and timeout_del will already know what to expect from task_set, task_add, and task_del. i wrote this because workq_add_task can fail in the place you actually need it, and there arent any good ways of recovering at that point. workq_queue_task was added to try and help, but required external state to be stored for users of that api to know whether something was already queued or not. workqs also didnt provide a way to cancel or remove work. this has been percolating with a bunch of people. putting it in as i wrote it so i can apply their feedback to the code with the history kept in cvs.