dragonfly.git
14 years agogames: Massive style(9) cleanup commit. Reduces differences to NetBSD.
Sascha Wildner [Sat, 9 Jan 2010 23:32:31 +0000 (00:32 +0100)]
games: Massive style(9) cleanup commit. Reduces differences to NetBSD.

Submitted-by: Ulrich Spoerlein <uqs@spoerlein.net>
14 years agoMerge branch 'vendor/OPENSSH'
Peter Avalos [Sat, 9 Jan 2010 22:17:04 +0000 (12:17 -1000)]
Merge branch 'vendor/OPENSSH'

14 years agoUpgrade to OpenSSH-5.3p1.
Peter Avalos [Sat, 9 Jan 2010 22:06:31 +0000 (12:06 -1000)]
Upgrade to OpenSSH-5.3p1.

General Bugfixes:

 * Do not limit home directory paths to 256 characters. bz#1615
 * Several minor documentation and correctness fixes.

Portable OpenSSH Bugfixes:

 * Move the deletion of PAM credentials on logout to after the
   session close. bz#1534
 * Accept ENOSYS as a fallback error when attempting
   atomic rename(). bz#1535
 * Fix detection of krb5-config. bz#1639
 * Fix test for server-assigned remote forwarding port for
   non-root users. bz#1578

14 years agonice(3): Return EPERM if increment is negative.
Stathis Kamperis [Fri, 8 Jan 2010 18:04:44 +0000 (20:04 +0200)]
nice(3): Return EPERM if increment is negative.

Mandated by POSIX.

14 years agomqueues: Garbage collect dead function prototype.
Stathis Kamperis [Thu, 7 Jan 2010 17:11:42 +0000 (19:11 +0200)]
mqueues: Garbage collect dead function prototype.

14 years agogdtoa - Allocate more entries on freelist to better handle large fields.
Antonio Huete Jimenez [Wed, 6 Jan 2010 23:12:59 +0000 (00:12 +0100)]
gdtoa - Allocate more entries on freelist to better handle large fields.

http://www.securityfocus.com/bid/35510

Taken-from: NetBSD
Reported-by: Johannes Hofmann <Johannes.Hofmann@gmx.de>
14 years agokernel - poll - Fix MP races
Matthew Dillon [Wed, 6 Jan 2010 03:28:12 +0000 (19:28 -0800)]
kernel - poll - Fix MP races

* Some of the poll code had been taken out from under the MP lock too
  early, creating races.  Put it back under the MP lock until the whole
  mess can be rewritten using kqueue.

Reported-by: Rumko
14 years agodebug - Add kmapinfo to dump the kernel_map
Matthew Dillon [Tue, 5 Jan 2010 22:29:02 +0000 (14:29 -0800)]
debug - Add kmapinfo to dump the kernel_map

* kmapinfo is a program to dump the kernel_map, giving us an idea with
  regards to how much KVM is being used.  Also works on core dumps.

14 years agoFix a panic during snd_uaudio(4) attach.
Sascha Wildner [Tue, 5 Jan 2010 21:18:23 +0000 (22:18 +0100)]
Fix a panic during snd_uaudio(4) attach.

If mixer_ioctl() is called without process context, don't call
vchanvolume().

In-discussion-with: corecode

14 years agoHAMMER VFS - Fix volume ref count leak in fhtovp code.
Matthew Dillon [Tue, 5 Jan 2010 21:01:43 +0000 (13:01 -0800)]
HAMMER VFS - Fix volume ref count leak in fhtovp code.

* The transaction is left dangling open if the inode could not be found
  in a fhtovp operation, leaking refs on the root volume.  Fix by properly
  closing the transaction.

Reported-by: Jan Lentfer <Jan.Lentfer@web.de>
14 years agoHAMMER VFS - Fix serious bug when downgrading (and later upgrading) a PFS
Matthew Dillon [Tue, 5 Jan 2010 19:36:56 +0000 (11:36 -0800)]
HAMMER VFS - Fix serious bug when downgrading (and later upgrading) a PFS

* When downgrading a PFS master to a slave the sync-end-tid (in the
  pfs-status) is not updated.  This will cause the data to become
  inaccessible.

  Then, when upgrading back to a master the original stale sync-end-tid
  is used to rollback the PFS, effectively destroying its contents.

* We now properly update sync-end-tid when downgrading a PFS.  This
  makes the data accessible in slave mode and prevents the rollback
  when re-upgrading the PFS from destroying any of the master's original
  data.

* Why is a rollback used at all when upgrading you ask?  When a PFS is
  operating as a slave mirroring operations can be interrupted, leaving
  a lot of partially updated records.  Since sync-end-tid is not updated
  until the mirroring operation completes (when in slave mode), these
  partially mirrored records are not visible.

  However, if the slave is upgraded to a master any records from
  incomplete mirroring operations must be destroyed.  Hence the rollback
  during an upgrade is a necessary feature under normal operation.

Reported-by: Thomas Nikolajsen
14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 5 Jan 2010 02:35:13 +0000 (18:35 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agonetwork - VR driver - increase RX ring descriptors
Matthew Dillon [Tue, 5 Jan 2010 00:40:36 +0000 (16:40 -0800)]
network - VR driver - increase RX ring descriptors

* Increase the number of RX descriptors from 64 to 256 to reduce
  occurrences of RX FIFO overflows, particularly on EPIA systems
  which tend to have horrible main-memory bandwidth.

Reported-by: Jan Lentfer <Jan.Lentfer@web.de>
14 years agoUnbreak LINT (tick() -> ustick()).
Sascha Wildner [Mon, 4 Jan 2010 08:34:00 +0000 (09:34 +0100)]
Unbreak LINT (tick() -> ustick()).

14 years agotesting
Sascha Wildner [Sun, 3 Jan 2010 22:37:36 +0000 (23:37 +0100)]
testing

14 years agovfs_conf.c: Fix a warning and remove 'nowerror'.
Sascha Wildner [Sun, 3 Jan 2010 14:43:05 +0000 (15:43 +0100)]
vfs_conf.c: Fix a warning and remove 'nowerror'.

14 years agoUnbreak buildworld.
Sascha Wildner [Sun, 3 Jan 2010 13:25:32 +0000 (14:25 +0100)]
Unbreak buildworld.

The inclusion of <sys/eventvar.h> in <sys/proc.h> in commit
a591f597ce2a2a0d1c8edc23e0445acfbd8a0852 broke some things
in userland.

<kinfo.h> defines _KERNEL_STRUCTURES. If, however, some file included
before <kinfo.h> has code under _KERNEL_STRUCTURES that is needed by
files which come _after_ _KERNEL_STRUCTURES is defined by <kinfo.h>,
we break.

In netstat(1), the solution is to remove the inclusion of <sys/protosw.h>
(which comes in again via <net/netmsg.h> later after <kinfo.h> is
included) in route.c.

In sockstat(1), in lieu of a better solution, we just define
_KERNEL_STRUCTURES early for now.

Reported-by: lentferj
14 years agokernel - kqueue - fix bug in marker handling
Matthew Dillon [Sun, 3 Jan 2010 06:00:30 +0000 (22:00 -0800)]
kernel - kqueue - fix bug in marker handling

* Fix a double-remove in the list marker used by kevent()

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 3 Jan 2010 05:02:02 +0000 (21:02 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agokernel - poll/select - temporary fix for stalls
Matthew Dillon [Sun, 3 Jan 2010 04:54:57 +0000 (20:54 -0800)]
kernel - poll/select - temporary fix for stalls

* Switch around a conditional to test LWP_SELECT first before attempting
  to make the process runnable.  This seems to fix the race causing
  reported stalls.

14 years agokernel - poll/select - temporary fix for stalls
Matthew Dillon [Sun, 3 Jan 2010 04:54:57 +0000 (20:54 -0800)]
kernel - poll/select - temporary fix for stalls

* Switch around a conditional to test LWP_SELECT first before attempting
  to make the process runnable.  This seems to fix the race causing
  reported stalls.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 3 Jan 2010 03:41:06 +0000 (19:41 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agokernel - kqueue - refactor kqueue_scan(), rename tick to ustick
Matthew Dillon [Sun, 3 Jan 2010 03:40:15 +0000 (19:40 -0800)]
kernel - kqueue - refactor kqueue_scan(), rename tick to ustick

* Refactor kqueue_scan() so it can be called stand-alone.

* Rename tick to ustick (microseconds per tick), and add nstick
  (nanoseconds per tick).

14 years agoiso639: Sync with Library of Congress list.
Sascha Wildner [Sun, 3 Jan 2010 03:01:00 +0000 (04:01 +0100)]
iso639: Sync with Library of Congress list.

14 years agobsd-family-tree: Sync with FreeBSD (FreeBSD 8.0 and OpenBSD 4.6).
Sascha Wildner [Sun, 3 Jan 2010 03:00:23 +0000 (04:00 +0100)]
bsd-family-tree: Sync with FreeBSD (FreeBSD 8.0 and OpenBSD 4.6).

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 3 Jan 2010 02:54:07 +0000 (18:54 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agokernel - kqueue - major refactoring
Matthew Dillon [Sun, 3 Jan 2010 00:50:49 +0000 (16:50 -0800)]
kernel - kqueue - major refactoring

* Move filedesc->fd_knhashmask/kn_knhash to kqueue->kq_knhashmask/kq_knhash.

* Remove filedesc->fd_knlistsize/fd_knlist, replace with a per file pointer
  list.

* Partition the kqueue code such that independent kqueues can be created
  without being associated with a file pointer or descriptor.

14 years agokprintf(9): Add 'h' and 'hh' modifiers (ACPI debug output needs 'h').
Sascha Wildner [Sat, 2 Jan 2010 22:39:04 +0000 (23:39 +0100)]
kprintf(9): Add 'h' and 'hh' modifiers (ACPI debug output needs 'h').

Taken-from: FreeBSD

14 years agoopenssl - enable cryptodev support.
Jan Lentfer [Sat, 2 Jan 2010 22:25:37 +0000 (23:25 +0100)]
openssl - enable cryptodev support.

14 years agokernel - kqueue - move kq_kev out of struct kqueue
Matthew Dillon [Sat, 2 Jan 2010 21:59:47 +0000 (13:59 -0800)]
kernel - kqueue - move kq_kev out of struct kqueue

* Move kqueue->kq_kev from the kqueue structure to the stack.

14 years agokernel - pmap (i386) - fix bugs in gd_GDMAP1 and gd_GDADDR1 initialization
Matthew Dillon [Sat, 2 Jan 2010 02:07:40 +0000 (18:07 -0800)]
kernel - pmap (i386) - fix bugs in gd_GDMAP1 and gd_GDADDR1 initialization

* I was using the wrong index variable to initialize the per-cpu
  gd_GDMAP1 and gd_GDADDR1 fields.  This caused the cpu mask for
  the alt page table mapping to not work properly.

14 years agoAdd some missing ACPI source files to 'files' (for LINT).
Sascha Wildner [Sat, 2 Jan 2010 01:41:31 +0000 (02:41 +0100)]
Add some missing ACPI source files to 'files' (for LINT).

14 years agoacpi(4): Fix some x86_64 warnings.
Sascha Wildner [Sat, 2 Jan 2010 00:47:21 +0000 (01:47 +0100)]
acpi(4): Fix some x86_64 warnings.

14 years agorealpath(1): Fix style(9) violation from previous.
Stathis Kamperis [Fri, 1 Jan 2010 23:36:34 +0000 (01:36 +0200)]
realpath(1): Fix style(9) violation from previous.

Sorry for the noise.

14 years agoEnable the machdep.disable_rtc_set sysctl on x86_64.
Sascha Wildner [Fri, 1 Jan 2010 21:54:02 +0000 (22:54 +0100)]
Enable the machdep.disable_rtc_set sysctl on x86_64.

This makes adjkerntz(8) work for me (instead of giving an error because
the sysctl couldn't be found).

14 years agorealpath(1): Return ENOENT if filename is empty string.
Stathis Kamperis [Fri, 1 Jan 2010 13:55:34 +0000 (15:55 +0200)]
realpath(1): Return ENOENT if filename is empty string.

Mandated by POSIX.

Linux, NetBSD and OpenSolaris do the same, so we are on
the safe side.

Shortly-discussed-with: aggelos@

14 years agokernel - adjust vnode reclamation
Matthew Dillon [Fri, 1 Jan 2010 03:25:25 +0000 (19:25 -0800)]
kernel - adjust vnode reclamation

* Do a pre-check for auxillary refs and do not reclaim a vnode through
  standard recyclement if auxillary refs are present.

  Recyclement can still occur under other circumstances.  Auxillary
  refs nominally just prevent the vnode from being completely destroyed
  or reused.

  This is a bit experimental.

14 years agokernel - namecache - fix deadlock
Matthew Dillon [Fri, 1 Jan 2010 03:08:48 +0000 (19:08 -0800)]
kernel - namecache - fix deadlock

* cache_drop() can be called in numerous situations where unrelated
  vnode or namecache locks are held, particularly in the
  allocfreevnode() path when it calls cache_inval_vp_nonblock().

* If cache_drop() is transitioning a nc_refs from 1 to 0 it will call
  cache_zap() to free the (now untracked) ncp.  Adjust cache_zap() to
  leave the namecache entry alone if a lock on ncp->nc_parent
  cannot be acquired, instead of blocking (and potentially deadlocking).

* Add _cache_cleandefered() (part of cache_hysteresis()) to handle
  any buildup.  It is expensive but the race occurs at a low rate
  under moderate load so it should hardly ever have to be run.

14 years agomd.4: Adjust SYNOPSIS a bit.
Sascha Wildner [Fri, 1 Jan 2010 03:03:51 +0000 (04:03 +0100)]
md.4: Adjust SYNOPSIS a bit.

14 years agodevelopment.7: Remove blank line.
Sascha Wildner [Tue, 29 Dec 2009 22:33:43 +0000 (23:33 +0100)]
development.7: Remove blank line.

14 years agokernel - pmap - more invltlb stuff
Matthew Dillon [Fri, 1 Jan 2010 02:52:55 +0000 (18:52 -0800)]
kernel - pmap - more invltlb stuff

* Make sure pmap->pm_cache is cleared when a pmap gets reused,
  fixing an issue where the pmap subsystem wasn't properly
  invltlb'ing the recycled pmap due to stale cpu cache bits.

* Add sysctl vm.dreadful_invltlb (default to off) as a debugging aid.
  Turning this on disables pmap->pm_cache and does an unconditional
  invltlb on every pmap operation.

14 years agoBump copyright years. Happy new year!
Sascha Wildner [Fri, 1 Jan 2010 02:08:07 +0000 (03:08 +0100)]
Bump copyright years. Happy new year!

14 years agorealpath(1): Return EINVAL if filename is NULL pointer.
Stathis Kamperis [Thu, 31 Dec 2009 18:52:21 +0000 (20:52 +0200)]
realpath(1): Return EINVAL if filename is NULL pointer.

Mandated by POSIX.

14 years agoIn ACPI land, 0K is -273.2 degrees Celsius (instead of -273.15).
Sascha Wildner [Thu, 31 Dec 2009 18:14:19 +0000 (19:14 +0100)]
In ACPI land, 0K is -273.2 degrees Celsius (instead of -273.15).

Reported-by: Constantine Murenin <C++@Cns.SU>
14 years agoSync zoneinfo database with tzdata2009u from elsie.
Sascha Wildner [Thu, 31 Dec 2009 17:57:31 +0000 (18:57 +0100)]
Sync zoneinfo database with tzdata2009u from elsie.

asia:           8.48 -> 8.50

Bangladesh will go back to Standard Time on December 31, 2009.

14 years agokernel - pmap - add additional logic for cpu_invltlb()
Matthew Dillon [Thu, 31 Dec 2009 16:28:05 +0000 (08:28 -0800)]
kernel - pmap - add additional logic for cpu_invltlb()

* Cached pmaps still require a cpu_invltlb() call if another cpu
  modifies the pmap.

14 years agovinum(8) - Fix error when compiling with -DVINUMDEBUG
Antonio Huete Jimenez [Thu, 31 Dec 2009 01:48:36 +0000 (02:48 +0100)]
vinum(8) - Fix error when compiling with -DVINUMDEBUG

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1062>

14 years agokernel - pmap (i386) - Refactor the foreign pmap mapping
Matthew Dillon [Wed, 30 Dec 2009 19:38:39 +0000 (11:38 -0800)]
kernel - pmap (i386) - Refactor the foreign pmap mapping

* Remove the global alternative pmap and related hacks.  Leave
  the PTD entry reserved because I really do not want to
  change the location of MPPTDI (The PDE via which the
  globaldata array is mapped).

* Reserve SMP_MAXCPU (16) PTDs in the kernel page table for
  per-cpu page table maps.  This eats about 64MB of KVM
  (not 64M of physical memory).

* Adjust get_ptbase() in platform/pc32/i386/pmap.c to use the
  per-cpu map.  This greatly simplifies the tracking required
  to determine when a cpu_invltlb() call is required.

  get_ptbase() is now MPSAFE but the rest of the pmap system
  is not, yet.  This is a big step though.

* Note that because these are PTD mappings and not PTE mappings,
  each process pmap gets its own set, and because processes
  may be threaded the new get_ptbase() still WILL NOT safely
  survive a thread switch.

  On the otherhand, for vkernels, this inherent (process pmap x NCPU)
  pagetable mapping cache should work quite efficiently.  The
  vkernel threads running on different physical cpus will get their
  own page table map cache ptd.

14 years agokernel - pmap (mainly i386) - fix TLB race and other issues
Matthew Dillon [Wed, 30 Dec 2009 17:10:18 +0000 (09:10 -0800)]
kernel - pmap (mainly i386) - fix TLB race and other issues

* Temporary fix for a TLB race.  Due to threading a process pmap
  may be mapped to multiple cpus.  The APTmap is built into the
  per-process pmap and used for temporary page table mappings.

  The i386 pmap code was only invalidating the TLB if the APTmap
  had to be updated, but did not consider the possibility that
  it would be accessed from a different cpu than the one it was
  originally installed in.

  Add a simple global cpumask to avoid the degenerate case.
  This is a bit of overkill.  A followup commit will move
  APTmap into the globaldata structure as a more permanent
  fix.

  The vkernel and x86_64 pmap code do not have this issue.  The
  vkernel pmap code already uses a per-globaldata pmap and
  the x86_64 pmap code uses the direct phys map.

* Add a ton of debugging code articulated with PMAP_DEBUG in
  case I ever have to do this again.  Default disabled.

* Fix a few minor issues in the pmap code.

  (1) The pv in pmap_remove_entry() is not optional.

  (2) Add a few minor missing pmap->pm_generation increments.

  (3) Add a missing critical section.

  (4) Remove an unused #define.

* Zalloc code.  No specific bugs but make sure the ZONE_INTERRUPT
  code acquires the MP lock when/if it needs to expand the mapping.

Reported-by: YONETANI Tomokazu <y0netan1@crater.dragonflybsd.org>
14 years agokernel - Fix improper vgone() in procfs and races in truss
Matthew Dillon [Tue, 29 Dec 2009 23:50:39 +0000 (15:50 -0800)]
kernel - Fix improper vgone() in procfs and races in truss

* procfs was trying to destroy the vnodes associated with exiting pids,
  ripping them out from under active users.  This is no longer legal.

  Instead flag it for the exiting pid so further operations fail.

* procfs's stopevents handling for process tracing was not MPSAFE
  and raced against MPSAFE system call entry points.  This led to
  numerous situations where gdb or truss would get stuck, or where
  the process getting traced would get stuck.

  Make the whole mess MPSAFE by protecting the tests against proc->p_spin.

* Note that the platform trap case is optimized to only acquire p_spin
  once it has been determined that a stopevent might be pending.

Reported-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
14 years agokernel - fix fifofs kqueue broken on the 25th
Matthew Dillon [Tue, 29 Dec 2009 19:52:59 +0000 (11:52 -0800)]
kernel - fix fifofs kqueue broken on the 25th

* A misnamed field caused kqueue ops to fail on filesystem fifos.

Reported-by: Jan Lentfer, Rumko
14 years agoatc - Fix bug related to delayed command and altitude change
Matthias Schmidt [Sun, 20 Dec 2009 09:05:20 +0000 (10:05 +0100)]
atc - Fix bug related to delayed command and altitude change

When playing atc, if a plane has a delayed turn command, and you issue
an altitude command that would send the plane to the same altitude to
which it is already going, the delay is disabled and the plane turns
immediately.

Fix is from OpenBSD (PR 3448).

Discussed-with: swildner@
Provided-by: 26c3
14 years agomd(4) - Several fixes to make the module loading/unloading work properly.
Antonio Huete Jimenez [Tue, 29 Dec 2009 17:31:35 +0000 (18:31 +0100)]
md(4) - Several fixes to make the module loading/unloading work properly.

Previously, md(4) crashed the system. It produced inconsistencies due
it wasn't registered as a module, thus allowing to be kldloaded even
when it was compiled in on kernel.

Reported-by  : Sascha Wildner and many people
Lots-of-help : Alex Hornung
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue174>

14 years agoinstaller: Fix the manual configuration of lnc(4) in VMware.
Sascha Wildner [Mon, 28 Dec 2009 20:51:17 +0000 (21:51 +0100)]
installer: Fix the manual configuration of lnc(4) in VMware.

7daaee58e8b828a4951bb466c19b066381826d2c fixed the DHCP case but not the
manual configuration case. Apply a similar fix there.

While here, move the DHCP fix a bit up, just to look similar in both
cases.

However, the exact issue hasn't been found yet. We don't know why string
is junk in VMware before these fixes, as nothing before the old location
of the asprintf() seems to modify it.

In-discussion-with: matthias

14 years agokernel - MPSAFE stabilization
Matthew Dillon [Mon, 28 Dec 2009 17:15:25 +0000 (09:15 -0800)]
kernel - MPSAFE stabilization

* Fix for 'panic: sysref_activate: bad count 00000002'.  Mistakenly
  assumed the lockmgr lock was sufficient protection but forgot it
  might be acquired LK_SHARED.  Extend v_spinlock protection to fix
  the problem.

14 years agokernel - fine-grained namecache and partial vnode MPSAFE work
Matthew Dillon [Mon, 28 Dec 2009 06:36:07 +0000 (22:36 -0800)]
kernel - fine-grained namecache and partial vnode MPSAFE work

Namecache subsystem

* All vnode->v_flag modifications now use vsetflags() and vclrflags().
  Because some flags are set and cleared by vhold()/vdrop() which
  do not require any locks to be held, all modifications must use atomic
  ops.

* Clean up and revamp the namecache MPSAFE work.  Namecache operations now
  use a fine-grained MPSAFE locking model which loosely follows these
  rules:

  - lock ordering is child to parent.  e.g. lock file, then lock parent
    directory.  This allows resolver recursions up the parent directory
    chain.

  - Downward-traversing namecache invalidations and path lookups will
    unlock the parent (but leave it referenced) before attempting to
    lock the child.

  - Namecache hash table lookups utilize a per-bucket spinlock.

  - vnode locks may be acquired while holding namecache locks but not
    vise-versa.  VNodes are not destroyed until all namecache references
    go away, but can enter reclamation.  Namecache lookups detect the case
    and re-resolve to overcome the race.  Namecache entries are not
    destroyed while referenced.

* Remove vfs_token, the namecache MPSAFE model is now totally fine-grained.

* Revamp namecache locking primitves (cache_lock/cache_unlock and
  friends).  Use atomic ops and nc_exlocks instead of nc_locktd and
  build-in a request flag.  This solves busy/tsleep races between lock
  holder and lock requester.

* Revamp namecache parent/child linkages.  Instead of using vfs_token to
  lock such operations we simply lock both child and parent namecache
  entries.  Hash table operations are also fully integrated with the
  parent/child linking operations.

* The vnode->v_namecache list is locked via vnode->v_spinlock, which
  is actually vnode->v_lock.lk_spinlock.

* Revamp cache_vref() and cache_vget().  The passed namecache entry must
  be referenced and locked.  Internals are simplified.

* Fix a deadlock by moving the call to _cache_hysteresis() to a
  place where the current thread otherwise does not hold any locked
  ncp's.

* Revamp nlookup() to follow the new namecache locking rules.

* Fix a number of places, e.g. in vfs/nfs/nfs_subs.c, where ncp->nc_parent
  or ncp->nc_vp was being accessed with an unlocked ncp.  nc_parent
  and nc_vp accesses are only valid if the ncp is locked.

* Add the vfs.cache_mpsafe sysctl, which defaults to 0.  This may be set
  to 1 to enable MPSAFE namecache operations for [l,f]stat() and open()
  system calls (for the moment).

VFS/VNODE subsystem

* Use a global spinlock for now called vfs_spin to manage vnode_free_list.
  Use vnode->v_spinlock (and vfs_spin) to manage vhold/vdrop ops and
  to interlock v_auxrefs tests against vnode terminations.

* Integrate per-mount mnt_token and (for now) the MP lock into VOP_*()
  and VFS_*() operations.  This allows the MP lock to be shifted further
  inward from the system calls, but we don't do it quite yet.

* HAMMER: VOP_GETATTR, VOP_READ, and VOP_INACTIVE are now MPSAFE.  The
  corresponding sysctls have been removed.

* FIFOFS: Needed some MPSAFE work in order to allow HAMMER to make things
  MPSAFE above, since HAMMER forwards vops for in-filesystem fifos to
  fifofs.

* Add some debugging kprintf()s when certain MP races are averted, for
  testing only.

MISC

* Add some assertions to the VM system.

* Document existing and newly MPSAFE code.

14 years agokgdb - Fix kernel trapframe backtraces for i386
Matthew Dillon [Mon, 28 Dec 2009 02:19:59 +0000 (18:19 -0800)]
kgdb - Fix kernel trapframe backtraces for i386

* A recent gdb update removed our stack frame sniffer hooks,
  add them back in for i386.

* I got trapframe to work properly for i386.  I dunno about
  interrupt frames.

14 years agoInstall mandoc_char.7 because mandoc.1 references it.
Sascha Wildner [Sun, 27 Dec 2009 21:21:21 +0000 (21:21 +0000)]
Install mandoc_char.7 because mandoc.1 references it.

14 years agodevelopment.7: Adjust targets.
Sascha Wildner [Sun, 27 Dec 2009 20:44:17 +0000 (20:44 +0000)]
development.7: Adjust targets.

14 years agohammer volume - Serialize volume operations
Michael Neumann [Sun, 27 Dec 2009 18:28:21 +0000 (19:28 +0100)]
hammer volume - Serialize volume operations

Only one hammer volume-add or hammer volume-del operation
is allowed at the same time per mount.

While for volume-add operations it is not strictly needed, it is
absolutely required for the reblocking phase of the volume-del
operation.

14 years agokernel - Correct bug in cache_fullpath()
Matthew Dillon [Sun, 27 Dec 2009 16:40:19 +0000 (08:40 -0800)]
kernel - Correct bug in cache_fullpath()

* cache_copy() needs to check for a NULL ncp

Reported-by: Stathis Kamperis
14 years agokernel - fix improper VOP_*() calls on dead vnode
Matthew Dillon [Sun, 27 Dec 2009 09:06:48 +0000 (01:06 -0800)]
kernel - fix improper VOP_*() calls on dead vnode

* Certain degenerate cases were trying to make dead vnodes
  inactive.  Fixes vp->v_mount a panic.

* It is possible that more such cases will leak out of the woodwork.

Reported-by: Stathis Kamperis
14 years agokernel - Add per-mount token to replace mplock.
Matthew Dillon [Sun, 27 Dec 2009 02:12:56 +0000 (18:12 -0800)]
kernel - Add per-mount token to replace mplock.

* Fix issues with dupfdopen() not being MPSAFE.

* Implement a dummy mount structure for devfs-synthesized vnodes prior
  to the root mount.

* Wrap all VFS_*() calls, including vfs_init() and vfs_uninit(), to
  acquire the per-mount token if not flagged as being MPSAFE.

* Wrap all VOP_*() calls to acquire the per-mount token if not flagged
  as being MPSAFE.

* Move VOP_READ/VOP_WRITE MPSAFE flags to the mount structure.

* Make fifoops MPSAFE (so HAMMER can flag read & write as being
  MPSAFE generally).

* The VFS code currently also acquires the MP lock when not MPSAFE
  (there are things called by VFSes which are not yet MPSAFE), except
  for read() and write().

14 years agovesa(4): Remove some old prototypes.
Sascha Wildner [Wed, 23 Dec 2009 06:36:04 +0000 (07:36 +0100)]
vesa(4): Remove some old prototypes.

14 years agomptable(1): Only suggest to try -grope when -grope wasn't used.
Sascha Wildner [Thu, 24 Dec 2009 21:52:52 +0000 (21:52 +0000)]
mptable(1): Only suggest to try -grope when -grope wasn't used.

14 years agonrelease: Adjust a little for x86_64.
Sascha Wildner [Thu, 24 Dec 2009 21:00:16 +0000 (21:00 +0000)]
nrelease: Adjust a little for x86_64.

14 years agox86_64: Fix a warning.
Sascha Wildner [Thu, 24 Dec 2009 02:07:06 +0000 (02:07 +0000)]
x86_64: Fix a warning.

14 years agoDecrement prisoncount on error
Michael Neumann [Wed, 23 Dec 2009 11:41:21 +0000 (12:41 +0100)]
Decrement prisoncount on error

14 years agosignal.h - Rename 'union sigval' members to fit requirements in SuSv2 and POSIX.
Antonio Huete Jimenez [Mon, 21 Dec 2009 22:27:20 +0000 (23:27 +0100)]
signal.h - Rename 'union sigval' members to fit requirements in SuSv2 and POSIX.

Also leave the old members there to keep compatibility.

Taken-from: FreeBSD

14 years agoacpi_thermal.4: Revert a bit (temperatures are still in 10ths of Kelvin).
Sascha Wildner [Tue, 22 Dec 2009 22:42:56 +0000 (23:42 +0100)]
acpi_thermal.4: Revert a bit (temperatures are still in 10ths of Kelvin).

14 years agoFix some x86_64 warnings in the kernel (and remove nowerror).
Sascha Wildner [Tue, 22 Dec 2009 16:06:37 +0000 (17:06 +0100)]
Fix some x86_64 warnings in the kernel (and remove nowerror).

14 years agohammer(8): Add -X to usage().
Sascha Wildner [Tue, 22 Dec 2009 13:55:53 +0000 (14:55 +0100)]
hammer(8): Add -X to usage().

Submitted-by: Dylan Reinhold <dylan@ocnetworking.com>
14 years agoacpi_hp.4 & mandoc.1: mdoc fluff
Sascha Wildner [Tue, 22 Dec 2009 13:41:24 +0000 (14:41 +0100)]
acpi_hp.4 & mandoc.1: mdoc fluff

14 years agoaio: Make sysconf() report correct value.
Stathis Kamperis [Mon, 21 Dec 2009 20:42:39 +0000 (22:42 +0200)]
aio: Make sysconf() report correct value.

Issue 6 says that _POSIX_ASYNCHRONOUS_IO shall be defined equal to
-1, 0, or 200112L. But sysconf() shall report either -1 or 200112L.

We provide headers, data types and functions for the AIO interface,
but not any actual implementation. This means that the symbol
_POSIX_ASYNCHRONOUS_IO shall be 0 (it is already) and sysconf()
shall return -1 (it didn't until now).

14 years agoSync zoneinfo database with tz{code,data}2009t from elsie.
Sascha Wildner [Mon, 21 Dec 2009 18:40:48 +0000 (19:40 +0100)]
Sync zoneinfo database with tz{code,data}2009t from elsie.

Theory:         8.3  -> 8.4
asia:           8.44 -> 8.48
europe:         8.24 -> 8.25
zone.tab:       8.29 -> 8.31

Theory      "Calendrical Calculations" updated (thanks to Steve Ward).
asia        Hong Kong comments corrected; Xinjiang comments added.
europe      Russian region comments updated (thanks to Oscar van Vlijmen)
zone.tab    version change only

14 years agokernel - Fix atomic ops for x86_64 kernel build
Matthew Dillon [Mon, 21 Dec 2009 18:19:28 +0000 (10:19 -0800)]
kernel - Fix atomic ops for x86_64 kernel build

* atomic*_ptr functions were not casting arguments to long, resulting
  in compile-time errors.

14 years agoHAMMER Utility - Add ssh compression option
Matthew Dillon [Mon, 21 Dec 2009 17:29:49 +0000 (09:29 -0800)]
HAMMER Utility - Add ssh compression option

* Unfortunately the utility already uses -C, so the new option is -X

* For the moment the utility has no visibility on the actual
  over-the-wire bandwidth used and any specified bandwidth limits
  will apply to the uncompressed data stream.

14 years agokernel - namecache MPSAFE work
Matthew Dillon [Mon, 21 Dec 2009 16:15:18 +0000 (08:15 -0800)]
kernel - namecache MPSAFE work

* Most of the MPSAFE coding required for namecache operation.  The MP
  lock still surrounds this code.

* Use a per-bucket spinlock for nchashtbl[] lookups.

* Use a global spinlock for ncneglist.

* Use a global token for nc_parent interlocks.

* Use a per-vnode spinlock (v_spinlock == v_lock.lk_spinlock) to
  manage access to the v_namecache list.

* Recode namecache locks to use atomic_cmpset_ptr() based around
  nc_locktd instead of nc_exlocks.  nc_exlocks is still used to
  track the exclusive lock count.

  NOTE: There may be an issue with the way nc_lockreq is handled.

* Recode cache_hold/drop to use atomic_cmpset_int().

* Carefully code cache_zap() for MPSAFEness.  In particular, multiple
  locks must be held before it can be determined that a namecache
  structure no longer has any referers.  Here is where having the global
  token is really useful.

* cache_fullpath() and vn_fullpath() previously assumed the good graces
  of the MP lock and didn't bother holding refs on the namecache pointers
  they were traversing.  Now they do.

* nlookup*() functions also previously made assumptions with regards
  to holding refs.  Now they properly hold refs.

* struct namecache's nc_flag field is no longer modified outside of
  holding a lock on the structure, so we do not have to resort to
  atomic ops.

14 years agokernel - Split an assertion in the sysref code to make it MPSAFE
Matthew Dillon [Mon, 21 Dec 2009 16:13:47 +0000 (08:13 -0800)]
kernel - Split an assertion in the sysref code to make it MPSAFE

* An assertion in the sysref code was not MPSAFE.  Test SRF_ALLOCATED
  after we have determined that the object is completely free.

14 years agoRemove the JG64 kernel config (a subset of X86_64_GENERIC).
Sascha Wildner [Mon, 21 Dec 2009 11:44:35 +0000 (12:44 +0100)]
Remove the JG64 kernel config (a subset of X86_64_GENERIC).

Adjust the x86_64 test framework which was the last place where it was used.

14 years agoMisc. manpage cleanup for the recent T/TCP removal.
Sascha Wildner [Sat, 12 Dec 2009 08:43:31 +0000 (09:43 +0100)]
Misc. manpage cleanup for the recent T/TCP removal.

14 years agocrypto - Mark cryptodev ioctl as MPSAFE
Alex Hornung [Mon, 21 Dec 2009 08:27:41 +0000 (08:27 +0000)]
crypto - Mark cryptodev ioctl as MPSAFE

* Mark the cryptodev (/dev/crypto) ioctl as MPSAFE.

14 years agokern_memio - mark dev_ops READ and WRITE MPSAFE
Alex Hornung [Mon, 21 Dec 2009 08:26:09 +0000 (08:26 +0000)]
kern_memio - mark dev_ops READ and WRITE MPSAFE

* Mark read and write dev ops as being MPSAFE. This affects urandom,
  random, zero, null, mem, kmem.

14 years agodevfs - Introduce MPSAFE read/write/ioctl support
Alex Hornung [Mon, 21 Dec 2009 08:22:46 +0000 (08:22 +0000)]
devfs - Introduce MPSAFE read/write/ioctl support

* Add D_MPSAFE_READ, D_MPSAFE_WRITE and D_MPSAFE_IOCTL defines for use
  with the dev_ops structure to mark the read,write and/or ioctl methods
  as mpsafe.

* Change devfs so that it won't acquire the mplock for
  read/writes/ioctls that are marked as MPSAFE.

* Add some statistics under sysctl vfs.devfs about the number of read
  and writes done with the mplock and without it.

* While here, MPSAFE specf_stat in devfs so it doesn't acquire the
  mplock anymore as it doesn't even need it.

14 years agokernel - lwkt_token code, minor fix to last commit
Matthew Dillon [Mon, 21 Dec 2009 05:34:02 +0000 (21:34 -0800)]
kernel - lwkt_token code, minor fix to last commit

* lwkt_getalltokens() has to release any partially acquired tokens
  when it fails to get them all.  Fixes an issue with the last commit
  that could cause processes to get stuck in a Run state.

14 years agokernel - Refactor the lwkt_token code, making it faster
Matthew Dillon [Mon, 21 Dec 2009 03:33:07 +0000 (19:33 -0800)]
kernel - Refactor the lwkt_token code, making it faster

* Rewrite the core token functions and revamp the structures.  The
  lwkt_token structure now contains just a single element, a pointer
  to the on-stack lwkt_tokref.  The lwkt_tokref now contains the
  owner id.

* Recursive tokens are still fully supported and coded trivially.

* Critical sections and spinlocks are no longer needed or used by
  the lwkt_token code.  Token aquisition is basically a single
  atomic_cmpset_ptr() call in the critical path.  Everything runs
  ultra clean now.

* Improve the pool token API.

* Remove extranious cruft

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 21 Dec 2009 03:23:12 +0000 (19:23 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoSilence -Wold-style-definition in a number of places in the kernel.
Sascha Wildner [Sun, 20 Dec 2009 23:02:13 +0000 (00:02 +0100)]
Silence -Wold-style-definition in a number of places in the kernel.

14 years agokernel - jails - undo minor prisoncount atomic ops
Matthew Dillon [Sun, 20 Dec 2009 23:02:24 +0000 (15:02 -0800)]
kernel - jails - undo minor prisoncount atomic ops

* cleanup, the functions in question aren't MPSAFE yet anyway.

14 years agofsmid followup - fix compiler warning in ls
Matthew Dillon [Sun, 20 Dec 2009 22:43:47 +0000 (14:43 -0800)]
fsmid followup - fix compiler warning in ls

* Fix an unused variable warning that was causing buildworld to
  fail (due to WARNS options).

14 years agomake.conf.5: Note that NO_WERROR applies to the kernel build as well.
Sascha Wildner [Sun, 20 Dec 2009 21:57:00 +0000 (22:57 +0100)]
make.conf.5: Note that NO_WERROR applies to the kernel build as well.

14 years agokernel - remove FSMID support
Matthew Dillon [Sun, 20 Dec 2009 18:20:50 +0000 (10:20 -0800)]
kernel - remove FSMID support

* Remove all the fsmid stuff.  I never got it working 100% (e.g. such as
  when hardlinks are present) and it really complicates the MPSAFE work
  on the namecache.

* Remove struct stat->st_fsmid (replace with a spare field)

* Comment out the _ST_FSMID_PRESENT_ flag.  Userland conditionalizes
  on the flag so it should still build.

* The kqueue vnode monitoring feature is good enough and more portable.

14 years agotop(1): Merge top.x and top.local.1 into one manual page.
Sascha Wildner [Sun, 20 Dec 2009 15:46:34 +0000 (16:46 +0100)]
top(1): Merge top.x and top.local.1 into one manual page.

14 years agotop: Describe new output "CTIME" in man page.
Jan Lentfer [Sun, 20 Dec 2009 15:05:15 +0000 (16:05 +0100)]
top: Describe new output "CTIME" in man page.

14 years agoAdd some missing ACPI source files (for LINT).
Sascha Wildner [Sun, 20 Dec 2009 14:24:08 +0000 (15:24 +0100)]
Add some missing ACPI source files (for LINT).

14 years agoFix acpi (loading it failed).
Sascha Wildner [Sun, 20 Dec 2009 14:22:58 +0000 (15:22 +0100)]
Fix acpi (loading it failed).

Reported-by: alexh
14 years agoAdd a BUS_ADD_CHILD.9 manual page (adapted from FreeBSD).
Sascha Wildner [Sun, 20 Dec 2009 14:02:51 +0000 (15:02 +0100)]
Add a BUS_ADD_CHILD.9 manual page (adapted from FreeBSD).

14 years agombuf.9: We have neither the MFREE() nor M_COPY_PKTHDR() macros.
Sascha Wildner [Sun, 20 Dec 2009 13:24:23 +0000 (14:24 +0100)]
mbuf.9: We have neither the MFREE() nor M_COPY_PKTHDR() macros.

14 years agohash.9: Improve wording.
Sascha Wildner [Sun, 20 Dec 2009 13:11:36 +0000 (14:11 +0100)]
hash.9: Improve wording.

14 years agohash.9: Update the manual page for the *_ext() functions.
Sascha Wildner [Sun, 20 Dec 2009 13:04:05 +0000 (14:04 +0100)]
hash.9: Update the manual page for the *_ext() functions.