dragonfly.git
13 years agokernel: Comment out some unused functions.
Sascha Wildner [Sun, 27 Feb 2011 01:09:54 +0000 (02:09 +0100)]
kernel: Comment out some unused functions.

13 years agomly(4): Put mly_timeout() under MLY_DEBUG where it belongs.
Sascha Wildner [Sun, 27 Feb 2011 01:06:32 +0000 (02:06 +0100)]
mly(4): Put mly_timeout() under MLY_DEBUG where it belongs.

13 years agokernel - Fix incorrect inode wait code in HAMMER
Matthew Dillon [Sat, 26 Feb 2011 17:32:40 +0000 (09:32 -0800)]
kernel - Fix incorrect inode wait code in HAMMER

* Fix incorrect code t wait for an inode flush to finish.  This should also
  fix the reported assertion.

  Any bugs in this new code would likely result in process stalls instead
  of panics, so watch for that possibility.

Reported-by: Venkatesh Srinivas <vsrinivas@dragonflybsd.org>,
     Peter Avalos <peter@theshell.com>

13 years agolibrt: Fix buildworld by putting some unused variables in #if 0.
Sascha Wildner [Sat, 26 Feb 2011 09:29:13 +0000 (10:29 +0100)]
librt: Fix buildworld by putting some unused variables in #if 0.

While here, use #if 0 for #ifdef notyet in the committed part, too.

13 years agoifconfig(8): Change constructor priorities from 100 to 101.
Sascha Wildner [Sat, 26 Feb 2011 08:30:01 +0000 (09:30 +0100)]
ifconfig(8): Change constructor priorities from 100 to 101.

This silences some gcc44 warnings.

Constructor priorities are bounded between 101 and 65535 inclusive.
0 to 100 are reserved for the implementation.

See also:

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html

13 years agoAdd YY_NO_INPUT to a number of lex(1) input files (silences gcc44 warnings).
Sascha Wildner [Sat, 26 Feb 2011 08:14:54 +0000 (09:14 +0100)]
Add YY_NO_INPUT to a number of lex(1) input files (silences gcc44 warnings).

13 years agolibrt -- AIO: Implement SIGEV_THREAD for AIO completion notification.
Venkatesh Srinivas [Sat, 26 Feb 2011 03:40:31 +0000 (19:40 -0800)]
librt -- AIO: Implement SIGEV_THREAD for AIO completion notification.

SIGEV_THREAD launches a libthread thread in response to I/O completion.
We link librt against libthread to allow access to the pthread_*
routines.

13 years agolibevtr: Add YY_NO_INPUT to ktrfmt.l and regenerate (silences gcc44 warning).
Sascha Wildner [Fri, 25 Feb 2011 19:51:36 +0000 (20:51 +0100)]
libevtr: Add YY_NO_INPUT to ktrfmt.l and regenerate (silences gcc44 warning).

13 years agoAdd 'gcc46' as a CCVER value (using /usr/pkgsrc/lang/gnat-aux).
Sascha Wildner [Fri, 25 Feb 2011 17:20:18 +0000 (18:20 +0100)]
Add 'gcc46' as a CCVER value (using /usr/pkgsrc/lang/gnat-aux).

So far I've tested building and running our kernel (which both works).

World hasn't been tested and would fail using default values, since
gnat-aux so far only supports C and Ada.

Many thanks to John Marino <john@marino.st> who did and maintains the
lang/gnat-aux package.

13 years agogcc44: Make i486 the default arch
Sepherosa Ziehau [Fri, 25 Feb 2011 03:36:57 +0000 (11:36 +0800)]
gcc44: Make i486 the default arch

13 years agomk: Rearrange bsd.cpu.gcc44.mk
Sepherosa Ziehau [Thu, 24 Feb 2011 09:15:19 +0000 (17:15 +0800)]
mk: Rearrange bsd.cpu.gcc44.mk

- Don't always set -march=xxx
- Support CPUTYPE=native
- Support several new -march argument, e.g. barcelona
- Split CPUTYPE adjustment into compat CPUTYPE adjustment and
  CPUTYPE alias adjustment

13 years agomk: Add FORCE_CPUTYPE which overrides user's CPUTYPE or forcefully sets CPUTYPE
Sepherosa Ziehau [Thu, 24 Feb 2011 06:13:24 +0000 (14:13 +0800)]
mk: Add FORCE_CPUTYPE which overrides user's CPUTYPE or forcefully sets CPUTYPE

13 years agoRemove an old header via 'make upgrade'.
Sascha Wildner [Fri, 25 Feb 2011 11:37:04 +0000 (12:37 +0100)]
Remove an old header via 'make upgrade'.

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 24 Feb 2011 22:16:52 +0000 (14:16 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - Major bridging functionality added (bonding)
Matthew Dillon [Thu, 24 Feb 2011 22:14:42 +0000 (14:14 -0800)]
kernel - Major bridging functionality added (bonding)

* Add channel bonding support to if_bridge.  This utilizes the link2 flag
  on the bridge interface.  Participating member interfaces must be
  programmed to the same MAC address.  Multiple bonding groups can be
  created.

  Note that both sides of participating member interfaces must implement
  the link2 feature.  If the other side does not it will likely be blocking
  (due to the spanning tree protocol) some of the member interfaces and
  you will get packet loss.

* Document all the link flags and new features.

13 years agoRemove the meteor(4) driver.
Sascha Wildner [Thu, 24 Feb 2011 18:19:34 +0000 (19:19 +0100)]
Remove the meteor(4) driver.

It stopped building when -msoft-float was added to the options for building
the kernel.

FreeBSD removed it over 7 years ago, and so far I've heard of no one using
DragonFly because he had one of those old cards and we still had a driver,
so I guess it's safe to follow suit.

However, the <dev/video/meteor/ioctl_meteor.h> header is used by other,
working drivers (bktr(4) and cxm(4)) so we keep it. We also keep the
/usr/share/examples/meteor directory because the bktr(4) driver is based
on meteor(4) and bktr(4)'s manual page references these examples as being
mostly valid for bktr(4), too.

13 years agoprocfs - Fix open() for procfs.
Antonio Huete Jimenez [Thu, 24 Feb 2011 10:58:36 +0000 (11:58 +0100)]
procfs - Fix open() for procfs.

* PFIND() macro has been replaced with function pfs_pfind()
  which will hold a reference to the found proc via pfind()
  or on proc0 in the case no process is found.
* Fix a case where there was no PRELE() after a pfind()

13 years agokernel - Major bridging functionality completed
Matthew Dillon [Thu, 24 Feb 2011 08:28:23 +0000 (00:28 -0800)]
kernel - Major bridging functionality completed

* Rewrite the spanning tree algorithm.  Not well tested but both sides
  properly calculate the blocking pairs for the ports whereas before
  they did not.

  Document the code as needed.  The poor documentation created a lot of
  unnecessary headaches.

  Separate out the peer state from the aggregated state.

* Greatly enhance the 'ifconfig [-v] bridgeN' status output so one
  can see exactly what the state of the sub-interfaces is.

* The bridge interface's ether address can now be modified.  It is also
  possible to add IP addresses to the bridge interface but this has
  not been tested well and might not work.

* Nearly all traffic sourced from interfaces attached to the bridge
  now use the bridge's MAC address.  This includes ARP.  Theoretically
  this means that ganged links between bridges (bonding is NOT yet
  supported! Strictly master/backup)... should be able to failover
  without destroying the ARP tables on various systems.

* Add an experimental LINK2 option to the bridge.  This will eventually
  be channel bonding but doesn't work so hot right now.  At the moment
  it just round-robins output on sub-interfaces with the same MAC (usually
  TAP interfaces).  Ill gets aggregated using the bridge's MAC but the
  comparison is used to create bonding groups.

  This one needs considerably more work on properly adjusting its state
  to DESIGNATED instead of hacking packets over members in the BLOCKING
  state.

* Clean up some of the state transitions used by the LINK1 failover
  feature.

* Change the bridge interface to IFT_ETHER to allow IP and MAC assignments
  and for it to be properly handled in the rest of the stack.

* Aggregate input from all member interfaces into the bridge proper and
  re-output/forward/route as appropriate using the stateful information
  available in the bif lists to handle failover and other features.

* ARP handles MAC snafus due to bridging a little better.

* Changeover to TAILQs from LISTs for bifs.

* Move bif_flags to the bif_info structure so we can use it to hold
  active state.

* Implement SIOCGIFMEDIA in IF_TAP (still needs some work).  This
  is required by the bridge code to properly be able to use TAP
  interfaces as members.

13 years agoLINT: Comment out meteor(4) for now (it doesn't build with -msoft-float).
Sascha Wildner [Thu, 24 Feb 2011 08:35:33 +0000 (09:35 +0100)]
LINT: Comment out meteor(4) for now (it doesn't build with -msoft-float).

13 years agokernel - Fix serious bug w/non-blocking commit
Matthew Dillon [Thu, 24 Feb 2011 04:59:59 +0000 (20:59 -0800)]
kernel - Fix serious bug w/non-blocking commit

* NDELAY isn't supposed to make HAMMER do non-block disk I/O,
  NRDELAY is the only one that does that.

* Fixes tons and tons of confusion (named, vi, tons of other
  programs that open regular files O_NONBLOCK).

Requested-by: Venkatesh Srinivas <me@endeavour.zapto.org>
13 years agoFix typo in last commit.
Peter Avalos [Thu, 24 Feb 2011 02:37:27 +0000 (16:37 -1000)]
Fix typo in last commit.

Requested-by: Venkatesh Srinivas <me@endeavour.zapto.org>
13 years agokernel -- Add O_FRNONBLOCKING, to allow reads which do not block on disk accesses.
Venkatesh Srinivas [Wed, 23 Feb 2011 15:12:20 +0000 (07:12 -0800)]
kernel -- Add O_FRNONBLOCKING, to allow reads which do not block on disk accesses.

Using extpread() or extpreadv() with O_FRNONBLOCKING on HAMMER file systems now allows
reads to return EWOULDBLOCK when the requested data is not in the buffer cache.

13 years agomy(4): Add a missing '=' (although in an #if 0'd section).
Sascha Wildner [Wed, 23 Feb 2011 14:40:37 +0000 (15:40 +0100)]
my(4): Add a missing '=' (although in an #if 0'd section).

13 years agokernel - Greatly enhance if_bridge
Matthew Dillon [Wed, 23 Feb 2011 04:56:42 +0000 (20:56 -0800)]
kernel - Greatly enhance if_bridge

* Document the link0 feature, which enables transparent bridging.

* Implement the link1 feature, automatic failover using a slight mangling
  of the 802.11d protocol.  Both ends must implement the feature for this
  to work.  Essentially this causes CFG 802.11d messages to be generated
  on the hello interval even if a bridge is not the root bridge.

  The bridge also monitors for this traffic and places the link in a special
  L1BLOCKING state if it fails to receive any frames in (10 x hello) (around
  20 seconds usually).  This will automatically cause the bridge to failover
  to other links.

  This only operates on links participating in the STP protocol (see man
  ifconfig), when link1 is set on the bridge interface.  For ethernet
  bridging the link interfaces are typically multiple TAP interfaces.

* Allow all link interfaces participating in a bridge to have the same
  MAC address (used with TAP interfaces typically).  This is mandatory
  if you also intend to use the link1 feature and want your failover to
  be reasonably smooth.  The feature can be useful regardless.

* The ifconfig bridge output now shows additional information about
  link state and who it thinks the root node is.

13 years agortld(1), headers, manual pages: Bring in some whitespace, comment etc. fixes.
Sascha Wildner [Tue, 22 Feb 2011 17:31:49 +0000 (18:31 +0100)]
rtld(1), headers, manual pages: Bring in some whitespace, comment etc. fixes.

These are all non-functional changes that reduce diffs to FreeBSD.

Submitted-by: John Marino <john@marino.st>
Taken-from:   FreeBSD

13 years ago<sys/link_elf.h>: Fix include guard.
Sascha Wildner [Tue, 22 Feb 2011 17:31:08 +0000 (18:31 +0100)]
<sys/link_elf.h>: Fix include guard.

Submitted-by: John Marino <john@marino.st>
Taken-from:   FreeBSD

13 years agokernel - Unconditionally clear BRIDGE_MBUF_TAGGED in two cases
Matthew Dillon [Tue, 22 Feb 2011 16:54:48 +0000 (08:54 -0800)]
kernel - Unconditionally clear BRIDGE_MBUF_TAGGED in two cases

* First unconditionally clear BRIDGE_MBUF_TAGGED if the target MAC
  in the link header points to us, regardless of what we do with the
  packet.

* Second, unconditionally clear BRIDGE_MBUF_TAGGED if IPFW2 redirects
  the packet destination, bad things will happen if the original source
  MAC is kept in the link header.  i.e. the packet becomes routed at
  that point.

13 years agokernel/i386: Add -msoft-float to CFLAGS
Sepherosa Ziehau [Tue, 22 Feb 2011 14:24:01 +0000 (22:24 +0800)]
kernel/i386: Add -msoft-float to CFLAGS

13 years agolibstand: Make sure that -march=i386 is specified
Sepherosa Ziehau [Tue, 22 Feb 2011 12:03:40 +0000 (20:03 +0800)]
libstand: Make sure that -march=i386 is specified

This unbreaks the loader compiled by gcc44

13 years agodloader: Make sure that -march=i386 is specified
Sepherosa Ziehau [Tue, 22 Feb 2011 12:03:11 +0000 (20:03 +0800)]
dloader: Make sure that -march=i386 is specified

13 years agoMerge branch 'master' of /repository/git/dragonfly
Venkatesh Srinivas [Tue, 22 Feb 2011 11:35:54 +0000 (03:35 -0800)]
Merge branch 'master' of /repository/git/dragonfly

13 years agomptable: Implement stub I/O APIC enumerator
Sepherosa Ziehau [Tue, 22 Feb 2011 10:59:14 +0000 (18:59 +0800)]
mptable: Implement stub I/O APIC enumerator

13 years agokernel - More if_bridge work + misc fixes
Matthew Dillon [Tue, 22 Feb 2011 00:02:30 +0000 (16:02 -0800)]
kernel - More if_bridge work + misc fixes

* When bridging packets sent from one of our own MACs we always override
  the ether_shost in the output packet so it comes from the actual
  interface the packet is being sent out on.

* LINK0 will still nominally keep the ether_shost intact when forwarding
  across a bridge, except in the above case.  That is, any foreign MAC
  set as the source coming in on one interface will be retained as the
  source when being thrown out on another interface.  But any local MAC
  will be replaced with the MAC of the outgoing interface.

* When receiving a unicast frame on one interface which is targetted to
  another interface, retain the original rcvif for any vlan or arp
  processing.  Otherwise (for example) if this were an ARP reply the ARP
  code would associate the reply with the wrong interface.  We would want
  the ARP entry to be associated with the first interface, not the second,
  because the first interface is the one the reply actually came in on.

* Adjust the ARP code in if_ether.c to use rcvif and not ifp, and don't
  log if non-matching interfaces are part of the same bridge (unless
  log_arp_wrong_iface is set to 2).

* Augment the ether_reinput_cpu() API to pass additional flags in,
  allowing the caller to specify that m->m_pkthdr.rcvif not be
  overwritten.  Used to support the above features.

* Clear M_HASH in a few more cases in pf.c

13 years agoAdd definitions for SIGEV_THREAD.
Venkatesh Srinivas [Mon, 21 Feb 2011 23:07:16 +0000 (15:07 -0800)]
Add definitions for SIGEV_THREAD.

13 years agortld.1: Staticize the variable in the _rtld_functrace example.
Sascha Wildner [Mon, 21 Feb 2011 20:47:42 +0000 (21:47 +0100)]
rtld.1: Staticize the variable in the _rtld_functrace example.

Pointed-out-by: corecode
13 years agortld.1: Add an example on how to set up _rtld_functrace.
Sascha Wildner [Mon, 21 Feb 2011 20:38:54 +0000 (21:38 +0100)]
rtld.1: Add an example on how to set up _rtld_functrace.

While here, put the function's prototype into the SYNOPSIS and add a
_rtld_functrace(3) MLINK.

13 years agotcp: Allow listen(2) to be called on the same socket for any number of times
Sepherosa Ziehau [Mon, 21 Feb 2011 05:42:28 +0000 (13:42 +0800)]
tcp: Allow listen(2) to be called on the same socket for any number of times

DragonFly-bug: http://bugs.dragonflybsd.org/issue1993

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 21 Feb 2011 03:36:00 +0000 (19:36 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - Fix extra rel_mplock() in if_tap
Matthew Dillon [Mon, 21 Feb 2011 03:35:12 +0000 (19:35 -0800)]
kernel - Fix extra rel_mplock() in if_tap

* Fix crash/panic when running openvpn w/if_tap due to dangling
  rel_mplock().

13 years agoinpcb: Exclusive the usage of wildcard hash and connect hash
Sepherosa Ziehau [Mon, 21 Feb 2011 02:52:20 +0000 (10:52 +0800)]
inpcb: Exclusive the usage of wildcard hash and connect hash

DragonFly-bug: http://bugs.dragonflybsd.org/issue1993

13 years agoHAMMER - Fix long stalls when writing out core files
Matthew Dillon [Mon, 21 Feb 2011 02:26:17 +0000 (18:26 -0800)]
HAMMER - Fix long stalls when writing out core files

* Fix a long-stall case (hmrwww) due to a broken pipelining algorithm when
  using large write()s to write out large files.

13 years agonewsyslog: Sync with FreeBSD.
Peter Avalos [Sun, 20 Feb 2011 22:14:03 +0000 (12:14 -1000)]
newsyslog: Sync with FreeBSD.

-Don't consider non-existence of a PID file an error.
-Add -P flag which prevents further action if the pidfile is empty or
doesn't exist.
-Add a -S switch to override the default syslog pid file.
-Add support for creating the archived log filenames using a time-stamp
instead of the traditional simple counter.
-Add xz(1) support.
-Rewrite and simplify logfile compression code.
-Convert newsyslog to using queue(3) macros.
-Add file include processing.

Obtained-from: FreeBSD

13 years agoSync /bin/sh regression tests with FreeBSD.
Peter Avalos [Sun, 20 Feb 2011 21:33:23 +0000 (11:33 -1000)]
Sync /bin/sh regression tests with FreeBSD.

-Add some tests for omitting whitespace.
-Split off some special behaviour into separate tests.
-Do not use "local" in the test runner.
-Make execution/fork1.0 work even if the basename of ${SH} is not "sh".
-Test that the read builtin passes through all byte values except NUL,
newline and backslash.
-Unset some locale vars in two tests that may cause them to break.

Obtained-from: FreeBSD

13 years ago<sys/elf_generic.h>: Fix typo in a #warning.
Sascha Wildner [Sun, 20 Feb 2011 12:22:08 +0000 (13:22 +0100)]
<sys/elf_generic.h>: Fix typo in a #warning.

13 years agoRemove some kref(9) related files via 'make upgrade'.
Sascha Wildner [Sun, 20 Feb 2011 09:36:45 +0000 (10:36 +0100)]
Remove some kref(9) related files via 'make upgrade'.

13 years agoLINT: Fix wording and remove a duplicate option from the comments.
Sascha Wildner [Sun, 20 Feb 2011 02:02:42 +0000 (03:02 +0100)]
LINT: Fix wording and remove a duplicate option from the comments.

13 years agokernel - Clear BRIDGE_MBUF_TAGGED for NAT translations
Matthew Dillon [Sat, 19 Feb 2011 22:04:42 +0000 (14:04 -0800)]
kernel - Clear BRIDGE_MBUF_TAGGED for NAT translations

* Clear the new BRIDGE_MBUF_TAGGED flag when a NAT or other translation
  changes the source IP for a packet, otherwise packets traversing a bridged
  interface may wind up with a source MAC that has nothing to do with
  the translated source IP.

13 years agokernel - Add a transparent MAC bridging feature to if_bridge
Matthew Dillon [Sat, 19 Feb 2011 20:57:56 +0000 (12:57 -0800)]
kernel - Add a transparent MAC bridging feature to if_bridge

* Defaults to non-transparent (historical) operation, which is safer.
  Set link0 to use in transparent MAC mode.

* Transparent MAC mode will attempt to retain the MAC source in the
  link address header when retransmitting a packet on a different
  interface.

  Only IP/IPV6 packets will retain the MAC.  ARP and other ether types
  will get the outgoing interface's MAC address, which is usually
  desireable.

* Note that transparent MAC mode is a bit dangerous, which is why it
  isn't turned on by default.  If a packet with the originating MAC
  winds up being sent out the same interface it came in on with the
  MAC intact, any switches between the two boxes will suddenly think
  the originating machine is somewhere else and will get confused.

  The code tries to avoid this situation.

  Bridging loops can also cause this sort of behavior even with the spanning
  tree protocol.  link0 is not recommended if you have loops.

* Coded because I needed this for braindead at&t uverse routers which
  do MAC-based security and only allow one IP association for each MAC,
  and whos firewalls cannot be completely disabled, and which cannot deal
  with IPs on routed networks (it expects everything to be directly connected
  on a switched network. sigh).

13 years agokernel - Fix minor mistake corrupting an allocation in recent MPTable work
Matthew Dillon [Sat, 19 Feb 2011 09:02:26 +0000 (01:02 -0800)]
kernel - Fix minor mistake corrupting an allocation in recent MPTable work

* Fix an allocation which was too small (sizeof pointer vs structure),
  which fixes an early-boot panic.

Reported-by: Peter Avalos <peter@theshell.com>
13 years agokernel - Fix fairq, PF table hash was not being initialized
Matthew Dillon [Sat, 19 Feb 2011 04:49:20 +0000 (20:49 -0800)]
kernel - Fix fairq, PF table hash was not being initialized

* fairq depends on the PF table entry hash, which was not being
  initialized.

* Fixes problems with fairq not queueing fairly.

13 years agokernel - Allow rn_inithead() to be called early
Matthew Dillon [Sat, 19 Feb 2011 04:44:03 +0000 (20:44 -0800)]
kernel - Allow rn_inithead() to be called early

* Allow rn_inithead() to be called earlier than rn_init().  rn_init() is
  called very late and was responsible for creating the all-ones and
  all-zeros keys.  It also required the proto domains to be initialized(?).

* A PF module preload was calling rn_inithead() before the all-ones and
  all-zeros keys could be allocated, resulting in a crash.

13 years agovkernel64 - Enable function name resolution in DDB.
Antonio Huete Jimenez [Fri, 18 Feb 2011 09:05:41 +0000 (10:05 +0100)]
vkernel64 - Enable function name resolution in DDB.

13 years agomptable: Save PCI interrupt pin to I/O APIC pin maps
Sepherosa Ziehau [Fri, 18 Feb 2011 07:54:17 +0000 (15:54 +0800)]
mptable: Save PCI interrupt pin to I/O APIC pin maps

13 years agops: Update man page for adding comm as an alias for ucomm.
Peter Avalos [Fri, 18 Feb 2011 01:23:49 +0000 (15:23 -1000)]
ps: Update man page for adding comm as an alias for ucomm.

13 years agops: Add the comm keyword which is an alias for ucomm.
Peter Avalos [Sun, 13 Feb 2011 22:00:12 +0000 (12:00 -1000)]
ps: Add the comm keyword which is an alias for ucomm.

While I'm here, don't pad the output of ucomm if it's the last column.

13 years agolibrt: Initial userland implementation of POSIX AIO functionality.
Venkatesh Srinivas [Thu, 17 Feb 2011 18:03:42 +0000 (10:03 -0800)]
librt: Initial userland implementation of POSIX AIO functionality.

Issues synchronous IO requests in response to AIO calls; does not
support SIGEV_THREAD or SIGEV_SIGNAL; the former because our
infrastructure doesn't have SIGEV_THREAD already; the latter
because we do not support sigqueue() or sending signals w/ a
sigval payload.

13 years agokernel - Add batch heuristic to scheduler and refactor some of the code 1/2
Matthew Dillon [Thu, 17 Feb 2011 08:47:58 +0000 (00:47 -0800)]
kernel - Add batch heuristic to scheduler and refactor some of the code 1/2

* Split the dynamic priority mechanism into two stages:

* Stage 1 is the normal dynamic priority mechanism which reacts very quickly
  to cpu hogging vs idle / not hogging.

* Stage 2 is a long-term (30-second) batch operations detector which de-tunes
  the estcpu calculation based on how long the process has been acting
  batch-like or non-batch-like.  estcpu is detuned up to 50% for processes
  considered to be fully interactive.

* Newly forked processes are placed two queue slots higher (less desireable)
  than their parent in stage 1.  If they aren't batch they will quickly
  recover.

* Newly forked processes are given a batch heuristic value that is mid-range
  for stage 2 and must prove themselves one way or the other.

* 'ps -o batch -axl' can be used to see the batch heuristic.  ps will display
  it as a value between 0 and 11 for the moment.

  The idea here is for something like firefox and the X server to remain
  interactive even if they use a lot of cpu, while something like a parallel
  buildworld winds up remaining batch-like because the core processes are
  cpu-bound.

13 years agokernel - Fix seg-fault in clock interrupt due to race
Matthew Dillon [Thu, 17 Feb 2011 08:41:43 +0000 (00:41 -0800)]
kernel - Fix seg-fault in clock interrupt due to race

* Fix a seg-fault which can occur due to races against a newly created
  process whos lwp has not been completely initialized.

13 years agox86_64: 64-bit index register should be used.
Sepherosa Ziehau [Thu, 17 Feb 2011 08:00:17 +0000 (16:00 +0800)]
x86_64: 64-bit index register should be used.

Looks like qemu does not accept 32-bit index register, while the
real boxs and virtualbox accept 32-bit index regiter.

However, according to AMD <<24593--Rev. 3.17--June 2010>> Page 25,
64-bit index register should be used to create effective address.

DragonFly-bug: http://bugs.dragonflybsd.org/issue1991

13 years agops - Fix sorting mistake in recent commits
Matthew Dillon [Wed, 16 Feb 2011 22:32:43 +0000 (14:32 -0800)]
ps - Fix sorting mistake in recent commits

* qsort passes a pointer to the element, so its a KINFO** instead of
  a KINFO*.  Fix the indirection.

* Fixes weird default output sorting that was all wrong.

13 years agokernel - Fix MP refcount race in struct sigacts (2)
Matthew Dillon [Wed, 16 Feb 2011 19:17:37 +0000 (11:17 -0800)]
kernel - Fix MP refcount race in struct sigacts (2)

* Fix buildworld failure by changing u_int to unsigned int in
  header file.

13 years agokernel - Fix MP refcount race in struct sigacts
Matthew Dillon [Wed, 16 Feb 2011 17:53:54 +0000 (09:53 -0800)]
kernel - Fix MP refcount race in struct sigacts

* Code wasn't MPSAFE.

* Use the refcount API to manage refs for struct sigacts

13 years agokernel - knote_alloc() must always succeed
Matthew Dillon [Wed, 16 Feb 2011 17:44:26 +0000 (09:44 -0800)]
kernel - knote_alloc() must always succeed

* We cannot use M_NOWAIT here, knote_alloc() must always succeed.

13 years agokernel - Fix MP refcount race in struct pargs (2)
Matthew Dillon [Wed, 16 Feb 2011 17:43:47 +0000 (09:43 -0800)]
kernel - Fix MP refcount race in struct pargs (2)

* Fix additional case in kern_exit.c

13 years agomptable: Test the usage of default MPTABLE config during mptable_probe()
Sepherosa Ziehau [Wed, 16 Feb 2011 08:22:54 +0000 (16:22 +0800)]
mptable: Test the usage of default MPTABLE config during mptable_probe()

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Wed, 16 Feb 2011 07:51:22 +0000 (23:51 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agomptable: Function renaming
Sepherosa Ziehau [Wed, 16 Feb 2011 03:22:43 +0000 (11:22 +0800)]
mptable: Function renaming

In preparation for the upcoming MPTABLE I/O APIC enumerator.

13 years agomptable: Prepare to create I/O APIC MPTABLE enumerator
Sepherosa Ziehau [Wed, 16 Feb 2011 06:21:13 +0000 (14:21 +0800)]
mptable: Prepare to create I/O APIC MPTABLE enumerator

- Run mptable_probe() at BOOT2_PRESMP/ORDER_FIRST.
- Save MPTABLE's physical address in global variable.
- Move preliminary LAPIC checks from MPTABLE probing to MPTABLE LAPIC
  enumerator's probing function.

13 years agokernel - Fix MP refcount race in struct pargs
Matthew Dillon [Wed, 16 Feb 2011 05:53:05 +0000 (21:53 -0800)]
kernel - Fix MP refcount race in struct pargs

* Protect p->p_args with p->p_token.

* Protect pargs refcounts with sys/refcount.h.

* This fixes at least one memory corruption bug during heavy fork/exec/exit
  testing with fastbulk.

Testing-by: dillon, tuxillo
13 years agokernel -- vm locking: Add vm object locking to vm_object_referenced.
Venkatesh Srinivas [Wed, 16 Feb 2011 05:04:35 +0000 (21:04 -0800)]
kernel -- vm locking: Add vm object locking to vm_object_referenced.

13 years agoRemove VFS_AIO config option.
Venkatesh Srinivas [Wed, 16 Feb 2011 04:48:56 +0000 (20:48 -0800)]
Remove VFS_AIO config option.

13 years agokernel -- Eliminate AIO.
Venkatesh Srinivas [Wed, 16 Feb 2011 04:40:55 +0000 (20:40 -0800)]
kernel -- Eliminate AIO.

AIO was not enabled by default and the code had received little attention.

13 years agoirqmap: Consume the syscall entry in irqmap
Sepherosa Ziehau [Wed, 16 Feb 2011 02:49:43 +0000 (10:49 +0800)]
irqmap: Consume the syscall entry in irqmap

13 years agokernel -- vm locking: Lock kernel_object in kmem_alloc3.
Venkatesh Srinivas [Wed, 16 Feb 2011 02:33:43 +0000 (18:33 -0800)]
kernel -- vm locking: Lock kernel_object in kmem_alloc3.

13 years agoMerge branch 'master' of /repository/git/dragonfly
Venkatesh Srinivas [Wed, 16 Feb 2011 01:20:10 +0000 (17:20 -0800)]
Merge branch 'master' of /repository/git/dragonfly

13 years agoUpdate stale comment in lwkt_token_init().
Venkatesh Srinivas [Wed, 16 Feb 2011 01:19:37 +0000 (17:19 -0800)]
Update stale comment in lwkt_token_init().

13 years agokernel -- vm locking: Take per-object token in vm_map and vm_object_coalesce.
Venkatesh Srinivas [Wed, 16 Feb 2011 01:18:27 +0000 (17:18 -0800)]
kernel -- vm locking: Take per-object token in vm_map and vm_object_coalesce.

13 years agops - Fix longstanding bug in initial populating loop
Matthew Dillon [Wed, 16 Feb 2011 00:58:51 +0000 (16:58 -0800)]
ps - Fix longstanding bug in initial populating loop

* Fix the populating loop to not try to load KInfo[nentries],
  overflowing the array.

* Fixes a seg-fault which can occur when the allocated array is right on
  a page boundary.

13 years agokernel -- vm locking: Add vm_page_(un)lock and vm_object_(un)lock.
Venkatesh Srinivas [Tue, 15 Feb 2011 23:59:44 +0000 (15:59 -0800)]
kernel -- vm locking: Add vm_page_(un)lock and vm_object_(un)lock.

Each vm_object and vm_page are associated with a token; for vm_pages,
we use a pool token; for objects, a per-object token. For vm_pages,
the token will interlock access to the pv_chain, at least.

Also remove per-vm_object range locks. They were unused.

13 years agops - Remove debugging printfs
Matthew Dillon [Tue, 15 Feb 2011 19:42:40 +0000 (11:42 -0800)]
ps - Remove debugging printfs

* Remove debug printfs that were accidently left in

13 years agokernel - Add options SLAB_DEBUG to help debug memory corruption
Matthew Dillon [Tue, 15 Feb 2011 19:37:38 +0000 (11:37 -0800)]
kernel - Add options SLAB_DEBUG to help debug memory corruption

* Adding options SLAB_DEBUG to your kernel config will reconfigure
  kmalloc(), krealloc(), and kstrdup() to record all allocation
  sources on a zone-by-zone basis, file and line number.

  A full kernel recompile is needed when you add or drop this option
  from your kernel config.

* Limited to 32 slots per slab.  Since slabs offer a narrow range of
  chunk sizes this will normally be sufficient.

* When a memory corruption related panic occurs kgdb can be used
  to determine who allocated out of the slab in question.

13 years agomadt: Ignore interrupt override entry if no overriding will happen
Sepherosa Ziehau [Tue, 15 Feb 2011 15:02:30 +0000 (23:02 +0800)]
madt: Ignore interrupt override entry if no overriding will happen

While I'm here, fix up the warning message about bogus trigger mode
and polarity.

13 years agops - Add a new option, -R, which sub-sorts by parent/child and indents
Matthew Dillon [Tue, 15 Feb 2011 07:23:39 +0000 (23:23 -0800)]
ps - Add a new option, -R, which sub-sorts by parent/child and indents

* This new option will sub-sort by process parent/child associations and
  will indent the command to make it very, very obvious.

* This is an ultra useful feature.

13 years agokernel - MPSAFE work, fix race in init zombie cleanup
Matthew Dillon [Tue, 15 Feb 2011 04:29:25 +0000 (20:29 -0800)]
kernel - MPSAFE work, fix race in init zombie cleanup

* Acquire the required initproc->p_token when reparenting an exiting
  process's children to init, fixing a race against init's wait*().

13 years agokernel - Remove the last MP locks from tmpfs (2).
Matthew Dillon [Mon, 14 Feb 2011 21:20:57 +0000 (13:20 -0800)]
kernel - Remove the last MP locks from tmpfs (2).

* The tmpfs interlock is the per-mount token now, not the MP lock

Reported-by: Venkatesh Srinivas <me@endeavour.zapto.org>
13 years agokernel - Remove the last MP locks from tmpfs.
Matthew Dillon [Mon, 14 Feb 2011 21:11:30 +0000 (13:11 -0800)]
kernel - Remove the last MP locks from tmpfs.

* Remove get_mplock/rel_mplock calls in tmpfs which are no longer needed.
  This will improve the write path a bit though we still utilize the
  per-mount token in most places.

Reported-by: Venkatesh Srinivas <me@endeavour.zapto.org>
13 years agokernel - Remove safety mplocks around VFS system calls
Matthew Dillon [Mon, 14 Feb 2011 19:15:46 +0000 (11:15 -0800)]
kernel - Remove safety mplocks around VFS system calls

* Remove the safety get_mplock()/rel_mplock() calls around numerous
  VFS system calls.  The MP lock or per-mount token is handled deeper
  in the filesystem code.

* open() has been running without the safety mplock's for a while to
  testing nlookup().  nlookup() should be MPSAFE.  The safety mplocks
  being removed were primarily there to protect it.

13 years agokernel - Remove incorrect assertion
Matthew Dillon [Mon, 14 Feb 2011 18:52:30 +0000 (10:52 -0800)]
kernel - Remove incorrect assertion

* Remove the assertion that p2->p_lock == 0 in fork().  Since p2 has already
  been added to allproc PHOLD/PRELEs can cause this field to become non-zero.

  This assertion was originally added when p_lock was moved out of the
  copy zone.  It is no longer applicable or correct.

13 years agoRemove kref.9 manpage.
Venkatesh Srinivas [Mon, 14 Feb 2011 14:27:26 +0000 (06:27 -0800)]
Remove kref.9 manpage.

13 years agoioapic: Pass ioapic address to ioapic_{read,write}()
Sepherosa Ziehau [Mon, 14 Feb 2011 09:25:33 +0000 (17:25 +0800)]
ioapic: Pass ioapic address to ioapic_{read,write}()

This makes easier for us to get rid of the ioapic addresses array.

13 years agoIntroduce ioapic enumerators, which is used to probe and config ioapics
Sepherosa Ziehau [Mon, 14 Feb 2011 06:47:39 +0000 (14:47 +0800)]
Introduce ioapic enumerators, which is used to probe and config ioapics

ioapic enumerator implementation should provide two methods:

ioapic_probe()
    Make sure that if this enumerator is selected, later ioapic
    enumeration could work.  Return error code upon failure.

ioapic_enumerate()
    Enumerate ioapic and prepare for later ioapic configuration in
    the common code (the configuration in the common code is not
    implemented yet).

ioapic enumerator implementation could be registered by calling
ioapic_enumerator_register() with ioapic_enumerator struct.  The
higher the priority field, the earlier the ioapic enumerator's
ioapic_probe method will be invoked.

Currently a do-nothing-other-than-logging ioapic enumerators are
implemented and registered.  This dummy ioapic enumerator uses ACPI
MADT.

13 years agokernel - Make numerous proc accesses use p->p_token instead of proc_token.
Matthew Dillon [Mon, 14 Feb 2011 04:57:32 +0000 (20:57 -0800)]
kernel - Make numerous proc accesses use p->p_token instead of proc_token.

* pfind() zpfind() now returns a referenced proc structure, callers must
  release the proc with PRELE().  Callers no longer need to hold proc_token
  for stable access.

* Enhance pgrp, adding pgrp->pg_token and pgrp->pg_refs in addition to
  pgrp->pg_lock.  The lock is used to interlock races between fork() and
  signals while the token and refs are used to control access.

* Add pfindn(), a version of pfind() which does not ref the returned proc.
  Some code still uses it (linux emulation) ---> needs work.

* Add pgref() and pgrel() to mess with the pgrp's pg_refs.  pgrel()
  automatically destroys the pgrp when the last reference goes away.

* Most process group operations now use the per-process token instead of
  proc_token, though pgfind() still needs it temporarily.

* pgfind() now returns a referenced pgrp or NULL.

* Interlock signal handling with p->p_token instead of proc_token.

* Adjust most nice/priority functions to use the per-process token.

* Add protective PHOLD()s in various places in the signal code, the
  ptrace code, and procfs.

* Change funsetown() to take the address of the sigio pointer to match
  fsetown(), add sanity assertions.

* pgrp's in tty sessions are now ref-counted.

13 years agokernel - Replace sys/ref.h & kern/kern_ref.c with sys/refcount.h
Matthew Dillon [Sun, 13 Feb 2011 21:39:29 +0000 (13:39 -0800)]
kernel - Replace sys/ref.h & kern/kern_ref.c with sys/refcount.h

* The sys/refcount.h API is a bit nicer so use it instead of the sys/ref.h
  API.  No need for duplication so remove the sys/ref.h API.

13 years agoAdd printf(1) regression tests.
Peter Avalos [Sun, 13 Feb 2011 10:46:49 +0000 (00:46 -1000)]
Add printf(1) regression tests.

Obtained-from: FreeBSD

13 years agoprintf(1): Sync with FreeBSD
Peter Avalos [Sun, 13 Feb 2011 10:12:53 +0000 (00:12 -1000)]
printf(1): Sync with FreeBSD

-Fix more issues allowing /bin/sh to pass more regression tests.
-Do not use sh memory functions in sh builtin.
-We work on ctype's and not only on numbers so set LC_ALL.
-The only caller of mknum() provides a char instead of an int, so make
it match the definition.
-Remove support for building as a csh builtin.
-POSIX compliance.
-Prefer intmax_t over long long.
-Handle null characters in the format string.
-No reason to write \a and \v as octal escape sequences.
-Move parts of the long main() function into a new function doformat().
-Rewrite the loop in main() to be more understandable.
-Replace buggy for-loops to skip certain character with strspn().
-Support the L modifier for floating-point values as an extension.
-Allow %' to be used as a format flag by printf(1).
-Enable support for the %a, %A, and %F format specifiers.
-Let printf(1) tell the difference between zero width/precision and
unspecified width/precision.
-Allow format strings containing "%%" to be reused.
-Allow `%' to be written out with an octal escape (\45 or \045).
-Man page markup.

Obtained-from: FreeBSD

13 years agokill(1): Sync with FreeBSD
Peter Avalos [Sun, 13 Feb 2011 07:48:31 +0000 (21:48 -1000)]
kill(1): Sync with FreeBSD

-Make sys_signame upper case.
-Stop processing if a syntactically invalid pid is encountered.
-Do not restrict the allowed signals that can be specified by number
-Cleanup man page markup.

Obtained-from: FreeBSD

13 years agoAdd regression tests for /bin/test.
Peter Avalos [Sun, 13 Feb 2011 07:32:57 +0000 (21:32 -1000)]
Add regression tests for /bin/test.

Obtained-from: FreeBSD

13 years agobin/test: Sync with FreeBSD
Peter Avalos [Sun, 13 Feb 2011 06:52:35 +0000 (20:52 -1000)]
bin/test: Sync with FreeBSD

-Help /bin/sh pass a few more regression tests.
-Convert to use st_mtim instead of st_mtimespec.
-Fix various cases with 3 or 4 parameters in test(1) to be POSIX
compliant.
-Use intmax_t as a quad replacement instead of long long.
-__printflike() should really be __printf0like().
-Localize (LC_CTYPE).
-Cleanup whitespace.
-Simplify markup in man page.
-Describe how test(1) will evaluate its expressions for a symlink.
-Document that both sides of -a or -o are always evaluated.

Obtained-from: FreeBSD

13 years agosh: Detect dividing the smallest integer by -1.
Peter Avalos [Sun, 13 Feb 2011 01:47:27 +0000 (15:47 -1000)]
sh: Detect dividing the smallest integer by -1.

Obtained-from: FreeBSD

13 years agokernel - Make most of the fork and exit paths MPSAFE
Matthew Dillon [Sat, 12 Feb 2011 22:20:09 +0000 (14:20 -0800)]
kernel - Make most of the fork and exit paths MPSAFE

* Remove the MP lock from numerous system calls (mainly socket calls) that
  no longer need it.

* Use proc_token in a couple of places that still need work (instead of
  the MP lock).  For example, the process group (pgrp) and several places
  which call pfind() still need to use the proc_token.

* Use the per-process p->p_token in fork1(), exit1(), and lwp_exit().
  The critical portions of these paths now have significant concurrency.

* Use the per-process p->p_token when traversing p->p_children, primarily
  aiding the kern_wait() code.  So the wait*() system calls should now
  have significant concurrency.

* Change the fgetown() API to avoid certain races.

* Add M_ZERO to the struct filedesc_to_leader allocation for safety
  purposes.