Commit graph

38677 commits

Author SHA1 Message Date
Jake Burkholder 7b66da6e32 lock.h must be included before mutex.h. 2003-03-14 07:19:29 +00:00
Jeff Roberson 8501ead911 - Add a forgotten BUF_LOCK()
Most sincere apologies to:	jake
2003-03-14 05:13:19 +00:00
David Xu 9a4b78c9da Export current time when returning from never blocked syscall. 2003-03-14 03:52:16 +00:00
Maxime Henrion 7541142438 Oops, add missing includes. Pass me the pointy hat.
Reported by:	jake
2003-03-14 00:04:37 +00:00
John Baldwin 2d055ab20f Trim some trailing whitespace. 2003-03-13 23:07:09 +00:00
Scott Long 6f420b1756 Now that bus_dmamem_alloc() handles its Giant mutex requirements itself,
don't bother doing the same in the code that calls it.
2003-03-13 22:56:11 +00:00
John Baldwin b62f75cf44 - Change the linux_[gs]et_os{name, release, s_version}() functions to
take a thread instead of a proc for their first argument.
- Add a mutex to protect the system-wide Linux osname, osrelease, and
  oss_version variables.
- Change linux_get_prison() to take a thread instead of a proc for its
  first argument and to use td_ucred rather than p_ucred.  This is ok
  because a thread's prison does not change even though it's ucred might.
- Also, change linux_get_prison() to return a struct prison * instead of
  a struct linux_prison * since it returns with the struct prison locked
  and this makes it easier to safely unlock the prison when we are done
  messing with it.
2003-03-13 22:45:43 +00:00
John Baldwin 75768576cc Add a new userland-visible ktrace flag KTR_DROP and an internal ktrace flag
KTRFAC_DROP to track instances when ktrace events are dropped due to the
request pool being exhausted.  When a thread tries to post a ktrace event
and is unable to due to no available ktrace request objects, it sets
KTRFAC_DROP in its process' p_traceflag field.  The next trace event to
successfully post from that process will set the KTR_DROP flag in the
header of the request going out and clear KTRFAC_DROP.

The KTR_DROP flag is the high bit in the type field of the ktr_header
structure.  Older kdump binaries will simply complain about an unknown type
when seeing an entry with KTR_DROP set.  Note that KTR_DROP being set on a
record in a ktrace file does not tell you anything except that at least one
event from this process was dropped prior to this event.  The user has no
way of knowing what types of events were dropped nor how many were dropped.

Requested by:	phk
2003-03-13 18:31:15 +00:00
John Baldwin a5881ea55a - Cache a reference to the credential of the thread that starts a ktrace in
struct proc as p_tracecred alongside the current cache of the vnode in
  p_tracep.  This credential is then used for all later ktrace operations on
  this file rather than using the credential of the current thread at the
  time of each ktrace event.
- Now that we have multiple ktrace-related items in struct proc that are
  pointers, rename p_tracep to p_tracevp to make it less ambiguous.

Requested by:	rwatson (1)
2003-03-13 18:24:22 +00:00
Maxime Henrion c0796d1cb4 Grab Giant around calls to contigmalloc() and contigfree() so
that drivers converted to be MP safe don't have to deal with it.
2003-03-13 17:18:48 +00:00
Maxime Henrion ea458bbcdb Memory allocated with contigmalloc() should be freed with
contigfree(), not with free().
2003-03-13 17:10:54 +00:00
Hartmut Brandt 57648f8aae This corrects a longstanding endian bug in processing LLC/SNAP encoded
frames. A comment in if_atm.h suggests that both macros, that for extracting
the ethertype and that for inserting it, handle their argument in host
byte order. In fact, the inserting macro treated its argument as an opposite
host order short and the calling code feeds it the result of htons(). This
happens to work on i386, but fails on sparc. Make the macro use real host
endianess.

Reviewed by:	kjc, atm@
2003-03-13 12:44:06 +00:00
Jeffrey Hsu 7792ea2700 Greatly simplify the unlocking logic by holding the TCP protocol lock until
after FIN_WAIT_2 processing.

Helped with debugging:	Doug Barton
2003-03-13 11:46:57 +00:00
Søren Schmidt f711eff1d2 Remove the check for more than one open if one is a write op.
This allows using DVD+RW and DVD-RW as random storage, provided
the 32K blocksize is honoured for DVD-RW (DVD+RW has built in
read-modify-write).
2003-03-13 09:12:17 +00:00
Søren Schmidt 6918962fad Dont free the stats struct, this has been changed by the new stat code.
Spotted by: Ian Dowse <iedowse@maths.tcd.ie>
2003-03-13 09:09:10 +00:00
Søren Schmidt 394046e66f Dont call dma->free unless dma is there.
Spotted by: Ian Dowse <iedowse@maths.tcd.ie>
2003-03-13 09:04:55 +00:00
Ian Dowse a80cc4e104 In m_dup_pkthdr(), convert the supplied `how' argument into malloc
flags when passing it into m_tag_copy_chain(), as m_tag* functions
use malloc, not mbuf flags.
2003-03-13 09:02:19 +00:00
Søren Schmidt 64eca1e1f2 Add pci id# for the sis648 2003-03-13 07:55:53 +00:00
Jeff Roberson 749ffa4ecd - Add a lock for protecting against msleep(bp, ...) wakeup(bp) races.
- Create a new function bdone() which sets B_DONE and calls wakup(bp). This
   is suitable for use as b_iodone for buf consumers who are not going
   through the buf cache.
 - Create a new function bwait() which waits for the buf to be done at a set
   priority and with a specific wmesg.
 - Replace several cases where the above functionality was implemented
   without locking with the new functions.
2003-03-13 07:31:45 +00:00
Jeff Roberson e99215a614 - Remove a dead check for bp->b_vp == vp in vtruncbuf(). This has not been
possible for some time.
 - Lock the buf before accessing fields.  This should very rarely be locked.
 - Assert that B_DELWRI is set after we acquire the buf.  This should always
   be the case now.
2003-03-13 07:22:53 +00:00
Jeff Roberson 09f11da5a3 - Remove a race between fsync like functions and flushbufqueues() by
requiring locked bufs in vfs_bio_awrite().  Previously the buf could
   have been written out by fsync before we acquired the buf lock if it
   weren't for giant.  The cluster_wbuild() handles this race properly but
   the single write at the end of vfs_bio_awrite() would not.
 - Modify flushbufqueues() so there is only one copy of the loop.  Pass a
   parameter in that says whether or not we should sync bufs with deps.
 - Call flushbufqueues() a second time and then break if we couldn't find
   any bufs without deps.
2003-03-13 07:19:23 +00:00
Jeff Roberson f5f0dee483 - Lock the buf before clearing flags. 2003-03-13 07:07:16 +00:00
Jeff Roberson c033bdc013 - Lock bufs before inspecting their flags. 2003-03-13 07:05:22 +00:00
Jeff Roberson 619bddc702 - Lock the buf before inspecting its contents. 2003-03-13 07:04:11 +00:00
Alfred Perlstein 569d3c4bf0 Make sure we actually have a dev before dereferencing in case someone
botches and sends us a NULL pointer.  The other code in this file seems
to expect it to be able to handle it behaving this way.
2003-03-13 06:29:44 +00:00
Jeff Roberson de950c003c - Tune down read_max. For single disks we get no gain out of reading more
than a MAXPHYS size block ahead.  Having this set too high just leaves
   other processes starved for IO and screws up interactive response.  Let the
   users with RAID set it higher when they need it.
2003-03-13 06:17:59 +00:00
Jeffrey Hsu da3a8a1a4f Add support for RFC 3390, which allows for a variable-sized
initial congestion window.
2003-03-13 01:43:45 +00:00
Tim J. Robbins 6ec62361c8 Tidy up previous change: move comment about obtaining an exclusive
reference where it belongs, and remove a blank line to make it more
obvious what the comment applies to.
2003-03-13 00:57:47 +00:00
Tim J. Robbins 262c27b846 Back out previous. The locking here needs a rethink. 2003-03-13 00:54:53 +00:00
Maxime Henrion f3b8b63b15 Pass the correct malloc flags to m_tag_alloc(). 2003-03-13 00:30:31 +00:00
David Schultz 72d97679ff - When the VM daemon is out of swap space and looking for a
process to kill, don't block on a map lock while holding the
  process lock.  Instead, skip processes whose map locks are held
  and find something else to kill.
- Add vm_map_trylock_read() to support the above.

Reviewed by:	alc, mike (mentor)
2003-03-12 23:13:16 +00:00
Jeffrey Hsu 582a954b00 Implement the Limited Transmit algorithm (RFC 3042). 2003-03-12 20:27:28 +00:00
John Baldwin 8510f2a833 - Various little style fixes.
- If SYSCTL_OUT() fails in sysctl_kern_proc_args(), return the error
  instead of ignoring it if we have new arguments for the process.
- If the new arguments for a process are too long, return ENOMEM instead of
  returning success but not doing the actual copy.

Submitted by:	bde
2003-03-12 20:17:40 +00:00
Maxim Sobolev 525e5ed929 Correct clock frequency for the IC Book Labs' cards, so that it's possible
to use speeds higher than 115200.

Sponsored by:	IC Book Labs
MFC after:	2 weeks
2003-03-12 17:56:03 +00:00
Maxim Sobolev a2a101e766 Add initial support for IC Book Labs Dreadnought x16 Pro 16-ports card. Since
this card is based on 16750 UART, modify sio(4) a bit to ignore 16750-specific
7th bit of MCR when probing card. This allows card to be detected and attached
as 16550A-compatible device. More work needs to be done in order to enable
nice 16750-specific features such as larger fifo buffer and higher speeds.

Sponsored by:	IC Book Labs
MFC after:	2 weeks
2003-03-12 17:20:24 +00:00
John Baldwin 4bc6471b53 - Avoid dropping the proc lock around a simple permissions check and just
hold hold it across the check to avoid extra lock operations in the
  common case.
- Copy in the new args to a temporary pargs structure before we drop the
  reference to the old one.  Thus, if the copyin() fails, the process
  arguments are unchanged rather than being deleted.  Also, p_args is no
  longer NULL during the sysctl operation.
2003-03-12 16:14:55 +00:00
Søren Schmidt deff57d72c Correct the last commit, only look for subfunctions on the same PCI slot. 2003-03-12 15:45:52 +00:00
Orion Hodson b2a0f525e6 Correct CS4205 base vendor id.
Reported by:    Christophe Juniet and Mark Santcroos.
2003-03-12 15:11:25 +00:00
Sam Leffler 4a692a1fc2 correct two more flag misuses; m_tag* use malloc flags 2003-03-12 14:45:22 +00:00
Ruslan Ermilov 99bca5069e Simplify the assignment statement. 2003-03-12 14:32:46 +00:00
Søren Schmidt 5b24125046 Cleanup the probe code a bit. 2003-03-12 12:05:17 +00:00
Tim J. Robbins a7cbe87a5e Acquire sched_lock around use of FOREACH_KSEGRP_IN_PROC, accesses
to kg_nice and calls to sched_nice() in getpriority() and setpriority()
(really donice()).
2003-03-12 11:24:41 +00:00
Tim J. Robbins 3890793e9c In wait1(), remove the zombie process from zombproc before removing
it from its pgrp to avoid leaving zombies around with p_pgrp == NULL.
This bug was apparent as a NULL-dereference in the pid selection code
in fork1().
2003-03-12 11:10:04 +00:00
Søren Schmidt 9eb8572ea2 Dont hang the channel on enclosures without sensors. 2003-03-12 10:59:35 +00:00
Hidetoshi Shimokawa d067ce208d Put back including sys/devicestat.h for 4-stable. 2003-03-12 10:36:53 +00:00
Kenjiro Cho fec4b7015e clean up the en driver since it will survice for a while by
Harti Brandt's effort.
remove the DMA test to detect problems of the first generation PCI chipsets
back in 1998.
it is no longer needed and has been the source of the false alarm that
the driver uses too much stack space.
2003-03-12 10:28:26 +00:00
Jake Burkholder 4d3f408cee - Added support for multiple page directory pages to pmap_pinit and
pmap_release.
- Merged pmap_release and pmap_release_free_page.  When pmap_release is
  called only the page directory page(s) can be left in the pmap pte object,
  since all page table pages will have been freed by pmap_remove_pages and
  pmap_remove.  In addition, there can only be one reference to the pmap and
  the page directory is wired, so the page(s) can never be busy.  So all there
  is to do is clear the magic mappings from the page directory and free the
  page(s).

Sponsored by:	DARPA, Network Associates Laboratories
2003-03-12 07:38:37 +00:00
Sam Leffler 9adc8e4d75 correct malloc flag argument
Reported by:	Kris Kennaway <kris@obsecurity.org>
2003-03-12 06:08:48 +00:00
Alexander Kabaev 46300030ec Do not depend on namespace pollution, explicitly include sys/sx.h 2003-03-12 02:55:20 +00:00
Sam Leffler 98822e3945 fix module building; drivers now require opt_{ubsec,hifn}.h 2003-03-11 23:20:43 +00:00
Sam Leffler cff5befbba FIPS 140-2 rng data tester for h/w crypto devices. This driver periodically
monitors the entropy data harvested by crypto drivers to verify it complies
with FIPS 140-2.  If data fails any test then the driver discards it and
commences continuous testing of harvested data until it is deemed ok.
Results are collected in a statistics block and, optionally, reported on
the console.  In normal use the overhead associated with this driver is
not noticeable.

Note that drivers must (currently) be compiled specially to enable use.

Obtained from:	original code by Jason L. Wright
2003-03-11 22:54:44 +00:00
Sam Leffler b7c4858f1e o add crypto driver glue for using the new rndtest driver/module; this is
conditional in each driver on foo_RNDTEST being defined_
o bring HIFN_DEBUG and UBSEC_DEBUG out to be visible options; they control
  the debugging printfs that are set with hw.foo.debug (e.g. hw.hifn.debug)
2003-03-11 22:47:06 +00:00
John Baldwin 2ca9461a05 Trim an extra blank line that snuck into the last commit. 2003-03-11 22:33:42 +00:00
Sam Leffler bd17515b68 gack; revert previous commit; not only did I read things backward but
I was in the wrong tree
2003-03-11 22:23:19 +00:00
Sam Leffler 44cc7634a3 sync with current: reduce default maxbatch setting from 5 to 1
Reviewed by:	re (sort of, consider this part of my previous request)
2003-03-11 22:20:43 +00:00
Alexander Kabaev c162e9c2eb Rename vfs_stdsync function to vfs_stdnosync which matches more
closely what function is really doing. Update all existing consumers
to use the new name.

Introduce a new vfs_stdsync function, which iterates over mount
point's vnodes and call FSYNC on each one of them in turn.

Make nwfs and smbfs use this new function instead of rolling their
own identical sync implementations.

Reviewed by:	jeff
2003-03-11 22:15:10 +00:00
John Baldwin 427b3a6549 - Change witness_displaydescendants() to accept the indentation level as
a parameter instead of using the level of a given witness.  When
  recursing, pass an indent level of indent + 1.
- Make use of the information witness_levelall() provides in
  witness_display_list() to use an O(n) algorithm instead of an O(n^2)
  algo to decide which witnesses to display hierarchies from.  Basically,
  we only display a hierarchy for witnesses with a level of 0.
- Add a new per-witness flag that is reset at the start of
  witness_display() for all witness's and is set the first time a witness
  is displayed in witness_displaydescendants().  If a witness is
  encountered more than once in the lock order tree (which happens often),
  witness_displaydescendants() marks the later occurrences with the string
  "(already displayed)" and doesn't display the subtree under that
  witness.  This avoids duplicating large amounts of the lock order tree
  in the 'show witness' output in DDB.

All these changes serve to make 'show witness' a lot more readable and
useful than it was previously.
2003-03-11 22:14:21 +00:00
John Baldwin f82c6950be - Split the itismychild() function into two functions: insertchild()
adds a witness to the child list of a parent witness.  rebalancetree()
  runs through the entire tree removing direct descendants of witnesses
  who already have said child witness as an indirect descendant through
  another direct descendant.  itismychild() now calls insertchild()
  followed by rebalancetree() and no longer needs the evil hack of
  having static recursed variable.
- Add a function reparentchildren() that adds all the direct descendants
  of one witness as direct descendants of another witness.
- Change the return value of itismychild() and similar functions so that
  they return 0 in the case of failure due to lack of resources instead
  of 1.  This makes the return value more intuitive.
- Check the return value of itismychild() when defining the static lock
  order in witness_initialize().
- Don't try to setup a lock instance in witness_lock() if itismychild()
  fails.  Witness is hosed anyways so no need to do any more witness
  related activity at that point.  It also makes the code flow easier to
  understand.
- Add a new depart() function as the opposite of enroll().  When the
  reference count of a witness drops to 0 in witness_destroy(), this
  function is called on that witness.  First, it runs through the
  lock order tree using reparentchildren() to reparent direct descendants
  of the departing witness to each of the witness' parents in the tree.
  Next, it releases it's own child list and other associated resources.
  Finally it calls rebalanacetree() to rebalance the lock order tree.
- Sort function prototypes into something closer to alphabetical order.

As a result of these changes, there should no longer be 'dead' witnesses
in the order tree, and repeatedly loading and unloading a module should no
longer exhaust witness of its internal resources.

Inspired by:	gallatin
2003-03-11 22:07:35 +00:00
John Baldwin d5b13ee082 Trim useless "../" leading strings from filenames passed into witness. 2003-03-11 21:53:12 +00:00
John Baldwin 28e4d137a2 Adjust style of #ifdef's and #endif's to be more consistent and in line
with recent additions to style(9).
2003-03-11 21:38:49 +00:00
John Baldwin d278a7f9ba Do the lock order check skip for the LOP_TRYLOCK case after the check for
recursing on a lock instead of before.  This fixes a bug where WITNESS
could get a little confused if you did an sx_tryslock() on a sx lock that
you already had an slock on.  WITNESS would still function correctly but
it could result in weirdness in the output of 'show locks'.  This also
makes it possible for mtx_trylock() to recurse on a lock.
2003-03-11 20:54:37 +00:00
John Baldwin ecdf4409f9 Rework the eventhandler locking for hopefully the last time. The scheme
used popped into my head during my morning commute a few weeks ago, but
it is also very similar (though a bit simpler) to a patch that mini@
developed a while ago.  Basically, each eventhandler list has a mutex and
a run count.  During an eventhandler invocation, the mutex is held while
we traverse the list but is dropped while we execute actual handlers.  Also,
a runcount counter is incremented at the start of an invocation and
decremented at the end of an invocation.  Adding to the list is not a big
deal since the reference of a thread currently executing the handlers
remains valid across an add operation.  Whether or not new handlers are
executed by threads currently executing the handlers for a given list is
indeterminate however.  The harder case is when a handler is removed from
the list.  If the runcount is zero, the handler is simply removed from the
list directly.  If the runcount is not zero, then another thread is
currently executing the handlers of this list, so the priority of this
handler is set to a magic value (currently -1) to mark it as dead.  Dead
handlers are not executed during an invocation.  If the runcount is zero
after it is decremented at the end of an invocation, then a new
eventhandler_prune_list() function is called to remove dead handlers from
the list.

Additional minor notes:
- All the common parts of EVENTHANDLER_INVOKE() and
  EVENTHANDLER_FAST_INVOKE() have been merged into a common
  _EVENTHANDLER_INVOKE() macro to reduce duplication and ease maintenance.
- KTR logging for eventhandlers is now available via the KTR_EVH mask.
- The global eventhander_mutex is no longer recursive.

Tested by:	scottl (SMP i386)
2003-03-11 20:17:00 +00:00
John Baldwin 8d25e77a0d Retire the KTR_LOCKMGR bit and use it to log eventhandler messages
instead as KTR_EVH.
2003-03-11 20:07:22 +00:00
John Baldwin 75d468ee12 Axe the useless MTX_SLEEPABLE flag. mutexes are not sleepable locks.
Nothing used this flag and WITNESS would have panic'd during mtx_init()
if anything had.
2003-03-11 20:02:57 +00:00
John Baldwin 740190593a Use a shorter and less redundant name for the sysctl tree lock. 2003-03-11 20:01:51 +00:00
John Baldwin c06394f53f Use the KTR_LOCK mask for logging events via KTR in lockmgr() rather
than KTR_LOCKMGR.  lockmgr locks are locks just like other locks.
2003-03-11 20:00:37 +00:00
John Baldwin 4c6ffc94c0 Trim leading "../" sequences from filenames. 2003-03-11 19:56:16 +00:00
Jake Burkholder 2089c5c95e Use bus_space_handle_t to represent host port and virtual addresses;
bus_addr_t may not be appropriate.

Sponsored by:	DARPA, Network Associates Laboratories
2003-03-11 19:43:38 +00:00
Sam Leffler ac7e2c0515 FIPS 140-2 rng data tester for h/w crypto devices. This driver periodically
monitors the entropy data harvested by crypto drivers to verify it complies
with FIPS 140-2.  If data fails any test then the driver discards it and
commences continuous testing of harvested data until it is deemed ok.
Results are collected in a statistics block and, optionally, reported on
the console.  In normal use the overhead associated with this driver is
not noticeable.

Note that drivers must (currently) be compiled specially to enable use.

Obtained from:	original code by Jason L. Wright
2003-03-11 19:26:16 +00:00
Sam Leffler 3ff737f4dc correct output byte count statistic collection 2003-03-11 18:43:24 +00:00
Warner Losh 739804813b Remove bogus UNLOCK in if_wi.c. Since we no longer WILOCK() in the
attach routine, calling WIUNLOCK in the error case of one of the ifs
for that routine is now bogus.  This should have been removed when the
WILOCK() was removed, but wasn't.

Submitted by:  "Harti Brandt" <brandt@fokus.fraunhofer.de>
2003-03-11 17:13:33 +00:00
Takanori Watanabe a009cc2a40 Add _HID of IrDA module and Pen tablet on
Tablet PC Acer Travel Mate C100.

Sponsored by: ACER ,Alpha Omega, MYCOM , Synnex
2003-03-11 16:49:06 +00:00
Ruslan Ermilov cf7d67b20e FreeBSD 5.0 has stopped shipping /modules 2.5 years ago. Catch
up with this further by excluding /modules from the (default)
kern.module_path.
2003-03-11 12:09:25 +00:00
Ian Dowse ec8b828fc4 Make uhci_waitintr() robust to interrupts being enabled, even though
it is expected that they will not be enabled at the time that it
is called. This is reported to work around a problem in RELENG_4
where the kernel panics on boot if FAST_IPSEC and crypto support
are enabled.

Tested by:	Scott Johnson <scottj@insane.com>
2003-03-11 09:12:55 +00:00
Jeff Roberson 9ec559555b - Regularize variable usage in cluster_read().
- Issue the io that we will later block on prior to doing cluster read ahead
   so that it is more likely to be ready when we block.
 - Loop issuing clustered reads until we've exhausted the seq count supplied
   by the file system.
 - Use a sysctl tunable "vfs.read_max" to determine the maximum number of
   blocks that we'll read ahead.
2003-03-11 06:14:03 +00:00
David Xu 661db6da35 Lock proc lock before changing p_flag. 2003-03-11 03:16:02 +00:00
David Xu 21e0492ab1 Fix signal delivering bug for threaded process. 2003-03-11 02:59:50 +00:00
Nate Lawson bdc321a648 Quirk for SanDisk ImageMate II compact flash reader
PR:		kern/47877
Submitted by:	Mike Durian <durian@boogie.com>
MFC after:	3 days
2003-03-11 02:07:17 +00:00
Nate Lawson 2a7e0bee37 Quirk for Pentax Optio 230 USB camera. Note that other products probably
use the underlying AsahiOptical USB chip and thus this quirk may need to
be generalized in the future.

PR:		kern/46369
Submitted by:	Tim Vanderhoek <vanderh@ecf.utoronto.ca>
MFC After:	3 days
2003-03-11 01:55:11 +00:00
Nate Lawson bc25d60d7c usbdevs entry for Asahi Optical OPTIO 230 digital camera. Regen. 2003-03-11 01:41:33 +00:00
Eric Anholt acbdeb0ca1 Update Radeon PCI IDs and naming from pciids.sf.net. 2003-03-11 01:38:17 +00:00
David Xu e574e444e0 Fix threaded process job control bug. SMP tested.
Reviewed by: julian
2003-03-11 00:07:53 +00:00
Poul-Henning Kamp e582990901 If we run out of consumers while orphaning them, and the provider's geom
is withering, destroy the provider when done.

This was exposed by the recent change to geom_dev's orphaning logic.
2003-03-10 23:41:41 +00:00
Poul-Henning Kamp e60dce6b42 Fix yet another fallout of our M_* song and dance. 2003-03-10 23:34:12 +00:00
Jake Burkholder 3233337249 "Or" is expressed with 2 separate config lines.
Reported by:	Stijn Hoop <stijn@win.tue.nl>
2003-03-10 23:25:54 +00:00
Alexander Kabaev 72f0679cfa Remove trainling whitespace. 2003-03-10 21:55:00 +00:00
Poul-Henning Kamp 194a0abf73 PHCC[1]:
I had commented the #ifdef INVARIANTS checks out to make sure I ran this
code in all kernels and forgot to comment the #ifdefs back in before I
committed.

Spotted by:	bmilekic

[1] PHCC = Pointy Hat Correction Commit
2003-03-10 20:24:54 +00:00
Poul-Henning Kamp d3c11994e1 Make malloc and mbuf allocation mode flags nonoverlapping.
Under INVARIANTS whine if we get incompatible flags.

Submitted by:   imp
2003-03-10 19:39:53 +00:00
John Baldwin 0e8677f68b Now that we have WITNESS_WARN(), we only call witness_list() from the
ddb 'show locks' command.  Thus, move witness_list() to the #ifdef DDB
section and remove extra checks for calling this function outside of
DDB.  Also, witness_list() now returns void instead of returning an int.

Reported by:	Steve Ames <steve@energistic.com>
Prodded by:	davidxu
2003-03-10 17:03:57 +00:00
Søren Schmidt cad57b089a Remove the enclose_print() call, it is already called from ata-disk.c 2003-03-10 08:20:57 +00:00
Søren Schmidt 7b4cb338ac Dont use r_bmio on Cyrix chips if not set from BIOS. 2003-03-10 08:20:14 +00:00
Marcel Moolenaar e9523c31c5 Fix two rounds of breakages and cleanup. Remove the sccdebug sysctl
while I'm here and garbage collect dead code (ssc_clone). Define
d_maxsize as DFLTPHYS for now because that's what it will be if we
don't define it.
2003-03-10 01:58:31 +00:00
David Malone fca9a10bc1 Add a a sysctl, hw.kbd.keymap_restrict_change, which acts a bit
like secure level but which restricts changes to the keymap. Its
values impose the following restrictions:

0: No restriction - this is the default.
1: Only root can change restricted keys (like boot, panic, ...)
2: Only root can change restricted keys and regular keys.
   Other users still can change accents and function keys.
3: Only root can change restricted keys, regular keys and accents.
4: Only root can change any of the keymap (restricted keys, regular
      keys, accents and function keys).

Unfortunately, the keyboard's accent map is cleared when a new keymap
is loaded, which makes the distinction between level 3 and level 4
less useful.

The MAC guys might like to make this a policy?

No objections from: -audit about 6 moths ago
2003-03-09 22:49:48 +00:00
Poul-Henning Kamp 45901e280b Don't call make_dev() before we are ready for it. 2003-03-09 20:42:49 +00:00
Alan Cox 167b972088 Remove some unnecessary actions by the zero-copy setup and teardown code.
Remove an incorrect comment.  (Incrementing an object's reference count
does not prevent a process from exiting.  The real concern here is that the
physical page must not be deleted until transmission is complete.  That is
already handled by the VM system and sf_buf_free().)

Tested by:	ken
2003-03-09 20:38:56 +00:00
Shunsuke Akiyama 20280807ca Fix device freeze to reduce output packet size.
And make this value configurable by kernel config or sysctl.
2003-03-09 11:50:27 +00:00
Shunsuke Akiyama 4e6f1adc6b Fix page fault with FTDI's USB serial device.
Fix lost characters counting.
Move setting receiver state to proper place on ucomstopread().
2003-03-09 11:33:26 +00:00
Shunsuke Akiyama 86aa13bdbf Fix duplicate sc_dying usage.
All drivers which depend on ucom interfaces should use only one
sc_dying.
2003-03-09 11:19:18 +00:00
Shunsuke Akiyama 5ce609f75b Add missing module dependency. 2003-03-09 11:14:34 +00:00
Poul-Henning Kamp d42ee4e410 Note that MAJOR_AUTO is now the default if d_maj is not initialized. This
is more robust and prevents the hijacking of /dev/console for the typical
mistake.

Remove unneeded MAJOR_AUTO uses, it is only needed explicitly now if the
driver source has cross-branch compatibility to old releases.
2003-03-09 11:03:45 +00:00
Poul-Henning Kamp 441931b53c Define MAJOR_AUTO as zero, which means that leaving out an initialization
of d_maj means "allocate major number automatically".

Keep the definition of MAJOR_AUTO to make life easier for cross-branch
source maintainers.
2003-03-09 10:29:20 +00:00
Poul-Henning Kamp 06a8bb906c Add one little hack to allow us to make MAJOR_AUTO be zero:
Let the console driver ask for major 256 and magically change this to
mean zero.
2003-03-09 10:28:05 +00:00
Yoshihiro Takahashi e76a843b59 MFi386: revision 1.1079 2003-03-09 10:20:16 +00:00
Yoshihiro Takahashi 26db0f997b Merged from sys/dev/syscons/syscons.c revision 1.396. 2003-03-09 10:18:15 +00:00
Yoshihiro Takahashi 947878824d Merged from sys/dev/sio/sio.c revisions 1.387 and 1.388. 2003-03-09 10:15:11 +00:00
Yoshihiro Takahashi 484be8eac1 Build the drm module also on pc98. 2003-03-09 10:12:58 +00:00
Poul-Henning Kamp 564632b081 Remove unneeded #include of geom_stats.h 2003-03-09 10:04:21 +00:00
Poul-Henning Kamp f48b881942 Stamp out Danglish. 2003-03-09 10:02:31 +00:00
Poul-Henning Kamp 0e6be4723b Don't use statistics counters to detect outstanding I/O. 2003-03-09 10:01:16 +00:00
Poul-Henning Kamp c6ae9b5fd2 Don't abuse the statistics counters for detecting if we have outstanding
I/O requests, instead use the new dedicated fields in the consumer and
provider to track this.
2003-03-09 09:59:48 +00:00
Poul-Henning Kamp 0e082fcca2 Add u_int nstart, nend counters to consumer and providers so we will not
have to examine the stats structure to tell if we have outstanding I/O
requests.

Making them u_int improves the chance of atomic updates to them,
but risks roll-over.  Since the only interesting property is if
they are equal or not, this is not an issue.
2003-03-09 09:58:36 +00:00
Poul-Henning Kamp df6c9fe955 When a DEV class consumer is orphan'ed we need to wait for all the
outstanding requests to return before we unravel the mesh.

It is very important that the stuff below us plays nice and don't
overlook a couple of outstanding bio's, because until they remember
the geom event thread is blocked.  At an expense in code here this
could be made more robust, but I actually _want_ a robust failure
in this case so any offending drivers can be fixed.
2003-03-09 09:28:45 +00:00
David Xu d03c79eea1 Cosmetic change, make it QUEUE_MACRO_DEBUG friendly 2003-03-09 04:27:46 +00:00
Eric Anholt 43e2d1e384 Update the DRM to latest from DRI CVS. This is approximately the version
included in XFree86 4.3, but includes some fixes.  Notable changes include
Radeon 8500-9100 support, PCI Radeon/Rage 128 support, transform & lighting
support for Radeons, and vblank syncing support for r128, radeon, and mga.
The gamma driver was removed due to lack of any users.
2003-03-09 02:08:30 +00:00
Tim J. Robbins ef3dab76bf Hold the proc lock while accessing p_procsig in trapsignal(). 2003-03-09 01:40:55 +00:00
Jonathan Lemon fb68148f4a Discard the packet if the netisr queue is null instead of panicing, for
the benefit of modules which are compiled differently than the kernel.
2003-03-08 22:12:32 +00:00
Jonathan Lemon a3b6edc353 Remove check for t_state == TCPS_TIME_WAIT and introduce the tw structure.
Sponsored by: DARPA, NAI Labs
2003-03-08 22:07:52 +00:00
Jonathan Lemon 607b0b0cc9 Remove a panic(); if the zone allocator can't provide more timewait
structures, reuse the oldest one.  Also move the expiry timer from
a per-structure callout to the tcp slow timer.

Sponsored by: DARPA, NAI Labs
2003-03-08 22:06:20 +00:00
Jonathan Lemon 921f8bb982 Fix module build by adding options to Makefile. 2003-03-08 21:54:32 +00:00
Poul-Henning Kamp f37de12275 Retire devstat_add_entry() as a public function and bump __FreeBSD_version
to mark this act.
2003-03-08 21:46:43 +00:00
Poul-Henning Kamp a9d2245ea8 Allocate the devstat structure with devstat_new_entry(). 2003-03-08 21:44:46 +00:00
John Polstra 537b41d5ff Correct names for fxp devices. Sort data by devid in
fxp_ident_table.

PR:		kern/48699
Submitted by:	Sergey A. Osokin <osa@FreeBSD.org.ru>
Obtained from:	NetBSD (the device strings, that is)
MFC after:	4 weeks
2003-03-08 21:44:21 +00:00
Poul-Henning Kamp 8098046099 Allocate the devstat structure with devstat_new_entry(). 2003-03-08 21:32:59 +00:00
Poul-Henning Kamp 09f958046c Allocate devstat structure with devstat_new_entry(). 2003-03-08 20:00:11 +00:00
Poul-Henning Kamp c7e73d59c4 Introduce a device driver for /dev/devstat, this will allow us to mmap
the device statistics structures into userland instead of using sysctl.

Introduce new devstat_new_entry() function which allocates the devstat
structure an calls devstat_add_entry() on it.
2003-03-08 19:58:57 +00:00
Poul-Henning Kamp bfd614b8a5 Augment the devstat structure with 3 new fields and bump the DEVSTAT_VERSION.
Two fields are sequence numbers for integrity check when we switch devstat
to use mmap to export data rather than sysctl, the last field is to mark
this as an allocated devstat entry.
2003-03-08 19:55:59 +00:00
Jonathan Lemon 06acad4aa4 Revert last change and insure the driver can support other address families.
Pointed out by: ume, matusita
2003-03-08 17:32:21 +00:00
Jonathan Lemon e0e6419344 The tun driver is INET only. Don't pretend to support other address families.
Sponsored by: DARPA, NAI Labs
2003-03-08 16:26:34 +00:00
Jonathan Lemon 8c90439d70 Include correct opt_* headers for supported address families. Dike out
the unused ATM cases.

Sponsored by: DARPA, NAI Labs
2003-03-08 16:25:27 +00:00
Poul-Henning Kamp 60794e0478 Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
Tim J. Robbins 74c69254e6 Remove unimplemented IP-in-IPX encapsulation support (options IPTUNNEL). 2003-03-08 06:58:22 +00:00
Kenneth D. Merry 9b80d344ec Zero copy send and receive fixes:
- On receive, vm_map_lookup() needs to trigger the creation of a shadow
  object.  To make that happen, call vm_map_lookup() with PROT_WRITE
  instead of PROT_READ in vm_pgmoveco().

- On send, a shadow object will be created by the vm_map_lookup() in
  vm_fault(), but vm_page_cowfault() will delete the original page from
  the backing object rather than simply letting the legacy COW mechanism
  take over.  In other words, the new page should be added to the shadow
  object rather than replacing the old page in the backing object.  (i.e.
  vm_page_cowfault() should not be called in this case.)  We accomplish
  this by making sure fs.object == fs.first_object before calling
  vm_page_cowfault() in vm_fault().

Submitted by:	gallatin, alc
Tested by:	ken
2003-03-08 06:58:18 +00:00
David Xu b4508d7d3f Lock sched_lock before modifying td_flags. 2003-03-08 04:09:04 +00:00
David Xu 1108975fe0 Initialize eflags in fake frame to default value rather than random one.
The random value sometimes causes macro CLKF_USERMODE to return true
because PSL_VM bit is set and really shoudn't be, this causes statclock()
to execute in wrong path, and further breaks KSE code and kernel crashes
when executing threaded program.
2003-03-08 03:58:50 +00:00
Kirk McKusick 34968037b1 Use the appropriate size when zeroing out the unused portion
of a snapshot's copy of a superblock. This patch fixes a panic
when taking a snapshot of a 4096/512 filesystem.

Reported by:	Ian Freislich <ianf@za.uu.net>
Sponsored by:   DARPA & NAI Labs.
2003-03-07 23:49:16 +00:00
Andrey A. Chernov 864b284996 Replace u_int with "unsigned int" to prevent following errors:
#include <sys/types.h>
#include <sys/stat.h>

main () {
}

cc -D_POSIX_C_SOURCE test.c
/usr/include/sys/stat.h:127: syntax error before "u_int"
/usr/include/sys/stat.h:158: syntax error before "u_int"

(u_int becomes invisible for _POSIX_C_SOURCE and some other *_SOURCE modes)
2003-03-07 23:11:37 +00:00
Rob Braun d132c84f07 Fix a spelling error.
Submitted by:	jkh
Reviewed by:	zarzycki
2003-03-07 22:47:32 +00:00
John Baldwin 9722121a3c Respect any passed in external lockmgr flags such as LK_NOWAIT in the
default implementations of VOP_LOCK() and VOP_UNLOCK().

Tested by:	jlemon, phk
Glanced at by:	jeffr
2003-03-07 20:45:07 +00:00
Poul-Henning Kamp ea6ff0649f Limit our requests to DFLTPHYS, this is generally a good idea for
memory-allocation purposes.  Right now it is also a very good idea
because we hit a Giant assertion in the free(9) processing if we
free something larger than 64k.
2003-03-07 19:09:46 +00:00
Tim J. Robbins f69d0d7067 Set f_fstypename in coda_nb_statfs(). 2003-03-07 09:18:15 +00:00
Tom Rhodes ff470880ba Fix a few spelling errors.
Submitted by:	Stefan Farfeleder <stefan@fafoe.dyndns.org> via -doc.
2003-03-07 03:24:38 +00:00
Hidetoshi Shimokawa 3b79dd164b - improve timeout handling in fwmem.c
- stop processing of TX db if we reaches the end of active db.
2003-03-07 02:51:59 +00:00
Justin T. Gibbs 2cd3cc377a aic79xx.c:
Include read streaming in the PPR flags we display in diagnostics.

	In ahd_reset(), set the known mode after our initial pause prior to
	setting the mode. We can't just set the mode directly because the
	current mode, after the pause, is most likely unknown and setting the
	mode when the saved mode is unknown will trigger an assertion in
	the mode debug code.

	Complete an audit for SCB RAM reads.  These reads must be performed
	via the special ahd_in?_scbram() methods so we can perform a
	Rev A. PCI-X workaround.

	Remove a superfluous mode save operation that was performed just
	prior to a call to ahd_clear_critical_section().  The saved mode
	was never restored and wouldn't have been valid anyway since the
	mode could change while single stepping out of a critical section.

aic79xx.h:
	Add new BUG definition AHD_PCIX_SCBRAM_RD_BUG.

aic79xx_inline.h:
	Update ahd_inb_scbram routine to check for AHD_PCIX_SCBRAM_RD_BUG
	and only apply the workaround if this bug is active.  The old code
	applied the workaround in all cases.

aic79xx_pci.c:
	Set AHD_PCIX_SCBRAM_RD_BUG for the A4.

	Remove an attempted saved_modes call in ahd_pci_test_register_access().
	Saving the modes can only occur when we are paused, but the call was
	happening before the chip was known to be paused.  Restoring the
	modes doesn't make sense either since the code makes no assumptions
	about the state of the sequencer until the first time the mode is set
	by the driver.  This happens after the registers are successfully
	mapped.
2003-03-06 23:58:34 +00:00
Kirk McKusick 9a9906281f When the system is panicing, the lock manager grants all lock
requests whether or not the lock is available. To avoid "unlocked
buffer" panics after a crash, we just claim that all buffers
are locked when cleaning up after a system panic.

Reported by:	Attila Nagy <bra@fsn.hu>
Sponsored by:   DARPA & NAI Labs.
2003-03-06 21:40:07 +00:00
John Baldwin 9da590b49b Oops, fix the double faults people were seeing with the recent changes to
witness.  Sleepable locks such as sx locks always come before all mutexes
including Giant.  However, the static lock order list placed Giant before
the proctree and allproc sx locks.  This resulted in witness creating a
cycle in its lock order "tree" (real trees don't have cycles) leading to
infinite recursion and eventually a double fault.  To fix, put Giant after
sx locks in the lock order list.
2003-03-06 17:25:06 +00:00
Takanori Watanabe b256620797 Add integer value of _CID handling.
If _CID is string, it will need more complicated
handling to distinguish bus other than ISA.

Submitted by: Paul Wankadia <junyer@gmx.net>
2003-03-06 14:40:15 +00:00
Tim J. Robbins 1303bfb807 Add a temporary workaround for a deadlock in Coda venus 5.3.19 that
occurs when mounting the filesystem. The problem is that venus issues
the mount() syscall, which calls vfs_mount(), which calls coda_root()
which attempts to communicate with venus.
2003-03-06 10:48:03 +00:00
Tim J. Robbins fe72c63e22 Remove fragments of support for the FreeBSD 3.x and 4.x branches. 2003-03-06 10:38:18 +00:00
Hidetoshi Shimokawa 2b4601d10b MFp4(simokawa_sbp)
Improve if_fwe performance.
- Simplify mbuf handling by using bulkxfer.
	Now, it uses mbuf clusters for RX buffer as usual ethernet drivers.
- Recycle struct xfer buffer and don't call malloc at runtime.
- Count input and output errors.
- Handle a mbuf chain longer than 6 correctly.
- Increase queue length.
2003-03-06 05:06:44 +00:00
Alan Cox 7c4351aabd Remove GIANT_REQUIRED from sf_buf_free(). 2003-03-06 04:48:19 +00:00