summaryrefslogtreecommitdiffstats
path: root/sys/i386/include
Commit message (Collapse)AuthorAgeFilesLines
* Overhaul of the SMP code. Several portions of the SMP kernel support havejhb2001-04-276-598/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | been made machine independent and various other adjustments have been made to support Alpha SMP. - It splits the per-process portions of hardclock() and statclock() off into hardclock_process() and statclock_process() respectively. hardclock() and statclock() call the *_process() functions for the current process so that UP systems will run as before. For SMP systems, it is simply necessary to ensure that all other processors execute the *_process() functions when the main clock functions are triggered on one CPU by an interrupt. For the alpha 4100, clock interrupts are delievered in a staggered broadcast fashion, so we simply call hardclock/statclock on the boot CPU and call the *_process() functions on the secondaries. For x86, we call statclock and hardclock as usual and then call forward_hardclock/statclock in the MD code to send an IPI to cause the AP's to execute forwared_hardclock/statclock which then call the *_process() functions. - forward_signal() and forward_roundrobin() have been reworked to be MI and to involve less hackery. Now the cpu doing the forward sets any flags, etc. and sends a very simple IPI_AST to the other cpu(s). AST IPIs now just basically return so that they can execute ast() and don't bother with setting the astpending or needresched flags themselves. This also removes the loop in forward_signal() as sched_lock closes the race condition that the loop worked around. - need_resched(), resched_wanted() and clear_resched() have been changed to take a process to act on rather than assuming curproc so that they can be used to implement forward_roundrobin() as described above. - Various other SMP variables have been moved to a MI subr_smp.c and a new header sys/smp.h declares MI SMP variables and API's. The IPI API's from machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h. - The globaldata_register() and globaldata_find() functions as well as the SLIST of globaldata structures has become MI and moved into subr_smp.c. Also, the globaldata list is only available if SMP support is compiled in. Reviewed by: jake, peter Looked over by: eivind
* Make the ap_boot_mtx mutex static.jhb2001-04-201-1/+1
|
* Back out 1.103. It wasn't approved by the owner of the file andimp2001-04-181-45/+45
| | | | | | introduced style bugs. Submited by: bde
* Blow away the panic mutex in favor of using a single atomic_cmpset() on ajhb2001-04-171-4/+0
| | | | | | panic_cpu shared variable. I used a simple atomic operation here instead of a spin lock as it seemed to be excessive overhead. Also, this can avoid recursive panics if, for example, witness is broken.
* Back out wrapping the asm ... ; bits in #ifndef lint macros. Theremarkm2001-04-141-6/+0
| | | | | | | | | | | | | | | | | are some good reasons for not doing this, even if the linting of the code breaks. 1) If lint were ever to understand the stuff inside the macros, that would break the checks. 2) There are ways to use __GNUC__ to exclude overly specific code. 3) (Not yet practical) Lint(1) needs to properlyu understand all of te code we actually run. Complained about by: bde Education by: jake, jhb, eivind
* Make this more lint-friendly. This file seems to be invoked in justmarkm2001-04-131-4/+10
| | | | | about any .c file that includes a .h, and lint produces copious whining because of the asm ...; stuff.
* Rename the IPI API from smp_ipi_* to ipi_* since the smp_ prefix is justjhb2001-04-112-18/+18
| | | | | | "redundant noise" and to match the IPI constant namespace (IPI_*). Requested by: bde
* Remove constants defining the bitmasks of the old giant kernel lock.jhb2001-04-102-10/+0
|
* Remove the old APIC I/O higher level IPI API in favor of the newer MIjhb2001-04-101-46/+0
| | | | | | API for IPI's that isn't tied to the Intel APIC. MD code can still use the apic_ipi() function or dink with the apic directly if needed to send MD IPI's.
* Remove the BETTER_CLOCK #ifdef's. The code is on by default and is herejhb2001-04-103-38/+5
| | | | | | to stay for the foreseeable future. OK'd by: peter (the idea)
* Add an MI API for sending IPI's. I used the same API present on the alphajhb2001-04-102-12/+74
| | | | | | | | because: - it used a better namespace (smp_ipi_* rather than *_ipi), - it used better constant names for the IPI's (IPI_* rather than X*_OFFSET), and - this API also somewhat exists for both alpha and ia64 already.
* Axe the per-cpu variable witness_spin_check as it was replaced by thejhb2001-04-062-2/+0
| | | | per-cpu spinlocks list.
* De __P() while I'm here. Done as a separate commit since it is justimp2001-04-031-45/+45
| | | | | | | | | | stylistic. # Yes, this break K&R, but this file already used so many gcc extensions # keeping K&R support seemed too anachronistic for me. Didn't fix the bug where functions that can only be used in the kernel are exported to userland.
* Make this file C++ safe. It defines many useful functions (inb, outb)imp2001-04-031-0/+4
| | | | | | | that people use from userland in C++ programs. I've had this in my tree for ages and just got bit by it not being in the real tree again. This is a MFC candidate.
* Rework the witness code to work with sx locks as well as mutexes.jhb2001-03-283-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Introduce lock classes and lock objects. Each lock class specifies a name and set of flags (or properties) shared by all locks of a given type. Currently there are three lock classes: spin mutexes, sleep mutexes, and sx locks. A lock object specifies properties of an additional lock along with a lock name and all of the extra stuff needed to make witness work with a given lock. This abstract lock stuff is defined in sys/lock.h. The lockmgr constants, types, and prototypes have been moved to sys/lockmgr.h. For temporary backwards compatability, sys/lock.h includes sys/lockmgr.h. - Replace proc->p_spinlocks with a per-CPU list, PCPU(spinlocks), of spin locks held. By making this per-cpu, we do not have to jump through magic hoops to deal with sched_lock changing ownership during context switches. - Replace proc->p_heldmtx, formerly a list of held sleep mutexes, with proc->p_sleeplocks, which is a list of held sleep locks including sleep mutexes and sx locks. - Add helper macros for logging lock events via the KTR_LOCK KTR logging level so that the log messages are consistent. - Add some new flags that can be passed to mtx_init(): - MTX_NOWITNESS - specifies that this lock should be ignored by witness. This is used for the mutex that blocks a sx lock for example. - MTX_QUIET - this is not new, but you can pass this to mtx_init() now and no events will be logged for this lock, so that one doesn't have to change all the individual mtx_lock/unlock() operations. - All lock objects maintain an initialized flag. Use this flag to export a mtx_initialized() macro that can be safely called from drivers. Also, we on longer walk the all_mtx list if MUTEX_DEBUG is defined as witness performs the corresponding checks using the initialized flag. - The lock order reversal messages have been improved to output slightly more accurate file and line numbers.
* - Switch from using save/disable/restore_intr to using critical_enter/exitjhb2001-03-281-5/+5
| | | | | | | | | | | | | | | | | and change the u_int mtx_saveintr member of struct mtx to a critical_t mtx_savecrit. - On the alpha we no longer need a custom _get_spin_lock() macro to avoid an extra PAL call, so remove it. - Partially fix using mutexes with WITNESS in modules. Change all the _mtx_{un,}lock_{spin,}_flags() macros to accept explicit file and line parameters and rename them to use a prefix of two underscores. Inside of kern_mutex.c, generate wrapper functions for _mtx_{un,}lock_{spin,}_flags() (only using a prefix of one underscore) that are called from modules. The macros mtx_{un,}lock_{spin,}_flags() are mapped to the __mtx_* macros inside of the kernel to inline the usual case of mutex operations and map to the internal _mtx_* functions in the module case so that modules will use WITNESS and KTR logging if the kernel is compiled with support for it.
* - Add the new critical_t type used to save state inside of criticaljhb2001-03-282-15/+21
| | | | | | | | | sections. - Add implementations of the critical_enter() and critical_exit() functions and remove restore_intr() and save_intr(). - Remove the somewhat bogus disable_intr() and enable_intr() functions on the alpha as the alpha actually uses a priority level and not simple bit flag on the CPU.
* Export intrnames and intrcnt as sysctls (hw.nintr, hw.intrnames andtmm2001-03-231-0/+13
| | | | | | hw.intrcnt). Approved by: rwatson
* Use a generic implementation of the Fowler/Noll/Vo hash (FNV hash).peter2001-03-171-1/+1
| | | | | | | | | | | | | | | | | Make the name cache hash as well as the nfsnode hash use it. As a special tweak, create an unsigned version of register_t. This allows us to use a special tweak for the 64 bit versions that significantly speeds up the i386 version (ie: int64 XOR int64 is slower than int64 XOR int32). The code layout is a little strange for the string function, but I was able to get between 5 to 10% improvement over the original version I started with. The layout affects gcc code generation choices and this way was fastest on x86 and alpha. Note that 'CPUTYPE=p3' etc makes a fair difference to this. It is around 45% faster with -march=pentiumpro on a p6 cpu.
* Kill the 4MB kernel limit dead. [I hope :-)].peter2001-03-151-3/+9
| | | | | | | | | | | | | | | For UP, we were using $tmp_stk as a stack from the data section. If the kernel text section grew beyond ~3MB, the data section would be pushed beyond the temporary 4MB P==V mapping. This would cause the trampoline up to high memory to fault. The hack workaround I did was to use all of the page table pages that we already have while preparing the initial P==V mapping, instead of just the first one. For SMP, the AP bootstrap process suffered the same sort of problem and got the same treatment. MFC candidate - this breaks on 4.x just the same.. Thanks to: Richard Todd <rmtodd@ichotolot.servalan.com>
* Fix mtx_legal2block. The only time that it is bad to block on a mutex isjhb2001-03-091-1/+0
| | | | | | | | | | | | | | | | if we hold a spin mutex, since we can trivially get into deadlocks if we start switching out of processes that hold spinlocks. Checking to see if interrupts were disabled was a sort of cheap way of doing this since most of the time interrupts were only disabled when holding a spin lock. At least on the i386. To fix this properly, use a per-process counter p_spinlocks that counts the number of spin locks currently held, and instead of checking to see if interrupts are disabled in the witness code, check to see if we hold any spin locks. Since child processes always start up with the sched lock magically held in fork_exit(), we initialize p_spinlocks to 1 for child processes. Note that proc0 doesn't go through fork_exit(), so it starts with no spin locks held. Consulting from: cp
* Spell what was originally "unsigned long" as "unsigned long" again,dwmalone2001-03-061-4/+4
| | | | | | | to cut down on some compiler warnings caused by lexically mismatched types. Reviewed by: bde
* Merged from sys/i386/include/bus_at386.h revision 1.13.kato2001-03-021-1/+0
|
* version 1.7 made some changes to correct problems identifed by compilingmdodd2001-03-022-2/+0
| | | | | | | | | | | with egcs-1.1.1. bus_space_write_multi_2() had an extra operation that should have been removed. Remove it. This fixes the panic when bus_space_write_multi_2() is used. Obtained from: jake
* Always use the ELF naming after the demise of asnames.h.peter2001-02-251-5/+0
|
* Remove the leading underscore from all symbols defined in x86 asmjake2001-02-254-329/+4
| | | | | | | | | | | and used in C or vice versa. The elf compiler uses the same names for both. Remove asnames.h with great prejudice; it has served its purpose. Note that this does not affect the ability to generate an aout kernel due to gcc's -mno-underscores option. moral support from: peter, jhb
* - Rename the lcall system call handler from Xsyscall to Xlcall_syscalljake2001-02-251-1/+1
| | | | | | | | | to be more like Xint0x80_syscall and less like c function syscall(). - Reduce code duplication between the int0x80 and lcall handlers by shuffling the elfags into the right place, saving the sizeof the instruction in tf_err and jumping into the common int0x80 code. Reviewed by: peter
* Activate USER_LDT by default. The new thread libraries are going topeter2001-02-235-11/+2
| | | | | | | | depend on this. The linux ABI emulator tries to use it for some linux binaries too. VM86 had a bigger cost than this and it was made default a while ago. Reviewed by: jhb, imp
* GC unused and now obsolete assertion macros.jhb2001-02-221-8/+0
|
* - Don't call clear_resched() in userret(), instead, clear the resched flagjhb2001-02-201-1/+0
| | | | | | | | | | | | in mi_switch() just before calling cpu_switch() so that the first switch after a resched request will satisfy the request. - While I'm at it, move a few things into mi_switch() and out of cpu_switch(), specifically set the p_oncpu and p_lastcpu members of proc in mi_switch(), and handle the sched_lock state change across a context switch in mi_switch(). - Since cpu_switch() no longer handles the sched_lock state change, we have to setup an initial state for sched_lock in fork_exit() before we release it.
* Removed all traces of T_ASTFLT (except for gaps where it was). It becamebde2001-02-191-1/+0
| | | | unused except in dead code when ast() was split off from trap().
* Changed the aston() family to operate on a specified process instead ofbde2001-02-191-1/+1
| | | | | | | | | | | | | | always on curproc. This is needed to implement signal delivery properly (see a future log message for kern_sig.c). Debogotified the definition of aston(). aston() was defined in terms of signotify() (perhaps because only the latter already operated on a specified process), but aston() is the primitive. Similar changes are needed in the ia64 versions of cpu.h and trap.c. I didn't make them because the ia64 is missing the prerequisite changes to make astpending and need_resched per-process and those changes are too large to make without testing.
* Fixed style bugs in clock.c rev.1.164 and cpu.h rev.1.52-1.53 -- declarebde2001-02-191-4/+1
| | | | | | tsc_present in the right places (together with other variables of the same linkage), and don't use messy ifdefs just to avoid exporting it in some cases.
* Fixed disordering in previous commit. "Fixed" a null comment in previousbde2001-02-171-1/+1
| | | | commit by removing it.
* Correct 2nd argument of getnameinfo(3) to socklen_t.ume2001-02-151-0/+1
| | | | Reviewed by: itojun
* RIP <machine/lock.h>.markm2001-02-114-91/+57
| | | | | | | Some things needed bits of <i386/include/lock.h> - cy.c now has its own (only) copy of the COM_(UN)LOCK() macros, and IMASK_(UN)LOCK() has been moved to <i386/include/apic.h> (AKA <machine/apic.h>). Reviewed by: jhb
* - Make astpending and need_resched process attributes rather than CPUjhb2001-02-104-40/+8
| | | | | | | | | | | attributes. This is needed for AST's to be properly posted in a preemptive kernel. They are backed by two new flags in p_sflag: PS_ASTPENDING and PS_NEEDRESCHED. They are still accesssed by their old macros: aston(), astoff(), etc. For completeness, an astpending() macro has been added to check for a pending AST, and clear_resched() has been added to clear need_resched(). - Rename syscall2() on the x86 back to syscall() to be consistent with other architectures.
* Add a macro mtx_intr_enable() to alter a spin lock such that interruptsjhb2001-02-101-0/+1
| | | | will be enabled when it is released.
* Woops, remove an obsolete reference to gd_cpu_lockid.jhb2001-02-091-1/+0
|
* Axe gd_cpu_lockid as it is no longer used.jhb2001-02-092-2/+0
|
* Change and clean the mutex lock interface.bmilekic2001-02-095-41/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* Fix typo: compatability -> compatibility.asmodai2001-02-061-1/+1
| | | | Compatability is not an existing english word.
* Zap last remaining references to (and a use use of) of simple_locks.peter2001-01-311-10/+0
|
* Remove some leftovers from the CMAP* stuff in globaldata and thepeter2001-01-303-21/+6
| | | | BSP and AP startup.
* Move the setting of curproc to idleproc up earlier in ap_init(). Thebmilekic2001-01-281-6/+6
| | | | | | | | | | | problem is that a mutex lock, prior to this change, is acquired before the curproc is set to idleproc, so we mess ourselves up by calling the mutex lock routine with curproc == NULL. Moving it up after the aps_ready spin-wait has us hopefully setting it after idleproc is setup. Solved by: jake (the allmighty) :-)
* Defer assignment of low level interrupt handlers for PCI interruptstegge2001-01-282-37/+49
| | | | | described in the MP table until something asks for the interrupt number later on.
* Add experimental support for Eicon.Diehl DIVA 2.0 and 2.02 ISA PnP cards.hm2001-01-261-3/+4
| | | | | Increment i4b minor revision (=step) so a buildworld or a make install in /usr/src/sys/include is necessary to get isdnd and i4b kernel parts in sync.
* Convert all simplelocks to mutexes and remove the simplelock implementations.jasone2001-01-244-85/+43
|
* Remove unused locks: cpl, fast_intr, intr, mpintr.jhb2001-01-241-4/+0
|
* - Proc locking.jhb2001-01-241-4/+7
| | | | | - P_OWEUPC -> PS_OWEUPC. - Remove obsolete prototype for MD fork_return().
OpenPOWER on IntegriCloud