dragonfly.git
12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Fri, 23 Mar 2012 08:40:00 +0000 (01:40 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agotcp/sack: Add comment about the implemented TCP/SACK related RFCs
Sepherosa Ziehau [Fri, 23 Mar 2012 06:48:26 +0000 (14:48 +0800)]
tcp/sack: Add comment about the implemented TCP/SACK related RFCs

12 years agokernel - Fix mount refs interactions and umount races
Matthew Dillon [Fri, 23 Mar 2012 04:37:25 +0000 (21:37 -0700)]
kernel - Fix mount refs interactions and umount races

* It is possible for a umount to race other operations on active mount
  point, causing one or the other to deadlock.

* vfs_busy()/vfs_unbusy() now incr/decr mp->mnt_refs.

* cache_findmount() now increments mp->mnt_refs, and add a new API
  function cache_dropmount() which decrements it.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Fri, 23 Mar 2012 04:35:07 +0000 (21:35 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel - Fix three AHCI bugs
Matthew Dillon [Fri, 23 Mar 2012 04:31:31 +0000 (21:31 -0700)]
kernel - Fix three AHCI bugs

* This fixes spurious timeouts which occur on SMP boxes with faster devices
  (such as SSDs or more recent hard drives)

* The global interrupt status register appears to be latched on some parts
  rather than wire-or.  Clearing it after signaling the port threads or
  processing the interrupt can cause interrupts to be lost.

* In cases where it is actually wire-or we may get a double-interrupt,
  but stability is more important here.

* Fix the port signaling code.  The mask was being cleared with the
  port interlock released.  It has to be cleared when the interlock is
  held.

* Reorder the per-port interrupt status register clearing code in two
  places to execute before processing the operation rather than after,
  which may fix another source of lost interrupts.

12 years agohammer2 - Implement depth limit for stack recursion, embedded data fixes
Matthew Dillon [Thu, 22 Mar 2012 23:52:11 +0000 (16:52 -0700)]
hammer2 - Implement depth limit for stack recursion, embedded data fixes

* Implement a procedure call depth limit in hammer2_chain_flush().
  Dirty elements that are too deep are placed on a deferral list and
  then executed at the top-level.  Worst case stack depth is reduced 40:1.

* Fix a bug when transitioning from embedded data to indirect data.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Thu, 22 Mar 2012 23:51:45 +0000 (16:51 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel - Cluster fixes + Enable clustering for HAMMER1
Matthew Dillon [Thu, 22 Mar 2012 23:45:55 +0000 (16:45 -0700)]
kernel - Cluster fixes + Enable clustering for HAMMER1

* Add cluster_awrite(), which replaces vfs_bio_awrite() and has the same
  basic semantics as bawrite().

* Remove vfs_bio_awrite(), which had an odd API that required the buffer
  to be locked but not removed from its queues.

* Make cluster operations work on disk device buffers as well as on
  regular files.

* Add a blkflags argument to getcacheblk(), allowing GETBLK_NOWAIT to
  be passed to it.

* Enhance cluster_wbuild() to support cluster_awrite() by having it take
  an optional bp to incorporate into the cluster.  The caller disposes of
  the bp by calling bawrite() if the cluster_wbuild() code could not use it.

* Certain adjustments to cluster_write() and related code in checking against
  the file EOF to not break when variable block sizes are used.

* Fix a bug in calls made to buf_checkwrite().  The caller is required to
  initiate the I/O if the function returns good (0).  HAMMER1 uses this
  save side effects and blows up if the I/O is then not initiated.

* Enable clustering in HAMMER1 for both data and meta-data.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Thu, 22 Mar 2012 19:41:29 +0000 (12:41 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Thu, 22 Mar 2012 19:22:27 +0000 (12:22 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel/kobj: Put the default kobj_method inside the kobjop_desc struct.
Sascha Wildner [Thu, 22 Mar 2012 18:35:13 +0000 (19:35 +0100)]
kernel/kobj: Put the default kobj_method inside the kobjop_desc struct.

Also, make kobj_methods constant. See FreeBSD's r227343 and r227384 for
more information.

This change reduces the size of a LINT64 kernel by 18KB and our source
by 7 lines!

Taken-from: FreeBSD

12 years agoVFS accounting: handle file truncation on open(2)
Francois Tigeot [Thu, 22 Mar 2012 16:51:47 +0000 (17:51 +0100)]
VFS accounting: handle file truncation on open(2)

* Files succesfully opened with O_TRUNC are truncated to zero length.
  This case was not previously handled, leading to a growing drift
  between VFS counters and reality.

* Fix a buildworld issue caused by the last VFS accounting commit

12 years agopstat.8: The fstat manpage is in section 1.
Sascha Wildner [Thu, 22 Mar 2012 15:50:05 +0000 (16:50 +0100)]
pstat.8: The fstat manpage is in section 1.

12 years agoVFS accounting: isolate the code to find the real mp
François Tigeot [Thu, 22 Mar 2012 12:48:33 +0000 (13:48 +0100)]
VFS accounting: isolate the code to find the real mp

* It was not specific to vop_write()

* Put it in a standalone vq_vptomp() function so that it may be easily
  used in other places

12 years agohammer2 - Bug fixes in allocator and chain_next, rename
Matthew Dillon [Thu, 22 Mar 2012 07:12:43 +0000 (00:12 -0700)]
hammer2 - Bug fixes in allocator and chain_next, rename

* The addition of a larger segment to allocate blocks out of caused
  the allocator to mishandle 64K requests, resulting in non-optimal
  I/O performance.

* Fix a bug in hammer2_chain_next() which was causing truncations to
  crash.

* Rename operations would sometimes not recursively mark the chain
  MODIFIED1 or would not mark the updated inode MOVED, causing
  data loss.

* Replace HAMMER2_CHAIN_WAS_MODIFIED with a local variable.

12 years agohammer2 - Major hammer2_chain_*() API cleanup
Matthew Dillon [Thu, 22 Mar 2012 04:10:40 +0000 (21:10 -0700)]
hammer2 - Major hammer2_chain_*() API cleanup

* Do a major rewrite of the hammer2_chain_*() API functions, primarily
  dealing with whether the caller wants data instantiated for a chain
  element or not.

  Also revamp the locking calls.  Integrate the ref count into
  hammer2_chain_lock() to simplify the operation.

* Add infrastructure to allow a minimum physical I/O size to be specified
  independently from the allocation size.  Not finished yet and currently
  disabled.

* Optimize I/O a little, but this still needs a ton of work.
  Set B_CLUSTEROK for logical buffers.

* Add some statistics gathering.

* Remove several duplicative functions.

12 years agohammer2 - small-embedded-data fixes, syncer fixes
Matthew Dillon [Wed, 21 Mar 2012 05:16:19 +0000 (22:16 -0700)]
hammer2 - small-embedded-data fixes, syncer fixes

* Add a bit of a hack to try to fix an issue where the embedded data
  would sometimes not get synchronized.  Add the DIRTYEMBED flag
  and test for it in various places.

* Remove an improper call to hammer2_chain_modify() on the inode
  (the previous handling of embedded data, which was broken).

* Detect and dispose of unlinked files from vop_inactive.

* Fix some inefficiencies in the flush code.  When modifying a chain
  in order to update its blockref array hammer2_chain_modify() was
  recursively setting SUBMODIFIED upward, messing up the flush code's
  sequencing and causing it to not completely flush the topology.

* Remove some debugging.

12 years agohammer2 - cleanup, stabilization pass
Matthew Dillon [Wed, 21 Mar 2012 02:13:56 +0000 (19:13 -0700)]
hammer2 - cleanup, stabilization pass

* MOVED -> SUBMODIFIED was not being set in the parent chain under some
  circumstances.

* Optimize I/O a bit more, there's no point dirtying a chain for a blockref
  update until all sub-chains are clean (at least for now).

* Additional chain locking around certain tests and propagations.

* Numerous fixes to hammer_chain_flush(), sync, and unmount

* Properly destroy the chains for disconnected inodes when the inodes are
  reclaimed.

* Code cleanup.

12 years agohammer2 - Avoid unnecessary IO
Matthew Dillon [Tue, 20 Mar 2012 22:35:07 +0000 (15:35 -0700)]
hammer2 - Avoid unnecessary IO

* With the new strategy we no longer have to build smaller blocksizes into
  larger buffers.

  When flushing embedded data we can now getblk() the block instead of
  bread() it.

* DELETED nodes have to be explicitly flushed to remove references
  associated with MODIFY1 and MOVE.

* There's no need to flush meta-data associated with a deleted node.

12 years agohammer2 - Reformulate strategy code and direct I/O
Matthew Dillon [Tue, 20 Mar 2012 22:12:02 +0000 (15:12 -0700)]
hammer2 - Reformulate strategy code and direct I/O

* Use variable block sizes for both logical and physical buffers such
  that the logical buffer matches the physical buffer.

* Change the file data layout to use 64K blocks for all bulk data fully
  enclosed in the block, with a single variable-length block straddling
  the file EOF sized 1K - 64K in powers of 2.  The inode's 512 bytes of
  embedded data is still implemented for file sizes <= 512 bytes.

* Implement direct IO for both reading and writing.

* Reformulate the strategy write code such that bio2.bio_offset is always
  pre-calculated, allowing the strategy code to issue the I/O without
  requiring any further filesystem interactions.

* Fixes numerous deadlocks.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Tue, 20 Mar 2012 22:11:27 +0000 (15:11 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel - Add argument to nvtruncbuf()
Matthew Dillon [Tue, 20 Mar 2012 22:10:02 +0000 (15:10 -0700)]
kernel - Add argument to nvtruncbuf()

* Add a 'trivial' arg to nvtruncbuf() that works similarly to
  nvextendbuf().

  This will allow hammer2 to tell nvtruncbuf() not to mess with the
  buffer that overlaps EOF, so hammer2 can mess with it atomically.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Tue, 20 Mar 2012 22:04:52 +0000 (15:04 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agompt(4): Fix an issue that caused the driver to attach to mfi(4) cards.
Sascha Wildner [Tue, 20 Mar 2012 20:19:25 +0000 (21:19 +0100)]
mpt(4): Fix an issue that caused the driver to attach to mfi(4) cards.

FreeBSD's commit message (r232411) explains it:

Fix a problem that was causing the mpt(4) driver to attach to MegaRAID
cards that should be handled by the mfi(4) driver.

The root of the problem is that the mpt(4) driver was masking off the
bottom bit of the PCI device ID when deciding which cards to attach to.

It appears that a number of the mpt(4) Fibre Channel cards had a LAN
variant whose PCI device ID was just one bit off from the FC card's device
ID.  The FC cards were even and the LAN cards were odd.

The problem was that this pattern wasn't carried over on the SAS and
parallel SCSI mpt(4) cards.  Luckily the SAS and parallel SCSI PCI device
IDs were either even numbers, or they would get masked to a supported
adjacent PCI device ID, and everything worked well.

Now LSI is using some of the odd-numbered PCI device IDs between the 3Gb
SAS device IDs for their new MegaRAID cards.  This is causing the mpt(4)
driver to attach to the RAID cards instead of the mfi(4) driver.

The solution is to stop masking off the bottom bit of the device ID, and
explicitly list the PCI device IDs of all supported cards.

This change should be a no-op for mpt(4) hardware.  The only intended
functional change is that for the 929X, the is_fc variable gets set.  It
wasn't being set previously, but needs to be because the 929X is a Fibre
Channel card.

12 years agoaesni(4): Move some unused variables into the #if 0'd parts.
Sascha Wildner [Tue, 20 Mar 2012 15:32:45 +0000 (16:32 +0100)]
aesni(4): Move some unused variables into the #if 0'd parts.

12 years agondis(4): Use the device_t for getting the softc.
Sascha Wildner [Tue, 20 Mar 2012 12:25:43 +0000 (13:25 +0100)]
ndis(4): Use the device_t for getting the softc.

12 years agohammer2 - Flush sequencing
Matthew Dillon [Tue, 20 Mar 2012 04:23:37 +0000 (21:23 -0700)]
hammer2 - Flush sequencing

* Add a flag HAMMER2_CHAIN_DIRTYBP to differentiate between clean and
  dirty buffers, separate from HAMMER2_CHAIN_MODIFIED1.  We needed a
  new flag because a buffer can be dirtied and then written out by the
  OS (becoming clean) before the chain hierarchy itself is flushed.

  This fixes an issue where a small percentage of buffers were being
  written out several times without any new changes.

* Clean up HAMMER2_CHAIN_IOFLUSH and implement to reduce double buffering
  overheads, at least for the buffer cache.  The VM backing store might
  still have double-buffered data.

  This reduces the load on the buffer management code in the kernel and
  helps avoid potential deadlocks.

* Unlock the inode when stalling in bwillwrite().  This solves a problem
  where a program stuck in flstik can also stall out the buffer daemons.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Tue, 20 Mar 2012 04:18:57 +0000 (21:18 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel - Fix buffer cache deadlock due to multiple buffer cache sizes
Matthew Dillon [Tue, 20 Mar 2012 04:14:13 +0000 (21:14 -0700)]
kernel - Fix buffer cache deadlock due to multiple buffer cache sizes

* The buffer daemon was triggering off of dirtybufspace[hw], comparing
  it against bufspace.  However, bufspace is an aggregation of the
  total buffer kva reserved, not the dirty count based on b_bufsize.

* Add dirtykvasize to track the dirty space in terms of the kva reservation
  and change the buffer daemons to use that instead.

* systat and other displays still use the bufsize, which is a more
  accurate indicator for human consumption.

12 years agohammer2 - Implement variable-sized indirect blocks, clustered reads
Matthew Dillon [Tue, 20 Mar 2012 01:34:45 +0000 (18:34 -0700)]
hammer2 - Implement variable-sized indirect blocks, clustered reads

* Implement 4K indirect blocks as well as 64K indirect blocks

* Do not flush the chains for VOP_FSYNC() calls issued from 'sync' or
  from the syncer, only flush the chains when called from fsync().

  This solves a fairly nasty repeated copy-on-write ops on the same block
  in the topology.

* Issue appropriate cluster_read() calls instead of bread().

* Implement forward-looking bmap across multiple blocks instead of just one.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Tue, 20 Mar 2012 00:56:18 +0000 (17:56 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel - Fix clustered read bug (2)
Matthew Dillon [Tue, 20 Mar 2012 00:52:48 +0000 (17:52 -0700)]
kernel - Fix clustered read bug (2)

* Fix an edge case that can cause hammer1 to panic.  The read-ahead
  must not go past the filesize limit.  HAMMER1 uses this to
  implement two different logical buffer sizes for regular files.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Tue, 20 Mar 2012 00:12:31 +0000 (17:12 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel - Fix clustered read bug
Matthew Dillon [Tue, 20 Mar 2012 00:11:09 +0000 (17:11 -0700)]
kernel - Fix clustered read bug

* cluster_read() was improperly reducing the 'maxra' variable when
  handling the read-ahead mark, creating a degenerate situation which
  would cause only the first few burst reads from a file to cluster,
  and the remainder to read-ahead but not cluster.

12 years agodma.8: Avoid a dead link in the online manual pages.
Sascha Wildner [Mon, 19 Mar 2012 21:08:36 +0000 (22:08 +0100)]
dma.8: Avoid a dead link in the online manual pages.

For the purposes of the manpage, referring to sendmail(8) (where a
manual page is available) alone is enough.

Reported-by: Loganaden Velvindron
12 years agokernel: Remove two unneeded inclusions of <sys/cdefs.h>.
Sascha Wildner [Mon, 19 Mar 2012 19:31:13 +0000 (20:31 +0100)]
kernel: Remove two unneeded inclusions of <sys/cdefs.h>.

12 years agohammer2 - Implelment variable-sized physical storage allocations
Matthew Dillon [Mon, 19 Mar 2012 17:38:53 +0000 (10:38 -0700)]
hammer2 - Implelment variable-sized physical storage allocations

* The physical block which straddles the file EOF now only allocates
  the nearest power of two >= 1024 bytes sufficient to hold the file.

  Note that files <= 512 bytes still fit in the inode embedded data area.

  This results in much, much better packing of small files.

* Remove most restrictions on logical/physical size mismatches.

  This also opens the door in the future for variable-sized indirect blocks.

* The strategy read code is now a lot smarter on optimizing to a direct-read.
  (direct writes are still not supported yet).  The code should also be
  more readable now.

* Rewrite the file truncation/extension code to use the new
  hammer2_chain_resize() function.

* Correct several bugs in the buffer offset calculations when pulling 16K
  logical buffers out of 64K physical buffers.

12 years agonewfs_hammer2 - cleanup, rename redo area to aux area, add default label
Matthew Dillon [Mon, 19 Mar 2012 17:36:37 +0000 (10:36 -0700)]
newfs_hammer2 - cleanup, rename redo area to aux area, add default label

* The -L option is no longer mandatory.  The label will default to 'ROOT'
  if not specified.

* The redo area in the volume header has been renamed to the aux area.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Mon, 19 Mar 2012 17:33:49 +0000 (10:33 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agotcp/md5sig: White space and indentation cleanup
Sepherosa Ziehau [Mon, 19 Mar 2012 06:33:45 +0000 (14:33 +0800)]
tcp/md5sig: White space and indentation cleanup

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Sun, 18 Mar 2012 23:45:13 +0000 (16:45 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel/acpi: Add a missing file to the module.
Sascha Wildner [Sun, 18 Mar 2012 22:30:50 +0000 (23:30 +0100)]
kernel/acpi: Add a missing file to the module.

Reported-by: tuxillo
12 years ago<sys/gmon.h>: Add prototypes for moncontrol() and monstartup().
Sascha Wildner [Sun, 18 Mar 2012 12:31:33 +0000 (13:31 +0100)]
<sys/gmon.h>: Add prototypes for moncontrol() and monstartup().

12 years ago<uuid.h>: Add four missing prototypes.
Sascha Wildner [Sun, 18 Mar 2012 11:25:26 +0000 (12:25 +0100)]
<uuid.h>: Add four missing prototypes.

For uuid_enc_le(), uuid_dec_le(), uuid_enc_be() and uuid_dec_be().

While here, do a little whitespace cleanup.

Taken-from: FreeBSD

12 years ago<sys/socket.h>: Add missing prototype for sockatmark().
Sascha Wildner [Sun, 18 Mar 2012 12:29:24 +0000 (13:29 +0100)]
<sys/socket.h>: Add missing prototype for sockatmark().

12 years agoopieinfo(1): Raise WARNS to 1.
Sascha Wildner [Sun, 18 Mar 2012 09:50:47 +0000 (10:50 +0100)]
opieinfo(1): Raise WARNS to 1.

12 years agortld: fixing bad patch
John Marino [Sun, 18 Mar 2012 02:30:43 +0000 (03:30 +0100)]
rtld: fixing bad patch

This code should have been part of the last rtld commit, but apparently
the wrong patch was committed.

12 years agocrtstuff: Stop calling _init/_fini methods on dyn binaries
John Marino [Sat, 17 Mar 2012 19:05:10 +0000 (20:05 +0100)]
crtstuff: Stop calling _init/_fini methods on dyn binaries

The runtime linker has already been modified to add the ability to call
_init and _fini methods on the main executable.  Previously it would
only do this for shared libraries.

A new ELF note with value 0x20 is added to signify that the crt code
no longer calls these methods so that rtld will know that it needs
to do it.  The name of the note section has been changed from
.note.ABI-tag to .note.tag.  There was an option to put the two notes
each in their own section, or put both notes in the same section.  The
latter was selected.  Since the second note is not an ABI-tag, the
section was simply renamed.  This doesn't cause any issues.

Taken from: FreeBSD SVN 232832 (2012-03-11)

12 years agortld: Add main object initialization and finalization
John Marino [Sat, 17 Mar 2012 18:52:17 +0000 (19:52 +0100)]
rtld: Add main object initialization and finalization

Since DragonFly's inception, crt1 has called _init and _fini functions of
the binary rather than leaving this task to the runtime linker.  Likely
this was done in order to use the same crt code for both statically and
dynamically linked binaries.

When FreeBSD imported DragonFly's preinit, init, and fini array handling
code, they moved the _init and _fini calls to rtld.  In order for rtld to
maintain compatiblity with binaries created with crt code that call these
functions, rtld looks for an ELF note that indicates the binary was built
with a crt that does not call _init and _fini.

This commit imports this capability as well as synchronizes some of the
changes FreeBSD made to the DragonFly code.  Many of the differences
weren't necessary, but some represented improvements.  In any case, it
benefits both operating systems to minimize the differences between the
runtime linkers in order to continue to collaborate and share new
features.

Taken from: FreeBSD SVN 232831 (2012-03-11)

One key difference between the DragonFly and FreeBSD implementations is
that FreeBSD will not properly execute a binary that requires
initialization and/or finalization if the PT_NOTE program header is
intentionally omitted using a custom linker script and the PHDRS
directive.  In the same case, DragonFly will look to see if the main
binary contains a gnu hash dynamic tag.  If it does, it assumes the binary
was built with the new crt, which is a very good assumption.  Since gnu
hash was inserted by default into binaries only a week ago, there's only
a window of few days where this isn't true, and PT_NOTE-free binaries are
very rare.

12 years agocrtstuff: refactor
John Marino [Sat, 17 Mar 2012 15:37:14 +0000 (16:37 +0100)]
crtstuff: refactor

Add common/initfini.c file to provide common prototypes and functions
to all DragonFly arches, particularly focusing on the various types
of initialization and finalization.

12 years agocrtstuff: Move ELF note definitions to dedicated header
John Marino [Sat, 17 Mar 2012 11:15:04 +0000 (12:15 +0100)]
crtstuff: Move ELF note definitions to dedicated header

Currently only note.ABI-tag is defined in crt files for the purpose
of identifying the operating system and version that created the binary.
Soon a new type of note will be created to indicate whether crt is
responsible for calling the _init function or not.  Creating a separate
header avoids duplicate note definitions.

12 years agocrtstuff: Move 6 identical sed patterns to variable
John Marino [Sat, 17 Mar 2012 10:45:02 +0000 (11:45 +0100)]
crtstuff: Move 6 identical sed patterns to variable

This note.ABI-tag pattern will be changed in an upcoming commit.
Taken from: FreeBSD SVN 232832 (2012-03-11)

12 years agortld: Don't use toupper function in rtld_printf.c
John Marino [Sat, 17 Mar 2012 10:23:45 +0000 (11:23 +0100)]
rtld: Don't use toupper function in rtld_printf.c

The libc function toupper may not function correctly due to TLS use when
LD_DEBUG is in effect.  Rather than determine this for sure, just use the
FreeBSD approach of eliminating ctype.h macro.

Taken from: FreeBSD SVN 232729 (2012-03-09)

12 years agocrtstuff: Remove unused crtbegin/crtend support files
John Marino [Sat, 17 Mar 2012 14:46:52 +0000 (15:46 +0100)]
crtstuff: Remove unused crtbegin/crtend support files

These files were imported:
commit 9b1e249481830caa2004c437ecda34c48b92798d (joerg, 2004-06-14)

The files stop being useful here:
commit fd8b66cd017f88e1baffc6426ca74ea7f57dbadd (corecode, 2007-01-15)

12 years agokernel/acpi: Bring in acpi_wmi(4) from FreeBSD, which acpi_hp(4) needs.
Sascha Wildner [Sat, 17 Mar 2012 16:53:51 +0000 (17:53 +0100)]
kernel/acpi: Bring in acpi_wmi(4) from FreeBSD, which acpi_hp(4) needs.

Also, hook acpi_hp(4) back into the build.

Some fixes to acpi_hp(4) were brought in, too.

It is all untested, unfortunately. The hope is, that someone with a
HP laptop might check it out.

12 years agokernel: Add sbuf_done() (taken from FreeBSD).
Sascha Wildner [Sat, 17 Mar 2012 16:24:04 +0000 (17:24 +0100)]
kernel: Add sbuf_done() (taken from FreeBSD).

12 years agokernel: Really fix DEV_SUPPORT for sys/dev/virtual.
Sascha Wildner [Sat, 17 Mar 2012 16:00:46 +0000 (17:00 +0100)]
kernel: Really fix DEV_SUPPORT for sys/dev/virtual.

Reported-by: aggelos
12 years agovkernel: Fix DEV_SUPPORT.
Sascha Wildner [Sat, 17 Mar 2012 15:26:43 +0000 (16:26 +0100)]
vkernel: Fix DEV_SUPPORT.

12 years agodev/virtual/vkernel Makefiles: Remove bogus .PATHs.
Sascha Wildner [Sat, 17 Mar 2012 14:44:17 +0000 (15:44 +0100)]
dev/virtual/vkernel Makefiles: Remove bogus .PATHs.

12 years agovkernel: Move things from dev/virtual to dev/virtual/vkernel.
Sascha Wildner [Sat, 17 Mar 2012 14:24:53 +0000 (15:24 +0100)]
vkernel: Move things from dev/virtual to dev/virtual/vkernel.

This is so we can later put any other "virtual" device drivers in their
own subdirectories in dev/virtual.

12 years agokernel/{a,b}list: Remove some unused variables in the debug code.
Sascha Wildner [Sat, 17 Mar 2012 11:08:27 +0000 (12:08 +0100)]
kernel/{a,b}list: Remove some unused variables in the debug code.

12 years agokernel/gre: Remove unused variables.
Sascha Wildner [Sat, 17 Mar 2012 11:03:49 +0000 (12:03 +0100)]
kernel/gre: Remove unused variables.

12 years agokernel/hammer: Remove an unused variable.
Sascha Wildner [Sat, 17 Mar 2012 10:37:51 +0000 (11:37 +0100)]
kernel/hammer: Remove an unused variable.

12 years agoalc(4): Ifdef out an unused variable and assignment.
Sascha Wildner [Sat, 17 Mar 2012 10:27:03 +0000 (11:27 +0100)]
alc(4): Ifdef out an unused variable and assignment.

12 years agokernel/sili: Actually print the generation.
Sascha Wildner [Sat, 17 Mar 2012 10:04:59 +0000 (11:04 +0100)]
kernel/sili: Actually print the generation.

12 years agortld: Shrink by eliminating stdio
John Marino [Fri, 16 Mar 2012 19:46:52 +0000 (20:46 +0100)]
rtld: Shrink by eliminating stdio

Eliminate stdio for parsing libmap.conf, and instead parse it from direct
mapping.  Also stop using strerror(3) in rtld which sucks in msgcat and
stdio.  Instead directly access sys_errlist array of error messages with
private rtld_strerror() function.

Results on x86_64 (includes debug symbols):

> size /usr/libexec/ld-elf.so.2*
   text    data     bss     dec     hex filename
  95294    1560    7680  104534   19856 /usr/libexec/ld-elf.so.2
 108830    3128   18216  130174   1fc7e /usr/libexec/ld-elf.so.2.old

> ls -al /usr/libexec/ld-elf.so.2*
-r-xr-xr-x  1 root  wheel  305763 Mar 16 20:33 /usr/libexec/ld-elf.so.2
-r-xr-xr-x  1 root  wheel  370392 Mar 14 00:02 /usr/libexec/ld-elf.so.2.old

Taken from:
FreeBSD SVN 232862 (2012-03-12)
FreeBSD SVN 232974 (2012-03-14)

12 years agotcp: Remove the workaround for the old servers in the retransmit timeout
Sepherosa Ziehau [Fri, 16 Mar 2012 10:53:10 +0000 (18:53 +0800)]
tcp: Remove the workaround for the old servers in the retransmit timeout

These old timers don't understand timestamp and window scale options;
they really should be retired.

12 years agotcp: Lowering initial RTO according to RFC 6298
Sepherosa Ziehau [Fri, 16 Mar 2012 10:23:47 +0000 (18:23 +0800)]
tcp: Lowering initial RTO according to RFC 6298

The SYN retransmit backoff is roughly according to the tcp_syn_backoff[]
as following:
                                      15s
tcp_syn_backoff[]     rexmt: 3 3 3 3 3 | 6 12 24 (ended at 57s)
tcp_syn_backoff_low[] rexmt: 1 2 4 4 4 | 8 16 16 (ended at 55s)

It is on by default and could be turned off by using sysctl
net.inet.tcp.low_rtobase

12 years agotcp: More RFC 3390 conforming
Sepherosa Ziehau [Fri, 16 Mar 2012 08:51:58 +0000 (16:51 +0800)]
tcp: More RFC 3390 conforming

If SYN or SYN|ACK was lost, the IW should be set to one MSS

This affects initial snd_cwnd and snd_cwnd after a long idle period

12 years agotcp_input: Factor out tcp_established()
Sepherosa Ziehau [Fri, 16 Mar 2012 07:43:19 +0000 (15:43 +0800)]
tcp_input: Factor out tcp_established()

12 years agotcp/syncache: Simplify syncache_add() interface
Sepherosa Ziehau [Fri, 16 Mar 2012 06:56:20 +0000 (14:56 +0800)]
tcp/syncache: Simplify syncache_add() interface

Since the passed in 'sop' are always NULL upon returning, we do not need
to pass in "struct socket **"; just pass in the listen socket, i.e.
struct socket *.

Nuke the code follows the syncache_add(), which acts upon non-NULL 'sop'
returns from syncache_add().  These codes are actually never executed.

12 years agojoin.1: Remove useless .Bk/.Ek
Sascha Wildner [Fri, 16 Mar 2012 04:06:37 +0000 (05:06 +0100)]
join.1: Remove useless .Bk/.Ek

12 years agofstat(1): Little fix in a cast.
Sascha Wildner [Fri, 16 Mar 2012 02:16:13 +0000 (03:16 +0100)]
fstat(1): Little fix in a cast.

12 years agoLINT/LINT64 configs: Reduce differences.
Sascha Wildner [Fri, 16 Mar 2012 02:11:54 +0000 (03:11 +0100)]
LINT/LINT64 configs: Reduce differences.

12 years agofstat - Include current offset in output
Matthew Dillon [Fri, 16 Mar 2012 00:40:08 +0000 (17:40 -0700)]
fstat - Include current offset in output

* When output regular file data also output the current seek offset,
  which can be very useful information.

12 years agoboot - Fix overflow in CD I/O code
Matthew Dillon [Fri, 16 Mar 2012 00:36:02 +0000 (17:36 -0700)]
boot - Fix overflow in CD I/O code

* Fix an overflow in cdb2devb():
from ((bno) * ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE)
to   ((bno) * (ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE))

* Adjust several fields from signed -> unsigned

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Fri, 16 Mar 2012 00:01:56 +0000 (17:01 -0700)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agokernel: Add mps(4) to our GENERIC kernels.
Sascha Wildner [Thu, 15 Mar 2012 18:30:22 +0000 (19:30 +0100)]
kernel: Add mps(4) to our GENERIC kernels.

12 years agoarp: Don't send gratuitous ARP for devices that are not ethernet typed
Sepherosa Ziehau [Thu, 15 Mar 2012 10:22:20 +0000 (18:22 +0800)]
arp: Don't send gratuitous ARP for devices that are not ethernet typed

Reported-by: alexh@ and swildner@
12 years agoLINT64: Adjust comment about TCP_MD5SIG; we use TCP_SIGNATURE_ENABLE
Sepherosa Ziehau [Thu, 15 Mar 2012 09:49:58 +0000 (17:49 +0800)]
LINT64: Adjust comment about TCP_MD5SIG; we use TCP_SIGNATURE_ENABLE

12 years agotcp/md5sig: Disallow enable/disable TCP MD5SIG after connect(2)/listen(2)
Sepherosa Ziehau [Thu, 15 Mar 2012 09:48:05 +0000 (17:48 +0800)]
tcp/md5sig: Disallow enable/disable TCP MD5SIG after connect(2)/listen(2)

12 years agotcp_input: Always call tcp_mss(), so snd_cwnd could be properly updated
Sepherosa Ziehau [Thu, 15 Mar 2012 07:01:29 +0000 (15:01 +0800)]
tcp_input: Always call tcp_mss(), so snd_cwnd could be properly updated

12 years agoftpd(8): Remove OLD_SETPROCTITLE related dead code.
Sascha Wildner [Wed, 14 Mar 2012 18:26:20 +0000 (19:26 +0100)]
ftpd(8): Remove OLD_SETPROCTITLE related dead code.

12 years agoioapic: By default, disable I/O APIC if we are booting on a virtual machine
Sepherosa Ziehau [Wed, 14 Mar 2012 03:18:44 +0000 (11:18 +0800)]
ioapic: By default, disable I/O APIC if we are booting on a virtual machine

I/O APIC causes too much trouble on virtual machines; simply disable
I/O APIC for virtual machines by default.

You could always explicitly enable I/O APIC on virtual machines by
setting tunable hw.ioapic_enable to 1

Thank swildner@ for hint on virtual machine detection method.

Reported-by: many
12 years agospacialreg: Add CPUID2_VMM according to AMD's CPUID specification
Sepherosa Ziehau [Wed, 14 Mar 2012 03:18:00 +0000 (11:18 +0800)]
spacialreg: Add CPUID2_VMM according to AMD's CPUID specification

12 years agogcc44: Update version to gcc-4.4.7 RELEASE
John Marino [Tue, 13 Mar 2012 22:30:14 +0000 (23:30 +0100)]
gcc44: Update version to gcc-4.4.7 RELEASE

The previous version of gcc was a pre-release snapshot of 4.4.7, dated
2011-10-25.  This is the final release of gcc-4.4.  The gcc-4.4 branch
has officially been closed by the gcc project.

Also cfgloop.c was added to modified files list as a result of Matt
Dillon's work-around for the AMD bug.

12 years agoMerge branch 'vendor/GCC44'
John Marino [Tue, 13 Mar 2012 23:06:56 +0000 (00:06 +0100)]
Merge branch 'vendor/GCC44'

12 years agoUpgrade GCC from 4.4.7 snapshot 2011-10-25 to 4.4.7-RELEASE avalon/vendor/GCC44
John Marino [Tue, 13 Mar 2012 22:22:06 +0000 (23:22 +0100)]
Upgrade GCC from 4.4.7 snapshot 2011-10-25 to 4.4.7-RELEASE

12 years agopstat.8: add reference to the fstat(8) command.
Chris Turner [Tue, 13 Mar 2012 21:13:35 +0000 (21:13 +0000)]
pstat.8: add reference to the fstat(8) command.

Seems relavent, and kept me from discovering the handyness of fstat(8).

12 years agoMerged thread-specific cleanup patch from FreeBSD.
Aycan iRiCAN [Tue, 13 Mar 2012 20:48:27 +0000 (22:48 +0200)]
Merged thread-specific cleanup patch from FreeBSD.

  See: http://lists.freebsd.org/pipermail/freebsd-threads/2009-June/004563.html

12 years agorc.conf.5: Fix the wlan setup example.
Sascha Wildner [Sun, 11 Mar 2012 18:05:08 +0000 (19:05 +0100)]
rc.conf.5: Fix the wlan setup example.

Submitted-by: Johannes Hofmann <johannes.hofmann@gmx.de>
Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/2330>

12 years ago<sys/cdefs.h>: For C++, unhide our interfaces via __{BEGIN,END}_DECLS.
Sascha Wildner [Sun, 11 Mar 2012 12:50:29 +0000 (13:50 +0100)]
<sys/cdefs.h>: For C++, unhide our interfaces via __{BEGIN,END}_DECLS.

This follows up on a previous (pthread specific) commit by alexh
(e7322b09faff75b1298e9bfe444633425d173536) that used a per-proto
macro. Revert this commit, too. In principle, we do it like NetBSD
now.

See http://gcc.gnu.org/wiki/Visibility in the GCC wiki for details
on the issue.

This solution was suggested by Martin Husemann in a thread about
xulrunner building issues:

http://mail-index.netbsd.org/tech-pkg/2012/03/11/msg008680.html

Reported-and-tested-by: marino and others
12 years agogcc44: Instruct linkers to create GNU hash tables
John Marino [Sun, 11 Mar 2012 00:45:39 +0000 (01:45 +0100)]
gcc44: Instruct linkers to create GNU hash tables

The real-time linker has just been taught how to use GNU hash tables
to speed up symbol lookup.  However, the linkers only generate SysV
hashes by default, so the specs file is being altered to generate
both types of hashes for every shared library and dynamic executable
for a while.  Maybe after a release or two we can consider only
generating the superior GNU hash, which will break forward compatibility
with older releases.

12 years agortld: Support DT_GNU_HASH (startup performance increase)
John Marino [Fri, 9 Mar 2012 07:40:34 +0000 (08:40 +0100)]
rtld: Support DT_GNU_HASH (startup performance increase)

This is another "First BSD to get" feature that Linux and Solaris
had years ago.  Essentially DT_GNU_HASH is a GNU extension to the ELF
format that allows symbol searches much faster than the System V ABI
standard hash does.  Both versions of our binutils have the capability
of generating GNU hashes alongside of (or instead of) the SysV hash.

The benefit comes at the real-time link stage when the rtld is
searching the libraries for symbols.  For very large programs
written in languages such as c++ that tend to link in many libraries
with many symbols, the reduction in start-time can be dramatic.

According to benchmarks done by binutils team in 2006, more than 90% of
the symbol queries of OpenOffice Writer are rejected by the Bloom filter
before the string comparison takes place:

http://sources.redhat.com/ml/libc-alpha/2006-07/msg00034.html

12 years agoMerge branch 'master' of git://git.dragonflybsd.org/dragonfly
Chris Turner [Sat, 10 Mar 2012 11:43:41 +0000 (11:43 +0000)]
Merge branch 'master' of git://git.dragonflybsd.org/dragonfly

12 years agopkill(1): add '-j jid' flag to restrict matches to jailed processes.
Chris Turner [Sat, 10 Mar 2012 11:37:48 +0000 (11:37 +0000)]
pkill(1): add '-j jid' flag to restrict matches to jailed processes.

Add a '-j' option to pgrep(1)/pkill(1).
Update manual page to reflect usage.

As DragonFlyBSD did not have this option previously, the 'COMPATIBILITY'
notes outlined in FreeBSD's '-j' options do not apply - namely,
the '-j 0' option defaults to non-jailed processes, and '-1' is used
to indicate all jailed processes should be matched. Also, the 'any'/'none'
string options were not ported as they require more invasive changes.

Inspired-by: FreeBSD
12 years agoRemove the old (and broken) kzip(8) utility.
Sascha Wildner [Sat, 10 Mar 2012 08:57:49 +0000 (09:57 +0100)]
Remove the old (and broken) kzip(8) utility.

12 years agokgzip(8) is i386 only, so stop building/installing on x86_64.
Sascha Wildner [Sat, 10 Mar 2012 08:53:08 +0000 (09:53 +0100)]
kgzip(8) is i386 only, so stop building/installing on x86_64.

12 years agosvc_vc_create(3): Initialize xprt with NULL.
Sascha Wildner [Sat, 10 Mar 2012 08:27:36 +0000 (09:27 +0100)]
svc_vc_create(3): Initialize xprt with NULL.

In the (corner-)case of being out of memory, this prevents free() to be
called on an uninitialized xprt below the cleanup_svc_vc_create: label.

12 years agokernel: fixup accidental whitespace shift in vm_fault_copy_entry commit
Chris Turner [Fri, 9 Mar 2012 21:31:19 +0000 (21:31 +0000)]
kernel: fixup accidental whitespace shift in vm_fault_copy_entry commit

was resulting in cherry-pick conflicts in MFC branch