Commit Graph

48978 Commits

Author SHA1 Message Date
Andre Oppermann
9b932e9e04 Convert ipfw to use PFIL_HOOKS. This is change is transparent to userland
and preserves the ipfw ABI.  The ipfw core packet inspection and filtering
functions have not been changed, only how ipfw is invoked is different.

However there are many changes how ipfw is and its add-on's are handled:

 In general ipfw is now called through the PFIL_HOOKS and most associated
 magic, that was in ip_input() or ip_output() previously, is now done in
 ipfw_check_[in|out]() in the ipfw PFIL handler.

 IPDIVERT is entirely handled within the ipfw PFIL handlers.  A packet to
 be diverted is checked if it is fragmented, if yes, ip_reass() gets in for
 reassembly.  If not, or all fragments arrived and the packet is complete,
 divert_packet is called directly.  For 'tee' no reassembly attempt is made
 and a copy of the packet is sent to the divert socket unmodified.  The
 original packet continues its way through ip_input/output().

 ipfw 'forward' is done via m_tag's.  The ipfw PFIL handlers tag the packet
 with the new destination sockaddr_in.  A check if the new destination is a
 local IP address is made and the m_flags are set appropriately.  ip_input()
 and ip_output() have some more work to do here.  For ip_input() the m_flags
 are checked and a packet for us is directly sent to the 'ours' section for
 further processing.  Destination changes on the input path are only tagged
 and the 'srcrt' flag to ip_forward() is set to disable destination checks
 and ICMP replies at this stage.  The tag is going to be handled on output.
 ip_output() again checks for m_flags and the 'ours' tag.  If found, the
 packet will be dropped back to the IP netisr where it is going to be picked
 up by ip_input() again and the directly sent to the 'ours' section.  When
 only the destination changes, the route's 'dst' is overwritten with the
 new destination from the forward m_tag.  Then it jumps back at the route
 lookup again and skips the firewall check because it has been marked with
 M_SKIP_FIREWALL.  ipfw 'forward' has to be compiled into the kernel with
 'option IPFIREWALL_FORWARD' to enable it.

 DUMMYNET is entirely handled within the ipfw PFIL handlers.  A packet for
 a dummynet pipe or queue is directly sent to dummynet_io().  Dummynet will
 then inject it back into ip_input/ip_output() after it has served its time.
 Dummynet packets are tagged and will continue from the next rule when they
 hit the ipfw PFIL handlers again after re-injection.

 BRIDGING and IPFW_ETHER are not changed yet and use ipfw_chk() directly as
 they did before.  Later this will be changed to dedicated ETHER PFIL_HOOKS.

More detailed changes to the code:

 conf/files
	Add netinet/ip_fw_pfil.c.

 conf/options
	Add IPFIREWALL_FORWARD option.

 modules/ipfw/Makefile
	Add ip_fw_pfil.c.

 net/bridge.c
	Disable PFIL_HOOKS if ipfw for bridging is active.  Bridging ipfw
	is still directly invoked to handle layer2 headers and packets would
	get a double ipfw when run through PFIL_HOOKS as well.

 netinet/ip_divert.c
	Removed divert_clone() function.  It is no longer used.

 netinet/ip_dummynet.[ch]
	Neither the route 'ro' nor the destination 'dst' need to be stored
	while in dummynet transit.  Structure members and associated macros
	are removed.

 netinet/ip_fastfwd.c
	Removed all direct ipfw handling code and replace it with the new
	'ipfw forward' handling code.

 netinet/ip_fw.h
	Removed 'ro' and 'dst' from struct ip_fw_args.

 netinet/ip_fw2.c
	(Re)moved some global variables and the module handling.

 netinet/ip_fw_pfil.c
	New file containing the ipfw PFIL handlers and module initialization.

 netinet/ip_input.c
	Removed all direct ipfw handling code and replace it with the new
	'ipfw forward' handling code.  ip_forward() does not longer require
	the 'next_hop' struct sockaddr_in argument.  Disable early checks
	if 'srcrt' is set.

 netinet/ip_output.c
	Removed all direct ipfw handling code and replace it with the new
	'ipfw forward' handling code.

 netinet/ip_var.h
	Add ip_reass() as general function.  (Used from ipfw PFIL handlers
	for IPDIVERT.)

 netinet/raw_ip.c
	Directly check if ipfw and dummynet control pointers are active.

 netinet/tcp_input.c
	Rework the 'ipfw forward' to local code to work with the new way of
	forward tags.

 netinet/tcp_sack.c
	Remove include 'opt_ipfw.h' which is not needed here.

 sys/mbuf.h
	Remove m_claim_next() macro which was exclusively for ipfw 'forward'
	and is no longer needed.

Approved by:	re (scottl)
2004-08-17 22:05:54 +00:00
Nate Lawson
4c37803a89 Fix a deadlock on boot for some systems where reading the battery status
also generates a notify.  Since we held the lock over this call, the
notify never got to run and the battery status read never returned.
Document this also.

Tested by:	Maxim Maximov <mcsi_at_mcsi.pp.ru>
Approved by:	re (scottl)
2004-08-17 18:36:07 +00:00
Justin T. Gibbs
e55a65d092 Defer the capture of the "expected sync bits" until the first "normal"
data packet is received from the mouse.  In the case of many KVM's,
this avoids a bug in their mouse emulation that sends back incorrect
sync when you explicitly request a data packet from the mouse.  Without
this change, you must force the driver into stock PS/2 mode or be flooded
with a never ending stream of "out of sync" messages on these KVMs.

Approved by: re
2004-08-17 18:12:37 +00:00
Robert Watson
2cfe973b62 Annotate call to DELAY() in interrupt storm mitigation as being
something to revisit.

Approved by:	re (scottl)
2004-08-17 04:09:09 +00:00
Justin T. Gibbs
d3f39a7438 Add ISA attachement files for the aic7xxx driver.
Approved by: re
Reminded by: obrien
2004-08-17 02:32:30 +00:00
Justin T. Gibbs
7afc02188a Add an ISA attachement to the aic7xxx driver to handle 284X controllers.
The ISA probe uses an identify routine to probe all slot locations from
1 to 14 that do not conflict with other allocated resources.  This required
making aic7770.c part of the driver core when compiled as a module.

aic7xxx.c:
aic79xx.c:
aic_osm_lib.c:
	Use aic_scb_timer_start() consistently to start the watchdog timer.
	This removes a few places that verbatum copied the code in
	aic_scb_timer_start().

	During recovery processing, allow commands to still be queued to
	the controller.  The only requirement we have is that our recovery
	command be queued first - something the code already guaranteed.
	The only other change required to make this work is to prevent
	timers from being started for these newly queued commands.

Approved by: re
2004-08-17 00:14:31 +00:00
Marius Strobl
34c8a85fc8 - Sync whitespace and comments with i386 GENERIC.
- Add some commented out NICs from i386 GENERIC. Most of them look like they
  would work but I'm not sure if they are endian-clean and can't test. There
  was a report that sk(4) works on sparc64 but it doesn't look like it would
  because it doesn't use busdma.
- Improve some of the descriptions of sparc64 specific devices.

There's no functional change, i.e. no added or deleted uncommented devices or
options, in this commit.
2004-08-16 23:23:21 +00:00
Marius Strobl
df774a6b16 Try to catch up with reality:
- Chase the split of pcm(4). This unbreaks LINT compiles.
- sc(4) basically works and a lot of its options should be supported.
- Add the creator and ofw_console drivers.
- vinum(4) should work, at least its module was turned on for sparc64 a while
  ago.
- Don't build sio(4). Its EBus front-end was removed a while ago and the ISA
  one hardly works. Use uart(4) instead, it's not perfect yet but works much
  better.
2004-08-16 23:21:06 +00:00
Peter Wemm
cc85036382 ciss's interrupt handler was missing the INTR_ENTROPY flag. 2004-08-16 23:13:16 +00:00
Peter Wemm
1c0dea0f6e Sync with i386 - Optimize intr_execute_handlers a bit etc. 2004-08-16 23:12:30 +00:00
Peter Wemm
a9cd97ba05 Sync with i386 - remove unused includes 2004-08-16 23:10:46 +00:00
Peter Wemm
e88022749d Sync with i386 - get the softc via the devclass rather than caching the dev 2004-08-16 23:10:18 +00:00
Peter Wemm
deefc3c4f5 Sync with i386 - add ADAPTIVE_GIANT, remove pcic 2004-08-16 22:59:24 +00:00
Peter Wemm
9727279886 Sync with i386 - add foot shooting protection for the DDB/KDB thing. 2004-08-16 22:57:47 +00:00
Peter Wemm
b93b95f67f Sync with i386 - set rbp reg to 0 for upcalls as a frame marker, not that
it is guaranteed to be used in userland though.
2004-08-16 22:57:13 +00:00
Peter Wemm
717209c708 Sync with i386 - trace syscall entry/exit times, and a cosmetic fix. 2004-08-16 22:56:20 +00:00
Peter Wemm
81f6665ec9 Sync with i386 - fix bounds check in lapic_create() 2004-08-16 22:55:32 +00:00
Peter Wemm
526d706192 Sync with i386 - pass resource requests up to parent 2004-08-16 22:54:50 +00:00
Peter Wemm
2c87e00194 Sync with i386 - s/cpu_swtch/cpu_switch/ 2004-08-16 22:53:29 +00:00
Peter Wemm
e4b3358b15 Sync with i386 - dont count needed bounce pages if loading a buffer that
was created with bud_dmamem_alloc()
2004-08-16 22:53:03 +00:00
Peter Wemm
6bd599a050 Sync with i386 - cosmetic fixes 2004-08-16 22:52:02 +00:00
Peter Wemm
66d2648494 Catch up with i386 - remove lots of no longer used symbolic constants 2004-08-16 22:51:44 +00:00
Peter Wemm
fd57ce88db Sync with i386 2004-08-16 22:51:13 +00:00
Arun Sharma
2d24da614a The existing code fails some corner cases. Replace it with
ia64_bsp_adjust() which has been tested to work in all cases for
arbitrary (bsp, nslots) combinations.

reviewed by: marcel@
2004-08-16 22:09:58 +00:00
Justin T. Gibbs
fc838bef65 Remove outb to "prime" the EISA ID registers of each slot. This was
only required to support probing of the Adaptec 284X VLB SCSI controller
which becomes visible in EISA space if you perform these writes.  284X
probing is moving to an ISA attachment.
2004-08-16 22:05:53 +00:00
Justin T. Gibbs
6ec309a62f Modify the "legacy bus" to pass all resource allocations through to its
parent rather than track resources locally.  The original code
was incomplete in that it would only honor requests for resources
that already exist in its resource list.  This prevented many ISA
identify routines from allocating temporary resources.  Passing
the requests up to legacy's parent losing no functionality and
allows these requests to succeed.

Reviewed by: imp, jhb
Approved by: RE
2004-08-16 21:55:29 +00:00
Philip Paeps
5459a0063b Don't initialize static variables to 0 (C should just take care of that).
Spotted by:	njl
2004-08-16 20:19:09 +00:00
Bill Paul
ae58ccaa60 I'm a dumbass: remember to initialize fh->nf_map to NULL in
ndis_open_file() in the module loading case.
2004-08-16 19:25:27 +00:00
Marcel Moolenaar
344bbdbd54 As I said: the previous commit was untested... Remove an #endif which
should have ceased to exist when its corresponding #if was removed.
2004-08-16 19:05:08 +00:00
Marcel Moolenaar
97752b2cbd Catch up with the drive-by renaming of IA32 to COMPAT_IA32. It must
have been rush hour...

While here, move COMPAT_IA32 from opt_global.h to opt_compat.h like on
amd64. Consequently, it's unsafe to use the option in pcb.h. We now
unconditionally have the ia32 specific registers in the PCB.

This commit is untested.
2004-08-16 18:54:23 +00:00
Bill Paul
161a639981 The Texas Instruments ACX111 driver wants srand(), so provide it. 2004-08-16 18:52:37 +00:00
Bill Paul
f454f98c31 Make the Texas Instruments 802.11g chipset work with the NDISulator.
This was tested with a Netgear WG311v2 802.11b/g PCI card. Things
that were fixed:

- This chip has two memory mapped regions, one at PCIR_BAR(0) and the
  other at PCIR_BAR(1). This is a little different from the other
  chips I've seen with two PCI shared memory regions, since they tend
  to have the second BAR ad PCIR_BAR(2). if_ndis_pci.c tests explicitly
  for PCIR_BAR(2). This has been changed to simply fill in ndis_res_mem
  first and ndis_res_altmem second, if a second shared memory range
  exists. Given that NDIS drivers seem to scan for BARs in ascending
  order, I think this should be ok.

- Fixed the code that tries to process firmware images that have been
  loaded as .ko files. To save a step, I was setting up the address
  mapping in ndis_open_file(), but ndis_map_file() flags pre-existing
  mappings as an error (to avoid duplicate mappings). Changed this so
  that the mapping is now donw in ndis_map_file() as expected.

- Made the typedef for 'driver_entry' explicitly include __stdcall
  to silence gcc warning in ndis_load_driver().

NOTE: the Texas Instruments ACX111 driver needs firmware. With my
card, there were 3 .bin files shipped with the driver. You must
either put these files in /compat/ndis or convert them with
ndiscvt -f and kldload them so the driver can use them. Without
the firmware image, the NIC won't work.
2004-08-16 18:50:20 +00:00
Arun Sharma
646c6dd2c0 ITC.{i,d} instructions use format M41 not M42.
reviewed by: marcel@
2004-08-16 18:41:24 +00:00
Robert Watson
a4f757cd5d White space cleanup for netinet before branch:
- Trailing tab/space cleanup
- Remove spurious spaces between or before tabs

This change avoids touching files that Andre likely has in his working
set for PFIL hooks changes for IPFW/DUMMYNET.

Approved by:	re (scottl)
Submitted by:	Xin LI <delphij@frontfree.net>
2004-08-16 18:32:07 +00:00
Max Laier
e89d8405c7 Comment out rev. 1.4 after problems w/ IPv6, a better solution must be
found.
2004-08-16 17:58:12 +00:00
Roman Kurakin
23ee8af5f5 Fix low level code for Tau-PCI/2E1 and Tau-PCI/4E1 that was broken by previous
commit.
Pointy hat: rik
2004-08-16 17:28:04 +00:00
Doug Ambrisko
05f1103b26 Allow i386 binaries to do amr ioctls such as LSI's megamgr on amd64 and
ia64.

PR:	63155
Submitted by:	Mikhail Teterin
Tested on:	i386, amd64 (via 64bit Xeon system)
2004-08-16 17:23:09 +00:00
Philip Paeps
8547e74f4f Update support for Synaptics Touchpads (Volume V)
o Add (long awaited) support for guest devices

Submitted by:	Arne Schwabe <arne@rfc2549.org>
Approved by:	njl (in a former revision)
2004-08-16 16:28:27 +00:00
Yoshihiro Takahashi
c3c04b646f agp_amd64.c is not needed on pc98. 2004-08-16 16:01:40 +00:00
Warner Losh
977b24f6e6 Some cards don't have the info entries in the CIS, so vendorstr and/or
prodstr may be NULL when fetched.  For the default device description,
guard against this and return the numeric IDs instead when this
happens.  For the matching routines, and consider NULL to not match
those entries that aren't NULL w/o calling strcmp.

Early patches by: Anders Hanssen
2004-08-16 15:57:18 +00:00
Marius Strobl
39513fa664 Instead of "OpenFirmware", "openfirmware", etc. use the official spelling
"Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended).

Ok'ed by:	tmm
2004-08-16 15:45:27 +00:00
Warner Losh
76c4b2cb5d And isa_if.h 2004-08-16 15:24:03 +00:00
Warner Losh
763cd88752 Add pccbb_isa.c and pccbb_pci.c 2004-08-16 15:23:10 +00:00
Alexander Kabaev
c8b876219f Upgrading a lock does not play well together with acquiring an exclusive lock
and can lead to two threads being granted exclusive access. Check that no one
has the same lock in exclusive  mode before proceeding to acquire it.

The LK_WANT_EXCL and LK_WANT_UPGRADE bits act as mini-locks and can block
other threads.  Normally this is not a problem since the mini locks are
upgraded to full locks and the release of the locks will unblock the other
threads.  However if a thread reset the bits without obtaining a full lock
other threads are not awoken. Add missing wakeups for these cases.

PR:		kern/69964
Submitted by:	Stephan Uphoff <ups at tree dot com>
Very good catch by: Stephan Uphoff <ups at tree dot com>
2004-08-16 15:01:22 +00:00
Robert Watson
56af75a582 Add MP_WATCHDOG option information to pc98, as it uses the i386
mp_machdep.c, which relies on the option's include file and
defines.

Constancy of:	tinderbox
2004-08-16 13:59:01 +00:00
Suleiman Souhlal
c0763d3763 Add /dev/mem and /dev/kmem to powerpc.
Approved by:	grehan (mentor)
2004-08-16 13:07:40 +00:00
David E. O'Brien
7a071c6a49 Complete 'IA32' -> 'COMPAT_IA32' change for the Linuxulator32. 2004-08-16 12:51:33 +00:00
Tim J. Robbins
7a47419763 Un-comment LINPROCFS. 2004-08-16 12:39:27 +00:00
David E. O'Brien
3c749e3fb1 AMD64 on-CPU GART support.
This also applies to AMD64 HW running 'i386' OS.

Submitted by:	Jung-uk Kim <jkim@niksun.com>
Integration by:	obrien
2004-08-16 12:25:48 +00:00
David E. O'Brien
15720d822e style.9. 2004-08-16 12:23:53 +00:00
David E. O'Brien
b61c60d401 Fix the 'DEBUG' argument code to unbreak the amd64 LINT build. 2004-08-16 12:15:07 +00:00
David E. O'Brien
5af87d0ea1 Put the 'antispoof' opcode in the proper place in the opcode list such
that it doesn't break the ipfw2 ABI.
2004-08-16 12:05:19 +00:00
Roman Kurakin
c8a7b935f6 Update low level code for Cronyx Tau-PCI:
1. Add support for Cronyx Tau-PCI/E3 rev.B.
2. Improve model identification and firmware load procedure.
2004-08-16 12:00:07 +00:00
David E. O'Brien
ce55a234ee I missed an 'IA32' in the documentation. 2004-08-16 11:15:46 +00:00
David E. O'Brien
4a16b489ca Fix the 'DEBUG' argument code to unbreak the amd64 LINT build. 2004-08-16 11:12:57 +00:00
David E. O'Brien
c680f6b12d I'm not sure what tjr envisioned for turning on FreeBSD/i386 rt support,
but make it COMPAT_IA32 for now.
Fix the 'DEBUG' argument code to unbreak the amd64 LINT build.
2004-08-16 11:09:59 +00:00
David E. O'Brien
186b870df3 Fix the 'DEBUG' argument code to unbreak the amd64 LINT build. 2004-08-16 10:54:25 +00:00
David E. O'Brien
3a2e3a4aa7 Fix the 'DEBUG' argument code to unbreak the LINT build. 2004-08-16 10:36:12 +00:00
David E. O'Brien
fa6a78376f Minor style.9 cleanup. 2004-08-16 10:33:35 +00:00
David Malone
da126abaf1 When looking for some extra data to include in the hash, use the
address of the dirhash, rather than the first sizeof(struct dirhash
*) bytes of the structure (which, thankfully, seem to be constant).

Submitted by:	Ted Unangst <tedu@zeitbombe.org>
MFC after:	2 weeks
2004-08-16 10:00:44 +00:00
Søren Schmidt
5f7a48ef1e Improve (hopefully) on the workaround code for devices that doesn't
interrupt when command is done, ie some ATAPI CD drives with no
media loaded.
2004-08-16 09:32:35 +00:00
Søren Schmidt
fe76f7b6c8 Fix Promise sx4/sx4000 support that broke on the latest race fixes. 2004-08-16 09:29:46 +00:00
David E. O'Brien
9c737de401 Increase the scaling of VM_KMEM_SIZE_MAX.
Submitted by:	alc
2004-08-16 08:35:22 +00:00
David E. O'Brien
78c37b0de8 s/MAX_SAFE_MAXVNODES/MAXVNODES_MAX/g 2004-08-16 08:33:37 +00:00
Pawel Jakub Dawidek
809a9dc601 Decrease debug level to 0. 2004-08-16 08:33:04 +00:00
Pawel Jakub Dawidek
5e6db16cd6 Fix warning. 2004-08-16 08:21:31 +00:00
Tim J. Robbins
84880f87d0 Add support for 32-bit Linux binary emulation on amd64:
- include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h>
  if building with the COMPAT_LINUX32 option.
- make minimal changes to the i386 linprocfs_docpuinfo() function to support
  amd64. We return a fake CPU family of 6 for now.
2004-08-16 08:19:18 +00:00
Tim J. Robbins
6766a2386d Regen. 2004-08-16 08:07:06 +00:00
Tim J. Robbins
ea0fabbc4f Add preliminary support for running 32-bit Linux binaries on amd64, enabled
with the COMPAT_LINUX32 option. This is largely based on the i386 MD Linux
emulations bits, but also builds on the 32-bit FreeBSD and generic IA-32
binary emulation work.

Some of this is still a little rough around the edges, and will need to be
revisited before 32-bit and 64-bit Linux emulation support can coexist in
the same kernel.
2004-08-16 07:55:06 +00:00
Tim J. Robbins
4af2762336 Changes to MI Linux emulation code necessary to run 32-bit Linux binaries
on AMD64, and the general case where the emulated platform has different
size pointers than we use natively:
- declare certain structure members as l_uintptr_t and use the new PTRIN
  and PTROUT macros to convert to and from native pointers.
- declare some structures __packed on amd64 when the layout would differ
  from that used on i386.
- include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h>
  if compiling with COMPAT_LINUX32. This will need to be revisited before
  32-bit and 64-bit Linux emulation support can coexist in the same kernel.
- other small scattered changes.

This should be a no-op on i386 and Alpha.
2004-08-16 07:28:16 +00:00
Tim J. Robbins
0e73a96209 Add a new type, l_uintptr_t, which is an unsigned integer type with the
same width as a pointer under Linux. Add two new macros, PTRIN and PTROUT,
which convert between l_uintptr_t and native pointers.
2004-08-16 07:05:44 +00:00
Pawel Jakub Dawidek
e81856c34c Connect RAID3 GEOM class to the build. 2004-08-16 06:36:21 +00:00
Warner Losh
b67471f34a Don't need to declare cbb module. don't know why I never saw
duplicate messages..
2004-08-16 06:33:58 +00:00
Peter Grehan
dbc13869ee Advertise that color is supported so that syscons doesn't come up
in monochrome mode when run as init.
2004-08-16 06:26:15 +00:00
Pawel Jakub Dawidek
2d1661a5b6 Introduce GEOM RAID3 class, i.e. kernel module, which implements RAID3
transformation and graid3(8) userland utility, which can be used for
configuration. No manual page yet, sorry.

Hardware provided by:	Daniel Seuffert
2004-08-16 06:23:14 +00:00
Alan Cox
c1fbc251cd - Introduce and use a new tunable "debug.mpsafevm". At present, setting
"debug.mpsafevm" results in (almost) Giant-free execution of zero-fill
   page faults.  (Giant is held only briefly, just long enough to determine
   if there is a vnode backing the faulting address.)

   Also, condition the acquisition and release of Giant around calls to
   pmap_remove() on "debug.mpsafevm".

   The effect on performance is significant.  On my dual Opteron, I see a
   3.6% reduction in "buildworld" time.

 - Use atomic operations to update several counters in vm_fault().
2004-08-16 06:16:12 +00:00
Robert Watson
40f2ac28a0 Always acquire the UNIX domain socket subsystem lock (UNP lock)
before dereferencing sotounpcb() and checking its value, as so_pcb
is protected by protocol locking, not subsystem locking.  This
prevents races during close() by one thread and use of ths socket
in another.

unp_bind() now assert the UNP lock, and uipc_bind() now acquires
the lock around calls to unp_bind().
2004-08-16 04:41:03 +00:00
Brian Feldman
7c938963a4 Rather than bringing back all of the changes to make VM map deletion
wait for system wires to disappear, do so (much more trivially) by
instead only checking for system wires of user maps and not kernel maps.

Alternative by:	tor
Reviewed by:	alc
2004-08-16 03:11:09 +00:00
Brian Feldman
8912c44d9f Add the missing knote_fdclose(). 2004-08-16 03:09:01 +00:00
Brian Feldman
1c0f9af5b5 Allocate the marker, when scanning a kqueue, from the "heap" instead of the
stack.  When swapped out, a process's kernel stack would be unavailable,
and we could get a page fault when scanning the same kqueue.

PR:	kern/61849
2004-08-16 03:08:38 +00:00
Warner Losh
9fea47c8e6 Didn't intend to commit debugging code enabled 2004-08-16 01:57:06 +00:00
Robert Watson
ce5f32de11 Annotate the current UNIX domain socket locking strategies, order,
strengths, and weaknesses in a comment.  Assert a copyright over the
changes made as part of the locking work.
2004-08-16 01:52:04 +00:00
Mike Silbersack
5173e8f567 Major enhancements to pipe memory usage:
- pipespace is now able to resize non-empty pipes; this allows
  for many more resizing opportunities

- Backing is no longer pre-allocated for the reverse direction
  of pipes.  This direction is rarely (if ever) used, so this cuts the
  amount of map space allocated to a pipe in half.

- Pipe growth is now much more dynamic; a pipe will now grow when
  the total amount of data it contains and the size of the write are
  larger than the size of pipe.  Previously, only individual writes greater
  than the size of the pipe would cause growth.

- In low memory situations, pipes will now shrink during both read
  and write operations, where possible.  Once the memory shortage
  ends, the growth code will cause these pipes to grow back to an appropriate
  size.

- If the full PIPE_SIZE allocation fails when a new pipe is created, the
  allocation will be retried with SMALL_PIPE_SIZE.  This helps to deal
  with the situation of a fragmented map after a low memory period has
  ended.

- Minor documentation + code changes to support the above.

In total, these changes increase the total number of pipes that
can be allocated simultaneously, drastically reducing the chances that
pipe allocation will fail.

Performance appears unchanged due to dynamic resizing.
2004-08-16 01:27:24 +00:00
Warner Losh
1ff2328528 Tweak the compatibility macros a little so that the device printing is
moved into them.
2004-08-15 23:39:18 +00:00
Warner Losh
cc81f0c35e Other part of the cbb isa/pci split. This likely is causing problems
wrt cbb module.
2004-08-15 23:17:54 +00:00
Marius Strobl
9c0c82c161 Add a kludge for building SBus-only kernels, i.e. kernels without support
for EBus, ISA and PCI, by compiling ofw_isa.c and ofw_pci_if.m unconditio-
nally. The correct way is to rewrite OF_decode_addr() in ofw_machdep.c in
a bus-neutral way. That's certainly possible but we unfortunately didn't
make it for FreeBSD 5.3.

Approved by:	tmm
2004-08-15 22:59:34 +00:00
Dag-Erling Smørgrav
c9b9a82654 Release the vnode cache mutex when calling vgone(), since vgone() may
sleep.  This makes pfs_exit() even less efficient than before, but on
the bright side, the vnode cache mutex no longer needs to be recursive.
2004-08-15 21:58:02 +00:00
Marius Strobl
775f3c3c28 Correct some uses of the wrong members of the *min()/*max()-familiy, e.g.
min() on unsigned long. None of these are believed to have been fatal though.

Reviewed by:	tmm
2004-08-15 21:37:52 +00:00
Alan Cox
87b9823ede - Make pmap_emulate_reference() MP and preemption safe. Previously, it
contained "sanity" checks that could be violated if another CPU modified
   the pmap between the emulation trap and locking the pmap in
   pmap_emulate_reference().  As a result, the pte could be inconsistent
   with the access that caused the emulation trap.  In such cases,
   pmap_emulate_reference() now flushes the current CPU's TLB entry and
   returns.
 - Make pmap_changebit() an inline function, reducing object code size.
2004-08-15 20:54:25 +00:00
Robert Watson
273ad9acbc Preemptive anti-footshooting: cause a #error if MP_WATCHDOG is compiled
with SCHED_ULE.
2004-08-15 20:32:40 +00:00
Robert Watson
932431328b Spell MP_WATCHDIG right: I fixed the build without MP_WATCHDOG after
testing MP_WATCHDOG, and used an incorrect ifdef.
2004-08-15 19:57:14 +00:00
Don Lewis
b6915bdbe5 Yet another tweak to the shutdown messages in boot():
Don't count busy buffers before the initial call to sync() and
  don't skip the initial sync() if no busy buffers were called.
  Always call sync() at least once if syncing is requested.  This
  defers the "Syncing disks, buffers remaining..." message until
  after the initial sync() call and the first count of busy
  buffers.  This backs out changes in kern_shutdown 1.162.

  Print a different message when there are no busy buffers after the
  initial sync(), which is now the expected situation.

  Print an additional message when syncing has completed successfully
  in the unusual situation where the work of syncing was done by
  boot().

  Uppercase one message to make it consistent with all of the other
  kernel shutdown messages.

Discussed with:	bde (in a much earlier form, prior to 1.162)
Reviewed by:	njl (in an earlier form)
2004-08-15 19:17:23 +00:00
Robert Watson
a632deec30 Add an "options MP_WATCHDOG" to i386. This option allows one of the
logical CPUs on a system to be used as a dedicated watchdog to cause a
drop to the debugger and/or generate an NMI to the boot processor if
the kernel ceases to respond.  A sysctl enables the watchdog running
out of the processor's idle thread; a callout is launched to reset a
timer in the watchdog.  If the callout fails to reset the timer for ten
seconds, the watchdog will fire.  The sysctl allows you to select which
CPU will run the watchdog.

A sample "debug.leak_schedlock" is included, which causes a sysctl to
spin holding sched_lock in order to trigger the watchdog.  On my Xeons,
the watchdog is able to detect this failure mode and break into the
debugger, which cannot otherwise be done without an NMI button.

This option does not currently work with sched_ule due to ule's push
notion of scheduling, similar to machdep.hlt_logical_cpus failing to
work with that scheduler.

On face value, this might seem somewhat inefficient, but there are a
lot of dual-processor Xeons with HTT around, so using one as a watchdog
for testing is not as inefficient as one might fear.
2004-08-15 18:02:09 +00:00
John-Mark Gurney
aafa519a46 move the declaration of struct kqlist into the non-KERNEL visable section
to fix userland.
2004-08-15 15:36:18 +00:00
Pawel Jakub Dawidek
f62d59df32 Avoid code duplication by introducing g_mirror_write_metadata() function,
which is used now by g_mirror_clear_metadata() function and
g_mirror_update_metadata() function.
2004-08-15 13:58:29 +00:00
Tim J. Robbins
ae8e14a6ac Replace linux_getitimer() and linux_setitimer() with implementations
based on those in freebsd32_misc.c, removing the assumption that Linux
uses the same layout for struct itimerval as we use natively.
2004-08-15 12:34:15 +00:00
Tim J. Robbins
d1d6dbf120 Avoid assuming that l_timeval is the same as the native struct timeval
in linux_select().
2004-08-15 12:24:05 +00:00
Tim J. Robbins
6fa534bad8 Use sv_psstrings from the current process's sysentvec structure instead
of PS_STRINGS. This is a no-op at present, but it will be needed when
running 32-bit Linux binaries on amd64 to ensure PS_STRINGS is in
addressable memory.
2004-08-15 11:52:45 +00:00
Ian Dowse
4ba861fa77 Use the USBD_FORCE_SHORT_XFER flag when setting up transmit transfers.
Without this, the device cannot detect the end of ethernet packets
whose size is a multiple of the USB packat size.

PR:		kern/70474
Submitted by:	Andrew Thompson <andy@fud.org.nz>
MFC after:	1 week
2004-08-15 10:51:21 +00:00
John-Mark Gurney
ad3b9257c2 Add locking to the kqueue subsystem. This also makes the kqueue subsystem
a more complete subsystem, and removes the knowlege of how things are
implemented from the drivers.  Include locking around filter ops, so a
module like aio will know when not to be unloaded if there are outstanding
knotes using it's filter ops.

Currently, it uses the MTX_DUPOK even though it is not always safe to
aquire duplicate locks.  Witness currently doesn't support the ability
to discover if a dup lock is ok (in some cases).

Reviewed by:	green, rwatson (both earlier versions)
2004-08-15 06:24:42 +00:00