summaryrefslogtreecommitdiffstats
path: root/sys/amd64/isa
Commit message (Collapse)AuthorAgeFilesLines
* Overhaul of the SMP code. Several portions of the SMP kernel support havejhb2001-04-272-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* People are still having problems with i586_* on UP machines and SMPjhb2001-04-131-1/+1
| | | | | | machines, so just hack it to disable them for now until it can be fixed. Inspired by hair pulling of: asmodai
* Remove the BETTER_CLOCK #ifdef's. The code is on by default and is herejhb2001-04-101-4/+0
| | | | | | to stay for the foreseeable future. OK'd by: peter (the idea)
* Catch up to header include changes:jhb2001-03-281-3/+1
| | | | | - <sys/mutex.h> now requires <sys/systm.h> - <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
* Switch from save/disable/restore_intr() to critical_enter/exit().jhb2001-03-281-16/+13
|
* Export intrnames and intrcnt as sysctls (hw.nintr, hw.intrnames andtmm2001-03-235-9/+10
| | | | | | hw.intrcnt). Approved by: rwatson
* Show the bzero() bandwidth in kBps instead of Bps; use u_int32_t insteaddes2001-03-191-3/+3
| | | | | | | of long and int64_t; and print the result as an unsigned long. This should make the output from the bzero() test more readable, and avoid printing a negative bandwidth. Note that this doesn't change the decision process, since that is based on time elapsed, not on computed bandwidth.
* Grab the process lock while calling psignal and before calling psignal.jhb2001-03-071-0/+2
|
* Don't enable interrupts before calling sched_ithd for threaded interrupts.jhb2001-03-053-3/+0
| | | | Tested by: obrien
* Remove the leading underscore from all symbols defined in x86 asmjake2001-02-257-46/+46
| | | | | | | | | | | 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
* - Add a new ithread_schedule() function to do the bulk of the work ofjhb2001-02-201-52/+7
| | | | | | | | | | | | | | | | scheduling an interrupt thread to run when needed. This has the side effect of enabling support for entropy gathering from interrupts on all architectures. - Change the software interrupt and x86 and alpha hardware interrupt code to use ithread_schedule() for most of their processing when scheduling an interrupt to run. - Remove the pesky Warning message about interrupt threads having entropy enabled. I'm not sure why I put that in there in the first place. - Add more error checking for parameters and change some cases that returned EINVAL to panic on failure instead via KASSERT(). - Instead of doing a documented evil hack of setting the P_NOLOAD flag on every interrupt thread whose pri was SWI_CLOCK, set the flag explicity for clk_ithd's proc during start_softintr().
* Fixed style bugs in clock.c rev.1.164 and cpu.h rev.1.52-1.53 -- declarebde2001-02-191-6/+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.
* Allow the superuser to prefent all interrupt harvesting onmarkm2001-02-181-1/+1
| | | | her system.
* RIP <machine/lock.h>.markm2001-02-113-9/+0
| | | | | | | 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
* Re-enable preemption on interrupts. My last commit accidentally revertedjhb2001-02-101-1/+8
| | | | it as I was playing with some other ways of doing kernel preemption.
* Catch up to changes to inthand_add().jhb2001-02-091-8/+8
|
* Use the MI ithread helper functions in the x86 interrupt code.jhb2001-02-094-417/+191
|
* Change and clean the mutex lock interface.bmilekic2001-02-095-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Implement preemptive scheduling of hardware interrupt threads.jake2001-02-012-2/+11
| | | | | | | | | | | | - If possible, context switch to the thread directly in sched_ithd(), rather than triggering a delayed ast reschedule. - Disable interrupts while restoring fpu state in the trap handler, in order to ensure that we are not preempted in the middle, which could cause migration to another cpu. Reviewed by: peter Tested by: peter (alpha)
* Convert mca (microchannel bus support) from something that we countpeter2001-01-293-13/+13
| | | | (bogus) to something that we test for the presence of.
* Send "#if NISA > 0" to the bit-bucket and replace it with an option.peter2001-01-292-8/+6
| | | | | These were compile-time "is the isa code present?" tests and not 'how many isa busses' tests.
* Clear intr_nesting_level when an interrupt thread has no morejake2001-01-282-0/+2
| | | | | | | handlers and wants to exit, so it doesn't panic in exit1() which malloc()s with M_WAITOK. Reported by: Bob Bishop <rb@gid.co.uk>
* Remove the Xforward_irq IPI.jhb2001-01-241-4/+0
|
* Make intr_nesting_level per-process, rather than per-cpu. Setupjake2001-01-215-6/+20
| | | | | | | | interrupt threads to run with it always >= 1, so that malloc can detect M_WAITOK from "interrupt" context. This is also necessary in order to context switch from sched_ithd() directly. Reviewed By: peter
* Remove MUTEX_DECLARE() and MTX_COLD. Instead, postpone full mutexjasone2001-01-211-1/+1
| | | | | | | | initialization until after malloc() is safe to call, then iterate through all mutexes and complete their initialization. This change is necessary in order to avoid some circular bootstrapping dependencies.
* - Make npx_intr INTR_MPSAFE and move acquiring Giant into thejake2001-01-201-1/+5
| | | | | | function itself. - Remove a hack to allow acquiring Giant from the npx asm trap vector.
* Convert apm from a bogus 'count' into a plain option. Clean out somepeter2001-01-191-3/+3
| | | | other cruft from the files.alpha and files.ia64 that were related to this.
* Add in a space that got lost in the previous commit in some debugging codejhb2001-01-191-1/+1
| | | | so that '&' becomes a binary operator and not a unary operator.
* EEK! I missed a couple of places with the 24->32 interrupt change.peter2001-01-193-2/+14
|
* Fix a warning (the prototypes probably shouldn't be so over-zealouslypeter2001-01-192-2/+2
| | | | #ifdef'ed though)
* Free the intrhand name when free'ing a intrhand.jhb2001-01-162-0/+2
| | | | Submitted by: bde
* Implement an optimization for INTREN/INTRDIS that bde pointed out lastpeter2001-01-152-0/+28
| | | | | | | | | | | time I tinkered around here. Since INTREN is called from the interrupt critical path now, it should not be too expensive. In this case, we look at the bits being changed to decide which 8 bit IO port to write to rather than unconditionally writing to both. I could probably have gone further and only done the write if the bits actually changed, but that seemed overkill for the usual case in interrupt threads. [an outb is rather expensive when it has to cross the ISA bus]
* Use PCPU_GET, PCPU_PTR and PCPU_SET to access all per-cpu variablesjake2001-01-101-17/+17
| | | | other then curproc.
* Use %fs to access per-cpu variables in uni-processor kernels the samejake2001-01-063-0/+6
| | | | | | | | | | | | | | | | | as multi-processor kernels. The old way made it difficult for kernel modules to be portable between uni-processor and multi-processor kernels. It is no longer necessary to jump through hoops. - always load %fs with the private segment on entry to the kernel - change the type of the self referntial pointer from struct privatespace to struct globaldata - make the globaldata symbol have value 0 in all cases, so the symbols in globals.s are always offsets, not aliases for fields in globaldata - define the globaldata space used for uniprocessor kernels in C, rather than assembler - change the assmebly language accessors to use %fs, add a macro PCPU_ADDR(member, reg), which loads the register reg with the address of the per-cpu variable member
* Introduce a new potientially cleaner interface for accessing per-cpujake2000-12-133-6/+6
| | | | | | | | | | | variables from i386 assembly language. The syntax is PCPU(member) where member is the capitalized name of the per-cpu variable, without the gd_ prefix. Example: movl %eax,PCPU(CURPROC). The capitalization is due to using the offsets generated by genassym rather than the symbols provided by linking with globals.o. asmacros.h is the wrong place for this but it seemed as good a place as any for now. The old implementation in asnames.h has not been removed because it is still used to de-mangle the symbols used by the C variables for the UP case.
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-082-8/+6
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Cleanup some leftover lint from the old interrupt system.peter2000-12-048-273/+57
| | | | | | | | Also, while here, run up to 32 interrupt sources on APIC systems. Normalize INTREN/INTRDIS so they are the same on both UP and SMP systems rather than sometimes a macro, and sometimes a function. Reviewed by: jhb, jakeb
* Namespace cleanup. Remove some #includes in favour of an explicitmarkm2000-12-021-0/+5
| | | | | | declaration. Asked for by: bde
* Change doreti to take a trapframe instead of an intrframe.jake2000-12-013-6/+6
| | | | | | Remove associated pushes of dummy units to convert frame. Reviewed by: jhb
* Assert that Giant is not owned during the main loop of ithd_loop().jhb2000-11-151-0/+1
|
* Revert two experimental changes which escaped from my devel machine.phk2000-10-281-1/+1
|
* Fix a couple of whitespace nits.jhb2000-10-272-4/+4
|
* Convert all users of fldoff() to offsetof(). fldoff() is badphk2000-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | because it only takes a struct tag which makes it impossible to use unions, typedefs etc. Define __offsetof() in <machine/ansi.h> Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h> Remove myriad of local offsetof() definitions. Remove includes of <stddef.h> in kernel code. NB: Kernelcode should *never* include from /usr/include ! Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API. Deprecate <struct.h> with a warning. The warning turns into an error on 01-12-2000 and the file gets removed entirely on 01-01-2001. Paritials reviews by: various. Significant brucifications by: bde
* Fast interrupts have no associated process, therefore do not tryps2000-10-252-22/+26
| | | | and schedule it. This fixes booting machines with broken MP tables.
* - Overhaul the software interrupt code to use interrupt threads for eachjhb2000-10-255-80/+76
| | | | | | | | | | | | | | | | | | | type of software interrupt. Roughly, what used to be a bit in spending now maps to a swi thread. Each thread can have multiple handlers, just like a hardware interrupt thread. - Instead of using a bitmask of pending interrupts, we schedule the specific software interrupt thread to run, so spending, NSWI, and the shandlers array are no longer needed. We can now have an arbitrary number of software interrupt threads. When you register a software interrupt thread via sinthand_add(), you get back a struct intrhand that you pass to sched_swi() when you wish to schedule your swi thread to run. - Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit more intuitive. Also, prefix all the members of struct intrhand with 'ih_'. - Make swi_net() a MI function since there is now no point in it being MD. Submitted by: cp
* Catch up to moving headers:jhb2000-10-201-1/+1
| | | | | - machine/ipl.h -> sys/ipl.h - machine/mutex.h -> sys/mutex.h
* Actually harvest interrupt threads when the last handler is removed from ajhb2000-10-203-6/+51
| | | | thread.
* - machine/mutex.h -> sys/mutex.hjhb2000-10-201-3/+3
| | | | | - machine/ipl.h -> sys/ipl.h - Use MUTEX_DECLARE() for clock_lock
* Convert the type of bus_space_handle_t of pc98 from structure intokato2000-10-201-10/+10
| | | | | | pointer to structure. Reviewed by: nyan
* - Change fast interrupts on x86 to push a full interrupt frame and tojhb2000-10-064-223/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | return through doreti to handle ast's. This is necessary for the clock interrupts to work properly. - Change the clock interrupts on the x86 to be fast instead of threaded. This is needed because both hardclock() and statclock() need to run in the context of the current process, not in a separate thread context. - Kill the prevproc hack as it is no longer needed. - We really need Giant when we call psignal(), but we don't want to block during the clock interrupt. Instead, use two p_flag's in the proc struct to mark the current process as having a pending SIGVTALRM or a SIGPROF and let them be delivered during ast() when hardclock() has finished running. - Remove CLKF_BASEPRI, which was #ifdef'd out on the x86 anyways. It was broken on the x86 if it was turned on since cpl is gone. It's only use was to bogusly run softclock() directly during hardclock() rather than scheduling an SWI. - Remove the COM_LOCK simplelock and replace it with a clock_lock spin mutex. Since the spin mutex already handles disabling/restoring interrupts appropriately, this also lets us axe all the *_intr() fu. - Back out the hacks in the APIC_IO x86 cpu_initclocks() code to use temporary fast interrupts for the APIC trial. - Add two new process flags P_ALRMPEND and P_PROFPEND to mark the pending signals in hardclock() that are to be delivered in ast(). Submitted by: jakeb (making statclock safe in a fast interrupt) Submitted by: cp (concept of delaying signals until ast())
OpenPOWER on IntegriCloud