summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clock.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Diff from art@:grange2004-11-101-2/+1
| | | | | | | | | Update ticks in timeout_hardclock_update to avoid errors in hardclock (this is the third time we mess up here). ticks is only used for timeouts anyway. At the same protect updating ticks with timeout_mutex and be slightly more paranoid in timeout_hardclock_update. ok tdeval@ miod@
* Typo in #endif comment.grange2004-09-151-2/+2
|
* Fix typos. Found by Dries Schellekensart2004-08-051-3/+3
|
* hardclock detects if ITIMER_VIRTUAL and ITIMER_PROF have expired andart2004-08-041-3/+44
| | | | | | | | | | | | | | | | | | | sends SIGVTALRM and SIGPROF to the process if they had. There is a big problem with calling psignal from hardclock on MULTIPROCESSOR machines though. It means we need to protect all signal state in the process with a lock because hardclock doesn't obtain KERNEL_LOCK. Trying to track down all the tentacles of this quickly becomes very messy. What saves us at the moment is that SCHED_LOCK (which is used to protect parts of the signal state, but not all) happens to be recursive and forgives small and big errors. That's about to change. So instead of trying to hunt down all the locking problems here, just make hardclock not send signals. Instead hardclock schedules a timeout that will send the signal later. There are many reasons why this works just as good as the previous code, all explained in a comment written in big, friendly letters in kern_clock. miod@ ok noone else dared to ok this, but noone screamed in agony either.
* Even when we have timecounters we still have to do the check for secondaryart2004-08-041-3/+3
| | | | | cpus calling hardclock and the statclock emulation. Move some ifdef __HAVE_TIMECOUNTER code.
* This touches only MI code, and adds new time keeping code. Thetholo2004-07-281-7/+24
| | | | | | | | | | | | | | | code is all conditionalized on __HAVE_TIMECOUNTER, and not enabled on any platforms. adjtime(2) support exists, courtesy of nordin@, sysctl(2) support and a concept of quality for each time source attached exists. High quality time sources exists for PIIX4 ACPI timer as well as some AMD power management chips. This will have to be redone once we actually add ACPI support (at that time we need to use the ACPI interfaces to get at these clocks). ok art@ ken@ miod@ jmc@ and many more
* This moves access to wall and uptime variables in MI code,tholo2004-06-241-6/+76
| | | | | | | | | | | | | | encapsulating all such access into wall-defined functions that makes sure locking is done as needed. It also cleans up some uses of wall time vs. uptime some places, but there is sure to be more of these needed as well, particularily in MD code. Also, many current calls to microtime() should probably be changed to getmicrotime(), or to the {,get}microuptime() versions. ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others "Oh, that is not your problem!" from miod@
* First step towards more sane time handling in the kernel -- this changestholo2004-06-211-1/+6
| | | | | | | | things such that code that only need a second-resolution uptime or wall time, and used to get that from time.tv_secs or mono_time.tv_secs now get this from separate time_t globals time_second and time_uptime. ok art@ niklas@ nordin@
* debranch SMP, have funniklas2004-06-131-5/+14
|
* Merge in a piece of the SMP branch into HEAD.art2004-06-091-13/+52
| | | | | | | | | | | Introduce the cpu_info structure, p_cpu field in struct proc and global scheduling context and various changed code to deal with this. At the moment no architecture uses this stuff yet, but it will allow us slow and controlled migration to the new APIs. All new code is ifdef:ed out. ok deraadt@ niklas@
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Force "struct timeval time" variable to be aligned to an 8-bit boundary.miod2003-05-131-2/+3
| | | | | | | This is at least necessary for the sparc microtime() function, and was only working before by goat luck. The recent commons removal triggered it. __atribute__ syntax borrowed from NetBSD.
* Restore pentium_microtime, testing by henning@, millert@. ok deraadt@nordin2002-09-241-1/+5
|
* Remove kernel support for NTP. ok deraadt@ and tholo@nordin2002-07-061-799/+2
|
* Change all variables definitions (int foo) in sys/sys/*.h to variablemiod2002-07-031-1/+3
| | | | declarations (extern int foo), and compensate in the appropriate locations.
* Change addupc_intr to not use fuswintr and suswintr to update the profilingart2002-06-071-2/+2
| | | | | | | | | info. Since we only use it to profile processes in user mode and there is no way to get back user mode without going past the AST that will write out the profiling info in a context where copyout works. Sitting in my tree for ages. Reviewed and with some suggestions from nordin@
* Simplify so that we can remove CLKF_BASEPRI() and spllowersoftclock()nordin2002-06-071-12/+3
| | | | infrastructure. ok art@ and miod@
* Introduce a new file, machine/internal_types.h, to hold that specific archespie2002-04-241-2/+2
| | | | | | | | | | | | | type characteristics. internal_types.h will contain only settings invisible from standard C, e.g., in the __* or _[A-Z]* namespace, and be reused by files like limits.h. This allows us to shorten machine/limits.h greatly, as all the common defines are now in sys/limits.h, plus a small stub in internal_types.h. Tested on all arches as far as I know. Approved after discussion with art, millert, deraadt, and others.
* Don't do unnecessary normalization. ok art@nordin2002-02-181-7/+3
|
* Improve comment. ok art@nordin2002-02-151-4/+4
|
* Add a tvtohz function. Like hzto, but doesn't subtract the current time.art2002-02-151-1/+51
|
* Remove reference to timeout table. deraadt@ oknordin2002-01-021-8/+2
|
* New hz value needed by AlphaServer 1200 and a couple other machinesnate2001-12-141-1/+4
|
* Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.miod2001-11-061-2/+2
| | | | (Look ma, I might have broken the tree)
* generic soft interrupts for softclock.art2001-08-191-4/+30
| | | | From NetBSD.
* Move the updating of timeout queues to after ticks is incremented.art2000-08-231-8/+4
| | | | | | | | The older code actually ensured that no timeout would be too early, but it violated the principle of least surprise by making it seem (when you looked at the time variable) that every timeout was one tick late. Also periodic timeouts (that readd themselves in the timeout function), will now happen with the frequency you expect.
* Make hzto return 0 for timeouts that should happen now or in the past.art2000-07-071-5/+5
|