summaryrefslogtreecommitdiffstats
path: root/sys/arch/sh/include/cpu.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* landisk has legacy global variable want_resched, rather than post-MPderaadt2020-09-251-10/+5
| | | | ci->ci_want_resched. convert to the modern style.
* introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.dlg2020-05-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | rnd.c uses nanotime to get access to some bits that change quickly between events that it can mix into the entropy pool. it doesn't use nanotime to get a monotonically increasing set or ordered and accurate timestamps, it just wants something with bits that change. there's been discussions for years about letting rnd use a clock that's super fast to read, but not necessarily accurate, but it wasn't until recently that i figured out it wasn't interested in time at all, so things like keeping a fast clock coherent between cpu cores or correct according to ntp is unecessary. this means we can just let rnd read the cycle counters on cpus and things will be fine. cpus with cycle counters that vary in their speed and arent kept consistent between cores may even be desirable in this context. so this is the first step in converting rnd.c to reading cycle counter. it copies the nanotime backend to each arch, and they can replace it with something MD as a second step later on. djm@ suggested rnd_messybytes, but we landed on cpu_rnd_messybits. thanks to visa for his eyes. ok deraadt@ visa@ deraadt@ says he will help handle any MD fallout that occurs.
* Add intr_{disable,restore}() for sh.visa2019-03-241-1/+13
| | | | Reminded by deraadt@
* CPU_BUSY_CYCLE(): A new MI statement for busy loop power reductionuebayasi2014-07-111-1/+3
| | | | | | | | | | The new CPU_BUSY_CYCLE() may be put in a busy loop body so that CPU can reduce power consumption, as Linux's cpu_relax() and FreeBSD's cpu_spinwait(). To start minimally, use PAUSE on i386/amd64 and empty on others. The name is chosen following the existing cpu_idle_*() functions. Naming and API may be polished later. OK kettenis@
* final removal of daddr64_t. daddr_t has been 64 bit for a long enoughderaadt2013-06-111-2/+2
| | | | | test period; i think 3 years ago the last bugs fell out. ok otto beck others
* Fix kernel profiling on MP systems by using per-CPU buffers and teachmpi2013-03-121-1/+4
| | | | | | | | | | | 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-4/+1
| | | | at this moment.
* Fix kernel profiling on MP systems by using per-CPU buffer. Previouslympi2013-02-111-1/+4
| | | | | | | | | 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@
* Determine whether we're currently on the alternative signal stackguenther2012-12-021-3/+3
| | | | | | | | | dynamically, by comparing the stack pointer against the altstack base and size, so that you get the correct answer if you longjmp out of the signal handler, as tested by regress/sys/kern/stackjmp/. Also, fix alt stack handling on vax, where it was completely broken. Testing and corrections by miod@, krw@, tobiasu@, pirofti@
* Implement a per-cpu held mutex counter if DIAGNOSTIC on all non-x86 platforms,miod2010-09-281-1/+4
| | | | | to complete matthew@'s commit of a few days ago, and drop __HAVE_CPU_MUTEX_LEVEL define. With help from, and ok deraadt@.
* Do not include <machine/intr.h> from <sh/psl.h>, and fix <sh/cpu.h> whichmiod2010-04-251-1/+3
| | | | used to depend on <sh/psl.h> bringing <machine/intr.h>.
* Remove cpu_wait(). It's original use was to be called from the reaper sooga2009-03-261-2/+1
| | | | | | | | MD code would free resources that couldn't be freed until we were no longer running in that processor. However, it's is unused on all architectures since mikeb@'s tss changes on x86 earlier in the year. ok miod@
* make random(9) return per-cpu values (by saving the seed in the cpuinfo),deraadt2008-10-151-1/+2
| | | | | | | which are uniform for the profclock on each cpu in a SMP system (but using a different seed for each cpu). on all cpus, avoid seeding with a value out of the [0, 2^31-1] range (since that is not stable) ok kettenis drahn
* Add empty cpu_unidle() macros for architectures that currently don't doart2008-10-101-1/+2
| | | | | | anything special to prod a cpu to leave the idle loop in signotify. powerpc, i386, amd64 and sparc64 will follow soon so that everyone has the same interface to wake an idling cpu.
* Define MAXCPUS on all architectures.art2008-10-101-1/+2
| | | | | For now, sparc64 is arbitrarily set to 256 (only architecture that didn't have a practical limit in the code on the number of cpus).
* Implement CPU_INFO_UNIT for everyone, not just MP kernels.art2008-10-091-1/+2
| | | | ok miod@
* Add a macro that clears the want_resched flag that need_resched sets.art2008-07-181-1/+2
| | | | | | | | | | | | | | Right now when mi_switch picks up the same proc, we didn't clear the flag which would mean that every time we service an AST we would attempt a context switch. For some architectures, amd64 being probably the most extreme, that meant attempting to context switch for every trap and interrupt. Now we clear_resched explicitly after every context switch, even if it didn't do anything. Which also allows us to remove some more code in cpu_switchto (not done yet). miod@ ok
* Not all cache operations need to be run from P2, so don't do this unlessmiod2008-05-211-16/+55
| | | | | | | necessary. Also, let the P2 functions return to P1 addresses, instead of jumping to their own P1 image before returning. This gives a ~15% speedup. From NetBSD, thanks uwe@netbsd for spotting this in the sh4 docs!
* Remove long dead CLKF_BASEPRI which crept in by mistake.miod2008-02-111-2/+1
|
* Make context switching much more MI:art2007-10-101-1/+6
| | | | | | | | | | | | | | | | | | | | - 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
* now that all partition size/offsets are potentially 64-bit, change thederaadt2007-06-061-2/+2
| | | | | | | type of all variables to daddr64_t. this includes the APIs for XXsize() and XXdump(), all range checks inside bio drivers, internal variables for disklabel handling, and even uvm's swap offsets. re-read numerous times by otto, miod, krw, thib to look for errors
* Switch sh to __HAVE_CPUINFO. The least possible effort for now.art2007-05-141-1/+21
| | | | deraadt@ ok
* machdep.led_blink sysctl for landisk, also move cpu_sysctl() code and relatedmiod2007-04-291-14/+1
| | | | variables from arch/sh/ to arch/landisk/. ok deraadt@
* Since p_flag is often manipulated in interrupts and without biglockart2007-03-151-6/+2
| | | | | | | | | | | | 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
* Kernel crash dumps and associated libkvm bits for landisk.miod2007-03-031-1/+4
|
* Move landisk to hardware floating point. At the moment the FPU context ismiod2007-03-021-1/+4
| | | | | | | | | | | | | | | always saved upon context switches, as FPU registers are heavily used for long long computations (don't ask). Gcc default to -m4. Credits to drahn@ otto@ and deraadt@ for feedback and help testing. Upgrade procedure if you don't want to use the damn snapshots: - build and install new kernel, reboot off it - build new gcc, do not install it yet - make includes - install new gcc - build and install lib/csu and lib/libc - make build
* power(4) driver for the power switch on many landisk models, hookedmartin2007-01-151-2/+4
| | | | | | up to machdep.kbdreset; modelled after the sparc64 power(4) driver discussed with miod@ and jsg@
* Remove cpu_swapin() and cpu_swapout(), they are no longer necessary (exceptmiod2006-11-291-8/+1
| | | | for cpu_swapin() on hppa* which is kept).
* few more filesmickey2006-10-061-1/+2
|
* Preliminary bits for SuperH-based ports, based on NetBSD/sh3 codebase withmiod2006-10-061-0/+213
minor changes.