Commit graph

24354 commits

Author SHA1 Message Date
John Baldwin 37ea3ced36 Reenable preemption on interrupts. My last commit accidentally reverted
it as I was playing with some other ways of doing kernel preemption.

You must still specify the PREEMPTION option in your config file to get a
preemptive kernel.
2001-02-10 02:46:50 +00:00
John Baldwin e990501c21 Re-enable preemption on interrupts. My last commit accidentally reverted
it as I was playing with some other ways of doing kernel preemption.
2001-02-10 02:41:50 +00:00
John Baldwin 142ba5f3d7 - Make astpending and need_resched process attributes rather than CPU
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.
2001-02-10 02:20:34 +00:00
John Baldwin e109e2b4cd Add a macro mtx_intr_enable() to alter a spin lock such that interrupts
will be enabled when it is released.
2001-02-10 02:15:18 +00:00
Luigi Rizzo 7e1cd0d23d Sync with the bridge/dummynet/ipfw code already tested in stable.
In ip_fw.[ch] change a couple of variable and field names to
avoid having types, variables and fields with the same name.
2001-02-10 00:10:18 +00:00
John Baldwin 16d92c70f1 Revert the spin mutex for the cy(4) driver.
Requested by:	bde
2001-02-09 22:37:24 +00:00
John Baldwin c75e5182ce Unify the two sleep lock order lists to enforce the process lock ->
uidinfo lock locking order.
2001-02-09 20:52:02 +00:00
John Baldwin c3a6f33758 Revert the previous revision for two reasons:
- I can't seem to reproduce the warning I got from WITNESS anymore.
- The fix was wrong.  Since a uidinfo struct is a member of proc, it
  makes sense for the locking order to be such that you are allowed to
  hold proc and then grab the uidinfo lock.
2001-02-09 20:51:11 +00:00
John Baldwin 1aa97cdea7 Work around some sizeof(long) != sizeof(int) bogons. 2001-02-09 19:02:39 +00:00
John Baldwin 5ee2dd82a9 Catch up to the new swi API. 2001-02-09 18:35:53 +00:00
John Baldwin 6221adac84 - Use a spin mutex instead of COM_LOCK, since COM_LOCK is going away.
The same name from the sio(4) driver was used and an appropriate
  dictionary item added at the top to reduce diffs.
- Catch up to the new swi API.
2001-02-09 17:55:32 +00:00
John Baldwin 522be16a94 Use the MI ithread helper functions in the alpha hardware interrupt code. 2001-02-09 17:53:23 +00:00
John Baldwin 5781f5419e Catch up to changes to inthand_add(). 2001-02-09 17:48:33 +00:00
John Baldwin 2e0c76cd20 Use the MI ithread helper functions in the x86 interrupt code. 2001-02-09 17:47:44 +00:00
John Baldwin 062d8ff5a0 - Catch up to the new swi API changes:
- Use swi_* function names.
  - Use void * to hold cookies to handlers instead of struct intrhand *.
- In sio.c, use 'driver_name' instead of "sio" as the name of the driver
  lock to minimize diffs with cy(4).
2001-02-09 17:46:35 +00:00
John Baldwin b4151f7101 - Move struct ithd to sys/interrupt.h.
- 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.
2001-02-09 17:42:43 +00:00
John Baldwin 3687f15b08 Add a new SYSINIT for interrupt thread initialization and stick
initialization right after it.
2001-02-09 17:38:19 +00:00
John Baldwin e761636a4b Axe INTR_HEAVY, INTR_LIGHT, and INTR_THREADED. Add in a INTR_TYPE_CLK
priorirty for clock interrupt handlers and an INTR_ENTROPY flag to mark
interrupt sources that are good sources of entropy.
2001-02-09 17:35:22 +00:00
John Baldwin 8ad802d82c Release the proc lock around crfree() and uifree() in wait1(). It leads to
a lock order violation, and since p is already a zombie at this point,
I'm not sure that we even need all the locking currently in wait1().
2001-02-09 16:43:18 +00:00
Joerg Wunsch a9623898b8 Unbreak EISA. The PCI-EISA bridge bus is named eisab', not isab'.
This mistake seems to have been benign until very recently, probably
until msmith's PCI code reshuffle which cleaned up a lot of things.

Still, my AIC7770 doesn't work again, but it at least probes the
EISA bus now.
2001-02-09 16:33:53 +00:00
John Baldwin 635962afdf Proc locking. 2001-02-09 16:27:41 +00:00
John Baldwin 929604ec9b Move the initailization of the proc lock for proc0 very early into the MD
startup code.
2001-02-09 16:25:16 +00:00
John Baldwin a91fe908db Woops, remove an obsolete reference to gd_cpu_lockid. 2001-02-09 16:13:57 +00:00
John Baldwin e910ba59fc - Change the 'witness_list' ddb command to 'show mutexes'. Note that this
will only display sleep mutexes held by the current process.
- Clean up some nits in the witness_display() function and add a ddb
  command 'show witness' that dumps the hierarchy and order lists to the
  console.
- Use queue(3) macros where appropriate.
- Resort the spin lock order list so that "com" is before "sched_lock".
  Also, add appropriate #ifdef's around SMP and i386-specific mutexes.
- Add two new mutexes used to protect the ithread lists and tables to the
  order list.

Requested by:	bde (1)
2001-02-09 15:19:41 +00:00
John Baldwin cd85c9e17c Change the ktr ddb commands to be show commands. The commands are now as
follows:
 - show ktr_first	display the first entry
 - show ktr_next	display the next entry
 - show ktr		display the entire buffer

The /v modifiers continue to work as described previously.

Requested by:	bde
2001-02-09 15:07:30 +00:00
John Baldwin 7ecfc090c0 - Point out that we don't lock anything during the idle setup because
only the boot processor should be running in the comments.
- Initialize curproc to point to each CPU's respective idleproc if their
  curproc is NULL.
- Keep track of the number of context switches performed by idleproc.
2001-02-09 14:59:43 +00:00
John Baldwin ec2e32b7fd Remove bogus #if 0'd code that dinked with the saved interrupt state in
sched_lock.
2001-02-09 14:50:52 +00:00
John Baldwin 40bcb55186 Remove unused forward_irq counters. 2001-02-09 14:30:03 +00:00
John Baldwin 7f918b0230 Axe gd_cpu_lockid as it is no longer used. 2001-02-09 14:25:22 +00:00
Ian Dowse 27d9bb4e44 Fix some problems that were introduced in revision 1.97. Instead
of returning an error code to the caller, NFS server op routines
must themselves build an error reply and return 0 to the caller.

This is achieved by replacing the erroneous return statements with
code that jumps forward to the op function's reply code. We need
to be careful to ensure that the 'struct mount' pointer is NULL
though, so that the final vn_finished_write() call becomes a no-op.

Reviewed by:	mckusick, dillon
2001-02-09 13:24:06 +00:00
Peter Wemm 05687ccaf2 Remove some leftovers. This is obviously unused, since the #defines
referred to members that no longer exist.
2001-02-09 08:26:26 +00:00
Peter Wemm 2bd5ac330f poll(2) array limits (take 2) - after some input from bde. 2001-02-09 08:10:22 +00:00
Bosko Milekic 9ed346bab0 Change and clean the mutex lock interface.
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)
2001-02-09 06:11:45 +00:00
Bill Paul c27eb220c2 Apply patch to add support for the intergrated ethernet in the SiS630E
chipset. The MAC address is stored in the APC CMOS RAM and we have to
commit trememdous evil in order to read it. The code to do this is only
activated on the i386 platform. Thanks to Cameron Grant for providing
access to a test box for me to tinker with.

This will fix the problem where the sis driver ends up with a station
address of 00:00:00:00:00:00 on boards that use the 630E chipset.
2001-02-09 00:45:29 +00:00
John Baldwin 1798caf635 Add includes of sys/malloc.h so this actually compiles.
Pointy-hat to:	asmodai
2001-02-09 00:16:41 +00:00
Luigi Rizzo b8987738cf Whoops... forgotten a few pieces in previous patch:
* a ">" is really ">=" ;
 * do not try to fetch zero-sized blocks from the card;
 * make sure that bpf gets the packets it wants even with
   bridging active;
2001-02-08 22:54:57 +00:00
Luigi Rizzo 338cdb139b Make sure that we do not accept packets shorter than a full ethernet
header, or we would have a negative length passed to ether_input().
2001-02-08 22:21:30 +00:00
Warner Losh 11c0c4ae55 Fix memory leaks with dev_get_children().
Submitted by: Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>
2001-02-08 22:14:27 +00:00
Søren Schmidt 32565eb8c5 Fix a memory leak.
Pointed out by: Asmodai
2001-02-08 21:59:27 +00:00
Jeroen Ruigrok van der Werven 4b91c22b12 Fix memoryleaks with device_get_children().
Approved by:	wpaul
2001-02-08 21:53:05 +00:00
Warner Losh 887e2e5d65 Fix memory leaks with dev_get_children().
Submitted by: Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>
2001-02-08 21:47:45 +00:00
Mike Smith 6c9eb5f3a6 Free the memory we get from devclass_get_devices and device_get_children.
Submitted by:	wpaul
2001-02-08 20:44:49 +00:00
Jeroen Ruigrok van der Werven 58d8a85e29 Fix typos: initalise -> initialise.
Initalise is not an english word.
2001-02-08 20:28:57 +00:00
Archie Cobbs cb24f323d0 When we receive an incoming Ethernet frame that was unicast to a
different hardware address, we should drop it (this should only
happen in promiscuous mode). Relocate the code for this check
from before ng_ether(4) processing to after ng_ether(4) processing.
Also fix a compiler warning.

PR:		kern/24465
2001-02-08 17:56:49 +00:00
Yoshihiro Takahashi 2992e4e37f Added pc98 supports. 2001-02-08 13:24:30 +00:00
Semen Ustimenko a66bd858ec Add recently added PHY drivers sources.
Reminded by: Peter Wemm <peter@netplex.com.au>
2001-02-08 04:58:17 +00:00
John Baldwin 5dbc7fe2d7 Don't bother with acquiring/releasing Giant around kmem_malloc() and
kmem_free() for now.  Kmem_malloc() and kmem_free() now have appropriate
assertions in place, and these checks aren't feasible until more of the
networking code is locked down.  Also, the extra assertions here should
already be caught by the WITNESS code as lock order violations should
mutex operations on Giant be reintroduced here later.
2001-02-08 00:27:38 +00:00
John Baldwin 297c46b68c Don't enable interrupts for a kernel breakpoint or trace trap. Otherwise,
this negates the explicit disabling of interrupts when entering the
debugger in Debugger().
2001-02-08 00:10:07 +00:00
John Baldwin 393c26a080 - Check if the ccb_infos in the softc is NULL before trying to free it in
adv_free() as the ISA probe routine doesn't malloc() ccb_infos but does
  call adv_free().
- Release the ISA-only overrun DMA tags, bufs, and maps if the probe fails.

Tested by:	rwatson
2001-02-08 00:00:12 +00:00
Peter Wemm 89b716473e The code I picked up from NetBSD in '97 had a nasty bug. It limited
the index of the pollfd array to the number of fd's currently open, not
the maximum number of fd's.  ie: if you had 0,1,2 open, you could not
use pollfd slots higher than 20.  The specs say we only have to support
OPEN_MAX [64] entries but we allow way more than that.
2001-02-07 23:28:01 +00:00