Commit Graph

45048 Commits

Author SHA1 Message Date
Peter Grehan
174e81ed65 - add a description of what .gdbinit should contain.
- add an option for the output device in the hope that this can
  be made non-blocking at some stage.
- define an alias for the disk device, required by dev/ofw/ofw_disk.c
- shift iobus to 0x9000000 so as not to clash with the OpenFirmware
  entry point of 0x8000400 when address decoding.
- down-tone comments about the disk dev config :-)
2004-02-04 13:23:05 +00:00
Peter Grehan
0ee6dbd789 Remove pmap_pvo_allocf zone alloc function. It was a way of
using the direct-mapping of physmem to force PTE data structures
to be physically addressable so the interrupt-time real-mode
DSI trap handler could perform PTE spills. However, the memory
may have been > 256Mb, which would have caused a BAT spill and
double-interrupt.

The new trap code no longer handles PTE spills, so the requirement
that these pages be direct-mapped no longer applies. The irony is
UMA_MD_SMALL_ALLOC will return direct mappings for these structs :-)
2004-02-04 13:16:21 +00:00
Peter Grehan
112a8d7bdb Major overhaul of common trap code
- remove unused 601 and tlb exception code
 - remove interrupt-time PTE spill code. The pmap code
   will now take care of pinning kernel PTEs, and there
   are no longer issues about physical mapping of PTE
   data structures
 - All segment registers are switched on kernel entry/exit,
   allowing the kernel to have more virtual space and for
   user virtual space to extend to 4G.
 - The temporary register save area has been shifted from
   unused exception vector space to the per-cpu data area.
   This allows interrupts to be delivered to multiple CPUs
 - ISI traps no longer spill to BAT tables. It is assumed
   that all of kernel instruction memory is pinned.
 - shift from 'ldmw/stmw' instructions to individual register
   loads/stores when saving context. All PPC manuals indicate
   this should be much faster.
 - use '%r' for register names throughout.

TODO: need to test if DSI traps were the result of kernel stack
guard-page hits.

Reworked from:  NetBSD
2004-02-04 13:10:25 +00:00
Peter Grehan
a6d9116665 - remove unused trap definitions
- ISI traps are now handled by the generic trap routine
- direct diagnostic traps to DDB if defined
- remove unused asngen pcpu init
2004-02-04 13:00:56 +00:00
Peter Grehan
aa6bcb7d23 - Lots more symbols required by the new trap_subr code 2004-02-04 12:58:49 +00:00
Peter Grehan
867069044e - Add definition for GET_CPUINFO, required by new trap_subr code
- garbage-collect unused defs
2004-02-04 12:57:41 +00:00
Peter Grehan
10df017f33 Move temporary register save area from exception-vector memory to
per-CPU memory. This allows for interrupt handling on multiple CPUs.

Obtained from: NetBSD
2004-02-04 12:56:15 +00:00
Hajimu UMEMOTO
68efda090a KNF
Obtained from:	KAME
2004-02-04 12:55:45 +00:00
Peter Grehan
1ac37de6b3 - add an identify method, since the disk device used to be picked
up in the recursive OpenFirmware node walk. Rely on the psim config
file to have a "ofwdisk" device alias
- minor white space nits
2004-02-04 12:52:57 +00:00
Peter Grehan
9960916dbb Allow child devices to set the OpenFirmware device node ivar 2004-02-04 12:50:47 +00:00
Poul-Henning Kamp
08b21ed2da Do not aggressively unroll the AES implementation, in non-benchmarking use
it is same speed on small cache cpus and slower on largecache cpus.

Approved by:	sam@
2004-02-04 08:44:10 +00:00
Mike Silbersack
ff5e43a3fd Rename iov_to_uio to uiofromiov to be more consistent with other
uio* functions.

Suggested by:	bde
2004-02-04 08:43:21 +00:00
Pawel Jakub Dawidek
19b0efd32d Allow assert that the current thread does not hold the sx(9) lock.
Reviewed by:		jhb
In cooperation with:	juli, jhb
Approved by:		jhb, scottl (mentor)
2004-02-04 08:14:58 +00:00
Mike Silbersack
2ccbe4b596 Style fixes
Submitted by:	bde
2004-02-04 08:14:47 +00:00
Pawel Jakub Dawidek
4133136ba7 Add SX_UNLOCKED define. It will be used with sx_assert(9) to be
sure that current thread does not hold given sx(9) lock.

Reviewed by:	jhb
Approved by:	jhb, scottl (mentor)
2004-02-04 07:53:35 +00:00
Robert Watson
5e312ddcc6 A variety of further cleanups to ttyinfo():
- Rename temporary variable names ("tmp", "tmp2") to more informative
  names ("load", "pctcpu", "rss", ...)

- Unclutter indentation and return paths: rather than lots of nested
  ifs, simply return earlier if it's not going to work out.  Simplify
  general structure and avoid "deep" code.

- Comment on the thread/process selection and locking.

- Correct handling of "running"/"runnable" states, avoid "unknown"
  that people were seeing for running processes.  This was due to
  a misunderstanding of the more complex state machine / inhibitors
  behavior of KSE.

- Do perform ttyinfo() printing on KSE (P_SA) processes, it seems
  generally to work.

While I initially attempted to formulate this as two commits (one
layout, the other content), I concluded that the layout changes were
really structural changes.

Many elements submitted by:  bde
2004-02-04 05:46:05 +00:00
Peter Grehan
78bdfb1f1c - removed debug printf that was a false positive on non-OpenPIC systems
- white space nits
2004-02-04 04:53:09 +00:00
Bill Paul
b783c5e972 Correct/improve the implementation of NdisMAllocateSharedMemoryAsync().
Since we have a worker thread now, we can actually do the allocation
asynchronously in that thread's context. Also, we need to return a
status value: if we're unable to queue up the async allocation, we
return NDIS_STATUS_FAILURE, otherwise we return NDIS_STATUS_PENDING
to indicate the allocation has been queued and will occur later.

This replaces the kludge where we just invoked the callback routine
right away in the current context.
2004-02-04 04:44:16 +00:00
Brooks Davis
36c19a572a Add the kernel side of network interface renaming support.
The basic process is to send a routing socket announcement that the
interface has departed, change if_xname, update the sockaddr_dl
associated with the interface, and announce the arrival of the interface
on the routing socket.

As part of this change, ifunit() is greatly simplified by testing
if_xname directly.  if_clone_destroy() now uses if_dname to look up the
cloner for the interface and if_dunit to identify the unit number.

Reviewed by:	ru, sam (concept)
		Vincent Jardin <vjardin AT free.fr>
		Max Laier <max AT love2party.net>
2004-02-04 02:54:25 +00:00
Daniel Eischen
3c96f1d190 The sem_timedwait() and ksem_timedwait() functions both
need struct timespec, so define it here.

Discussed in:	standards (wollman)
2004-02-03 22:27:03 +00:00
John Baldwin
7a9d7023a2 Revert the skipping of segment register reloads as it appears to actually
be a pessimization on non Pentium4 CPUs.  More importantly, it is buggy as
it can cause GPF's when using APM or vm86.
2004-02-03 22:00:42 +00:00
Hajimu UMEMOTO
f073c60f73 pass pcb rather than so. it is expected that per socket policy
works again.
2004-02-03 18:20:55 +00:00
John Baldwin
3e9ac3ebf2 Remove a bogus assertion.
Noticed by:	bde
Pointy hat to:	jhb
2004-02-03 15:14:27 +00:00
Daniel Eischen
4e4710b784 Add prototype for sem_timedwait().
Reviewed by:	standards (Stefan Farfeleder)
2004-02-03 10:15:16 +00:00
Peter Grehan
2894a94905 Use device alias "mpic" to locate the macio OpenPIC. This works
on the new 12/15/17" PowerBooks that don't have the "interrupt-controller"
property underneath "/chosen", which was the previous way of
searching.
2004-02-03 08:00:37 +00:00
Bill Paul
cea179a3fe Implement support for single packet sends. The Intel Centrino driver
that Asus provides on its CDs has both a MiniportSend() routine
and a MiniportSendPackets() function. The Microsoft NDIS docs say
that if a driver has both, only the MiniportSendPackets() routine
will be used. Although I think I implemented the support correctly,
calling the MiniportSend() routine seems to result in no packets going
out on the air, even though no error status is returned. The
MiniportSendPackets() function does work though, so at least in
this case it doesn't matter.

In if_ndis.c:ndis_getstate_80211(), if ndis_get_assoc() returns
an error, don't bother trying to obtain any other state since the
calls may fail, or worse cause the underlying driver to crash.

(The above two changes make the Asus-supplied Centrino work.)

Also, when calling the OID_802_11_CONFIGURATION OID, remember
to initialize the structure lengths correctly.

In subr_ndis.c:ndis_open_file(), set the current working directory
to rootvnode if we're in a thread that doesn't have a current
working directory set.
2004-02-03 07:39:23 +00:00
Bruce Evans
ab2bf9ff6a Removed bogus checks that (PCPU_GET(curpcb) != NULL). Rev.1.586 of
machdep.c fixed the missing early initialization of curpcb, so curpcb
is now always set together with curthread and it cannot be NULL except
before the IDT has been set up (so trap() is unreachable) or after a
memory error.  In any case, it was often used without checking.

curcpb shouldn't exist anyway.  It doesn't exist for most non-i386 arches.
It just caches curthread->td_pcb in a global.  This was a better idea
before it was per-cpu.  trap() and some other places can get at it more
efficiently using td->td_pcb instead of PCPU_GET(curpcb).  The main
exception is support.s which mostly wants only curpcb->pcb_onfault.
2004-02-03 06:35:29 +00:00
Daniel Eischen
51305c403f Regen. 2004-02-03 05:20:28 +00:00
Daniel Eischen
12ef052ac2 Sync with kern/syscalls.master. 2004-02-03 05:18:48 +00:00
Daniel Eischen
b5426f096b Regen after adding ksem_timedwait(). 2004-02-03 05:11:31 +00:00
Daniel Eischen
aae94fbbb6 Add ksem_timedwait() to complement ksem_wait().
Glanced at by:	alfred
2004-02-03 05:08:32 +00:00
Robert Watson
4f638130c3 Don't dec/inc the amountpipes counter every time we resize a pipe --
instead, just dec/inc in the ctor/dtor.  For now, increment/decrement
in two's, since we're now performing the operation once per pair,
not once per pipe.  Not really any measurable performance change
in my micro-benchmarks, but doing less work is good, especially when
it comes to atomic operations.

Suggested by:	alc
2004-02-03 04:55:24 +00:00
Nate Lawson
526785c638 Notify the user (at kern.emerg) that the system will be shutting down if
it is still above the critical temperature on the next poll cycle.  This
is a 10 second advance notice by default.  Document the private
(non-standard) notify we will be using with devd(8).
2004-02-03 04:18:56 +00:00
Robert Watson
9a830ddc54 Catch instances of (pipe == NULL) that were obsoleted with recent
changes to jointly allocated pipe pairs.  Replace these checks
with pipe_present checks.  This avoids a NULL pointer dereference
when a pipe is half-closed.

Submitted by:	Peter Edwards <peter.edwards@openet-telecom.com>
2004-02-03 02:50:51 +00:00
John Baldwin
b56ef1c10d Drop the reference count on the old vmspace after fully switching the
current thread to the new vmspace.

Suggested by:	dillon
2004-02-02 23:23:48 +00:00
John Baldwin
b71aa5f5e9 Set PCPU_GET(curpcb) for the BSP to thread0's pcb. Otherwise, the boot CPU
doesn't have a pcb until after it's first context switch.  This can cause
secondary panics if a page fault happens during bootup.
2004-02-02 23:22:24 +00:00
Andre Oppermann
b74d89bbbb Add sysctl net.inet.icmp.reply_src to specify the interface name
used for the ICMP reply source in reponse to packets which are not
directly addressed to us.  By default continue with with normal
source selection.

Reviewed by:	bms
2004-02-02 22:53:16 +00:00
Andre Oppermann
1488eac8ec More verbose description of the source ip address selection for ICMP replies.
Reviewed by:	bms
2004-02-02 22:17:09 +00:00
John Baldwin
9c9c52a3ed - Assert that witness_cold is not true in enroll().
- Only check witness_watch once in enroll().

Reported by:	ru (2)
2004-02-02 22:15:17 +00:00
Brooks Davis
ccb82468ac More macro cleanup. Use the system roundup2() macro instead of making
our own ROUNDUP() macro.

Suggested by:	bde
2004-02-02 21:55:34 +00:00
Paul Saab
65fd52fc8b Reserve 187 (twa) for the new 3ware ATA RAID controller. 2004-02-02 20:00:56 +00:00
Poul-Henning Kamp
0ed4f6a180 Allow a GEOM class to unload if it has no geoms or a method function to
get rid of them.

Prodded by:	pjd
2004-02-02 19:49:41 +00:00
Pawel Jakub Dawidek
3410b19324 Fix many issues related to mount/unmount:
1. Root from inside a jail was able to unmount any file system
   (except /).
2. Unprivileged root was able to unmount file systems mounted by
   privileged root (execpt /).
3. User from inside a jail was able to mount file system when
   sysctl vfs.usermount was set to 1.
4. User was able to mount file system when vfs.usermount was set to 1
   (that's ok) and unmount it even if vfs.usermount was equal to 0
   (that's not correct).

Possibility from point 1 was reported by: Dariusz Kowalski <darek@76.pl>

Only a part of this fix will be MFC'ed (if approved).

PR:		kern/60149
Reviewed by:	rwatson
Approved by:	scottl (mentor)
MFC after:	3 days
2004-02-02 19:02:05 +00:00
Pawel Jakub Dawidek
43a55a72ef Added flag MNT_USER to MNT_UPDATEMASK, it will be used for detecting
file systems mounted by unprivileged users.

Reviewed by:	rwatson
Approved by:	scottl (mentor)
MFC after:	3 days
2004-02-02 18:24:29 +00:00
Nate Lawson
322141f1e2 If the temperature is at _HOT or _CRT for 3 sequential readings, shutdown
the system.  Also, decrease the poll interval to 10 seconds from 30
seconds.  This is needed because some systems will report an invalid high
temperature for one poll cycle.  It is suspected this is due to the
embedded controller timing out.  A typical value is 138C for one cycle on a
system that is otherwise 65C.  This prevents the system from prematurely
shutting down after one invalid reading.  It will still shut down after 30
seconds of high temperature, which is the same as previous default
behavior.

Tested by:	Scott Lambert <lambert AT lambertfam.org>
2004-02-02 18:03:35 +00:00
Pawel Jakub Dawidek
cff2ddaeb2 - Use proper names in KASSERTs.
- Typos.

Approved by:	phk, scottl (mentor)
2004-02-02 17:50:09 +00:00
Poul-Henning Kamp
c740ae4b46 Add CRD_F_KEY_EXPLICIT which allows the key to be changed per
operation, just like it was possible to change the IV.

Currently supported on Hifn and software engines only.

Approved by:	sam@
2004-02-02 17:06:34 +00:00
Søren Schmidt
b8f6dec455 Move the enabling of interrupt back to where it was some time ago.
This apparently was what broke the boot with some devices (liteon).
2004-02-02 15:49:01 +00:00
MIHIRA Sanpei Yoshiro
e08f155b25 MFNetBSD: URL updates(rev.1.108) 2004-02-02 15:00:15 +00:00
Søren Schmidt
6595b49405 Fix support for the Promise TX4 on amd64.
Somehow the bridge on there shows up with another PCI id than
it does on x86, no idea why...
2004-02-02 14:05:57 +00:00
Poul-Henning Kamp
abc2e0fd56 Check error return from g_clone_bio(). (netchild@)
Rearrange code to avoid duplication (phk@)

Submitted by:	netchild@
2004-02-02 13:36:06 +00:00
Poul-Henning Kamp
3e5b686160 Check error return from g_clone_bio(). (netchild@)
Add XXX comment about why this is still not optimal. (phk@)

Submitted by:	netchild@
2004-02-02 13:08:03 +00:00
Poul-Henning Kamp
42fd931ee9 GC old unused dev_t mangling stuff. 2004-02-02 12:57:49 +00:00
Poul-Henning Kamp
793ffa8e55 Don't mingle malloc/g_event flags.
Spotted by:	pjd@
2004-02-02 10:58:07 +00:00
Jeff Roberson
fe5efaede8 - Make sure the apic is idle before sending an IPI. This is required on
non-X-APIC machines.  Previously this was only done in the
   DETECT_DEADLOCK case when really it is needed in all cases.

Reminded by:	jhb
2004-02-02 09:50:43 +00:00
Mike Silbersack
02ec600572 Remove debugging code that slipped into the previous commit.
Spotted by:	bde
2004-02-02 09:09:59 +00:00
Jeff Roberson
b209e5e3e4 - style fixes to the critical_exit() KASSERT().
Submitted by:	bde
2004-02-02 08:13:27 +00:00
Jeff Roberson
7b09539ce2 - Use a seperate startup function for the zeroidle kthread. Use this to
set P_NOLOAD prior to running the thread.
2004-02-02 07:51:03 +00:00
Peter Grehan
aa1985722c Add new Apple GEM PCI id. 2004-02-02 01:11:39 +00:00
David E. O'Brien
02c4c7b81f Remove a device that will compile fine, isn't 64-bit clean. 2004-02-02 00:54:59 +00:00
Robert Watson
91c2dc9478 Commit file missed in last pass: MAC api uses 'struct pipepair', not
'struct pipe' now.
2004-02-01 21:52:09 +00:00
Bill Paul
f0aed0dbd0 Use the OID_802_11_CONFIGURATION OID when deciding if the underlying driver
is for an 802.11 device or not. At least one driver I have does not
support the OID_802_11_NETWORK_TYPES_SUPPORTED OID.

Also, for now, don't do anything special in the ndis_suspend() method.
I originally wanted to shut down the NIC but leave the IFF_UP flag alone
since technically the interface is meant to remain up, but an interrupt
may be delivered to the ISR on suspend, and if this happens while the
NIC is halted, we will crash, since none of the miniport driver methods
will function.

This needs to be dealt with properly later, but for now this prevents
a panic, and the resume method properly re-inits the NIC.
2004-02-01 21:35:15 +00:00
Alan Cox
8600a4122a Eliminate all TLB shootdowns by pmap_pte_quick(): By temporarily pinning
the thread that calls pmap_pte_quick() and by virtue of the page queues
lock being held, we can manage PADDR1/PMAP1 as a CPU private mapping.

The most common effect of this change is to reduce the overhead of the page
daemon on multiprocessors.

In collaboration with:  tegge
2004-02-01 20:14:00 +00:00
Jeff Roberson
0392e39dff - Allow interactive tasks to use the maximum time-slice. This is not as
detrimental as I thought it would be in the case of massive process
   storms from a shell and it makes regular desktop usage noticeably
   better.
2004-02-01 10:38:13 +00:00
Mike Silbersack
beb699c7ba Rewrite sendfile's header support so that headers are now sent in the first
packet along with data, instead of in their own packet.  When serving files
of size (packetsize - headersize) or smaller, this will result in one less
packet crossing the network.  Quick testing with thttpd and http_load has
shown a noticeable performance improvement in this case (350 vs 330 fetches
per second.)

Included in this commit are two support routines, iov_to_uio, and m_uiotombuf;
these routines are used by sendfile to construct the header mbuf chain that
will be linked to the rest of the data in the socket buffer.
2004-02-01 07:56:44 +00:00
Jeff Roberson
f2f51f8ab8 - Disable ithread binding in all cases for now. This doesn't make as much
sense with sched_4bsd as it does with sched_ule.
 - Use P_NOLOAD instead of the absence of td->td_ithd to determine whether or
   not a thread should be accounted for in sched_tdcnt.
2004-02-01 06:20:18 +00:00
Jeff Roberson
aaa8bb1604 - Fix a problem where we did not drain the cache of buckets in the zone
when uma_reclaim() was called.  This was introduced when the zone
   working-set algorithm was removed in favor of using the per cpu caches
   as the working set.
2004-02-01 06:15:17 +00:00
Robert Watson
4795b82c13 Coalesce pipe allocations and frees. Previously, the pipe code
would allocate two 'struct pipe's from the pipe zone, and malloc a
mutex.

- Create a new "struct pipepair" object holding the two 'struct
  pipe' instances, struct mutex, and struct label reference.  Pipe
  structures now have a back-pointer to the pipe pair, and a
  'pipe_present' flag to indicate whether the half has been
  closed.

- Perform mutex init/destroy in zone init/destroy, avoiding
  reallocating the mutex for each pipe.  Perform most pipe structure
  setup in zone constructor.

- VM memory mappings for pageable buffers are still done outside of
  the UMA zone.

- Change MAC API to speak 'struct pipepair' instead of 'struct pipe',
  update many policies.  MAC labels are also handled outside of the
  UMA zone for now.  Label-only policy modules don't have to be
  recompiled, but if a module is recompiled, its pipe entry points
  will need to be updated.  If a module actually reached into the
  pipe structures (unlikely), that would also need to be modified.

These changes substantially simplify failure handling in the pipe
code as there are many fewer possible failure modes.

On half-close, pipes no longer free the 'struct pipe' for the closed
half until a full-close takes place.  However, VM mapped buffers
are still released on half-close.

Some code refactoring is now possible to clean up some of the back
references, etc; this patch attempts not to change the structure
of most of the pipe implementation, only allocation/free code
paths, so as to avoid introducing bugs (hopefully).

This cuts about 8%-9% off the cost of sequential pipe allocation
and free in system call tests on UP and SMP in my micro-benchmarks.
May or may not make a difference in macro-benchmarks, but doing
less work is good.

Reviewed by:	juli, tjr
Testing help:	dwhite, fenestro, scottl, et al
2004-02-01 05:56:51 +00:00
Jeff Roberson
40ece05382 - Revert rev 1.240 we no longer need a kthread for loadav(). 2004-02-01 05:37:36 +00:00
Jeff Roberson
e7f004fe23 - Use sched_load() rather than grabbing the sx lock and traversing the proc
table to discover the load.
2004-02-01 02:51:33 +00:00
Jeff Roberson
33916c360e - Add a new member to struct kseq called ksq_sysload. This is intended to
track the load for the sched_load() function.  In the SMP case this member
   is not defined because it would be redundant with the ksg_load member
   which already tracks the non ithd load.
 - For sched_load() in the UP case simply return ksq_sysload.  In the SMP
   case traverse the list of kseq groups and sum up their ksg_load fields.
2004-02-01 02:48:36 +00:00
Jeff Roberson
ca59f15272 - Keep a variable 'sched_tdcnt' that is used for the local implementation
of sched_load().  This variable tracks the number of running and runnable
   non ithd threads.  This removes the need to traverse the proc table and
   discover how many threads are runnable.
2004-02-01 02:46:47 +00:00
Jeff Roberson
b654d10049 - Add a sched API entry point that returns the system load. This load should
not include any ithreads.
 - Document the difference between sched_load() and sched_runnable() as they
   are very similar.
2004-02-01 02:44:35 +00:00
Robert Watson
fca542bcaa Move KASSERT regarding td_critnest to after the value of td is set to
curthread, to avoid warning and incorrect behavior.

Hoped not to mind:	jeff
2004-02-01 02:31:36 +00:00
Jeff Roberson
6767c6547b - Assert that td_critnest > 0 in critical_exit() to catch cases of
unbalanced uses of the critical_* api.
2004-02-01 01:24:54 +00:00
Robert Watson
26518e8d8c Fix an error in a KASSERT string: it's pipe_free_kmem(), not
pipespace(), that contains this KASSERT.
2004-01-31 23:03:22 +00:00
Takeshi Shibagaki
386a89ed83 Compiled longrun.c when defined options CPU_ENABLE_LONGRUN,
and fixed wrong comparation in cpu vendor. Longrun function
was re-enabled.
2004-01-31 20:14:44 +00:00
Warner Losh
20d6d1bd21 Add the Canon N1240U to the mix. It appears to be similar to the
1220U and supported by sane

# someone should update the man page to include all the devices that
# uscanner supports.
2004-01-31 18:12:18 +00:00
Poul-Henning Kamp
be8a62e821 Introduce the SO_BINTIME option which takes a high-resolution timestamp
at packet arrival.

For benchmarking purposes SO_BINTIME is preferable to SO_TIMEVAL
since it has higher resolution and lower overhead.  Simultaneous
use of the two options is possible and they will return consistent
timestamps.

This introduces an extra test and a function call for SO_TIMEVAL, but I have
not been able to measure that.
2004-01-31 10:40:25 +00:00
David E. O'Brien
f191a0bcf6 Bump the NFCv3/TCP defaults for rsize and wsize from 8K to 32K to match
Solaris and HP-UX.  This increases read performance for large files across NFS.

PR:		62024 & 26324
Submitted by:	Bjoern Groenvall <bg@sics.se>
2004-01-31 10:40:15 +00:00
Alan Cox
bfb7317ebf Remove unnecessary vm object reference and deallocate calls from ffs_read()
and ffs_write().  These calls trace their origins to the dead vfs_ioopt
code, first appearing in revision 1.39 of ufs_readwrite.c.

Observed by:	bde
Discussed with:	tegge
2004-01-31 05:42:58 +00:00
Søren Schmidt
367d380b54 Be more robust in the probe. We dont want to get into a loop with
reinitting when we try to identify devices. If they dont interrupt
on identify we retry once. If this fails we simply ignore that device.
2004-01-30 19:16:08 +00:00
Dag-Erling Smørgrav
e726bc0e6c Mechanical whitespace cleanup. 2004-01-30 16:26:29 +00:00
Hartmut Brandt
a1adb510b2 Use the official ng_timeout function to trigger sending. This means,
that we can get rid of of all the spl*() calls, because ng_timeout
handles the locking issues.
2004-01-30 15:34:57 +00:00
Hidetoshi Shimokawa
dbc80c7bf2 Add NEC uPD72873.
Submitted by: Christian Laursen <xi@borderworlds.dk>
2004-01-30 14:30:19 +00:00
Hidetoshi Shimokawa
b180671ce4 Use device_identify and bus_add_child methods to add a firewire
bus on fwohci. This should fix attach failure caused by a race
between firewire and fwochi initialization for the kernel module.
2004-01-30 14:28:11 +00:00
Daniel Eischen
d9fece91e0 Bump __FreeBSD_version to note the change of default thread library
from libc_r to libpthread.
2004-01-30 13:43:51 +00:00
Yoshihiro Takahashi
63c69957ca MFi386: revision 1.397 (cosmetic changes) 2004-01-30 13:15:42 +00:00
Yoshihiro Takahashi
6c5786f2da MFi386: revision 1.1122 (typos and cosmetic changes) 2004-01-30 13:06:57 +00:00
Maxim Sobolev
4c83789253 Remove NetBSD'isms (add FreeBSD'isms?), which makes gre(4) working again. 2004-01-30 09:03:01 +00:00
Scott Long
9148fa21dd Take the plunge and make this driver be INTR_FAST. This re-arranges the
interrupt handler so that no locks are needed, and schedules the
command completion routine with a taskqueue_fast.  This also corrects the
locking in the command thread and removes the need for operation flags.

Simple load tests show that this is now considerably faster than FreeBSD 4.x
in the SMP case when multiple i/o tasks are running.
2004-01-30 07:04:39 +00:00
Peter Wemm
3a0bfa76fd GRR. MFi386: white space spam 2004-01-30 03:02:45 +00:00
Peter Wemm
8a703d13b0 Merge some more changes from i386. 2004-01-30 00:24:45 +00:00
Jens Schweikhardt
08e33a7ff1 Consistently capitalize acronyms like POSIX and NIC. Style. 2004-01-29 21:24:53 +00:00
Jens Schweikhardt
495b73cfe0 Fix typos and remove whitespace at EOL. 2004-01-29 21:07:54 +00:00
Søren Schmidt
f279a36c6e Cleanups/cosmetics. 2004-01-29 15:03:01 +00:00
Ken Smith
4a98f6820b Fix pathname so 'make tags' in a kernel build directory looks in
the right place for the $MACHINE/include directory.

Approved by:	rwatson (mentor)
2004-01-29 14:58:22 +00:00
Michael Reifenberger
a905454644 Add dependency to snd_via8233 2004-01-29 14:11:03 +00:00
Bruce Evans
9a44a82b61 Fixed breakage of scheduling in rev.1.29 of subr_4bsd.c. The
"scheduler" here has very little to do with scheduling.  It is actually
the swapper, and it really must be the last SYSINIT'ed item like its
comment says, since proc0 metamorphoses into swapper by calling
scheduler() last in mi_start(), and scheduler() never returns..  Rev.1.29
of subr_4bsd.c broke this by adding another SI_ORDER_FIRST item
(kproc_start() for schedcpu_thread() onto the SI_SUB_RUN_SCHEDULER_LIST.
The sorting of SYSINITs with identical orders (at all levels) is
apparently nondeterministic, so this resulted in schedule() sometimes
being called second last and schedcpu_thread() not being called at all.

This quick fix just changes the code to almost match the comment
(SI_ORDER_FIRST -> SI_ORDER_ANY).  "LAST" is misspelled "ANY", and
there is no way to ensure that there is only 1 very lst SYSINIT.
A more complete fix would remove the SYSINIT obfuscation.
2004-01-29 12:35:11 +00:00
Matt Jacob
eedb2dfec3 Fix a bug where we never managed to include the sense data we wanted to send. 2004-01-29 06:36:30 +00:00
Bill Paul
e2402a9b9b Go back to using AUTHMODE_AUTO if WEP is on. In some cases, the Centrino
won't associate in BSS mode if you use AUTHMODE_SHARED. I probably don't
understand enough to know when SHARED should be used vs. OPEN or WPA.
For now, go back to what works.
2004-01-29 03:16:58 +00:00
Matt Jacob
ac9d0a02cf Fix longstanding buglet- for centrally handled CTIO2s we were checking the wrong
bit for this being the  last CTIO2.  It didn't matter since it really was the
last CTIO2 and the resources recycled, but still....

Add in CTIO3 define for future DAC work.
2004-01-29 02:40:43 +00:00
Robert Watson
30a9f26db2 Assert process lock in ptracestop(), since we're going to rely
on it, and later unlock it.
2004-01-29 00:58:21 +00:00
Peter Grehan
0efd0097cb When UMA_MD_SMALL_ALLOC is defined, pmap_kextract will be called
for direct-mapped addresses. Assume that any address less than KVA
is one of these and return it. Also assert that an address is KVA
does have a valid mapping - callers of pmap_kextract don't check
the return value, since they assume that they have a valid virtual
address.
2004-01-29 00:45:41 +00:00
Peter Grehan
db55e39aa1 Implement UMA_MD_SMALL_ALLOC, since the BAT registers allow direct
addressing of memory. Makes a substantial improvement for apps that
stress the limited amount of KVM on PPC (e.g. untarring the ports tree).

uma_machdep.c stolen from amd64/ia64.
2004-01-29 00:32:22 +00:00
Peter Wemm
ac498460b2 Re-add debug register support.
Some other minor tweaks snuck in here, including supporting more
discontiguous memory segments and some cosmetic tweaks.
2004-01-29 00:07:29 +00:00
Peter Wemm
170a05510d Re-add user_dbreg_trap() for debug register support 2004-01-29 00:05:03 +00:00
Peter Wemm
db5272252f Take another shot at the invariants calls to __panic. They hadn't been
updated for the regparm ABI on amd64.
Context switch debug regs.
Update for fpu simplification
Don't needlessly reload %cr3, in case the cpu has the tlb flush filter
turned off.  Re-add LAZY_SWITCH stubs.
2004-01-29 00:02:54 +00:00
Peter Wemm
fdf00d6d6c deal with dbregs for fork etc
update for fpu.c simplification
Merge #include sort from i386
2004-01-28 23:58:55 +00:00
Peter Wemm
bb2fbc41af Un-stub the hardware debug register stuff. 2004-01-28 23:57:40 +00:00
Peter Wemm
eb18d248ee Export PCB_DR* symbols 2004-01-28 23:57:02 +00:00
Peter Wemm
1c89210c83 We can simplify a lot of things now that we don't have to worry about
hardware bugs on external 386 cpus and now that we can depend on SSE.
2004-01-28 23:55:58 +00:00
Peter Wemm
d957532a87 Add dbreg struct definitions for /proc/*/dbregs and a place to store the
registers in the pcb
2004-01-28 23:54:31 +00:00
Peter Wemm
1182b177ff Re-add debug register functions 2004-01-28 23:53:04 +00:00
Peter Wemm
b29fd7c4db MFi386: mp_topology(). 2004-01-28 23:51:16 +00:00
Peter Wemm
5e465ab919 MFi386: add THERMTRIP msr values 2004-01-28 23:47:22 +00:00
Peter Wemm
4612a96f08 Diff reduction with i386 2004-01-28 23:46:48 +00:00
Peter Wemm
996a568eda Regen 2004-01-28 23:45:48 +00:00
Peter Wemm
0e3a9619ad Add getitimer swab stub 2004-01-28 23:45:37 +00:00
Robert Watson
94ffb20d72 Add a reset sysctl for mutex profiling: zeros all of the mutex
profiling buffers and hash table.  This makes it a lot easier to
do multiple profiling runs without rebooting or performing
gratuitous arithmetic.  Sysctl is named debug.mutex.prof.reset.

Reviewed by:	jake
2004-01-28 22:11:53 +00:00
Søren Schmidt
175352f07c Fix for those lost interrupts on probe on lots of controller types.
Note to self, just because an idea is good, it doesn't apply everywhere.
2004-01-28 21:54:40 +00:00
Peter Wemm
d0f2d056fa MFi386: change an outb to a DELAY() 2004-01-28 20:46:31 +00:00
John Baldwin
d5b75694e7 Move the loadav() callout into its own kthread since it uses allproc_lock
which is a sleepable lock and thus is not safe to acquire from a callout
routine.
2004-01-28 20:44:41 +00:00
John Baldwin
5352136a25 Optimize the i386 interrupt entry code to not reload the segment registers
if they already contain the correct kernel selectors.

Reviewed by:	peter
Suggested by:	peter
2004-01-28 20:44:08 +00:00
John Baldwin
8d768e7676 Rework witness_lock() to make it slightly more useful and flexible.
- witness_lock() is split into two pieces: witness_checkorder() and
  witness_lock().  Witness_checkorder() determines if acquiring a specified
  lock at the time it is called would result in a lock order.  It
  optionally adds a new lock order relationship as well.  witness_lock()
  updates witness's data structures to assume that a lock has been acquired
  by stick a new lock instance in the appropriate lock instance list.
- The mutex and sx lock functions now call checkorder() prior to trying to
  acquire a lock and continue to call witness_lock() after the acquire is
  completed.  This will let witness catch a deadlock before it happens
  rather than trying to do so after the threads have deadlocked (i.e. never
  actually report it).
- A new function witness_defineorder() has been added that adds a lock
  order between two locks at runtime without having to acquire the locks.
  If the lock order cannot be added it will return an error.  This function
  is available to programmers via the WITNESS_DEFINEORDER() macro which
  accepts either two mutexes or two sx locks as its arguments.
- A few simple wrapper macros were added to allow developers to call
  witness_checkorder() anywhere as a way of enforcing locking assertions
  in code that might acquire a certain lock in some situations.  The
  macros are: witness_check_{mutex,shared_sx,exclusive_sx} and take an
  appropriate lock as the sole argument.
- The code to remove a lock instance from a lock list in witness_unlock()
  was unnested by using a goto to vastly improve the readability of this
  function.
2004-01-28 20:39:57 +00:00
Søren Schmidt
816994ccc8 Use the biotask functionality in GEOM to put finished requests on
instead of taskqueue_swi. This shaves from 1 to 10% of the overhead.

Overhaul the locking once more, there was a few possible races that
are now closed.
2004-01-28 20:38:51 +00:00
John Baldwin
62a0fd943c Use mtx_assert() rather than using a home-rolled version. 2004-01-28 20:26:39 +00:00
Hajimu UMEMOTO
328a040858 protect access to ifnet structure with mutex. 2004-01-28 15:01:39 +00:00
Poul-Henning Kamp
5fcf4e4398 Bring back the geom_bioqueues, they _are_ a good idea.
ATA will uses these RSN.
2004-01-28 08:39:18 +00:00
Don Lewis
12e524a290 Change KASSERT() in feed_vchan16() into an explicit test and call to
panic() so that the buffer overflow just beyond this point is always
caught, even when the code is not compiled with INVARIANTS.

Change chn_setblocksize() buffer reallocation code to attempt to avoid
the feed_vchan16() buffer overflow by attempting to always keep the
bufsoft buffer at least as large as the bufhard buffer.

Print a diagnositic message
	Danger! %s bufsoft size increasing from %d to %d after CHANNEL_SETBLOCKSIZE()
if our best attempts fail.  If feed_vchan16() were to be called by
the interrupt handler while locks are dropped in chn_setblocksize()
to increase the size bufsoft to match the size of bufhard, the panic()
code in feed_vchan16() will be triggered.  If the diagnostic message
is printed, it is a warning that a panic is possible if the system
were to see events in an "unlucky" order.

Change the locking code to avoid the need for MTX_RECURSIVE mutexes.

Add the MTX_DUPOK option to the channel mutexes and change the locking
sequence to always lock the parent channel before its children to avoid
the possibility of deadlock.

Actually implement locking assertions for the channel mutexes and fix
the problems found by the resulting assertion violations.

Clean up the locking code in dsp_ioctl().

Allocate the channel buffers using the malloc() M_WAITOK option instead
of M_NOWAIT so that buffer allocation won't fail.  Drop locks across
the malloc() calls.

Add/modify KASSERTS() in attempt to detect problems early.

Abuse layering by adding a pointer to the snd_dbuf structure that points
back to the pcm_channel that owns it.  This allows sndbuf_resize() to do
proper locking without having to change the its API, which is used by
the hardware drivers.

Don't dereference a NULL pointer when setting hw.snd.maxautovchans
if a hardware driver is not loaded.  Noticed by Ryan Sommers
<ryans at gamersimpact.com>.

Tested by:	Stefan Ehmann <shoesoft AT gmx.net>
Tested by:	matk (Mathew Kanner)
Tested by:	Gordon Bergling <gbergling AT 0xfce3.net>
2004-01-28 08:02:15 +00:00
Peter Pentchev
1b8c233de3 Add an ACPI_FUNCTION_TRACE() to the newly-added acpi_Startup() routine
to get the ACPI_DEBUG case (and LINT in particular) to build.

Reviewed by:	jhb, njl
Approved by:	jhb
2004-01-28 07:48:03 +00:00
Nate Lawson
5de6c5b5a5 If not in the debugger or if the user requests it with the
debug.ddb_use_printf sysctl, output kernel debugger data to both the
console and kernel message buffer via printf.  This fixes the case where
backtrace() went directly to the console and should help debugging greatly.
Thanks to Ian Dowse for the work, minor edits or any bugs are by myself.

Submitted by:	iedowse
2004-01-28 06:51:18 +00:00
Robert Watson
265ef81196 Remove process lock XXX's, fixed in src/sys/sys/proc.h:1.366. 2004-01-28 06:48:31 +00:00
Alexander Kabaev
975634280a Move the part of the comment which applies to osigsuspend where
it belongs. The current sigsuspend syscall does expect a pointer
to the mask as argument.

Submitted by:	Igor Sysoev <is at rambler-co dot ru>
2004-01-28 06:06:04 +00:00
David E. O'Brien
66c59e7562 Always build ext2fs module. There is no written policy preventing the
building of GPL'ed modules.
2004-01-28 04:16:13 +00:00
Yoshihiro Takahashi
6bef25432c MFi386: revision 1.33
PR:	kern/62005
2004-01-28 04:15:31 +00:00
David E. O'Brien
848b79deef Enable ndis for AMD64 (for the time that modules are supported)... 2004-01-28 04:15:10 +00:00
Maksim Yevmenkin
18d948adb1 Add NO_BLUETOOTH knob to the build process
Requested by:	phk
Reviewed by:	imp (mentor), ru
2004-01-28 00:42:51 +00:00
Ruslan Ermilov
0ca2861fc9 Correct the descriptions of the net.inet.{udp,raw}.recvspace sysctls. 2004-01-27 22:17:39 +00:00
Jens Schweikhardt
2b51e103f6 Sync with Oxford Dictionary. Style (add missing full stops) while I'm here. 2004-01-27 22:15:03 +00:00
Ruslan Ermilov
4296e6f8b8 Correct the description of the net.graph.recvspace sysctl. 2004-01-27 22:02:01 +00:00
Marcel Moolenaar
a753b14687 Sort PFIL_HOOKS. 2004-01-27 20:22:53 +00:00
Robert Watson
4158244cc0 Allow the use of a stale p_stops value in STOPEVENT(), grabbing
the proc lock only if we actually need to perform a stop.  This
avoids two locks and unlocks of the process lock each system call,
and wins me about 20% on a simply system call test (getuid(),
which would otherwise require no locking).  This also has a net
improvement of about 10MB/s on some of the SMP bandwidth tests
I'm running.

Reviewed by:	jhb
2004-01-27 20:21:07 +00:00
Brooks Davis
a8773564ca Cleanup malloc() use in if_attach():
- malloc() returns a void* and does not need a cast
 - when called with M_WAITOK, malloc() can not return NULL so don't
   check for that case.  The result of the check was bogus anyway since
   it would leave the interface broken.
2004-01-27 19:35:05 +00:00
Dag-Erling Smørgrav
2845024409 Fix a reentrancy issue in md5_calc(). 2004-01-27 18:57:21 +00:00
Sam Leffler
8381996e5d o add missing break
o remove extraneous bzero
o add SYSINIT to properly initialize ip4_def_policy

Submitted by:	"Bjoern A. Zeeb" <bzeeb+freebsd@zabbadoz.net>
Submitted by:	gnn@neville-neil.com
2004-01-27 17:45:28 +00:00
Sam Leffler
8976be9465 change SYSINIT starting point to be consistent with other modules 2004-01-27 17:43:49 +00:00
Sam Leffler
6fd91c14d6 add spdcachelookup and spdcachemiss to our version of struct ipsecstat so
netstat works properly

Submitted by:	"Bjoern A. Zeeb" <bzeeb+freebsd@zabbadoz.net>
2004-01-27 17:42:57 +00:00
Dag-Erling Smørgrav
84344f9fbf Rename the kern.vm.kmem.size tunable to the more logical vm.kmem_size. To
assure backward compatibility (conditional on !BURN_BRIDGES), look it up
by its old name first, and log a warning (but accept the setting) if it
was found.  If both the old and new name are defined, the new name takes
precedence.

Also export vm.kmem_size as a read-only sysctl variable; I find it hard to
tune a parameter when I don't know its default value, especially when that
default value is computed at boot time.
2004-01-27 15:59:38 +00:00
Dag-Erling Smørgrav
823261a3e1 While USB keyboards attach as ukbd[0-9]+, the device node created by
kbd_attach() is called kbd[0-9]+, with a different unit number.  This
makes it impossible to write a devd rule which will automatically
switch to a USB keyboard when one is attached, because there is no way
to guess the correct device node to pass to kbdcontrol.

Therefore, change kbd_attach() to create a device node using the
keyboard device's real name (atkbd0, ukbd0...), and create the
kbd[0-9]+ node as an alias for backward compatibility.
2004-01-27 15:40:30 +00:00
Yoshihiro Takahashi
41319fae45 The ataraid device is not needed for pc98. 2004-01-27 15:39:32 +00:00
Ken Smith
8ecb006f39 - Fix for sparc64 to use new __panic() function
Adapted from patch by:	David Cornejo <dcornejo@firetide.com>
Reviewed by:		freebsd-sparc64 (harti)
Approved by:		rwatson (mentor)
2004-01-27 15:02:18 +00:00
Andrey A. Chernov
a0036d23a6 Turn uio_resid/uio_offset comments into KASSERTs
Reviewed by:    bde
2004-01-27 11:28:38 +00:00
Hartmut Brandt
4e0dea9a30 Don't confuse NULL and 0, use 0 where an integer is expected. 2004-01-27 10:46:33 +00:00
Hartmut Brandt
76bd585721 Style: add __FBSDID, relocate some { that were on the wrong line,
correct some indendation, change __FUNCTION__ to __func__ and remove
a local KASSERT definition.
2004-01-27 10:45:37 +00:00
Bill Paul
5d2b8edda2 This should have been checked in as part of the last update to if_ndis.c:
add yet another member to the ndis_softc as part of the workaround for
the net80211 dain bramage.
2004-01-27 09:08:12 +00:00
Bill Paul
3f7266edd6 Implement NdisVirtualBufferAddress() and NdisVirtualBufferAddressSafe().
The RealTek 8180 driver seems to need this.
2004-01-27 08:10:34 +00:00
Bill Paul
215e951637 Add a kludge to avoid having ndis_init() called needlessly by dhclient
on an SIOCSIFADDR (by way of brain damage in net80211).

Also, avoid trying to set NDIS_80211_AUTHMODE_AUTO since the Microsoft
documentation I have recommends not using it, and the Centrino driver
seems to dislike being told to use it.
2004-01-27 07:57:42 +00:00
Nate Lawson
e0ccb58ad9 Add TUNABLE_STR to make "hw.acpi.os_name" more correct. However, the call
to getenv_string() still doesn't work.
2004-01-27 06:07:09 +00:00
Robert Watson
bfd8097a69 Stick two XXX's in the syscall() code: we call STOPEVENT() twice for
every system call, and that grabs and release the process lock each
time.  Don't fix it (yet), but document it so we know to fix it.
Also should be a 5.3-RELEASE todo item.
2004-01-27 04:40:19 +00:00
Brooks Davis
8abaf58586 Clean up macro usage in if_attach():
- Use the system offsetof macro rather then making out own.
 - undef ROUND after we use it rather then polluting the whole file.
2004-01-27 03:15:09 +00:00
Bill Paul
0a4ab0aeef Use the M_BZERO flag with malloc() in a couple of places. 2004-01-27 03:14:59 +00:00
Bill Paul
581b0a24bc Reorganize the timer code a little and implement NdisInitializeTimer()
and NdisCancelTimer(). NdisInitializeTimer() doesn't accept an NDIS
miniport context argument, so we have to derive it from the timer
function context (which is supposed to be the adapter private context).
NdisCancelTimer is now an alias for NdisMCancelTimer().

Also add stubs for NdisMRegisterDevice() and NdisMDeregisterDevice().
These are no-ops for now, but will likely get fleshed in once I start
working on the Am1771/Am1772 wireless driver.
2004-01-26 21:21:53 +00:00
John Baldwin
afa632035c - Call acpi_Startup() before parsing interrupt-related APIC resources so we
can look at the ACPI tables.  If the startup fails, we panic and tell the
  user to try rebooting with ACPI disabled.  Previously in this case we
  would try to use $PIR interrupt routing which only works for the atpic
  while using the apic to handle interrupts which would result in misrouted
  interrupts and a hang at boot time with no error message.
- Read the SCI out of the FADT instead of hardcoding 9 when checking to see
  if an interrupt override entry is for the SCI.
- Try to work around some BIOS brain damage for the SCI's programming by
  forcing the SCI to be level triggered and active low if it is routed
  to a non-ISA interrupt (greater than 15) or if it is identity mapped with
  edge trigger and active high polarity.  This should fix some of the hangs
  with device apic and ACPI that some people see.

Reviewed by:	njl
2004-01-26 19:34:24 +00:00
John Baldwin
bbc2815c8d Move the code to initialize ACPI-CA into a separate acpi_Startup() function
that other modules can call to initialize ACPI-CA before the new-bus probe
and change acpi_identify() to call it.

Reviewed by:	njl
2004-01-26 19:29:04 +00:00
Hartmut Brandt
3b3948e881 Get rid of the last two uses of NG_NODELEN + 1 in the base system by
replacing them with NG_NODESIZ.
2004-01-26 16:41:21 +00:00
Alex Dupre
ce7e8baded Add missing 'device ataraid' to support ATA software RAID.
Noticed by:	Dario Freni <saturnero@gufi.org>
Approved by:	blackend (mentor)
Reviewed by:	sos
2004-01-26 16:38:33 +00:00
Hartmut Brandt
bbee16c0b9 Replace deprecated NG_NODELEN with the new NG_NODESIZ. There is one
problem here still to be solved: the sockaddr_hci has still a 16 byte
field for the node name. The code currently does not correctly use the
length field in the sockaddr to handle the address length, so
node names get truncated to 15 characters when put into a sockaddr_hci.
2004-01-26 15:19:43 +00:00
Hartmut Brandt
211326affc Get rid of the old *LEN constants in favour of the new *SIZ constants
that also include the trailing \0 byte.
2004-01-26 14:57:49 +00:00
Hartmut Brandt
46005fe0eb Define the new command NGM_SOURCE_START_NOW to allow generation of
traffic for non-ethernet hooks. This commit should have been packaged
with the commit to ng_source.c.
2004-01-26 14:54:39 +00:00
Hartmut Brandt
f5d15522f7 Make ng_source to work with non-ethernet interfaces. We do this by
introducing a START_NOW command. This command does not send
and GET_IFINDEX message downstream (to wait for the response from
the ETHERNET node), but directly starts the sending process. This allows
one to generate traffic as input for any hook on any node.
2004-01-26 14:53:16 +00:00
Hartmut Brandt
2cafef3ea4 Declare a function to silence a warning. 2004-01-26 14:48:21 +00:00
Hartmut Brandt
81a4ef8131 Should use the non-locking versions of the ifqueue macros to
fiddle around with private queues, because their mutex is not
needed. All this processing should be protected by the netgraph
locking.
2004-01-26 14:46:35 +00:00
Hartmut Brandt
b1b70498ba Replace a call to bzero() with an M_ZERO flag. Replace the MALLOC() with
malloc().
2004-01-26 14:44:36 +00:00
Hartmut Brandt
4321c5077c The version in the type description must be the ABI version, not
the netgraph version.

Correct the return type of a function: it wants to return an error
code, so it cannot be void.
2004-01-26 14:14:09 +00:00
Hartmut Brandt
87e2c66a6a Get rid of the deprecated *LEN constants in favour of the new
*SIZ constants that include the trailing \0 byte.
2004-01-26 14:05:31 +00:00
Maxim Sobolev
7735aeb9bb Add support for WCCPv2. It should be enablem manually using link2
ifconfig(8) flag since header for version 2 is the same but IP payload
is prepended with additional 4-bytes field.

Inspired by:	Roman Synyuk <roman@univ.kiev.ua>
MFC after:	2 weeks
2004-01-26 12:33:56 +00:00
Yoshihiro Takahashi
9c9fcfa30d Fixed some style bugs. 2004-01-26 12:28:40 +00:00
Hartmut Brandt
2c858ebee0 Get rid of the deprecated *LEN constants and use the new *SIZ
(that include the trailing \0) constants instead.
2004-01-26 12:24:07 +00:00
Maxim Sobolev
6e628b8187 (whilespace-only)
Kill trailing spaces.
2004-01-26 12:21:59 +00:00
Hartmut Brandt
33fb8dc930 Add a device type for virtual interfaces. 2004-01-26 12:13:11 +00:00
Hartmut Brandt
6eadc70894 Add an ATM sub-type for virtual interfaces. 2004-01-26 11:52:32 +00:00
Bill Paul
6c272c0241 Avoid possible panic on shutdown: if there are still some devices
attached when shutting down, kill our kthreads, but don't destroy
the mutex pool and uma zone resources since the driver shutdown
routine may need them later.
2004-01-26 08:36:18 +00:00
Mathew Kanner
e7245381b9 Fix a panic in dsp_clone when trying to access a sound
device that doesn't exists.  I'm using my discretion and
committing without mentor approval since Seigo is away.

Noticed by:	Maxime Henrion <mux@freebsd.org>
2004-01-25 22:46:22 +00:00
Robert Watson
6bea667f63 When aborting fork() due to a failure, if using MAC, make sure to clean
up the p_label field.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, McAfee Research
2004-01-25 18:42:18 +00:00
Hajimu UMEMOTO
a8938746a3 avoid duplicate free.
(though KAME doesn't decide how to fix it yet, I once commit it
to be in time for 5.2.1-RELEASE.)

Submitted by:	itojun
2004-01-25 17:18:12 +00:00
Bruce Evans
bad83add95 Fixed some style bugs (insertion sort errors, tab lossage, and ornation
of EOF).
2004-01-25 15:27:23 +00:00
Ruslan Ermilov
33fe8fd0df Register the uart(4)'s spin lock with witness(4). 2004-01-25 15:04:37 +00:00
Dag-Erling Smørgrav
f5e307118e Remove trailing whitespace. 2004-01-25 12:32:56 +00:00
Dag-Erling Smørgrav
dc171447b6 Replace description of the mutex profiling code with a reference to
the newly committed manual page.
2004-01-25 12:31:59 +00:00
Maxim Sobolev
87b4a80d97 Move LongRun support out of identcpu.c, where it hardly belongs, into its
own file and make it opt-in, not mandatory, depending on CPU_ENABLE_LONGRUN
config(8) option.

Discussed with: nate
MFC after:      2 weeks
2004-01-25 09:59:16 +00:00
Maxim Sobolev
1fbb6abce0 Move LongRun support out of identcpu.c, where it hardly belongs, into its
own file and make it opt-in, not mandatory, depending on CPU_ENABLE_LONGRUN
config(8) option.

PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
Discussed with: nate
MFC after:      2 weeks
2004-01-25 09:59:15 +00:00
Jeff Roberson
c77ac1fdee - sched_strict has been dead for a long time now. Get rid of it. 2004-01-25 08:58:14 +00:00
Jeff Roberson
c494ddc8a1 - Clean up KASSERTS. 2004-01-25 08:57:38 +00:00
Jeff Roberson
5a2b158d8d - Correct function names listed in KASSERTs. These were copied from other
code and it was sloppy of me not to adjust these sooner.
2004-01-25 08:21:46 +00:00
Jeff Roberson
f67fdc737e - Now that both schedulers support temporary cpu pinning use this rather
than the switchin functions to guarantee that we're operating with the
   correct tlb entry.
 - Remove the post copy/zero tlb invalidations.  It is faster to invalidate
   an entry that is known to exist and so it is faster to invalidate after
   use.  However, some architectures implement speculative page table
   prefetching so we can not be guaranteed that the invalidated entry is still
   invalid when we re-enter any of these functions.  As a result of this we
   must always invalidate before use to be safe.
2004-01-25 08:04:45 +00:00
Jeff Roberson
e17c57b14b - Implement cpu pinning and binding. This is acomplished by keeping a per-
cpu run queue that is only used for pinned or bound threads.

Submitted by:	Chris Bradfield <chrisb@ation.org>
2004-01-25 08:00:04 +00:00
Jeff Roberson
d1605f0ac9 - Use a unique string for the sched_setup SYSINIT and rename sched_setup to
synch_setup.  The schedulers use the sched_setup function name.
2004-01-25 07:49:45 +00:00
Jeff Roberson
b998bd92e3 - Compile 4BSD in LINT since ULE will be tested by GENERIC kernel builds.
- Fix the formatting on the ULE options line, I didn't notice that a space
   was used normally.

Reported by:	bde
2004-01-25 07:47:57 +00:00
Alan Cox
11a61c16c2 MFi386 revision 1.230
- Move smp_topology to subr_smp.c so that it is defined on all architectures.
2004-01-25 06:19:37 +00:00
Jeff Roberson
1a9b9c9837 - Don't define DETECT_DEADLOCK. I don't know that this code has detected
a deadlock in several years.  Furthermore, the IPI code is currently
   protected by a seperate spinlock.  This only served to make IPIs twice as
   expensive as they had to be which severely slowed down the IPI heavy ULE
   scheduler.
2004-01-25 05:03:14 +00:00
Jeff Roberson
29bcc4514f - Add a flags parameter to mi_switch. The value of flags may be SW_VOL or
SW_INVOL.  Assert that one of these is set in mi_switch() and propery
   adjust the rusage statistics.  This is to simplify the large number of
   users of this interface which were previously all required to adjust the
   proper counter prior to calling mi_switch().  This also facilitates more
   switch and locking optimizations.
 - Change all callers of mi_switch() to pass the appropriate paramter and
   remove direct references to the process statistics.
2004-01-25 03:54:52 +00:00
Robert Watson
8dc10be885 Add some basic support for measuring sleep mutex contention to the
mutex profiling code.  As with existing mutex profiling, measurement
is done with respect to mtx_lock() instances in the code, as opposed
to specific mutexes.  In particular, measure two things:

(1) Lock contention.  How often did this mtx_lock() call get made and
    have to sleep (or almost sleep) waiting for the lock.  This helps
    identify the "victims" of contention.

(2) Hold contention.  How often, while the lock was held by a thread
    as a result of this mtx_lock(), did another thread try to acquire
    the same mutex.  This helps identify the causes of contention.

I'm currently exploring adding measurement of "time waited for the
lock", but the current implementation has proven useful to me so far
so I figured I'd commit it so others could try it out.  Note that this
increases the size of mutexes when MUTEX_PROFILING is enabled, so you
might find you need to further bump UMA_BOOT_PAGES.  Fixes welcome.

The once over:	des, others
2004-01-25 01:59:27 +00:00
Bill Paul
cf736ea0c7 Correct KASSERT() in ndis_destroy(): ndis_mtx is a pointer now.
Also add KASSERT() for ndis_intrmtx().
2004-01-25 00:13:07 +00:00
Poul-Henning Kamp
551260fc36 Deal with MOD_FREQUENCY before MOD_OFFSET because the latter is the
one which runs the actual update.  This fixes a bug where there were
a delay in applying the frequency adjustment.  In extreme cases this
could result in marginal stability of the kernel-pll.
2004-01-24 21:48:43 +00:00
Jeff Roberson
81aecdd39d - Remove local changes that leaked into my last commit.
Spotted by:	juli
2004-01-24 21:45:25 +00:00
Jeff Roberson
048ac395be - Recruit some new ULE users by making it the default scheduler in GENERIC.
ULE will be in a probationary period to determine whether it will be left
   as the default in 5.3 which would likely mean the rest of the 5.x series.
2004-01-24 21:38:52 +00:00
Jeff Roberson
8a0402a4b8 - ULE is not exactly experimental anymore. Change some comments and enable
it in LINT.
2004-01-24 21:32:53 +00:00
Alan Cox
7dea2c2e3b 1. Statically initialize swap_pager_full and swap_pager_almost_full to the
full state.  (When swap is added their state will change appropriately.)
2. Set swap_pager_full and swap_pager_almost_full to the full state when
   the last swap device is removed.
Combined these changes eliminate nonsense messages from the kernel on swap-
less machines.

Item 2 submitted by:	Divacky Roman <xdivac02@stud.fit.vutbr.cz>
Prodding by:		phk
2004-01-24 21:31:06 +00:00
Maxim Sobolev
e13f9ac88b Regen after rev. 1.161 of usbdevs. 2004-01-24 21:24:36 +00:00
Maxim Sobolev
0bc4abec87 Add support for Crystalfontz CFA-631 USB LCD (uftdi(4) driver).
For some very unclear reason this device contains a FTDI 8U232AM USB->COM
adapter, but reports different device id than original 8U232AM. At the same
time, it reports vendor id of FTDI.

Sponsored by:	Porta Software Ltd
MFC after:	2 weeks
2004-01-24 21:23:12 +00:00
Maxim Sobolev
983a9b60e6 - Move performance-controlling sysctls into hw.p4tcc.* tree;
Suggested by:   nate

- get rid of "magick" values in code and make sysctl's reflecting reality
  on processor versions which have one or another frequency "forbidden"
  due to errata.

MFC after:      2 weeks
2004-01-24 21:13:13 +00:00
Maxim Sobolev
82b95ace07 - Move performance-controlling sysctls into hw.p4tcc.* tree;
Suggested by:   nate

- get rid of "magick" values in code and make sysctl's reflecting reality
  on processor versions which have one or another frequency "forbidden"
  due to errata.

PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:      2 weeks
2004-01-24 21:13:12 +00:00
Jeff Roberson
b9509b56fa - Move smp_topology to subr_smp.c so that it is defined on all architectures. 2004-01-24 19:52:48 +00:00
Jacques Vidrine
5864cda7c6 Add PFIL_HOOKS to the GENERIC kernel configuration, primarily so
that one can load the IPFilter module (which requires PFIL_HOOKS).

Requested by:	Many, for over a year
2004-01-24 14:59:51 +00:00
Tim J. Robbins
3215f33192 Copy workaround from FFS: open device for write access even if
the user requests a read-only mount. This is necessary because we
don't do the VOP_OPEN again if they upgrade a read-only mount to
read-write.

Noticed by:	bde
2004-01-24 08:43:06 +00:00
MIHIRA Sanpei Yoshiro
7d825ee7ff Sync to 1.160 of usbdevs 2004-01-24 07:15:23 +00:00
MIHIRA Sanpei Yoshiro
21c5b9f9e5 Add Support
- 2nd type of GL641USB USB-IDE bridge	[1]
	- Plextor Plexwriter 40/12/40U		[2]

PR:		kern/61671	[1]
		kern/61803	[2]
Submitted by:	Ralf Wenk <RZ-FreeBSD0401@fh-karlsruhe.de>	[1]
		Feisal Mohammed <feisal@uwi.tt>			[2]
MFC after:	1 week
2004-01-24 07:14:07 +00:00
Bill Paul
6f56639b42 Add missing newlines to some device_printf()s.
Don't do anything in ndis_get_assoc() if the link isn't up (avoids
spurrious "couldn't get bssid" messages on the console).
2004-01-24 02:48:22 +00:00
Matt Jacob
e23df011da If we have ISP_ROLE_INITIATOR set, make sure that we clear ICBOPT_INI_DISABLE
from the fwoptions. Likewise, we *set* ICBOPT_INI_DISABLE if we don't have
initiator role.
2004-01-23 23:23:31 +00:00
Matt Jacob
520b6299ac add MAKE_WWN_FROM_NODE_NAME macro 2004-01-23 23:22:35 +00:00
Matt Jacob
a556b68e3a Add firmware major, minor and micro revsions to the ISP_FC_GETHINFO ioctl
structure.
2004-01-23 23:22:11 +00:00
Poul-Henning Kamp
57ab2e0468 Make sure to keep track of canceled events.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 21:09:38 +00:00
Robert Watson
646e29ccac Don't grab Giant in crfree(), since prison_free() no longer requires it.
The uidinfo code appears to be MPSAFE, and is referenced without Giant
elsewhere.  While this grab of Giant was only made in fairly rare
circumstances (actually GC'ing on refcount==0), grabbing Giant here
potentially introduces lock order issues with any locks held by the
caller.  So this probably won't help performance much unless you change
credentials a lot in an application, and leave a lot of file descriptors
and cached credentials around.  However, it simplifies locking down
consumers of the credential interfaces.

Bumped into by:	sam
Appeased:	tjr
2004-01-23 21:07:52 +00:00
Poul-Henning Kamp
799426f877 Add KASSERTS.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 21:02:49 +00:00
Robert Watson
b3059e09f6 Defer the vrele() on a jail's root vnode reference from prison_free()
to a new prison_complete() task run by a task queue.  This removes
a requirement for grabbing Giant in crfree().  Embed the 'struct task'
in 'struct prison' so that we don't have to allocate memory from
prison_free() (which means we also defer the FREE()).

With this change, I believe grabbing Giant from crfree() can now be
removed, but need to check the uidinfo code paths.

To avoid header pollution, move the definition of 'struct task'
to _task.h, and recursively include from taskqueue.h and jail.h; much
preferably to all files including jail.h picking up a requirement to
include taskqueue.h.

Bumped into by:	sam
Reviewed by:	bde, tjr
2004-01-23 20:44:26 +00:00
Poul-Henning Kamp
f5b3481451 Plug an insignificant memoryleak.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 20:40:25 +00:00
Poul-Henning Kamp
752e0f0196 Add missing newline in printf.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 20:36:21 +00:00
Philip Paeps
e609fbdbc7 Add missing options from pcvt_conf.h to options.i386. This
allows the kernel build to survive config when these options
are specified in the config file.

Reviewed by:	hm
Approved by:	njl (mentor)
2004-01-23 20:30:52 +00:00
Hidetoshi Shimokawa
1398a889e6 * fwohci_pci.c
Improve error message for attach failure.

* sbp_targ.c
	- Add speed in struct sbp_targ_login.
	- Remove unnecessary htonl().
2004-01-23 17:37:09 +00:00
Mathew Kanner
3c6b655dff Sync with DFBSD v.1.16. Add new codecs IDs, fix some spelling.
Approved by:    des (interim mentor)
2004-01-23 16:38:54 +00:00
Ruslan Ermilov
12b8b80e45 Don't panic if there are more than 255 interfaces in the system. 2004-01-23 15:53:23 +00:00
Ruslan Ermilov
d2030b65a6 Allow the socket buffer sizes to be controlled via sysctl(8).
MFC after:	3 days
2004-01-23 14:35:44 +00:00
Poul-Henning Kamp
bbf53bc053 Remove the MD5_KEY debugging tool 2004-01-23 11:47:06 +00:00
Poul-Henning Kamp
8cae62eee9 Remove no longer necessary debug printfs 2004-01-23 10:56:16 +00:00
Søren Schmidt
17cafb29a0 Fix breakage in PIO multisector support. 2004-01-23 10:38:56 +00:00
Andrey A. Chernov
51cf017614 Copy comment about caller check from ffs_read to ffs_extread, don't
check for uio_resid < 0 here too.
2004-01-23 06:00:41 +00:00
Andrey A. Chernov
070f8eefb1 Fix various panic() strings to reflect true function name to allow
easy grep.
Small code reorganization to look more logic.
Copy ffs_write check from prev. commit to ffs_extwrite.
2004-01-23 05:52:31 +00:00
Andrey A. Chernov
bd0cc17757 ffs_read:
Replace wrong check returned EFBIG with EOVERFLOW handling from POSIX:

36708 [EOVERFLOW] The file is a regular file, nbyte is greater than 0, the
starting position is before the end-of-file, and the starting position is
greater than or equal to the offset maximum established in the open file
description associated with fildes.

ffs_write:
Replace u_int64_t cast with uoff_t cast which is more natural for types
used.

ffs_write & ffs_read:
Remove uio_offset and uio_resid checks for negative values, the caller
supposed to do it already. Add comments about it.

Reviewed by:    bde
2004-01-23 05:38:02 +00:00
Andre Oppermann
241f1e33b1 Remove leftover FREE() from changes in rev 1.50.
Noticed by:	Jun Kuriyama <kuriyama@imgsrc.co.jp>
2004-01-23 01:39:12 +00:00
Peter Wemm
ccaa41bc2c Unbreak amd64: Rename calls from panic to __panic 2004-01-23 01:04:28 +00:00
Andre Oppermann
201d185b69 Split the overloaded variable 'win' into two for their specific purposes:
recwin and sendwin.  This removes a big source of confusion and makes
following the code much easier.

Reviewed by:	sam (mentor)
Obtained from:	DragonFlyBSD rev 1.6 (hsu)
2004-01-22 23:22:14 +00:00
Andre Oppermann
1ddba8d63e Move the reduction by one of the syncache limit after the zone has been
allocated.

Reviewed by:    sam (mentor)
Obtained from:  DragonFlyBSD rev 1.6 (hsu)
2004-01-22 23:14:48 +00:00
Andre Oppermann
73080de2be Remove an unused variable and put the sockaddr_in6 onto the stack instead
of malloc'ing it.

Reviewed by:	sam (mentor)
Obtained from:	DragonFlyBSD rev 1.6 (hsu)
2004-01-22 23:10:11 +00:00
Poul-Henning Kamp
ee57aeea65 Write 100 times for tomorrow:
"Always print time_t as %jd, you never know what width it has"
2004-01-22 19:50:06 +00:00
John Baldwin
acf7d97237 Fix the PCI attach routine to properly setup the IRQ and port resource
rid's and to deallocate resources if a failure occurs during attach.  This
patch also fixes the driver to return failure if bus_alloc_resource() for
the IRQ fails rather than panic'ing on the next line by passing a NULL
resource to bus_setup_intr().  The other attachments already do all this.

Submitted by:	Jun Su <csujun@263.net>
2004-01-22 16:07:03 +00:00
Hidetoshi Shimokawa
4c790222f6 Add missing free() in exception handlers.
Reported by:    Stanford Metacompilation research group
2004-01-22 14:41:17 +00:00
Ralf S. Engelschall
446655ac4f Fix generation of random multicast MAC address.
In case no real/physical IEEE 802 address is available, both the expired
"draft-leach-uuids-guids-01" (section "4. Node IDs when no IEEE 802
network card is available") and RFC 2518 (section "6.4.1 Node Field
Generation Without the IEEE 802 Address") recommend (quoted from RFC
2518):

  "The ideal solution is to obtain a 47 bit cryptographic quality random
  number, and use it as the low 47 bits of the node ID, with the _most_
  significant bit of the first octet of the node ID set to 1. This bit
  is the unicast/multicast bit, which will never be set in IEEE 802
  addresses obtained from network cards; hence, there can never be a
  conflict between UUIDs generated by machines with and without network
  cards."

Unfortunately, this incorrectly explains how to implement this and
the FreeBSD UUID generator code inherited this generation bug from
the broken reference code in the standards draft. They should instead
specify the "_least_ significant bit of the first octet of the node ID"
as the multicast bit in a memory and hexadecimal string representation
of a 48-bit IEEE 802 MAC address.

This standards bug arised from a false interpretation, as the multicast
bit is actually the _most_ significant bit in IEEE 802.3 (Ethernet)
_transmission order_ of an IEEE 802 MAC address. The standards authors
forgot that the bitwise order of an _octet_ from a MAC address _memory_
and hexadecimal string representation is still always from left (MSB,
bit 7) to right (LSB, bit 0).

Fortunately, this UUID generation bug could have occurred on systems
without any Ethernet NICs only.
2004-01-22 13:34:11 +00:00
Ruslan Ermilov
95d9bfd8d6 Only enforce -fno-strict-aliasing for optimization levels that
imply -fstrict-aliasing.

Reviewed by:	bde
2004-01-22 10:01:47 +00:00
Peter Grehan
53cd4099fb Make proc's kg_nice/ki_nice explicitly signed for PPC. This is a
no-op on {i386/alpha/ia64/sparc64} where chars are signed by
default. Should help ARM and S390 which also suffer from this.

Tested on: ppc, i386, objdump disasm before/after diffs
Reviewed by: obrien, bde (a while back)
2004-01-22 06:56:00 +00:00