Commit Graph

43792 Commits

Author SHA1 Message Date
Peter Wemm
7b66b81ee4 Convert a couple of pointers to integers for source compatability with
amd64.
2003-11-14 22:23:30 +00:00
Peter Wemm
40e3826a9f Whitespace nit (sorry, couldn't help it) 2003-11-14 22:21:30 +00:00
Andre Oppermann
02c1c7070e Remove the global one-level rtcache variable and associated
complex locking and rework ip_rtaddr() to do its own rtlookup.
Adopt all its callers to this and make ip_output() callable
with NULL rt pointer.

Reviewed by:	sam (mentor)
2003-11-14 21:48:57 +00:00
Tom Rhodes
9365176c26 Fix a typo in a comment: sysctl(1) should be sysctl(8). 2003-11-14 21:37:35 +00:00
John Baldwin
3d9644ef0b Improve support for extended IRQ resources:
- For acpi_pci_link_entry_dump(), add a few helper functions to display
  the trigger mode, polarity, and sharemode of an individual IRQ resource.
  These functions are then called for both regular and extended IRQ
  resources.
- In acpi_pci_link_set_irq(), use the same type of IRQ resource
  (regular vs. extended) for the new current resource as the type of
  the resources from _PRS.
- When routing an interrupt don't ignore extended IRQ resources.  Also,
  use the same type of IRQ resource (regular vs. extended) for the new
  current resource when as the type of the resource from _PRS.

Tested by:	peter
2003-11-14 21:36:09 +00:00
Bruce Evans
57f253a4c6 Reduced prequisites by only using MALLOC_DECLARE() if it is defined.
This fixes a dependency of mac_label.c on namespace pollution in
<vm/uma.h>.

Similarly for SYSCTL_DECL() although I had no problems with it.  This
probably makes some includes of <sys/sysctl.h> bogus.
2003-11-14 21:18:04 +00:00
John Baldwin
64bb257f0b Always install IDT entries for ATPIC interrupt sources. The APIC no
longer uses these interrupt vectors for its ISA interrupt pins, so these
entries will not be overwritten.  If we get a spurious interrupt from the
ATPIC when using the APIC, it will be treated as a stray interrupt instead
of causing a panic.
2003-11-14 21:02:49 +00:00
Andre Oppermann
9188b4a169 Introduce ip_fastforward and remove ip_flow.
Short description of ip_fastforward:

 o adds full direct process-to-completion IPv4 forwarding code
 o handles ip fragmentation incl. hw support (ip_flow did not)
 o sends icmp needfrag to source if DF is set (ip_flow did not)
 o supports ipfw and ipfilter (ip_flow did not)
 o supports divert, ipfw fwd and ipfilter nat (ip_flow did not)
 o returns anything it can't handle back to normal ip_input

Enable with sysctl -w net.inet.ip.fastforwarding=1

Reviewed by:	sam (mentor)
2003-11-14 21:02:22 +00:00
Bruce Evans
f9d801d6f7 Include <sys/malloc.h> for the declaration of malloc(), etc. instead
of depending on namespace pollution 2 layers deep in <vm/uma.h>.  Fixed
most nearby include messes (another like this, several the opposite of
this, and some formatting).
2003-11-14 21:02:10 +00:00
John Baldwin
43d63d12fa If an interrupt source doesn't have an ithread, treat it as a stray
interrupt.  This can only happen if an unregistered interrupt source
triggers an interrupt.
2003-11-14 21:00:32 +00:00
Bruce M Simpson
f16770ae7e Fix a bug whereby the physical endpoints of a gre(4) tunnel would not
be printed, if the module were loaded into a kernel which had INET6 enabled.

The gre(4) driver does not use INET6, nor is it specified for IPv6. The
tunnel_status() function in ifconfig(8) is somewhat overzealous and assumes
that all tunnel interfaces speak KAME ifioctls.

This fix follows the path of least resistance, by teaching gre(4) about
the two KAME ifioctls concerned.

PR:	bin/56341
2003-11-14 20:58:00 +00:00
Alfred Perlstein
1bf8720450 University of Michigan's Citi NFSv4 kernel client code.
Submitted by: Jim Rees <rees@umich.edu>
2003-11-14 20:54:10 +00:00
Peter Wemm
db049820e1 basemem is in K, not bytes. I think I tricked jhb into making the same
mistake I did and then committing it to cvs.
2003-11-14 20:51:07 +00:00
Jake Burkholder
ea6e3dd2b3 Fix more spammage with local changes. Didn't look at the diffs before
committing.

Pointy hat to:	jake
2003-11-14 20:36:12 +00:00
Bruce Evans
4ef451dba3 Fixed some style bugs (English errors and poor wording in comments,
tab lossage, and missing comment on idempotency #endif).
2003-11-14 20:27:13 +00:00
Peter Wemm
2edfe38b10 "opt_auto_eoi.h" is not used here anymore. See atpic.c. 2003-11-14 20:06:24 +00:00
John Baldwin
f082493f10 Replace magic numbers with macros for i8259A register constants. Still
need the ICW4 bits for PC98 though.
2003-11-14 19:13:06 +00:00
John Baldwin
be06bd496f - Bring in constants for 8259A registers from amd64 with some updated
comments from NetBSD's dev/ic/i8259A.h.  These bits really belong in
  a file of the same name as well, but this will do for now.
- Axe unused HWI_MASK.
2003-11-14 19:12:25 +00:00
John Baldwin
3ab2ba59f4 Shuffle the APIC interrupt vectors around a bit:
- Move the IPI and local APIC interrupt vectors up into the 0xf0 - 0xff
  range.  The pmap lazyfix IPI was reordered down next to the TLB
  shootdowns to avoid conflicting with the spurious interrupt vector.
- Move the base of APIC interrupts up 16 so that the first 16 APIC
  interrupts do not overlap the vectors used by the ATPIC.
- Remove bogus interrupt vector reservations for LINT[01].
- Now that 0xc0 - 0xef are available, use them for device interrupts.
  This increases the number of APIC device interrupts to 191.
- Increase the system-wide number of global interrupts to 191 to catch up
  to more APIC interrupts.

Requested by:	peter (2)
2003-11-14 19:10:13 +00:00
Sam Leffler
5120abbfb4 Drop the driver lock around calls to if_input to avoid a LOR when
the packets are immediately returned for sending (e.g.  when bridging
or packet forwarding).  There are more efficient ways to do this
but for now use the least intrusive approach.

Reviewed by:	imp, rwatson
2003-11-14 19:00:32 +00:00
John Baldwin
274461c944 Fix a typo. We need opt_acpi.h not opt_apic.h for DEV_ACPI. 2003-11-14 19:00:02 +00:00
Olivier Houchard
1a29c80648 Better fix than my previous commit:
in exit1(), make sure the p_klist is empty after sending NOTE_EXIT.
The process won't report fork() or execve() and won't be able to handle
NOTE_SIGNAL knotes anyway.
This fixes some race conditions with do_tdsignal() calling knote() while
the process is exiting.

Reported by:	Stefan Farfeleder <stefan@fafoe.narf.at>
MFC after:	1 week
2003-11-14 18:49:01 +00:00
Bruce M Simpson
05b2efe044 Add a sysctl MIB, NET_RT_IFMALIST, to retrieve multicast group memberships
in a protocol-independent way.

Submitted by:	harti
2003-11-14 18:48:15 +00:00
Peter Wemm
3ef6155b2e Fix up the control word 3 bits. jhb discovered how much I screwed this
up. :-]
2003-11-14 18:20:20 +00:00
Hajimu UMEMOTO
979ed0d5e6 fix comments.
Obtained from:	KAME
2003-11-14 18:17:07 +00:00
Prafulla Deuskar
3c2ef4e7e2 - Code cleanup
- In the receive routine handle the case where last descriptor could have
  less than 4 bytes of data.
- Handle race between detach/ioctl routine.

MFC after:	3 days
2003-11-14 18:02:25 +00:00
Alan Cox
d1f42ac2ee - Remove use of Giant from uma_zone_set_obj(). 2003-11-14 17:49:07 +00:00
David E. O'Brien
4dc52c32bf Remove duplicate FBSDID's, move others to their right place. 2003-11-14 17:16:58 +00:00
John Baldwin
09f8eb4049 Add a WITNESS_WARN() check to _STOPEVENT() since any _STOPEVENT() can
potentially sleep.  This should help find some bogus locking.
2003-11-14 16:27:17 +00:00
Brian Feldman
8fa793d0fe Include opt_global.h in the modules build, when building from a normal
kernel build.  This makes it possible for me not to get pissed off that
random.ko crashes the system trying to rdtsc() when the i386/cpu.h
support code decides it's okay to call that op when neither I386_CPU or
I486_CPU is defined.  I guess it also makes WITNESS/INVARIANTS defines
get picked up by the modules.
2003-11-14 16:04:11 +00:00
Hidetoshi Shimokawa
79acdabb11 Add sbp_targ(4). 2003-11-14 11:54:49 +00:00
Johan Karlsson
33a3109794 Remove duplicate
#include <sys/cdefs.h>
__FBSDID(...);

Leave the one matching the other files in this directory.
2003-11-14 11:09:45 +00:00
David Schultz
95eac68fea - A sanity check in unionfs verifies that lookups of '.' return the
vnode of the parent.  However, this check should not be performed if
  the lookup failed.  This change should fix "union_lookup returning
  . not same as startdir" panics people were seeing.  The bug was
  introduced by an incomplete import of a NetBSD delta in rev 1.38.
- Move the aforementioned check out from DIAGNOSTIC.  Performance
  is the least of our unionfs worries.
- Minor reorganization.

PR:		53004
MFC after:	1 week
2003-11-14 08:23:13 +00:00
Alan Cox
6f8b4fc03a - Remove long dead code. 2003-11-14 08:22:38 +00:00
Alan Cox
b7b7cd4421 Changes to msync(2)
- Return EBUSY if the region was wired by mlock(2) and MS_INVALIDATE
   is specified to msync(2).  This is required by the Open Group Base
   Specifications Issue 6.
 - vm_map_sync() doesn't return KERN_FAILURE.  Thus, msync(2) can't
   possibly return EIO.
 - The second major loop in vm_map_sync() handles sub maps.  Thus,
   failing on sub maps in the first major loop isn't necessary.
2003-11-14 06:55:11 +00:00
Warner Losh
01f5b32809 Despam the const poisoning
Despam the u_->u change
2003-11-14 06:02:51 +00:00
Warner Losh
3373489b49 reconst poison
re-de u_intXX_t
2003-11-14 05:45:39 +00:00
Warner Losh
55e8a70c67 Reconst-poison crc routine that was renamed to mchash.
re-remove the _ in u_intXX_t
2003-11-14 05:37:36 +00:00
Jake Burkholder
6f9e4d866d Rev 1.61 accidentily added makeoptions NO_MODULES=yes. Funny that I add this
to all my kernel configs.

Submitted by:	Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
2003-11-14 05:31:50 +00:00
Alexander Kabaev
3b39740df8 Fix a number of style(9) bugs introduced in r1.113 by me.
Suggested by:	bde
2003-11-14 05:27:41 +00:00
Matt Jacob
1484f178c4 fix broken _IOR usage 2003-11-14 05:13:00 +00:00
Jeff Roberson
700249c287 - Drop the process lock before we call into ptrace_{read|write}_int or
any functions that call them.  Calling proc_rwmem() with the proc lock
   held is not safe.  Currently, we're protected from any races by Giant.
   Eventually proc_rwmem() should require the proc lock and not Giant.
2003-11-14 04:04:14 +00:00
Jeff Roberson
808674fd0e - regen. 2003-11-14 03:49:41 +00:00
Jeff Roberson
5c49a0566a - Revision 1.156 marked ptrace() SMP safe. Unfortunately, alpha implements
parts of ptrace using proc_rwmem().  proc_rwmem() requires giant, and
   giant must be acquired prior to the proc lock, so ptrace must require giant
   still.
2003-11-14 03:48:37 +00:00
Maksim Yevmenkin
f21fff6cf2 Change double include protection style in headers to match
the rest of Netgraph code.

Reviewed by: imp, ru
Approved by: imp (mentor)
2003-11-14 03:45:29 +00:00
David E. O'Brien
aa8255025a Try to create some sort of consistency in how the routings to find the
multicast hash are written.  There are still two distinct algorithms used,
and there actually isn't any reason each driver should have its own copy
of this function as they could all share one copy of it (if it grew an
additional argument).
2003-11-13 20:55:53 +00:00
David E. O'Brien
3b1c7064a3 It is obivous this started out as a copy of a Bill Paul driver so he has
a copyright on this driver as well.  Bill uses a 4-clause BSDL, so we need
to add a complete copy of Bill's copyright.
2003-11-13 19:54:37 +00:00
John Baldwin
dced4b0c31 Whitespace. 2003-11-13 18:16:37 +00:00
John Baldwin
69487322d8 Fix a typo. 2003-11-13 16:41:07 +00:00
Hartmut Brandt
835ab74093 Make the defines that prevent multiple includes look like the
others in netgraph.
2003-11-13 13:00:56 +00:00
Hajimu UMEMOTO
313ab6b4d5 add sysctl MIB net.key.esp_auth which was wrongly dropped
during recent KAME merge.
2003-11-13 12:26:55 +00:00
Poul-Henning Kamp
555a5de270 Various minor details:
Give the HZ/overflow check a 10% margin.
	Eliminate bogus newline.
	If timecounters have equal quality, prefer higher frequency.

Some inspiration from:	bde
2003-11-13 10:03:58 +00:00
Poul-Henning Kamp
daf9092bcd Don't disable the TSC with statclock_disable. 2003-11-13 10:02:12 +00:00
Poul-Henning Kamp
98d87dfecd Initialize b_iooffset correctly. 2003-11-13 09:58:09 +00:00
Jeff Roberson
08569709d1 - Unlock the clock lock before calling timeout in sysbeep(). This is almost
the same code that i386/isa/clock.c uses.
2003-11-13 09:24:21 +00:00
Hidetoshi Shimokawa
3055726d16 Respect RB_KDB flag. 2003-11-13 07:41:55 +00:00
Hidetoshi Shimokawa
86224a5746 Add tunables. 2003-11-13 06:29:40 +00:00
Sam Leffler
85643802a4 Don't count PHY errors as input errors. This is important for
5212-based devices because PHY errors are used to collect data
on environmental noise that and doesn't truly reflect the state
of the communications media.  The result is confused users.
Folks that want to watch PHY errors can still get the statistics
through the device ioctl (used by athstats).
2003-11-13 05:35:07 +00:00
Sam Leffler
93685685f4 o insure the current channel is in a good state before starting an AP scan
o reject scan requests for a device that isn't marked up

This fixes a problem where requesting a scan before marking the device
up would cause a panic because the current channel was set to "any" (0xffff).
2003-11-13 05:23:58 +00:00
Sam Leffler
f7bbe2c0f1 add missing inpcb lock before call to tcp_twclose (which reclaims the inpcb)
Supported by:	FreeBSD Foundation
2003-11-13 05:18:23 +00:00
Sam Leffler
1b73ca0bf1 o reorder some locking asserts to reflect the order of the locks
o correct a read-lock assert in in_pcblookup_local that should be
  a write-lock assert (since time wait close cleanups may alter state)

Supported by:	FreeBSD Foundation
2003-11-13 05:16:56 +00:00
Warner Losh
bf1e599dc1 Save the device so we can do a device_printf.
Use this in preference to aha_name.
Remove aha_name function and #define it to device_get_unitname()
Minor indentation tweaks resulting therefrom
2003-11-13 04:14:53 +00:00
Alan Cox
c78b8dfacf Call free(9) after the vnode interlock is released, avoiding a lock-order
reversal.
2003-11-13 03:56:32 +00:00
Peter Wemm
e46fe241d3 Stop pretending to support kernel profiling. The FAKE_MCOUNT() etc
calls are just gradually getting more and more stale.  At this point it
would be better to start from scratch once prof_machdep.c is adapted.
2003-11-13 02:38:33 +00:00
Jeff Roberson
8865448db0 - Add the WITNESS_SKIPSPIN option to the GENERIC kernel so that users who
enable WITNESS on alphas will not get the expensive spin lock checking by
   default.  This mirrors the default config settings for i386.
2003-11-13 02:04:34 +00:00
Andre Oppermann
16d6c90f5d Move global variables for icmp_input() to its stack. With SMP or
preemption two CPUs can be in the same function at the same time
and clobber each others variables.  Remove register declaration
from local variables.

Reviewed by:	sam (mentor)
2003-11-13 00:32:13 +00:00
John Baldwin
79a13d0182 - Close a race where a thread on another CPU could release a contested lock
and empty its turnstile while the blocking threads still pointed to the
  turnstile.  If the thread on the first CPU blocked on a lock owned by
  one of the threads blocked on the turnstile just woken up, then the
  first CPU could try to manipulate a bogus thread queue in the turnstile
  during priority propagation.
- Update locking notes for ts_owner and always clear ts_owner, not just
  under INVARIANTS.

Tested by:      sam (1)
2003-11-12 23:48:42 +00:00
Andre Oppermann
2683ceb661 Do not fragment a packet with hardware assistance if it has the DF
bit set.

Reviewed by:	sam (mentor)
2003-11-12 23:35:40 +00:00
Wilko Bulte
dafa835522 Add vendor ID to make Marvell chipset work. E.g. to be found
on SMC9452TX it seems

Submitted by: Jung-uk Kim <jkim@niksun.com>
Tested by: <Radu Bogdan 'veedee' Rusu> veedee@c7.campus.utcluj.ro
MFC after: 2 weeks
2003-11-12 23:01:15 +00:00
Kirk McKusick
48b0f4b67d At the request of several developers, restore the DIAGNOSIC code
deleted in 1.81. Increase the initial timeout limit to 2ms to
eliminate spurious messages of excessive timeouts in the NFS
client code.

Requested by:	Poul-Henning Kamp <phk@phk.freebsd.dk>
Requested by:	Mike Silbersack <silby@silby.com>
Requested by:	Sam Leffler <sam@errno.com>
2003-11-12 22:28:27 +00:00
Robert Watson
f0ab044241 Mark __mac_get_pid() as MPSAFE in the comment, as it runs without
Giant and is also MPSAFE.

Push Giant further down into __mac_get_fd() and __mac_set_fd(),
grabbing it only for constrained regions dealing with VFS, and
dropping it entirely for operations related to labeling of pipes.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-12 22:19:15 +00:00
Hajimu UMEMOTO
f4dec803c9 reflect ip6_pktopts and ip6_moptions into embeded scope of
destination address.  it makes `ping6 -I <if> <link-local>'
work again.  since we don't merge scope cleanup yet, we need
this for workaround.
2003-11-12 21:39:12 +00:00
Eric Anholt
81dc97109d Update from DRI CVS. Includes locking fixes (including PR 59202), changes for
Radeon IGP support (still lacking PCI IDs), and DRM interface 1.2 updates which
include finally tying the DRM instances to specific devices rather than relying
on the X Server.
2003-11-12 20:56:30 +00:00
Bruce M Simpson
83453a06de Add a new sysctl knob, net.inet.udp.strict_mcast_mship, to the udp_input path.
This switch toggles between strict multicast delivery, and traditional
multicast delivery.

The traditional (default) behaviour is to deliver multicast datagrams to all
sockets which are members of that group, regardless of the network interface
where the datagrams were received.

The strict behaviour is to deliver multicast datagrams received on a
particular interface only to sockets whose membership is bound to that
interface.

Note that as a matter of course, multicast consumers specifying INADDR_ANY
for their interface get joined on the interface where the default route
happens to be bound. This switch has no effect if the interface which the
consumer specifies for IP_ADD_MEMBERSHIP is not UP and RUNNING.

The original patch has been cleaned up somewhat from that submitted. It has
been tested on a multihomed machine with multiple QuickTime RTP streams
running over the local switch, which doesn't do IGMP snooping.

PR:		kern/58359
Submitted by:	William A. Carrel
Reviewed by:	rwatson
MFC after:	1 week
2003-11-12 20:17:11 +00:00
John Baldwin
68cb89dc06 Fix some typos. 2003-11-12 19:46:17 +00:00
Andre Oppermann
122aad88d5 dropwithreset is not needed in this case as tcp_drop() is already notifying
the other side. Before we were sending two RST packets.
2003-11-12 19:38:01 +00:00
John Baldwin
0926d72773 Garbage collect unused values. 2003-11-12 18:14:34 +00:00
John Baldwin
bd9cd7e3f7 - Move manipulation of td_intr_nesting_level out of assembly interrupt
vector stubs and into the C functions they call.
- Move disabling and EOIing of interrupt sources out of PIC driver entry
  points and into intr_execute_handlers().  Intr_execute_handlers() only
  disables a source for an interrupt if it is a stray interrupt or has
  threaded handlers.  Sources with fast handlers no longer disable (mask)
  the source while executing the handlers.
- Move the setting of clkintr_pending into intr_execute_handlers() and set
  the variable for any interrupt source with a vector of 0.  (Should only
  be true for IRQ 0.)  This fixes clkintr_pending in the NO_MIXED_MODE
  case.
- Implement lapic_eoi() and use it to implement ioapic_eoi_source().
- Rename atpic_sched_ithd() to atpic_handle_intr() since it is used to
  handle all atpic interrupts and not just threaded ones.

Inspired by:	peter's changes to amd64 in p4 (1)
Requested by:	bde (2)
2003-11-12 18:13:57 +00:00
John Baldwin
e5bc4f1b34 Remove extraneous & to fix compile. 2003-11-12 17:21:57 +00:00
Peter Wemm
cde6302bf0 MNAMELEN is back to an int again after Kirk's statfs commit
kern/vfs_mount.c:1305: warning: signed size_t format, different type arg (arg 4)
*** Error code 1
2003-11-12 17:09:12 +00:00
Hartmut Brandt
67371b0f5c Bump the netgraph header version to 6 for the change of the name
length definitions.

Reminded by: jdp
2003-11-12 17:03:40 +00:00
John Baldwin
284739a942 Reindent to non-style(9) compliant 4 space indent to match rest of file. 2003-11-12 16:24:16 +00:00
John Baldwin
07f0d09e81 Add an ACPI_FUNCTION_TRACE() invocation to acpi_OverrideInterruptLevel()
to fix compile with ACPI_DEBUG.

Reported by:	tinderbox
2003-11-12 16:23:21 +00:00
Robert Watson
4af32bd8a0 Remove extraneous fullpath variable, which broke lint build. This
extra argument to the devfs MAC policy entry points was accidentally
merged from the MAC branch during my earlier commit to these policies,
and is not scheduled to be merged just yet.
2003-11-12 15:09:39 +00:00
Bruce Evans
26a02c145c Fixed some style bugs (insertion sort error and extra blank line). 2003-11-12 15:07:18 +00:00
John Baldwin
861a7db56f Fix a typo in a comment.
Submitted by:	das
2003-11-12 14:55:45 +00:00
Ruslan Ermilov
26f9b263ae - vlan_start(): Increment the correct interface statistics member.
Reviewed by:	mdodd

- vlan_input(): Macroize the VLAN tag extraction from mbuf.
2003-11-12 12:58:19 +00:00
Poul-Henning Kamp
1415a09d42 Replace B_PHYS conditional assignment to bio_offset with KASSERT check
to see that the originating code already did it right.
2003-11-12 10:27:06 +00:00
Poul-Henning Kamp
2178f0e340 Don't mess around with spare fields of public structures. 2003-11-12 09:54:07 +00:00
Poul-Henning Kamp
1054ba63be Don't mess about with spare fields in public structures. 2003-11-12 09:52:10 +00:00
Poul-Henning Kamp
c12ec49eda Make sure to return errors if we have any.
Submitted by:    Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2003-11-12 09:46:54 +00:00
Hartmut Brandt
387ebc6d63 Double length of node names, hook names, command strings and types. Add
defines for these constants that include the trailing NUL byte. These
new constants have SIZ in their name instead of LEN. As soon as all
consumers in the tree are converted to use the new defines the old
defines will be put under BURN_BRIDGES.

Reviewed by:	archie, julian, ru
Approved by:	re (in principle)
2003-11-12 09:10:11 +00:00
Kirk McKusick
1977597b34 Update the five files derived from /sys/kern/syscalls.master
after the additions made for the new statfs structure (version
1.157). These must be updated in a separate checkin after
syscalls.master has been checked in so that they reflect its
new CVS identity. As these are purely derived files, it is not
clear to me why they are under CVS at all. I presume that it has
something to do with having `make world' operate properly.
2003-11-12 08:09:19 +00:00
Kirk McKusick
fde81c7d8e Update the statfs structure with 64-bit fields to allow
accurate reporting of multi-terabyte filesystem sizes.

You should build and boot a new kernel BEFORE doing a `make world'
as the new kernel will know about binaries using the old statfs
structure, but an old kernel will not know about the new system
calls that support the new statfs structure. Running an old kernel
after a `make world' will cause programs such as `df' that do a
statfs system call to fail with a bad system call.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Tim Robbins <tjr@freebsd.org>
Reviewed by:	Julian Elischer <julian@elischer.org>
Reviewed by:	the hoards of <arch@freebsd.org>
Sponsored by:   DARPA & NAI Labs.
2003-11-12 08:01:40 +00:00
Warner Losh
da01fc7a4a Minor diff reduction with p4 2003-11-12 05:44:44 +00:00
Warner Losh
a66f2afd1a Fix a harmless typo (use of res instead of rle: if rle is NULL, we'd
still get a panic, just not a nice message) and update to new
__FBSDID.

Submitted by: charnier@
2003-11-12 05:21:06 +00:00
Hajimu UMEMOTO
543729cf93 avoid module name conflict with opencrypto/rijndael.c.
Reported by:	tinderbox
2003-11-12 04:22:37 +00:00
Hidetoshi Shimokawa
39b2899f54 Improve debug message. 2003-11-12 04:06:21 +00:00
Hidetoshi Shimokawa
4a4bfb088e - Reserve a ocb for management ORB.
- Requeue XPT_SCSI_IO if ocb is short.
2003-11-12 03:45:10 +00:00
Robert Watson
39fc5d480d GC prototype for mac_destroy_vnode_label(), missed in last commit. 2003-11-12 03:33:43 +00:00
Hidetoshi Shimokawa
5414e3cfad Oops, fix typo in my name. 2003-11-12 03:29:57 +00:00
Marcel Moolenaar
eea3bbdff8 Remove ia64_highfp_load() now that it's unused. 2003-11-12 03:24:34 +00:00
Robert Watson
eca8a663d4 Modify the MAC Framework so that instead of embedding a (struct label)
in various kernel objects to represent security data, we embed a
(struct label *) pointer, which now references labels allocated using
a UMA zone (mac_label.c).  This allows the size and shape of struct
label to be varied without changing the size and shape of these kernel
objects, which become part of the frozen ABI with 5-STABLE.  This opens
the door for boot-time selection of the number of label slots, and hence
changes to the bound on the number of simultaneous labeled policies
at boot-time instead of compile-time.  This also makes it easier to
embed label references in new objects as required for locking/caching
with fine-grained network stack locking, such as inpcb structures.

This change also moves us further in the direction of hiding the
structure of kernel objects from MAC policy modules, not to mention
dramatically reducing the number of '&' symbols appearing in both the
MAC Framework and MAC policy modules, and improving readability.

While this results in minimal performance change with MAC enabled, it
will observably shrink the size of a number of critical kernel data
structures for the !MAC case, and should have a small (but measurable)
performance benefit (i.e., struct vnode, struct socket) do to memory
conservation and reduced cost of zeroing memory.

NOTE: Users of MAC must recompile their kernel and all MAC modules as a
result of this change.  Because this is an API change, third party
MAC modules will also need to be updated to make less use of the '&'
symbol.

Suggestions from:	bmilekic
Obtained from:		TrustedBSD Project
Sponsored by:		DARPA, Network Associates Laboratories
2003-11-12 03:14:31 +00:00
Alexander Kabaev
5c957adbf1 1. Consolidate mount struct allocation/destruction into a common code in
vfs_mount_alloc/vfs_mount_destroy functions and take care to completely
destroy the mount point along with its locks. Mount struct has grown in
coplexity recently and depending on each failure path to destroy it
completely isn't working anymore.

2. Eliminate largely identical vfs_mount and vfs_unmount question by
moving the code to handle both cases into a newly introduced vfs_domount
function.

3. Simplify nfs_mount_diskless to always expect an allocated mount
struct and never attempt an allocation/destruction itself. The
vfs_allocroot allocation was there to support 'magic' swap space
configuration for diskless clients that was already removed by PHK some
time ago.

4. Include a vfs_buildopts cleanups by Peter Edwards to validate the
sanity of nmount parameters passed from userland.

Submitted by:  (4) Peter Edwards <peter.edwards@openet-telecom.com>
Reviewed by:    rwatson
2003-11-12 02:54:47 +00:00
Peter Wemm
b79c9c6c58 Cosmetic sync with i386 2003-11-12 01:49:49 +00:00
Josef Karthauser
447f52c8b4 Remove a gremlin so that this code compiles under -stable without
a "syntax error before `struct'" error.
2003-11-12 01:40:11 +00:00
Marcel Moolenaar
0d9ae4e24e Further work-out the handling of the high FP registers. The most
important change is in cpu_switch() where we disable the high FP
registers for the thread that we switch-out if the CPU currently
has its high FP registers. This avoids that the high FP registers
remain enabled for the thread even when the CPU has unloaded them
or the thread migrated to another processor.
Likewise, when we switch-in a thread of that has its high FP
registers on the CPU, we enable them. This avoids an otherwise
harmless, but unnecessary trap to have them enabled.

The code that handles the disabled high FP trap (in trap()) has
been turned into a critical section for the most part to avoid
being preempted. If there's a race, we bail out and have the
processor trap again if necessary.

Avoid using the generic ia64_highfp_save() function when the
context is predictable. The function adds unnecessary overhead.
Don't use ia64_highfp_load() for the same reason. The function
is now unused and can be removed.

These changes make the lazy context switching of the high FP
registers in an UP kernel functional.
2003-11-12 01:26:02 +00:00
John Baldwin
efd21294ab Oh dear, forgot this file in the turnstile commit. This header defines
the turnstile API and includes several comments.

Reminded by:	peter
2003-11-11 23:08:26 +00:00
Jun Kuriyama
94ed763dee Add ID for ALC658 CODEC.
Tested on:	GIGABYTE GA-8S655FX-L
Reviewed by:	orion
2003-11-11 22:15:17 +00:00
John Baldwin
961a7b244d Add an implementation of turnstiles and change the sleep mutex code to use
turnstiles to implement blocking isntead of implementing a thread queue
directly.  These turnstiles are somewhat similar to those used in Solaris 7
as described in Solaris Internals but are also different.

Turnstiles do not come out of a fixed-sized pool.  Rather, each thread is
assigned a turnstile when it is created that it frees when it is destroyed.
When a thread blocks on a lock, it donates its turnstile to that lock to
serve as queue of blocked threads.  The queue associated with a given lock
is found by a lookup in a simple hash table.  The turnstile itself is
protected by a lock associated with its entry in the hash table.  This
means that sched_lock is no longer needed to contest on a mutex.  Instead,
sched_lock is only used when manipulating run queues or thread priorities.
Turnstiles also implement priority propagation inherently.

Currently turnstiles only support mutexes.  Eventually, however, turnstiles
may grow two queue's to support a non-sleepable reader/writer lock
implementation.  For more details, see the comments in sys/turnstile.h and
kern/subr_turnstile.c.

The two primary advantages from the turnstile code include: 1) the size
of struct mutex shrinks by four pointers as it no longer stores the
thread queue linkages directly, and 2) less contention on sched_lock in
SMP systems including the ability for multiple CPUs to contend on different
locks simultaneously (not that this last detail is necessarily that much of
a big win).  Note that 1) means that this commit is a kernel ABI breaker,
so don't mix old modules with a new kernel and vice versa.

Tested on:	i386 SMP, sparc64 SMP, alpha SMP
2003-11-11 22:07:29 +00:00
Eric Anholt
a6cb9d8e99 - Disable AGP on ALI chipsets if aperture size is 0.
- Fail in agp_alloc_gatt if the aperture size is 0 instead of panicing in
  contigmalloc.

Reported by:	Bjoern Fischer <bfischer@Techfak.Uni-Bielefeld.DE>
Reviewed by:	jhb
MFC after:	1 week
2003-11-11 21:49:18 +00:00
Robert Watson
599bcd064c Following the repo-copy from src/sys/modules/mac_none/Makefile,
I neglected to update the filenames/etc in mac_stub.  Do so now.
2003-11-11 21:23:54 +00:00
John Baldwin
fd7d14d30b Don't probe busses in the MP Table for the MP Table PCI bridge drivers
if the bus number doesn't correspond to a PCI bus in the MP Table.

Reported by:	jhay
2003-11-11 21:19:43 +00:00
Hajimu UMEMOTO
34d78ec3f1 cleanup rijndael API.
since there are naming conflicts with opencrypto, #define was
added to rename functions intend to avoid conflicts.

Obtained from:	KAME
2003-11-11 18:58:54 +00:00
John Baldwin
d3c01334ce Some motherboards like to remap the SCI (normally IRQ 9) up to a PCI
interrupt such as IRQ 22 or 19.  However, the ACPI BIOS still routes
interrupts from some PCI devices to the same intpin calling the pin
IRQ 22.  Thus, ACPI expects to address a single interrupt source via two
different names.  To work around this, if the SCI is remapped to a non-ISA
interrupt (i.e., greater than 15), then we use
acpi_OverrideInterruptLevel() function to tell ACPI to use IRQ 22 or 19
rather than IRQ 9 for the SCI.

Previously we would change IRQ 22 or 19's name to IRQ 9 when we encountered
such an Interrupt Source Override entry in the MADT which routed the SCI
properly but left PCI devices mapped to IRQ 22 or 19 w/o a routable
interrupt.

Tested by:	sos
2003-11-11 18:20:10 +00:00
Sam Leffler
a0bf1601a7 correct typos
Pointed out by:	Mike Silbersack
2003-11-11 18:16:54 +00:00
John Baldwin
801cc576ec Add an acpi_OverrideInterruptLevel() method that OSPM can use to override
the InterruptLevel used for the SCI.
2003-11-11 18:12:12 +00:00
Jake Burkholder
81163455ce Set RB_SERIAL in boothowto if the firmware output-device is ttya or ttyb.
This ensures that uart gets a higher console priority than syscons when
a serial console is being used.  Testing against the "console" environment
variable doesn't make sense since we only have one loader console driver.
2003-11-11 18:01:44 +00:00
Mike Silbersack
20880eabe9 Remove the m_defrag call from if_loop; testing with m_fragment
has shown that the IPv6 stack can clearly handle fragmented
mbuf chains without a problem.

MFC after:	1 week
2003-11-11 17:58:36 +00:00
Sam Leffler
0f9bd73b71 o add locking
o mark isr MPSAFE

Supported by:	FreeBSD Foundation
2003-11-11 17:57:03 +00:00
Sam Leffler
3d0b255a9a o add missing inpcb locking in tcp_respond
o replace spl's with lock assertions

Supported by:	FreeBSD Foundation
2003-11-11 17:54:47 +00:00
Hajimu UMEMOTO
331bf4e6f7 ipsec_esp_auth is unused when IPSEC_ESP is not defined.
Reported by:	Andre Oppermann <oppermann@pipeline.ch>
2003-11-11 17:25:45 +00:00
John Baldwin
da17811e64 Enable HTT CPUs by default instead of halting them by default. Users
should now only have HTT CPUs if they have explicitly asked for them
either by enabling HyperThreading in the BIOS or by using the
MPTABLE_FORCE_HTT kernel option.
2003-11-11 17:16:15 +00:00
John Baldwin
f9dbba5c4e Disable probing of HTT CPUs by default for the MP Table case. HTT CPUs
should only be used if they are enabled in the BIOS.  Now that we support
enumerating CPUs using the ACPI MADT, any HTT machine using ACPI should
respect the BIOS setting.  For HTT machines with ACPI disabled in the
kernel, the MPTABLE_FORCE_HTT kernel option can be used to try to probe HTT
CPUs like have done in the past for the MP Table case.  This option should
only be enabled if HTT is enabled in the BIOS.
2003-11-11 17:14:26 +00:00
Ruslan Ermilov
80476bacd8 MFS: Change interface name from "nge" to "ngeth" to avoid conflict
with nge(4).
2003-11-11 16:12:05 +00:00
John Baldwin
d1ccde5545 - Remove empty rogue SMP hardware section.
- Add some additional comments about 'device apic' to note that it can be
  used in both UP and SMP kernels but is required for SMP kernels.
2003-11-11 15:52:31 +00:00
John Baldwin
7e42a90bf6 Use the same style of paragraph indention that the rest of NOTES uses in
the SMP section.
2003-11-11 15:49:37 +00:00
John Baldwin
20694d64a2 Axe rotted comment about MP Tables and PCI cards with built in bridges.
Now that we properly route PCI interrupts for the apic case, these cards
are no longer a problem.
2003-11-11 15:47:44 +00:00
Søren Schmidt
1bebf0fbc9 Centralise mode setting. Instead of doing it in all subdrivers, do
it in ata-all.c where it belongs.

Prime controller HW by always setting PIO mode first in attach.
2003-11-11 14:55:36 +00:00
Ruslan Ermilov
e20480bfb6 Use a single style of multiple inclusion protection for Netgraph headers.
Reviewed by:	archie, harti, emax
2003-11-11 12:30:37 +00:00
Marcel Moolenaar
a5ba2b5cc4 Save and restore the high FP registers in {g|s}_mcontext(). Note
that we currently do not keep track of whether the thread has
actually used the high FP registers before. If not, we should
not save them in the context which automaticly means that we
also would not restore them from the context. For now, do it
unconditionally so that we can reach functional completeness.
2003-11-11 09:53:37 +00:00
Marcel Moolenaar
9d52656a5a Fix a nasty bug that got exposed when the sendsig() and sigreturn()
functions switched to using {g|s}et_mcontext(). The problem is that
sigreturn(), being a syscall, can be given an async. context (i.e.
one corresponding to an interrupt or trap). When this happens, we
try to return to user mode via epc_syscall_return with a trapframe
that can only be used to return to user mode via exception_restore.

To fix this, we check the frame's flags immediately prior to
epc_syscall_return and branch to exception_restore for non-syscall
frames. Modify the assertion in set_mcontext() to check that if
there's a mismatch, it's because of sigreturn().
2003-11-11 09:25:19 +00:00
Joseph Koshy
a5896914f0 Bound the number of iterations a thread can perform inside
ktr_resize_pool(); this eliminates a potential livelock.

Return ENOSPC only if we encountered an out-of-memory condition when
trying to increase the pool size.

Reviewed by:	jhb, bde (style)
2003-11-11 09:09:26 +00:00
Søren Schmidt
b25f2bc835 Update the dump code to flush buffers at the end of the dump
to avoid loosing evt cached data.
2003-11-11 07:49:45 +00:00
Jake Burkholder
cabf3c5279 Remove reference to sio (superseded by uart). 2003-11-11 07:49:13 +00:00
Jake Burkholder
858866e77c Add entries for creator, splash, uart and puc, commented out until they're
made the default.  These are needed to run X.
2003-11-11 07:48:02 +00:00
Jake Burkholder
9c91425b10 Remove references to atkbd, atkbdc, psm and vga. 2003-11-11 07:40:45 +00:00
Jake Burkholder
036913d1be Fix a typo. Allow for the creator not being stdout. 2003-11-11 07:34:08 +00:00
Jake Burkholder
d2f154c95e Add a uart attachment/syscons keyboard driver for sun keyboards. In theory
this will work with any uart backend, currently supported hardware uses
either ns8250 or z8530.
2003-11-11 07:33:24 +00:00
Jake Burkholder
d8c43e4c41 Allow uart to attach to keyboards that are not the firmware's notion of
stdin, such as when using a serial console.  We must recognize these
devices here so that we can override the tty attach routine.
2003-11-11 06:52:04 +00:00
Jake Burkholder
7b9346ced8 Assume that unit 0 is the graphics console initialized by syscons, instead
of testing if the device's firmware node is stdout.  This allows syscons to
be used when the firmware's input and output is the serial console.
2003-11-11 06:47:00 +00:00
Jake Burkholder
0019917542 Fix a bug in the data access error recorvery. Before re-enabling the data
cache after a data access error we must discard all cache lines.  When
disabled existing cache lines are not invalidated by stores to memory, so
we risk reading stale data that was cached before the data access error if
we don't flush them.  This is especially fatal when the memory involved
is the active part of the kernel or user stack.  For good measure we also
flush the instruction cache.

This fixes random crashes when the X server probes the PCI bus through
/dev/pci.
2003-11-11 06:41:54 +00:00
Bruce Evans
129540b834 Include <sys/reboot.h> the definition of RB_BOOTINFO. The previous
commit broke the world because it depended on namespace pollution that
was only in my version of <machine/bootinfo.h>.  The include was removed
in rev.1.63 after the last reference to it went away in rev.1.61.
2003-11-11 06:27:34 +00:00
Jake Burkholder
fe6b8ecd5e Rearrange slightly so that DELAY(9) works during cninit. 2003-11-11 06:08:10 +00:00
Scott Long
42c3555cff Fix sound LOR problems:
dsp_open: rearrange to only hold one lock at a time

dsp_close: ditto

mixer_hwvol_init: delete locking, the only consumer seems to
be the ess driver and it only call it a creation time, I
think the device will be stable across the sleepable malloc.

cmi interrupt routine: Release locks while caller chn_intr,
either this or do what emu10k1 does which is have no locks
at in the interrupt handler.

Submitted by:	mat@cnd.mcgill.ca
2003-11-11 05:38:28 +00:00
Joseph Koshy
b10221ffd9 Have utrace(2) return ENOMEM if malloc() fails. Document this error
return in its manual page.

Reviewed by:	jhb
2003-11-11 04:54:11 +00:00
Alan Cox
e35e0182c3 - Revision 1.469 of vfs_subr.c resulted in the buf's b_object field being
consistency initialized.  Consequently, a number of conditionals that
   checked the validity of b_object before passing it to VM_OBJECT_LOCK()
   and VM_OBJECT_UNLOCK() are no longer needed.
2003-11-11 04:45:37 +00:00
Robert Watson
c8e7bf92ad Whitespace sync to MAC branch, expand comment at the head of the file. 2003-11-11 03:40:04 +00:00
Alfred Perlstein
b46b1a899f Stop using shared locks for nfs vop locks.
The reason this was done was to avoid a race to the root when an
NFS server went down.  However a semi-recent change to the way that
the kernel's lookup() routine traverses mount points prevents this.

Rev 1.39 of vfs_lookup.c changed the ordering of locks such that we
aquire a shared lock on the mount point being accessed and then drop
the directory vnode lock before requesting the target lock.

With that in place we no longer need shared locks for NFS to prevent
race to the root lockups.
2003-11-11 00:32:46 +00:00
Sam Leffler
383df78dc8 use Giant-less callouts when debug_mpsafenet is non-zero
Supported by:	FreeBSD Foundation
2003-11-10 23:29:33 +00:00
Ian Dowse
3ab2096b80 In in_pcbconnect_setup(), don't use the cached inp->inp_route unless
it is marked as RTF_UP. This appears to fix a crash that was sometimes
triggered when dhclient(8) tried to send a packet after an interface
had been detatched.

Reviewed by:	sam
2003-11-10 22:45:37 +00:00
Don Lewis
8d0c247562 If fifo_open() is interrupted, fifo_close() may not get called, causing
a resource leak.  Move the resource deallocation code from fifo_close()
to a new function, fifo_cleanup(), and call fifo_cleanup() from
fifo_close() and the appropriate places in fifo_open().

Tested by: 	Lukas Ertl
Pointy hat to:	truckman
2003-11-10 22:21:00 +00:00
John Baldwin
4e478d4521 MFamd64 (via P4, not in CVS yet):
- Use the static boot_address variable directly rather than passing it
  around to several functions.
- Clean up a couple of magic numbers.
2003-11-10 21:24:34 +00:00
Jeffrey Hsu
1ce43e2348 Mark TCP syncache timer as not Giant-free ready yet. 2003-11-10 20:42:04 +00:00
Alfred Perlstein
cd3c61b93d Fix a bug where the taskqueue kproc was being parented by init
because RFNOWAIT was being passed to kproc_create.

The result was that shutdown took quite a bit longer because this
errant "child" would not respond to termination signals from init
at system shutdown.

RFNOWAIT dissassociates itself from the caller by attaching to init
as a parent proc.  We could have had the taskqueue proc listen for
SIGKILL, but being able to SIGKILL a potentially critical system
process doesn't seem like a good idea.
2003-11-10 20:39:44 +00:00
John Baldwin
95020215db Bump APIC ID limits up to 32 since a machine with 16 CPUs will have APIC
IDs for the I/O APICs that are greater than 16.

Reported by:	John Cagle <john.cagle@hp.com>
2003-11-10 19:52:58 +00:00
Bruce Evans
c00209396c Fixed loss of setting of the RB_BOOTINFO flag in rev.1.43. Fixed wrong
comment about this flag in rev.1.61.  It is not historical like the
comment said; it is the flag that says that most of what is laboriously
put in the bootinfo struct is actually there.  Newer kernels were
bootable by even the broken boot2 without losing anything except the
symbol table, but older kernels need at least the memory sizes.

Restoring the "|" with RB_BOOTINFO that was lost in rev.1.43 costs 5
bytes.  The fix can be done in only 4 bytes by fixing some code that
was removed in rev.1.61 (put RB_BOOTINFO back in in the initial value
of "opts" and fix RBX_MASK to not clobber it.)
2003-11-10 19:06:09 +00:00
Warner Losh
9b41f0a787 Don't establish the ISR in the sn_activate routine. I've had two
crashes that had sn0 as the irq that's being serviced, when there was
no sn0 in the system.  This seems to prevent them.  Also, we want to
wait until after we've registered with the network layer before we
turn on the interrupt spigot to avoid races.
2003-11-10 16:04:11 +00:00
John Baldwin
4c76854fad Update a comment related to SMP and describe the NO_MIXED_MODE kernel
option.

Requested by:	bde
2003-11-10 15:54:32 +00:00
John Baldwin
c68ec2c20b Update a comment.
Requested by:	bde
2003-11-10 15:48:30 +00:00
Gary Jennejohn
ebb5694a4b Based on an excellent suggestion from tanimura@ define I4BPRI and use it
in place of TTIPRI.
2003-11-10 14:20:34 +00:00
Hidetoshi Shimokawa
9b86b36df8 Reduce debug message. 2003-11-10 14:04:37 +00:00
Gary Jennejohn
84df55b1f4 Fix breakage cuased by the selwakeuppri commit by defining TTIPRI for
recent versions of FreeBSD (based on __FreeBSD_version check).
2003-11-10 14:02:22 +00:00
Ruslan Ermilov
5a4e8b0f24 Don't compile with -g by default; there's a better way to build modules with
debug support.
2003-11-10 12:54:54 +00:00
Hajimu UMEMOTO
db54001806 enable aes-xcbc-mac and aes-ctr, again. 2003-11-10 10:39:14 +00:00
Hajimu UMEMOTO
5129dcfce7 rijndael-alg-fst.[ch]:
- redo updating.

rijndael-api-fst.[ch]:
  - switch to use new low level rijndael api.
  - stop using u8, u16 and u32.
  - space cleanup.

Tested by:	gbde(8) and phk's test program
2003-11-10 10:33:39 +00:00
Tim J. Robbins
541c3b66b5 When there are no free sem_undo structs available in semu_alloc(), only
free one sem_undo with un_cnt == 0 instead of all of them. This is a
temporary workaround until the SLIST_FOREACH_PREVPTR loop gets fixed so
that it doesn't cause cycles in semu_list when removing multiple adjacent
items. It might be easier to just use (doubly-linked) LISTs here instead
of complicated SLIST code to achieve O(1) removals.

This bug manifested itself as a complete lockup under heavy semaphore use
by multiple processes with the SEM_UNDO flag set.

PR:		58984
2003-11-10 07:22:41 +00:00
Marcel Moolenaar
9422d61a1f In get_mcontext(), do not update bspstore and ndirty in the trapframe.
Only update them in the newly created context to reflect the state
after copying the dirty registers onto the user stack. If we were to
update the trapframe, we lose the state at entry into the kernel. We
may need that after we create the context, such as for KSE upcalls.

We have to update the trapframe after writing the dirty registers to
the user stack for signal delivery to work. But this is best done in
sendsig() itself where it applies, not in get_mcontext() where it's
done unconditionally.
2003-11-10 05:28:05 +00:00
Hidetoshi Shimokawa
4a431baa58 * Improve sbp device probe in boot process.
- Notify BUS RESET to CAM in sbp_attach().
	- Use last bus reset time to determine login delay.

Tested by: imura

* Add some sysctl MIB and tunables.
2003-11-10 03:51:23 +00:00
David Xu
73510b7ce5 If a thread masks all its signal, in cursig(), no signal will be exchanged
with debugger, so testing P_TRACED in SIGPENDING is useless. This test also
is the culprit which causes lots of 'failed to set signal flags properly for
 ast()' to be printed on console which is just a false complaint.
2003-11-10 03:11:08 +00:00
Warner Losh
71edba1fe8 Move 'guessing' code from the probe into the identify routine where it more
properly belongs.
2003-11-10 02:47:11 +00:00
Alan Cox
d88346020b - The Open Group Base Specifications Issue 6 specifies that an munmap(2)
must return EINVAL if size is zero.  Submitted by: tegge
 - In order to avoid a race condition in multithreaded applications, the
   check and removal operations by munmap(2) must be in the same critical
   section.  To accomodate this, vm_map_check_protection() is modified to
   require its caller to obtain at least a read lock on the map.
2003-11-10 01:37:40 +00:00
Jonathan Mini
8f101a2f31 NFC: Update stale comments.
Reviewed by:	alc
2003-11-10 00:44:00 +00:00
Josef Karthauser
7a4a3d9f69 MFNetBSD:
date: 2003/10/18 04:50:35;  author: simonb
    Remove assigned-to but otherwise unused variables.
    Remove unreachable break after return statements.
2003-11-10 00:20:52 +00:00
Josef Karthauser
f395d6798d MFNetBSD:
revision 1.142
    date: 2003/10/11 03:04:26;  author: toshii
    Fix a done list handling bug which exhibits under high shared
    interrupt rate and bus traffic.  As the interrupt register is
    read after checking hcca_done_head, there was a small chance
    of dropping a done list.  Ignore OHCI_WDH interrupt bit if
    hcca_done_head is zero so that OHCI_WDH is processed later.
2003-11-10 00:16:36 +00:00
Josef Karthauser
9c96cea538 MFNetBSD:
revision 1.141
    date: 2003/09/10 20:08:29;  author: mycroft;
    Update actlen even in the case where a TD returns an error --
    this is critical for the umass bulk-only STALL case.
2003-11-10 00:12:39 +00:00
Josef Karthauser
238894c5ee MFNetBSD:
revision 1.176
    date: 2003/11/04 19:11:21;  author: mycroft;
    Ignore a CRCTO error on a SETUP transaction in combination with
    STALLED or NAK.  This fixes problems with the GL641.
2003-11-10 00:08:41 +00:00
Josef Karthauser
97287bdb44 MFNetBSD:
date: 2003/09/12 16:18:08;  author: mycroft;
    Tweak a debugging printf().
2003-11-09 23:59:53 +00:00
Josef Karthauser
fe5e683b90 Revise the NetBSD revision control strings. 2003-11-09 23:56:19 +00:00
Josef Karthauser
35b64e1272 MFNetBSD:
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
  this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
2003-11-09 23:54:21 +00:00
Sam Leffler
bca1062ba5 fix typo that broke AP scanning by BSSID
Submitted by:	Len Widra
2003-11-09 23:36:46 +00:00
Marcel Moolenaar
3534a08109 When a thread is being swapped-out, save the high FP registers. We
have a pointer in the PCPU to the PCB of the thread that currently
has its high FP registers loaded.
2003-11-09 23:13:23 +00:00
Marcel Moolenaar
ac8c7680a6 Use get_mcontext() to construct the signal context in sendsig() and
use set_mcontext() to restore the context in sigreturn(). Since we
put the syscall number and the syscall arguments in the trapframe
(we don't save the scratch registers for syscalls, which allows us
to reuse the space to our advantage), create a MD specific flag so
that we save the scratch registers even for syscalls. We would not
be able to restart a syscall otherwise.

The signal trampoline does not need to flush the regiters anymore,
because get_mcontext() already handles that. In fact, if we set up
the context correctly, we do not need to have a trampoline at all.
This change however only minimally changes the trampoline code. In
follow-up commits this can be further optimized.

Note that normally we preserve cfm and iip in the trapframe created
by the EPC syscall path when we restore a context in set_mcontext()
because those fields are not normally set for a synchronuous context.
The kernel puts the return address and frame info of the syscall
stub in there. By preserving these fields we hide this detail from
userland which allows us to use setcontext(2) for user created
contexts. However, sigreturn() is commonly called from the trampoline,
which means that if we preserve cfm and iip in all cases, we would
return to the trampoline after the sigreturn(), which means we hit
the safety net: we call exit(2). So, we do not preserve cfm and iip
when we have a synchronous context that also has scratch registers
(the uncommon context created by sendsig() only), under the assumption
that if such a context is created in userland, something special is
going on and the use of cfm and iip is then just another quirk. All
this is invisible in the common case.
2003-11-09 22:17:36 +00:00
Alan Cox
637315ed9c - Remove Giant from msync(2). Giant is still acquired by the lower layers
if we drop into the pmap or vnode layers.
 - Migrate the handling of zero-length msync(2)s into vm_map_sync() so that
   multithread applications can't change the map between implementing the
   zero-length hack in msync(2) and reacquiring the map lock in
   vm_map_sync().

Reviewed by:	tegge
2003-11-09 22:09:04 +00:00
Scott Long
65b5d09597 Free the ata_request struct after we are done using it. This should stop
the memory leak seen when using ATAPICAM.
2003-11-09 20:46:08 +00:00
Marcel Moolenaar
fcaa2925a9 Change the clear_ret argument of get_mcontext() to be a flags argument.
Since all callers either passed 0 or 1 for clear_ret, define bit 0 in
the flags for use as clear_ret. Reserve bits 1, 2 and 3 for use by MI
code for possible (but unlikely) future use. The remaining bits are for
use by MD code.

This change is triggered by a need on ia64 to have another knob for
get_mcontext().
2003-11-09 20:31:04 +00:00
Warner Losh
116f7a3ddb Tweak the front end driver file list
Also some minor whitespace nits.
2003-11-09 20:02:47 +00:00
Warner Losh
740d18ecdc Add my copyright to aha_isa.c to make it crystal clear its license 2003-11-09 20:01:36 +00:00
Warner Losh
40f583c24a Let bus space manage softc. 2003-11-09 19:51:16 +00:00
Warner Losh
9b4fbfe900 Minor tweaks to make it behave better:
o When we're resetting the board, make sure that we error out the pending
  CCBs first.  Otherwise the aha_cmd won't accept further commands, such
  as those that are used to reset the card (AOP_INITIALIZE_MBOX).  This
  appears to cause a cascade failure where no more commands are possible
  to the card.
o Reduce from 10s down to 1s the amount of time we're willing to tolerate
  the card being awol.  This helps the above case.
o Add some error checking to two commands issued in the probe.

I have a dim memory of gibbs@ trying to tell me about this problem a
few years ago, so pointy hat to imp@ for sitting on it so long.
2003-11-09 17:16:39 +00:00
Warner Losh
716dfe3f18 Minor comment smithing 2003-11-09 17:05:55 +00:00
David Malone
5a8a13e0fc Use kern_sendit rather than sendit for the Linux send* syscalls.
This means we can avoid using the stack gap for most send* syscalls
now (it is still used in the IP_HDRINCL case).
2003-11-09 17:04:04 +00:00
Bruce Evans
b698380f33 Quick fix for scaling of statclock ticks in the SMP case. As explained
in the log message for kern_sched.c 1.83 (which should have been
repo-copied to preserve history for this file), the (4BSD) scheduler
algorithm only works right if stathz is nearly 128 Hz.  The old
commit lock said 64 Hz; the scheduler actually wants nearly 16 Hz
but there was a scale factor of 4 to give the requirement of 64 Hz,
and rev.1.83 changed the scale factor so that the requirement became
128 Hz.  The change of the scale factor was incomplete in the SMP
case.  Then scheduling ticks are provided by smp_ncpu CPUs, and the
scheduler cannot tell the difference between this and 1 CPU providing
scheduling ticks smp_ncpu times faster, so we need another scale
factor of smp_ncp or an algorithm change.

This quick fix uses the scale factor without even trying to optimize
the runtime divisions required for this as is done for the other
scale factor.

The main algorithmic problem is the clamp on the scheduling tick counts.
This was 295; it is now approximately 295 * smp_ncpu.  When the limit
is reached, threads get free timeslices and scheduling becomes very
unfair to the threads that don't hit the limit.  The limit can be
reached and maintained in the worst case if the load average is larger
than (limit / effective_stathz - 1) / 2 = 0.65 now (was just 0.08 with
2 CPUs before this change), so there are algorithmic problems even for
a load average of 1.  Fortunately, the worst case isn't common enough
for the problem to be very noticeable (it is mainly for niced CPU hogs
competing with less nice CPU hogs).
2003-11-09 13:45:54 +00:00
Søren Schmidt
35e67f571f Fix typo in breaking up requests to size limit.
Found by: Peter Edwards <pmedwards@eircom.net>
2003-11-09 10:11:15 +00:00
Seigo Tanimura
512824f8f7 - Implement selwakeuppri() which allows raising the priority of a
thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current
2003-11-09 09:17:26 +00:00
Marcel Moolenaar
2e55d247a6 Implement PAL_HALT_LIGHT now that the kernel halts the processor
when idle. All we have to do is return.
2003-11-09 07:42:16 +00:00
Marcel Moolenaar
84408cc05c Do not strip skiload when installed. The stripped binary does not load
in the simulator.
2003-11-09 06:53:37 +00:00
Alan Cox
950f8459d4 - Rename vm_map_clean() to vm_map_sync(). This better reflects the fact
that msync(2) is its only caller.
 - Migrate the parts of the old vm_map_clean() that examined the internals
   of a vm object to a new function vm_object_sync() that is implemented in
   vm_object.c.  At the same, introduce the necessary vm object locking so
   that vm_map_sync() and vm_object_sync() can be called without Giant.

Reviewed by:	tegge
2003-11-09 05:25:35 +00:00
Scott Long
68153f43b6 Sprinkle GIANT_REQUIRED asserts around the xpt layer to aid with locking the
SCSI drivers.
2003-11-09 02:22:33 +00:00
Warner Losh
3cce43b94e Make this driver a little more style(9) compliant 2003-11-09 00:51:52 +00:00
Sam Leffler
7138d65c3f replace explicit changes to rt_refcnt by RT_ADDREF and RT_REMREF
macros that expand to include assertions when the system is built
with INVARIANTS

Supported by:	FreeBSD Foundation
2003-11-08 23:36:32 +00:00
Marcel Moolenaar
00bd917263 Remove the atkbd, psm, sc and vga devices. Most ia64 boxes out there
are zx1 based machines and they don't particularly like it when we
poke at them with PC legacy code. The atkbd and psm devices were
disabled in the hints file so that one could enable them on machines
that support legacy devices, but that's not really something you can
expect from a first-time installer. This still leaves syscons (sc)
and the vga device, which were enabled by default and wrecking havoc
anyway. We could disable them by default like the atkbd and psm
devices, but there's really no point in pretending we're in a better
shape that way.
2003-11-08 23:19:13 +00:00
Sam Leffler
252f24a2cf divert socket fixups:
o pickup Giant in divert_packet to protect sbappendaddr since it
  can be entered through MPSAFE callouts or through ip_input when
  mpsafenet is 1
o add missing locking on output
o add locking to abort and shutdown
o add a ctlinput handler to invalidate held routing table references
  on an ICMP redirect (may not be needed)

Supported by:	FreeBSD Foundation
2003-11-08 23:09:42 +00:00
Sam Leffler
8484384564 assert optional inpcb is passed in locked
Supported by:	FreeBSD Foundation
2003-11-08 23:03:29 +00:00
Sam Leffler
59daba27d9 add locking assertions
Supported by:	FreeBSD Foundation
2003-11-08 23:02:36 +00:00
Sam Leffler
3c47a187b7 assert inpcb is locked in udp_output
Supported by:	FreeBSD Foundation
2003-11-08 23:00:48 +00:00
Sam Leffler
c29afad673 o correct locking problem: the inpcb must be held across tcp_respond
o add assertions in tcp_respond to validate inpcb locking assumptions
o use local variable instead of chasing pointers in tcp_respond

Supported by:	FreeBSD Foundation
2003-11-08 22:59:22 +00:00
Sam Leffler
2a0746208b use local values instead of chasing pointers
Supported by:	FreeBSD Foundation
2003-11-08 22:57:13 +00:00
Sam Leffler
fa286d7db2 replace mtx_assert by INP_LOCK_ASSERT
Supported by:	FreeBSD Foundation
2003-11-08 22:55:52 +00:00
Sam Leffler
50d7c061a3 add some missing locking
Supported by:	FreeBSD Foundation
2003-11-08 22:53:41 +00:00
Sam Leffler
1d78192b35 the sbappendaddr call in socket_send must be protected by Giant
because it can happen from an MPSAFE callout

Supported by:	FreeBSD Foundation
2003-11-08 22:51:18 +00:00
Sam Leffler
e3f268fc89 add locking assertions that turn into noops if INET6 is configured;
this is necessary because the ipv6 code shares the in_pcb code with
ipv4 but (presently) lacks proper locking

Supported by:	FreeBSD Foundation
2003-11-08 22:48:27 +00:00
Sam Leffler
7902224c6b o add a flags parameter to netisr_register that is used to specify
whether or not the isr needs to hold Giant when running; Giant-less
  operation is also controlled by the setting of debug_mpsafenet
o mark all netisr's except NETISR_IP as needing Giant
o add a GIANT_REQUIRED assertion to the top of netisr's that need Giant
o pickup Giant (when debug_mpsafenet is 1) inside ip_input before
  calling up with a packet
o change netisr handling so swi_net runs w/o Giant; instead we grab
  Giant before invoking handlers based on whether the handler needs Giant
o change netisr handling so that netisr's that are marked MPSAFE may
  have multiple instances active at a time
o add netisr statistics for packets dropped because the isr is inactive

Supported by:	FreeBSD Foundation
2003-11-08 22:28:40 +00:00
Hidetoshi Shimokawa
ddce43e1cf Move post dmamap_load processes into the callback function. 2003-11-08 16:26:22 +00:00
Josef Karthauser
68ded8480c I've had a couple of reports that the Sony Clie_40 doesn't need the
PALM_4 initialisation hack.  I've not confirmed it myself, but
seeing as we already don't use it for the Sony Clie_41, let's drop
it from the Clie_40 also and see what happens.

(Question: What about the Clie_S360 and Clie_NX60 devices?  Do we
 need to drop Palm4 from those as well?  Possibly, but I've not had
 any reports about those so I don't know.)

PR:		kern/56575
MFC after:	3 days
2003-11-08 11:23:07 +00:00
Scott Long
8226fdbdce Don't be so chatty when performing manual sense. This should make ATAPICAM
devices a lot more quiet.
2003-11-08 10:56:57 +00:00
Søren Schmidt
aeb1d7b554 Remove the NOGIANT flag again, it was premature. 2003-11-08 09:56:34 +00:00
Peter Wemm
4cd2d525e3 Move a MD 32 bit binary support routine into the MD areas. exec_setregs
is highly MD in an emulation environment since it operates on the host
environment.  Although the setregs functions are really for exec support
rather than signals, they deal with the same sorts of context and include
files.  So I put it there rather than create yet another file.
2003-11-08 07:43:44 +00:00
Peter Wemm
b0211d5445 Regen 2003-11-08 07:31:49 +00:00
Peter Wemm
bc0e45efa3 "implement" vfork(). Add comments next to the other syscalls that need
to be implemented.  This is enough to run i386 /bin/tcsh.  /bin/sh is still
not happy because of some strange job control problem.
2003-11-08 07:31:30 +00:00
Peter Wemm
fcfe57d640 Update the graffiti. 2003-11-08 04:39:22 +00:00
Peter Wemm
398dbb11d8 Switch from having a fpu "device" to something that is more like the
integrated part of the cpu core that it is.
2003-11-08 04:37:54 +00:00
Sam Leffler
6536168e0a must use RTFREE instead of rtfree for proper locking 2003-11-08 03:36:32 +00:00
Peter Wemm
e04f2bba96 Remove some duplicated comments that refer to npx. XXX The setregs
function is actually MD (not MI) though..
2003-11-08 03:35:06 +00:00
Peter Wemm
bf2f09ee97 The great s/npx/fpu/gi 2003-11-08 03:33:38 +00:00
Warner Losh
d0ff2e64ac -Wunused 2003-11-08 03:28:43 +00:00
Peter Wemm
a4d60a7fb3 Converge with i386/GENERIC 2003-11-08 03:17:36 +00:00
David Xu
685a6c448a Return a reasonable number for top or ps to display for M:N thread,
since there is no direct association between M:N thread and kse,
sometimes, a thread does not have a kse, in that case, return a pctcpu
from its last kse, it is not perfect, but gives a good number to be
displayed.
2003-11-08 03:03:17 +00:00
Alan Cox
5e4a2fc9aa - Similar to post-PAE RELENG_4 split pmap_pte_quick() into two cases,
pmap_pte() and pmap_pte_quick().  The distinction being based upon the
   locks that are held by the caller.  When the given pmap is not the
   current pmap, pmap_pte() should be used when Giant is held and
   pmap_pte_quick() should be used when the vm page queues lock is held.
 - When assigning to PMAP1 or PMAP2, include PG_A anf PG_M.
 - Reenable the inlining of pmap_is_current().

In collaboration with:	tegge
2003-11-08 03:01:26 +00:00
Peter Wemm
0432a0f961 Rename npx.c to fpu.c (it isn't an extension, its part of the core
architecture now).
2003-11-08 02:40:40 +00:00
Peter Wemm
8b2454d833 Rename npx* to fpu*. I haven't done the flags/function names yet. 2003-11-08 02:39:46 +00:00
Peter Wemm
42ad9517cc Point the description of the fpu data in the context structures to
i386/include/npx.h instead of the host's machine/npx.h (which might not
exist)
2003-11-08 02:36:05 +00:00
Sam Leffler
27a940c9a2 unbreak compilation of FAST_IPSEC
Supported by:	FreeBSD Foundation
2003-11-08 00:34:34 +00:00
Robert Watson
8a4b86b9a4 Replace a '-' with a ')'. Update copyright.
PR:	53195
2003-11-08 00:21:20 +00:00
Peter Wemm
7538a488f5 There isn't much point printing 'npx0: INT 16 interface' because that is
the only way it works here.
2003-11-08 00:13:43 +00:00
John Baldwin
88861af1fb Dump the trigger and polarity of each intpin's default setting in the
bootverbose output.
2003-11-07 23:44:35 +00:00
Sam Leffler
aab621f060 MFp4: reminder that random id code is not reentrant
Supported by:	FreeBSD Foundation
2003-11-07 23:31:29 +00:00
Scott Long
eb3b7bf69f Document the lockfunc and lockfuncarg arguments to bus_dma_tag_create() in
the busdma headers.
2003-11-07 23:29:42 +00:00
Sam Leffler
8f1ee3683d Move uid/gid checking logic out of line and lock inpcb usage. This
has a LOR between IPFW inpcb locks but I'm committing it now as the
lesser of two evils (the other being unlocked use of in_pcblookup).

Supported by:	FreeBSD Foundation
2003-11-07 23:26:57 +00:00
Warner Losh
123cd74e26 Remove channeling interrupts to IRQ1. Some chipsets don't do the
expected thing and that causes interference with keyboards.
2003-11-07 23:12:59 +00:00
Sam Leffler
a96756932a Assert GIANT_REQUIRED where sockets are manipulated. This is
preparatory for MPSAFE network commits and ongoing socket
locking work.

Supported by:	FreeBSD Foundation
2003-11-07 22:57:09 +00:00
Robert Watson
bea2b56b26 When allocation of a socket peer label fails, scrub what was
successfully initialized in the label as a socket peer label, not a
socket label.  For current policy modules, this didn't make a
difference, but if a policy module had label data in the peer label
that was to be GC'd in a different way than the normal socket label,
it might have been a problem.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-07 22:31:27 +00:00
Peter Wemm
2331fb5799 Ahh, the joys of badge engineering. Tell the sk driver that the
Linksys EG1032 is yet another variation.  It looks just like the 3c940
except it only has a Marvell logo and no 3com logo.
2003-11-07 22:04:26 +00:00
John Baldwin
fab73bc221 Regen. 2003-11-07 21:36:35 +00:00
John Baldwin
572e11ac18 Sync up MP safe flags with global syscalls.master for the first time. This
includes read(), write(), close(), linux_setuid16(), linux_getuid16(),
linux_pause(), linux_nice(), linux_kill(), dup(), linux_pipe(),
linux_setgid16(), linux_getgid16(), linux_signal(), linux_geteuid16(),
linux_getegid16(), acct(), setpgid(), umask(), dup2(), getppid(),
getpgrp(), setsid(), linux_sigaction(), linux_sgetmask(), linux_ssetmask(),
linux_setreuid16(), linux_setregid16(), linux_sigsuspend(), getrusage(),
gettimeofday(), linux_getgroups16(), linux_setgroups16(), getpriority(),
setpriority(), linux_sigreturn(), linux_clone(), linux_sigprocmask(),
linux_getsid(), mlock(), munlock(), mlockall(), munlockall(),
sched_setparam(), sched_getparam(), linux_sched_setscheduler(),
linux_sched_getscheduler(), linux_sched_get_priority_max(),
linux_sched_get_priority_min(), sched_rr_get_interval(),
linux_setresuid16(), linux_getresuid16(), linux_setresgid16(),
linux_getresgid16(), linux_rt_sigaction(), linux_rt_sigprocmask(),
linux_rt_sigsuspend(), geteuid(), getegid(), setreuid(), setregid(),
linux_getgroups(), linux_setgroups(), setresuid(), getresuid(),
setresgid(), getresgid(), setuid(), and setgid().
2003-11-07 21:36:14 +00:00
Peter Wemm
71d6084373 Dont write to the stackgap directly in execve(). 2003-11-07 21:27:13 +00:00
Peter Wemm
5ed80e429e Increase the size of SPARE_USRSPACE. It is way too small by default
for things like execve.
2003-11-07 21:25:54 +00:00
John Baldwin
13b6c41b6c Regen. 2003-11-07 21:13:08 +00:00
John Baldwin
11d4f58fdd Sync MP safe flags with global syscalls.master for the first time. This
includes read(), write(), close(), setuid(), getuid(), linux_ptrace(),
linux_kill(), setpgid(), dup(), pipe(), getgid(), osf1_sigprocmask(),
umask(), getpgrp(), linux_setgroups(), linux_getgroups(), dup2(),
setpriority(), osf1_sigreturn(), osf1_sigsuspend(), osf1_gettimeofday(),
setreuid(), setregid(), setgid(), setsid(), osf1_sigaction(), getpgid(),
linux_getsid(), osf1_sysinfo(), linux_clone(), mlock(), munlock(),
mlockall(), munlockall(), sched_setparam(), sched_getparam(),
linux_sched_setscheduler(), linux_sched_getscheduler(),
linux_sched_get_priority_max(), linux_sched_get_priority_min(),
setresuid(), getresuid(), linux_rt_sigaction(), linux_rt_sigprocmask(),
linux_rt_sigsuspend(), gettimeofday(), linux_getitimer(),
linux_setitimer(), getrusage(), setresgid(), getresgid().
2003-11-07 21:09:19 +00:00
John Baldwin
a2f10724b5 Regen. 2003-11-07 20:56:54 +00:00