summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clock.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* kernel, sysctl(8): remove dead variable: tickadjcheloha2021-01-131-6/+1
| | | | | | | | | | | | | | | | | | | | The global "tickadj" variable is a remnant of the old NTP adjustment code we used in the kernel before the current timecounter subsystem was imported from FreeBSD circa 2004 or 2005. Fifteen years hence it is completely vestigial and we can remove it. We probably should have removed it long ago but I guess it slipped through the cracks. FreeBSD removed it in 2002: https://cgit.freebsd.org/src/commit/?id=e1d970f1811e5e1e9c912c032acdcec6521b2a6d NetBSD and DragonflyBSD can probably remove it, too. We export tickadj via the kern.clockrate sysctl(2), so update sysctl.2 and sysctl(8) accordingly. Hypothetically this change could break someone's sysctl(8) parsing script. I don't think that's very likely. ok mvs@
* Import dt(4) a driver and framework for Dynamic Profiling.mpi2020-01-211-1/+12
| | | | | | | | | | | The design is fairly simple: events, in the form of descriptors on a ring, are being produced in any kernel context and being consumed by a userland process reading /dev/dt. Code and hooks are all guarded under '#if NDT > 0' so this commit shouldn't introduce any change as long as dt(4) is disable in GENERIC. ok kettenis@, visa@, jasper@, deraadt@
* softclock: move softintr registration/scheduling into timeout modulecheloha2019-11-021-12/+3
| | | | | | | | | | | | | | | softclock() is scheduled from hardclock(9) because long ago callouts were processed from hardclock(9) directly. The introduction of timeout(9) circa 2000 moved all callout processing into a dedicated module, but the softclock scheduling stayed behind in hardclock(9). We can move all the softclock() "stuff" into the timeout module to make kern_clock.c a bit cleaner. Neither initclocks() nor hardclock(9) need to "know" about softclock(). The initial softclock() softintr registration can be done from timeout_proc_init() and softclock() can be scheduled from timeout_hardclock_update(). ok visa@
* per-process itimers: itimerval -> itimerspeccheloha2019-08-021-5/+5
| | | | | | | | | | | | | Loongson runs at 128hz. 128 doesn't divide evenly into a million, but it does divide evenly into a billion. So if we do the per-process itimer bookkeeping with itimerspec structs we can have error-free virtual itimers on loongson just as we do on most other platforms. This change doesn't fix the virtual itimer error alpha, as 1024 does not divide evenly into a billion. But this doesn't make the situation any worse, either. ok deraadt@
* Simplify by using `spc' since we already have it, no behavior change.mpi2019-01-281-3/+2
|
* Only the scheduler time statistics should be affected by spinning.bluhm2018-10-171-9/+8
| | | | | | | Change the process time accounting back to the original code before spinning time was added. No change for scheduler time. Spinning interrupts are no longer accounted to process system time. input and OK visa@
* User land time accounting has changed when kernel spinning time wasbluhm2018-10-101-3/+5
| | | | | | introduced. Account spinning time to the process system time again. time(1) has no spinning, it only shows real, user, sys. OK visa@ mpi@ deraadt@
* drop BUMPTIMEcheloha2018-06-041-15/+1
| | | | | | unused since v1.76, ca 5.3 ok kettenis@ deraadt@
* Stopping counting and reporting CPU time spent spinning on a lock asmpi2018-05-141-2/+5
| | | | | | | | | system time. Introduce a new CP_SPIN "scheduler state" and modify userland tools to display the % of timer a CPU spents spinning. Based on a diff from jmatthew@, ok pirofti@, bluhm@, visa@, deraadt@
* Introduce jiffies, a volatile unsigned long version of our ticks variablekettenis2017-07-221-1/+5
| | | | | | | | | | | for use by the linux compatibility APIs in drm(4). While I hate infecting code in sys/kern with this, untangling all the of having different types and different signedness is too much for me right now. The best strategy may be to change ticks itself to be long but that needs some careful auditing. ok deraadt@
* clear structure on the stack before copying out for sysctl. At presentderaadt2017-04-051-1/+2
| | | | | it has no pads, but a future ABI change could add something and leak kernel memory.
* Introduce Dynamic Profiling, a ddb(4) based & gprof compatible kernelmpi2016-09-041-4/+4
| | | | | | | | | | | | | | | | profiling framework. Code patching is used to enable probes when entering functions. The probes will call a mcount()-like function to match the behavior of a GPROF kernel. Currently only available on amd64 and guarded under DDBPROF. Support for other archs will follow soon. A new sysctl knob, ddb.console, need to be set to 1 in securelevel 0 to be able to use this feature. Inputs and ok guenther@
* set ticks 15 seconds before its value wraps.dlg2016-03-241-1/+3
| | | | | | | | this helps us identify issues around ticks wrap in 15 minutes instead of 240ish days. the change is inspired by something freebsd did as a result of a ticks change they made that went horribly wrong. lots of people said they wanted this
* Update ticks in hardclock().uebayasi2016-03-201-1/+2
| | | | OK mikeb@
* Move hzto(9) to the attic; OK dlgmikeb2015-06-111-54/+1
|
* Remove non-standard <sys/dkstat.h> header. It has not contained anythingmiod2014-09-151-2/+1
| | | | | | | | | | related to disk stastics for almost 17 years, and the remaining userland-visible defines duplicate those found in <sys/sched.h>. Move the remaining _KERNEL defines to <sys/tty.h> where they belong, and update all users to cope with this. ok kettenis@
* Remove global cp_time[] array; no longer used now that all arches implementmiod2014-09-041-3/+1
| | | | cpu_info.
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-2/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* rename local ticks to nticks to avoid aliasing global. ok krwtedu2013-12-241-17/+17
|
* Fix delivery of SIGPROF and SIGVTALRM to threaded processes by havingguenther2013-10-081-37/+12
| | | | | | | | hardclock() set a flag on the running thread and force AST processing, and then have the thread signal itself from userret(). idea and flag names from FreeBSD ok jsing@
* Switch time_t, ino_t, clock_t, and struct kevent's ident and dataguenther2013-08-131-2/+3
| | | | | | | | | | | | | | | | | | | | members to 64bit types. Assign new syscall numbers for (almost all) the syscalls that involve the affected types, including anything with time_t, timeval, itimerval, timespec, rusage, dirent, stat, or kevent arguments. Add a d_off member to struct dirent and replace getdirentries() with getdents(), thus immensely simplifying and accelerating telldir/seekdir. Build perl with -DBIG_TIME. Bump the major on every single base library: the compat bits included here are only good enough to make the transition; the T32 compat option will be burned as soon as we've reached the new world are are happy with the snapshots for all architectures. DANGER: ABI incompatibility. Updating to this kernel requires extra work or you won't be able to login: install a snapshot instead. Much assistance in fixing userland issues from deraadt@ and tedu@ and build assistance from todd@ and otto@
* Add tstohz(9) as the timespec analog to tvtohz(9).matthew2013-04-241-1/+19
| | | | ok miod
* do not include machine/cpu.h from a .c file; it is the responsibility ofderaadt2013-03-281-2/+1
| | | | | .h files to pull it in, if needed ok tedu
* Fix kernel profiling on MP systems by using per-CPU buffers and teachmpi2013-03-121-3/+3
| | | | | | | | | | | kgmon(8) to deal with them, this time without public header changes. Previously various CPUs were iterating over the same global buffer at the same time to modify it and never ended. This diff includes some ideas submited by Thor Simon to NetBSD via miod@. ok deraadt@, mikeb@, haesbaert@
* Back out per-CPU kernel profiling, it shouldn't modify a public headermpi2013-02-121-3/+3
| | | | at this moment.
* Fix kernel profiling on MP systems by using per-CPU buffer. Previouslympi2013-02-111-3/+3
| | | | | | | | | various CPUs were iterating over the same global buffer at the same time to modify it and never ended. This diff includes some ideas submited by Thor Simon to NetBSD via miod@. ok mikeb@, haesbaert@
* unifdef -D __HAVE_TIMECOUNTERmiod2012-11-051-147/+1
|
* Apply profiling to all threads instead of just the thread that calledguenther2012-08-021-10/+12
| | | | | | | profil() by moving P_PROFIL from proc->p_flag to process->ps_flags with matching adjustment in fork1() and exit1() ok matthew@
* On resume, run forward the monotonic and realtimes clocks instead of jumpingguenther2012-05-241-4/+1
| | | | | | just the realtime clock, triggering and adjusting timeouts to reflect that. ok matthew@ deraadt@
* Make rusage totals, itimers, and profile settings per-process insteadguenther2012-03-231-17/+12
| | | | | | | of per-rthread. Handling of per-thread tick and runtime counters inspired by how FreeBSD does it. ok kettenis@
* The scheduling 'nice' value is per-process, not per-thread, so move itguenther2011-03-071-2/+2
| | | | | | into struct process. ok tedu@ deraadt@
* Change hzto(9) and tvtohz(9) arguments to const pointers.matthew2010-08-201-3/+3
| | | | ok krw@, "of course" tedu@
* fix typos in comments, no code changes;schwarze2010-01-141-2/+2
| | | | | from Brad Tilley <brad at 16systems dot com>; ok oga@
* Get rid of __HAVE_GENERIC_SOFT_INTERRUPTS now that all our platforms support it.kettenis2009-11-041-23/+3
| | | | ok jsing@, miod@
* Pass the new pointer to sysctl_clockrate(), so that trying to change themiod2009-01-211-3/+3
| | | | | value of kern.clockrate with sysctl(3) correctly sets errno on failure. PR #6040, ok tedu@
* At clock initialization, if we discover that tickadj is 0 (due to veryderaadt2008-10-041-1/+6
| | | | | | high HZ) set it to 1, to avoid various divide-by-zero errors later Based on discussion in PR 5511 ok miod
* In statclock(), fix local index type in the profiling code. Avoidsmiod2008-03-151-2/+2
| | | | out-of-bounds array accesses on some platforms.
* Make context switching much more MI:art2007-10-101-2/+2
| | | | | | | | | | | | | | | | | | | | - Move the functionality of choosing a process from cpu_switch into a much simpler function: cpu_switchto. Instead of having the locore code walk the run queues, let the MI code choose the process we want to run and only implement the context switching itself in MD code. - Let MD context switching run without worrying about spls or locks. - Instead of having the idle loop implemented with special contexts in MD code, implement one idle proc for each cpu. make the idle loop MI with MD hooks. - Change the proc lists from the old style vax queues to TAILQs. - Change the sleep queue from vax queues to TAILQs. This makes wakeup() go from O(n^2) to O(n) there will be some MD fallout, but it will be fixed shortly. There's also a few cleanups to be done after this. deraadt@, kettenis@ ok
* The world of __HAVEs and __HAVE_NOTs is reducing. All architecturesart2007-05-161-33/+9
| | | | | | have cpu_info now, so kill the option. eyeballed by jsg@ and grange@
* Don't bother performing ITIMER accounting on P_SYSTEM processes (i.e. kthreads).miod2007-04-171-2/+2
| | | | ok art@ kettenis@
* Garbage collect CPU_CLOCKUPDATE since it was only used by i386.art2007-03-251-5/+1
| | | | from brad.
* Since p_flag is often manipulated in interrupts and without biglockart2007-03-151-3/+3
| | | | | | | | | | | | it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int. Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way. kettenis@ ok
* If <machine/cpu.h> defines PROC_PC to compute the userland pc from an exceptionmiod2006-12-241-1/+6
| | | | frame, use it to report profiling information via addupc_intr().
* Introducing adjfreq(2), to adjust the clock frequency.otto2006-06-141-1/+22
| | | | Loosely based on dragonfly code. ok deraadt@
* revert auto-skew. some ntpd implementations interact poorly.tedu2006-01-201-3/+2
|
* auto adjusting adjtime. be more responsive to large clock deltas,tedu2006-01-131-2/+3
| | | | | and attempt to compensate for incorrect clocks by adjusting ticks slowly. ok deraadt
* Make #undef match its temporary #define.miod2006-01-031-2/+2
|
* ansi/deregister.jsg2005-11-281-14/+9
| | | | 'go for it' deraadt@
* dont' -> don't in comments;jmc2005-10-251-2/+2
| | | | from ray lai;
* In hardclock(), do not setup process virtual and profile timers if the processaaron2005-10-031-2/+2
| | | | | | is in the midst of exiting. This solves a race condition that causes freed memory to be left referenced in the master kernel timeout worklist, leading to a uvm_fault (observed on an i386 MP system). tedu@, deraadt@, miod@ ok