summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_intr.c
Commit message (Collapse)AuthorAgeFilesLines
* - Add a new ithread_schedule() function to do the bulk of the work ofjhb2001-02-201-47/+101
| | | | | | | | | | | | | | | | 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().
* Implement a unified run queue and adjust priority levels accordingly.jake2001-02-121-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - All processes go into the same array of queues, with different scheduling classes using different portions of the array. This allows user processes to have their priorities propogated up into interrupt thread range if need be. - I chose 64 run queues as an arbitrary number that is greater than 32. We used to have 4 separate arrays of 32 queues each, so this may not be optimal. The new run queue code was written with this in mind; changing the number of run queues only requires changing constants in runq.h and adjusting the priority levels. - The new run queue code takes the run queue as a parameter. This is intended to be used to create per-cpu run queues. Implement wrappers for compatibility with the old interface which pass in the global run queue structure. - Group the priority level, user priority, native priority (before propogation) and the scheduling class into a struct priority. - Change any hard coded priority levels that I found to use symbolic constants (TTIPRI and TTOPRI). - Remove the curpriority global variable and use that of curproc. This was used to detect when a process' priority had lowered and it should yield. We now effectively yield on every interrupt. - Activate propogate_priority(). It should now have the desired effect without needing to also propogate the scheduling class. - Temporarily comment out the call to vm_page_zero_idle() in the idle loop. It interfered with propogate_priority() because the idle process needed to do a non-blocking acquire of Giant and then other processes would try to propogate their priority onto it. The idle process should not do anything except idle. vm_page_zero_idle() will return in the form of an idle priority kernel thread which is woken up at apprioriate times by the vm system. - Update struct kinfo_proc to the new priority interface. Deliberately change its size by adjusting the spare fields. It remained the same size, but the layout has changed, so userland processes that use it would parse the data incorrectly. The size constraint should really be changed to an arbitrary version number. Also add a debug.sizeof sysctl node for struct kinfo_proc.
* - Move struct ithd to sys/interrupt.h.jhb2001-02-091-85/+302
| | | | | | | | | | | | | | | - Add a set of MI helper functions for interrupt threads: - ithread_create() creates a new interrupt thread - ithread_destroy() destroys an interrupt thread - ithread_add_handler() attaches a new handler to an interrupt thread - ithread_remove_handler() detaches a handler from an interrupt thread - Rename sinthand_add() and sched_swi() to swi_add() and swi_sched() respectively so that they live in a consistent namespace. - struct intrhand is no longer a public type. It would be private to kern_intr.c but the current implementation of fast interrupts on the alpha requires the type to be exported. However, all handlers should be treated as void * cookies in the way that new-bus treats them. This includes references to software interrupt handlers.
* Change and clean the mutex lock interface.bmilekic2001-02-091-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Remove the static splXXX functions and replace them by static __inlinepeter2001-01-191-24/+0
| | | | | stubs. Remove the xxx_imask variables which have been all but gone for a while.
* Ignore a net interrupt if the corresponding handler is nottanimura2000-12-311-1/+4
| | | | | | | registered. This fixes panic on my laptop where a spurious arp packet is received when arp is not ready to run.
* Fix another sched_sihand -> sched_swi in a KTR trace message.jhb2000-12-181-1/+1
|
* Remove the last of the MD netisr code. It is now all MI. Removejake2000-12-051-0/+27
| | | | | | | | spending, which was unused now that all software interrupts have their own thread. Make the legacy schednetisr use an atomic op for setting bits in the netisr mask. Reviewed by: jhb
* Whitespace. Fix an overly long line.jake2000-12-041-2/+2
|
* - Protect the callout wheel with a separate spin mutex, callout_lock.jake2000-11-191-1/+1
| | | | | | | | | | | - Use the mutex in hardclock to ensure no races between it and softclock. - Make softclock be INTR_MPSAFE and provide a flag, CALLOUT_MPSAFE, which specifies that a callout handler does not need giant. There is still no way to set this flag when regstering a callout. Reviewed by: -smp@, jlemon
* - Replace some instances of sched_ithd with sched_swi in KTR tracepoints.jhb2000-11-151-2/+3
| | | | - Assert that Giant is not owned during the main loop of sithd_loop().
* Ignore the INTR_MPSAFE flag when calculating the priority of an interruptjhb2000-11-101-0/+1
| | | | thread.
* Minor nit: missed ithd_loop -> sithd_loop in the KTR tracepoints.jhb2000-11-071-1/+1
|
* - Overhaul the software interrupt code to use interrupt threads for eachjhb2000-10-251-225/+160
| | | | | | | | | | | | | | | | | | | 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
* - Heavyweight interrupt threads on the alpha for device I/O interrupts.jhb2000-10-051-17/+225
| | | | | | | | | | | - Make softinterrupts (SWI's) almost completely MI, and divorce them completely from the x86 hardware interrupt code. - The ihandlers array is now gone. Instead, there is a MI shandlers array that just contains SWI handlers. - Most of the former machine/ipl.h files have moved to a new sys/ipl.h. - Stub out all the spl*() functions on all architectures. Submitted by: dfr
* - Remove the inthand2_t type and use the equivalent driver_intr_t type fromjhb2000-09-131-0/+39
| | | | | | | | | | | | | newbus for referencing device interrupt handlers. - Move the 'struct intrec' type which describes interrupt sources into sys/interrupt.h instead of making it just be a x86 structure. - Don't create 'ithd' and 'intrec' typedefs, instead, just use 'struct ithd' and 'struct intrec' - Move the code to translate new-bus interrupt flags into an interrupt thread priority out of the x86 nexus code and into a MI ithread_priority() function in sys/kern/kern_intr.c. - Remove now-uneeded x86-specific headers from sys/dev/ata/ata-all.c and sys/pci/pci_compat.c.
* Trim unused options (or #ifdef for undoc options).peter1999-10-111-1/+0
| | | | Submitted by: phk
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Stage 1 of a cleanup of the i386 interrupt registration mechanism.peter1999-04-211-405/+1
| | | | | | | Interrupts under the new scheme are managed by the i386 nexus with the awareness of the resource manager. There is further room for optimizing the interfaces still. All the users of register_intr()/intr_create() should be gone, with the exception of pcic and i386/isa/clock.c.
* add #include <sys/kernel.h> where it's needed by MALLOC_DEFINE()peter1998-11-101-3/+3
|
* Start using the new SWI registration system instead of hardwiring everything.dfr1998-09-261-9/+13
|
* Implemented dynamic registration of software interrupt handlers. Notbde1998-08-111-6/+97
| | | | | | used yet. Use dummy SWI handlers to avoid some checks for null pointers.
* Cast pointers to uintptr_t/intptr_t instead of to u_long/long,bde1998-07-151-5/+5
| | | | | | | respectively. Most of the longs should probably have been u_longs, but this changes is just to prevent warnings about casts between pointers and integers of different sizes, not to fix poorly chosen types.
* Changed the type of an isa/general interrupt handler to take abde1998-06-181-3/+2
| | | | | | `void *' arg. Fixed or hid most of the resulting type mismatches. Handlers can now be updated locally (except for reworking their global declarations in isa_device.h).
* Only build this on i386 for now. I may use it for the alpha later butdfr1998-06-111-1/+10
| | | | currently it doesn't compile.
* This commit fixes various 64bit portability problems required fordfr1998-06-071-6/+6
| | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time.
* Really finish supporting compiling with `gcc -ansi'.bde1998-04-171-2/+2
|
* Move include of <machine/ipl.h> inside ifndef SMP where it is used, toeivind1998-02-101-3/+3
| | | | avoid getting 'unused include file' warnings in the SMP case.
* - Hide the 'device doesn't supported shared interrupts' code behindnate1997-10-061-4/+5
| | | | | | bootverbose, since the older register_intr() code didn't print out anything, and the laptop support will cause lots of these un-necessary messages.
* Added a half dozen casts to eliminate annoying warnings.fsmp1997-08-211-7/+7
|
* Moved splq() to isa/ipl_funcs.c for SMP only.fsmp1997-08-201-2/+4
| | | | This is in preperation for moving all cpl accesses behind a critical region lock.
* Removed unused #includes.bde1997-08-021-4/+1
|
* Back out changes for 'conflicts' with IRQ, remove intr_registered()ache1997-07-091-7/+1
|
* Add safety check in case "conflicts" keyword specified more times thanache1997-06-081-1/+7
| | | | needed
* The defines INTR_FAST and INTR_EXCL are part of the public interface. Thedfr1997-06-021-3/+1
| | | | previous commit made them private which broke things.
* Move interrupt handling code from isa.c to a new file. This should makedfr1997-06-021-3/+3
| | | | | | | isa.c (slightly) more portable and will make my life developing the really portable version much easier. Reviewed by: peter, fsmp
* Move "typedef struct intrec {} intrec" from sys/interrupt.h to kern_intr.cpeter1997-06-011-1/+14
| | | | | | since that's the only place that it's used. Submitted by: se (apparently on suggestion from dfr)
* <machine/spl.h> -> <machine/ipl.h>peter1997-05-311-10/+10
| | | | | | s/intrmask/intrmask_t/g Reviewed by: bde, se
* Fix problem reported by PHK: Panic in pcic probe because of NULL pointerse1997-05-281-12/+15
| | | | dereference (head->next in intr_disconnect).
* Add support for shared interrupts to the kernel. This code is meantse1997-05-261-0/+418
be (eventually) architecture independent. It provides an emulation of the ISA interrupt registration function register_intr(), but that function does no longer manipulated the interrupt controller and interrupt descriptor table, but calls the architecture dependent function setup_icu() for that purpose. After theISA/EISA bus code has been modified to directly call the new interrupt registartion functions (intr_create() and intr_connect()), the emulation of register_intr() should be dropped. The C level interrupt handler function should take a (void*) argument, and the function pointer type (inthand2_t) should defined in some other place than isa_device.h. This commit is a pre-requisite for the removal of the PCI specific shared interrupt code. Reviewed by: dfr,bde
OpenPOWER on IntegriCloud