dragonfly.git
13 years agokernel - Change PROP_RWLOCK from spinlock to mtx
Matthew Dillon [Wed, 25 Aug 2010 06:54:56 +0000 (23:54 -0700)]
kernel - Change PROP_RWLOCK from spinlock to mtx

* The PROP_RWLOCK can be held across switches and sleeps and so cannot
  be a spinlock.

* Fixes spinlocks-held-during-switch panic.

13 years agokernel - lock sim in cam_periph_alloc()
Matthew Dillon [Wed, 25 Aug 2010 04:02:54 +0000 (21:02 -0700)]
kernel - lock sim in cam_periph_alloc()

* cam_periph_alloc() is called from places where the sim lock is not
  being held.  Acquire the lock internally as needed.

13 years agovm: Idlezero changes
Venkatesh Srinivas [Wed, 25 Aug 2010 03:31:07 +0000 (20:31 -0700)]
vm: Idlezero changes

* Restore yield to idlezero loop; we lwkt_yield() every 64-bytes rather than
  every page now.
* Unmark as MPSAFE; we are not MPSAFE, we hold the MP lock. When the page
  queues are safe to access with the vm token alone, we can revert to a prior
  edition of this code, which was mpsafe.

13 years agotmpfs: Allow kmalloc from M_TMPFSNAME zone to return NULL; handle null cases.
Venkatesh Srinivas [Wed, 25 Aug 2010 03:03:34 +0000 (20:03 -0700)]
tmpfs: Allow kmalloc from M_TMPFSNAME zone to return NULL; handle null cases.

tmpfs now survives fsstress without panicing the system.

13 years agotmpfs: Convert dirent malloc zone to a per-mount zone.
Venkatesh Srinivas [Wed, 25 Aug 2010 01:51:35 +0000 (18:51 -0700)]
tmpfs: Convert dirent malloc zone to a per-mount zone.

13 years agotmpfs: Convert tmpfs node allocation zone into a per-mount pool.
Venkatesh Srinivas [Wed, 25 Aug 2010 01:37:54 +0000 (18:37 -0700)]
tmpfs: Convert tmpfs node allocation zone into a per-mount pool.

Each tmpfs mount tracked the number and max nodes separately, leading to an
inaccurate measure of the limit of the tmpfs node malloc zone. We now create
a kmalloc zone for each mount, as in HAMMER (hammer_vfsops.c).

13 years agoioprio(1): Higher priorities receive more I/O time; note in manpage.
Venkatesh Srinivas [Wed, 25 Aug 2010 00:39:51 +0000 (17:39 -0700)]
ioprio(1): Higher priorities receive more I/O time; note in manpage.

13 years agoHAMMER VFS - Add another lwkt_user_yield()
Matthew Dillon [Tue, 24 Aug 2010 23:09:48 +0000 (16:09 -0700)]
HAMMER VFS - Add another lwkt_user_yield()

* Add a lwkt_user_yield() call to reverse b-tree iterations, which are
  used by the pruning code.  Forward iterations already call
  lwkt_user_yield().

13 years agoHAMMER VFS - Make all entry points MPSAFE, remove giant & critical sections
Matthew Dillon [Tue, 24 Aug 2010 23:04:59 +0000 (16:04 -0700)]
HAMMER VFS - Make all entry points MPSAFE, remove giant & critical sections

* All VFS, VOP, ioops, and bio_done entry points are now mpsafe and no
  longer use giant.

* Implement hmp->fs_token and hmp->io_token for each HAMMER mount.

  All operations that previously needed the MP lock now use hmp->fs_token.
  All operations that interact with BIO callbacks now use hmp->io_token.
  All critical sections now use io_token (these previously interlocked
  against IO callbacks).

  NOTE: read (for cached data) and getattr were MPSAFE before and
continue to be MPSAFE.

13 years agokernel - Add define for MNTK_ALL_MPSAFE
Matthew Dillon [Tue, 24 Aug 2010 23:02:09 +0000 (16:02 -0700)]
kernel - Add define for MNTK_ALL_MPSAFE

* Add a define to specify all available MPSAFE flags for a vfs.

13 years agoopencrypto - Only yield for cryptosoft
Alex Hornung [Tue, 24 Aug 2010 06:54:09 +0000 (07:54 +0100)]
opencrypto - Only yield for cryptosoft

* There's no need to yield the CPU when doing hardware-assisted
  crypto. Move the lwkt_yield()s into cryptosoft.

13 years agokernel - Adjustments to fix UP kernel build
Matthew Dillon [Tue, 24 Aug 2010 05:56:05 +0000 (22:56 -0700)]
kernel - Adjustments to fix UP kernel build

* Minor SMP wrapping issues.

13 years agobuildworld - Adjust ps for recent commits
Matthew Dillon [Tue, 24 Aug 2010 05:19:41 +0000 (22:19 -0700)]
buildworld - Adjust ps for recent commits

* Fixes buildworld

13 years agosystat - Enhance systat -pv
Matthew Dillon [Tue, 24 Aug 2010 04:55:55 +0000 (21:55 -0700)]
systat - Enhance systat -pv

* Enhance the -pv option to display the contention points on all cpus

13 years agokernel - Add additional fields to kinfo_cputime
Matthew Dillon [Tue, 24 Aug 2010 04:50:29 +0000 (21:50 -0700)]
kernel - Add additional fields to kinfo_cputime

* Add a message field and address to allow the kernel to report contention
  points on the cpus to userland.

* Enhance the mplock and token subsystems to record contention points.

* Enhance the scheduler to record contention information in the
  per-cpu cpu_time structure.

13 years agokernel - rewrite the LWKT scheduler's priority mechanism
Matthew Dillon [Tue, 24 Aug 2010 01:39:45 +0000 (18:39 -0700)]
kernel - rewrite the LWKT scheduler's priority mechanism

The purpose of these changes is to begin to address the issue of cpu-bound
kernel threads.  For example, the crypto threads, or a HAMMER prune cycle
that operates entirely out of the buffer cache.  These threads tend to hicup
the system, creating temporary lockups because they never switch away due
to their nature as kernel threads.

* Change the LWKT scheduler from a strict hard priority model to
  a fair-share with hard priority queueing model.

  A kernel thread will be queued with a hard priority, giving it dibs on
  the cpu earlier if it has a higher priority.  However, if the thread
  runs past its fair-share quantum it will then become limited by that
  quantum and other lower-priority threads will be allowed to run.

* Rewrite lwkt_yield() and lwkt_user_yield(), remove uio_yield().
  Both yield functions are now very fast and can be called without
  further timing conditionals, simplifying numerous callers.

  lwkt_user_yield() now uses the fair-share quantum to determine when
  to yield the cpu for a cpu-bound kernel thread.

* Implement the new yield in the crypto kernel threads, HAMMER, and
  other places (many of which already used the old yield functions
  which didn't work very well).

* lwkt_switch() now only round-robins after the fair share
  quantum is exhausted.  It does not necessarily always round robin.

* Separate the critical section count from td_pri.  Add td_critcount.

13 years agokernel - clarify code documentation in vfs_cluster
Matthew Dillon [Mon, 23 Aug 2010 01:52:00 +0000 (18:52 -0700)]
kernel - clarify code documentation in vfs_cluster

* Clarify the operation of minreq/maxreq a little better in
  cluster_read().

13 years agokernel - Fix read event on file for select/poll API
Matthew Dillon [Sun, 22 Aug 2010 22:30:08 +0000 (15:30 -0700)]
kernel - Fix read event on file for select/poll API

* select/poll have always returned an immediate read event on regular
  files, but kqueue is expected to only return a EVFILT_READ event
  when not sitting at the file EOF.

* The kernel adds a NOTE_OLDAPI flag which filter functions can use to
  discern between select/poll and kqueue related knotes.

* Adjust filesystem filter function to always return an immediate
  event for reads via select/poll.

* Fixes guile, which for some reason beyond our ken select()'s for a
  read event on a file.

Reported-by: Johannes Hofmann <johannes.hofmann@gmx.de>
13 years agodm_target_crypt - Clean up debug
Alex Hornung [Sun, 22 Aug 2010 20:00:04 +0000 (21:00 +0100)]
dm_target_crypt - Clean up debug

* Disable the debug message showing up when a device was configured,
  which included the key.

* As a status string to dm, we give the configuration string with the
  key 0'ed out.

13 years agoopencrypto - Adjust xforms for explicit extra IV
Alex Hornung [Sun, 22 Aug 2010 19:06:22 +0000 (20:06 +0100)]
opencrypto - Adjust xforms for explicit extra IV

* Some transforms such as XTS and CTR have some private 'IV'. Since our
  cryptosoft is now concurrent, we need to keep that private IV per-op
  and not per-session as OpenBSD does. We do this by passing in the
  local IV to encrypt() and decrypt() functions, as well as reinit(),
  which was already getting it.

* We can now also use AES-XTS and AES-CTR in a concurrent environment
  without having to have multiple sessions or an explicit key.

* While here, also radically simplify the reinit() for XTS.

* With these changes we can now use aes-xts for dm_target_crypt
  successfully.

13 years agodm_target_crypt - Bump version to 1.6.0
Alex Hornung [Sun, 22 Aug 2010 18:50:53 +0000 (19:50 +0100)]
dm_target_crypt - Bump version to 1.6.0

13 years agolibkvm - Adjust new sysctl-based kvm_getswapinfo() code
Matthew Dillon [Sun, 22 Aug 2010 16:13:10 +0000 (09:13 -0700)]
libkvm - Adjust new sysctl-based kvm_getswapinfo() code

* Make it adhere to the original API which populates a cumulative
  result at swap_ary[returned_index].

Submitted-by: Ilya Dryomov <idryomov@gmail.com>
13 years agokernel - Assert on remaining known races
Matthew Dillon [Sun, 22 Aug 2010 15:56:15 +0000 (08:56 -0700)]
kernel - Assert on remaining known races

* Add a flag to catch remaining known kevent races and assert on the case.

13 years agomonitor - Fix wrong memory access attempt.
Antonio Huete Jimenez [Sun, 22 Aug 2010 14:22:13 +0000 (16:22 +0200)]
monitor - Fix wrong memory access attempt.

13 years agotmpfs: Set tmpfs node malloc zone limit to be the same as tm_node_max.
Venkatesh Srinivas [Sun, 22 Aug 2010 12:17:43 +0000 (05:17 -0700)]
tmpfs: Set tmpfs node malloc zone limit to be the same as tm_node_max.

This doesn't resolve panics from running fsstress on tmpfs, but it is a first
step towards solving these problems. No consideration of multiple tmpfs mounts
at the minute either.

13 years agocryptsetup - Fix uuid bug, cleanup
Alex Hornung [Sun, 22 Aug 2010 11:16:23 +0000 (12:16 +0100)]
cryptsetup - Fix uuid bug, cleanup

* Clean up some useless debug and improve some other to be more
  meaningful.

* Fix (another) bug in the uuid mess. Linux' uuid_unparse doesn't
  allocate any memory, unlike our uuid_to_string. Work around it by
  using a temporary buffer and then copying into the final destination.
  The compiler has been warning me about this one long enough...

13 years agodm_target_crypt - Fix a number of bugs
Alex Hornung [Sun, 22 Aug 2010 10:57:40 +0000 (11:57 +0100)]
dm_target_crypt - Fix a number of bugs

* Fix several bugs causing panics when the initialization failed but the
  uninit code is called anyways.

* Adjust ESSIV constructor to be 100% compatible with Linux.

* Most problems were found running cryptsetup compat-test.

13 years agocryptsetup - Port compat-test
Alex Hornung [Sun, 22 Aug 2010 10:57:16 +0000 (11:57 +0100)]
cryptsetup - Port compat-test

13 years agokernel - close more kqueue MP races
Matthew Dillon [Sun, 22 Aug 2010 07:42:17 +0000 (00:42 -0700)]
kernel - close more kqueue MP races

* Leave the KN_QUEUED flag set while processing a knote in kern_kevent().
  The flag prevents the knote from being requeued while blocked in the
  filter function.

  Document this requirement.

* Use kq_token in a few more places

13 years agoHAMMER VFS - More cluster_read() fixes
Matthew Dillon [Sun, 22 Aug 2010 04:20:04 +0000 (21:20 -0700)]
HAMMER VFS - More cluster_read() fixes

* The recent cluster limiting code was improperly using raw block device
  offsets to calculate the largeblock mask used to prevent clustered I/Os
  from crossing a large-block boundary.

  raw block device offsets are not necessarily largeblock aligned, so
  this calculation failed to properly limit cluster_read()s and the
  result was an occassional clustered read would cross-over into an
  incompatible largeblock and later cause an overlapping buffer panic.

* Calculate the proper limit in the hammer_ondisk.c module and refactor
  hammer_io_read().

Reported-by: swildner
13 years agokernel - Fix reentrant serialization in if_tun
Matthew Dillon [Sun, 22 Aug 2010 01:47:29 +0000 (18:47 -0700)]
kernel - Fix reentrant serialization in if_tun

* Fix an issue where a KNOTE() is called while the serializer is held,
  resulting in nested serialization calls.

13 years agocryptosoft - Fix x86_64 buildkernel
Matthew Dillon [Sun, 22 Aug 2010 01:45:50 +0000 (18:45 -0700)]
cryptosoft - Fix x86_64 buildkernel

* Minor #include issue for x86_64 builds.

13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 22 Aug 2010 01:45:34 +0000 (18:45 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel - close numerous kqueue MP and blocking races
Matthew Dillon [Sun, 22 Aug 2010 01:41:15 +0000 (18:41 -0700)]
kernel - close numerous kqueue MP and blocking races

* create race

Close a race where one thread registers a kevent and blocks in
f_attach allowing another thread to register a change or deletion
on the same event.

* delete race

Close a race where one thread deletes a kevent and blocks in
f_detach allowing another thread to register a change or deletion
on the same event.

* scan/close race

Close a race where one thread is in the middle of a kqueue_scan()
and another concurrently close()s a related file descriptor.  This
could cause select and poll to loop forever due to not being able
to delete the 'spurious' kevent.

* register/close race

Close a race where one thread registers a kevent and blocks
in f_attach and another thread close()s the related file
descriptor at the same time.

13 years agocryptosoft - (partially) fix AES_XTS for contiguous buffers
Alex Hornung [Sat, 21 Aug 2010 22:50:56 +0000 (23:50 +0100)]
cryptosoft - (partially) fix AES_XTS for contiguous buffers

* The reinit magic skipping the iv mess for CBC was not being done for
  contiguous buffers, only for iovs and mbufs.

* This resulted in all test vectors for aes xts passing from userland
  (which uses iovs) but everything failing in kernel.

* Right now cryptsetup with -c aes-xts-plain still won't work, but at
  least some simple encryption and decryption tests work in kernel, too.

13 years agokernel - NFS server cleanup and xid atomic ops
Matthew Dillon [Sat, 21 Aug 2010 21:26:12 +0000 (14:26 -0700)]
kernel - NFS server cleanup and xid atomic ops

* Use atomic_fetchadd_int() to allocate xid's in two places.

* NULL out rp fields and clear flags after freeing their pointers,
  for safety.

13 years agoHAMMER VFS - Minor iterator change for pid hash
Matthew Dillon [Sat, 21 Aug 2010 21:21:00 +0000 (14:21 -0700)]
HAMMER VFS - Minor iterator change for pid hash

* Make the iterator volatile so the compiler only loads it once.

13 years agoHAMMER VFS - Add debugging for overlapping buffer issue
Matthew Dillon [Sat, 21 Aug 2010 21:15:41 +0000 (14:15 -0700)]
HAMMER VFS - Add debugging for overlapping buffer issue

* Add debug flags to display information that may be useful when
  diagnosing overlapping buffers.

  Set vfs.hammer.debug_general=163840 (0x28000) to generate
  the debug data.

13 years agokernel - clarify comment in nestio code
Matthew Dillon [Sat, 21 Aug 2010 21:14:16 +0000 (14:14 -0700)]
kernel - clarify comment in nestio code

* Clarify comments on the use of a counter to determine when the
  last nested I/O is finished.

13 years agokernel - minor flags coding change
Matthew Dillon [Sat, 21 Aug 2010 21:12:30 +0000 (14:12 -0700)]
kernel - minor flags coding change

* Use |= instead of =.  The related structure was bzero'd so the effect
  is the same but this reduces potential confusion.

13 years agokernel - Fix system lockup w/ kqueue based select/poll due to dup2()
Matthew Dillon [Sat, 21 Aug 2010 21:00:49 +0000 (14:00 -0700)]
kernel - Fix system lockup w/ kqueue based select/poll due to dup2()

* dup2() was not calling knote_fdclose() on the original descriptor being
  replaced

* fdfree() (called by exit) was not cleaning out knotes either, though
  exit*() probably took care of it already when it closed the descriptors.

* Assert that a file has no knotes on the last fdrop().

Reported-by: everyone + lentferj + alexh + swildner + Studbolt
13 years agoMove the arp(4) manual page to share/man, too.
Sascha Wildner [Sat, 21 Aug 2010 19:07:22 +0000 (21:07 +0200)]
Move the arp(4) manual page to share/man, too.

13 years agoMove the random(4) manual page to share/man.
Sascha Wildner [Sat, 21 Aug 2010 19:05:02 +0000 (21:05 +0200)]
Move the random(4) manual page to share/man.

13 years agohotplugd(8): Remove unnecessary SRCS.
Sascha Wildner [Sat, 21 Aug 2010 19:03:38 +0000 (21:03 +0200)]
hotplugd(8): Remove unnecessary SRCS.

13 years agodm_target_crypt - fix logic for xts support
Alex Hornung [Sat, 21 Aug 2010 16:33:27 +0000 (17:33 +0100)]
dm_target_crypt - fix logic for xts support

13 years agocrypto.[49] - update for CRYPTO_AES_{XTS,CTR}
Alex Hornung [Sat, 21 Aug 2010 14:56:38 +0000 (15:56 +0100)]
crypto.[49] - update for CRYPTO_AES_{XTS,CTR}

13 years agoMerge branch 'master' of git://git.dragonflybsd.org/dragonfly
Alex Hornung [Sat, 21 Aug 2010 14:37:50 +0000 (15:37 +0100)]
Merge branch 'master' of git://git.dragonflybsd.org/dragonfly

13 years agocrypto - fix crypto_getfeat
Alex Hornung [Sat, 21 Aug 2010 14:35:57 +0000 (15:35 +0100)]
crypto - fix crypto_getfeat

* CRK_DH_COMPUTE_KEY was being skipped in crypto_getfeat, as it is ==
  CRK_ALGORITHM_MAX.

13 years agoLINT: Why not just keep it sorted?
Sascha Wildner [Sat, 21 Aug 2010 14:02:07 +0000 (16:02 +0200)]
LINT: Why not just keep it sorted?

13 years agoaesni - printf -> kprintf for DEBUG
Alex Hornung [Sat, 21 Aug 2010 13:36:09 +0000 (14:36 +0100)]
aesni - printf -> kprintf for DEBUG

13 years agoMerge branch 'master' of git://git.dragonflybsd.org/dragonfly
Alex Hornung [Sat, 21 Aug 2010 13:16:29 +0000 (14:16 +0100)]
Merge branch 'master' of git://git.dragonflybsd.org/dragonfly

13 years agodm_target_crypt - Enable support for AES-XTS
Alex Hornung [Sat, 21 Aug 2010 12:48:24 +0000 (13:48 +0100)]
dm_target_crypt - Enable support for AES-XTS

13 years agopadlock - Rework locking
Alex Hornung [Sat, 21 Aug 2010 12:25:03 +0000 (13:25 +0100)]
padlock - Rework locking

* Change lockmgr to spinlock (FreeBSD used to use rwlocks for this),
  since there's no blocking in the locked sections.

* Fix several bugs where previously a shared lock was held although an
  exclusive lock was required.

* Add a missing unlock in padlock_detach.

13 years agoaesni - Bind into build system & LINT
Alex Hornung [Sat, 21 Aug 2010 12:17:11 +0000 (13:17 +0100)]
aesni - Bind into build system & LINT

13 years agoaesni - Rename amd64 -> x86_64
Alex Hornung [Sat, 21 Aug 2010 12:16:52 +0000 (13:16 +0100)]
aesni - Rename amd64 -> x86_64

13 years agoaesni - Port to DragonFly
Alex Hornung [Sat, 21 Aug 2010 12:11:30 +0000 (13:11 +0100)]
aesni - Port to DragonFly

* Please note that this is completely *UNTESTED*

13 years agoaesni - Import verbatim from FreeBSD
Alex Hornung [Sat, 21 Aug 2010 11:51:19 +0000 (12:51 +0100)]
aesni - Import verbatim from FreeBSD

13 years agotest - Add crypto(dev) tests from OpenBSD
Alex Hornung [Sat, 21 Aug 2010 12:58:23 +0000 (13:58 +0100)]
test - Add crypto(dev) tests from OpenBSD

* Obtained-from: OpenBSD

13 years agocryptodev - Allow software crypto
Alex Hornung [Sat, 21 Aug 2010 11:35:19 +0000 (12:35 +0100)]
cryptodev - Allow software crypto

* Allow using software crypto via cryptodev if the sysctl
  kern.cryptodevallowsoft is set to 1.

* This allows to run a bunch of crypto tests and verify test vectors
  without having hardware acceleration.

13 years agocrypto - Update crypto for AES XTS and CTR
Alex Hornung [Sat, 21 Aug 2010 10:51:38 +0000 (11:51 +0100)]
crypto - Update crypto for AES XTS and CTR

* Sync a bit up with OpenBSD, adding 'reinit' and 'ivsize' to the xform
  structure.

* Add support for AES-XTS and AES-CTR.

Obtained-from: OpenBSD

13 years agopadlock - Properly align data
Alex Hornung [Sat, 21 Aug 2010 10:46:17 +0000 (11:46 +0100)]
padlock - Properly align data

* Most parameters to the xcrypt instruction need to be aligned to 16
  bytes. So far we haven't been aligning some of the data such as the
  key, iv and control structure. Refer to the "VIA PadLock Programming
  Guide" for more details.

* Address this by allocating a bit more
  space and setting stuff up at 16-byte boundaries and ensuring gcc
  aligns the whole structure 16-bytish. While this wastes some memory,
  it is negligible.

* This fixes the issue with encryption and decryption with padlock
  causing general protection faults.

Reported-by: Jan Lentfer (lentferj@)
13 years agoman9/Makefile: Sort alphabetically.
Sascha Wildner [Sat, 21 Aug 2010 11:43:23 +0000 (13:43 +0200)]
man9/Makefile: Sort alphabetically.

13 years agocryptosoft - Fix useless compression detection
Alex Hornung [Sat, 21 Aug 2010 06:49:27 +0000 (07:49 +0100)]
cryptosoft - Fix useless compression detection

* If the result of the compression has the same size as the input, it's
  also useless; not only when it's bigger.

* This seems to fix several issues with consumers that would send the
  data out without noting that compression was used.

Obtained-from: FreeBSD

13 years agodm_target_crypt - Fix compatibility with Linux
Alex Hornung [Sat, 21 Aug 2010 06:17:54 +0000 (07:17 +0100)]
dm_target_crypt - Fix compatibility with Linux

* The sector number that Linux' dm-crypt passes to its iv generators
  is offset another -block_offset sectors, so that the actual sector
  number is the one on the dm device, not the underlying device.

* Also fix the plain iv generator, which is supposed to be a "32-bit
  little-endian version of the sector number"

* Now our dm_target_crypt can read Linux' crypt disks. This was tested
  with an image using aes-cbc-essiv:sha256 and aes-cbc-plain.

13 years agokernel - Correct hex2key() in dm_crypt
Matthew Dillon [Fri, 20 Aug 2010 23:11:15 +0000 (16:11 -0700)]
kernel - Correct hex2key() in dm_crypt

* hex2key() was only scanning half the key, leaving the remainder
  as garbage.

13 years agokernel - Fix iv sector mush in dm_target_crypt for offsets >= 1TB
Matthew Dillon [Fri, 20 Aug 2010 21:52:58 +0000 (14:52 -0700)]
kernel - Fix iv sector mush in dm_target_crypt for offsets >= 1TB

* The linux code uses a 64-bit sector number for iv generation, so we
  have to as well.

13 years agopadlock - get rid of __GNUCLIKE_ASM #ifdefs
Alex Hornung [Fri, 20 Aug 2010 20:09:52 +0000 (21:09 +0100)]
padlock - get rid of __GNUCLIKE_ASM #ifdefs

* Remove the uses of __GNUCLIKE_ASM, as we don't define it and in any
  case it only causes problems.

* If it wasn't defined, it would cause encryption to succeed but without
  encrypting anything, potentially leaking private information. Since on
  DragonFly this define doesn't exist, this would always be the case.

Reported-by: Jan Lentfer (lentferj@)
Dragonfly-bug: http://bugs.dragonflybsd.org/issue1638

13 years agokernel - opencrypto - optimize chained synchronous callbacks for soft crypto
Matthew Dillon [Fri, 20 Aug 2010 20:05:54 +0000 (13:05 -0700)]
kernel - opencrypto - optimize chained synchronous callbacks for soft crypto

* When a crypto operation is dispatched to a crypto thread and makes a
  synchronous callback from that thread, and the callback function
  dispatches a followup crypto as part of a chain, we ignore F_BATCH
  and run the followup crypto directly.

  Since we are already in a crypto thread there's no point dispatching
  the followup crypto to another crypto thread.

  Increases dm_crypt's essiv performance w/software crypto by 7%.

* Warning: The chain length for crypto operations with synchronous
  callbacks should be limited to 2 or 3 to avoid blowing up the kernel's
  thread stack.

13 years agoFix minor mdoc(7) issues
Thomas Nikolajsen [Fri, 20 Aug 2010 19:47:44 +0000 (21:47 +0200)]
Fix minor mdoc(7) issues

 * Start sentence on new line
 * Delete white-space at end of line

13 years agodm_target_crypt - rework ivgen magic, fix bug
Alex Hornung [Fri, 20 Aug 2010 17:44:48 +0000 (18:44 +0100)]
dm_target_crypt - rework ivgen magic, fix bug

* Add a forgotten crypto_freesession() in the destruction of the target.

* Change ivgen infrastructure to be more complete; each ivgen can now
  have a ctor, a dtor and some private data.

* Change ESSIV ivgen to use its own crypto session.

* Change all the crypto stuff *not* to use an explicit key but rather
  use the key with which they were initialized.

* Dispatch the actual data crypto from the ivgens, allowing the iv
  generation to happen asynchronously.

Discussed-with: Matt Dillon (dillon@)

13 years agocrypto(9) - Fix argument type for crypto_freesession
Alex Hornung [Fri, 20 Aug 2010 17:43:29 +0000 (18:43 +0100)]
crypto(9) - Fix argument type for crypto_freesession

13 years agoFix LINT build
Thomas Nikolajsen [Fri, 20 Aug 2010 18:56:26 +0000 (20:56 +0200)]
Fix LINT build

13 years agoudevd - Change socket permissions so non-privileged users can access it.
Antonio Huete Jimenez [Tue, 17 Aug 2010 16:59:50 +0000 (18:59 +0200)]
udevd - Change socket permissions so non-privileged users can access it.

13 years agoudevd - Add an option to not daemonize udevd.
Antonio Huete Jimenez [Tue, 17 Aug 2010 16:41:25 +0000 (18:41 +0200)]
udevd - Add an option to not daemonize udevd.

13 years agoudev - Add unit serial number to the udev
Antonio Huete Jimenez [Thu, 12 Aug 2010 12:19:34 +0000 (14:19 +0200)]
udev - Add unit serial number to the udev
       dictionary when available.

13 years agoHAMMER VFS - Throw away cached vnodes on stage2 mount failure
Matthew Dillon [Fri, 20 Aug 2010 05:54:54 +0000 (22:54 -0700)]
HAMMER VFS - Throw away cached vnodes on stage2 mount failure

* Make sure all cached vnodes are thrown away before we destroy the mount
  structure after a stage2 recovery failure.

Reported-by: Venkatesh Srinivas <vsrinivas@crater.dragonflybsd.org>
13 years agokernel - Fix intermediate value overflows in badjiosched() and bwillwrite()
Matthew Dillon [Fri, 20 Aug 2010 05:38:11 +0000 (22:38 -0700)]
kernel - Fix intermediate value overflows in badjiosched() and bwillwrite()

* Fix overflows which can skew our write limiting heuristics and cause
  the buffer daemons to flush too much dirty data at once.

13 years agoHAMMER VFS - Limit pending writes when flushing undos
Matthew Dillon [Fri, 20 Aug 2010 05:36:40 +0000 (22:36 -0700)]
HAMMER VFS - Limit pending writes when flushing undos

* Call hammer_io_limit_backlog() in the undo flush.  We already call it
  when flushing data and meta-data.

* Handles certain extreme cases where large amounts of undo data could
  overwhelm dm_target_crypt.

13 years agokernel - limit running io writes during fsync
Matthew Dillon [Fri, 20 Aug 2010 05:33:35 +0000 (22:33 -0700)]
kernel - limit running io writes during fsync

* The fsync code was queueing an unlimited number of BUF/BIOs while
  flushing a file, which creates a very large write burden on the
  system, read stalls due to locked buffers, and can also blow out
  things like dm_target_crypt which must allocate side-buffers for
  the data.

* Fixes kmalloc exhaustion panics with dm_crypt.

* Improves read performance under heavy write loads (e.g. blogbench).

13 years agoFix !INVARIANTS build.
Venkatesh Srinivas [Fri, 20 Aug 2010 05:08:38 +0000 (22:08 -0700)]
Fix !INVARIANTS build.

Fix-from: Matt Dillon.

13 years agokernel - dm_target_crypt - use CRYPTO_F_BATCH
Matthew Dillon [Fri, 20 Aug 2010 02:29:54 +0000 (19:29 -0700)]
kernel - dm_target_crypt - use CRYPTO_F_BATCH

* Allow crypto requests to be dispatched to multiple crypto support
  threads instead of executing the operation synchronously.

* Greatly improves crypto performance on SMP boxes.  25MB/s -> 80MB/s on
  my quad.

* Currently the ivgen code gets in the way because it must be executed
  synchronously before the data crypto op can be initiated.  Further
  performance improvements are possible.

13 years agokernel - Add SMP support for software crypto driver
Matthew Dillon [Fri, 20 Aug 2010 02:29:03 +0000 (19:29 -0700)]
kernel - Add SMP support for software crypto driver

* Create a crypto thread for each cpu.

* Run the threads without the MP lock.

* Dispatch to the threads round-robin.

13 years agokernel - add kthread_create_cpu()
Matthew Dillon [Fri, 20 Aug 2010 02:07:57 +0000 (19:07 -0700)]
kernel - add kthread_create_cpu()

* Add a version of kthread_create() where the cpu can also be specified.

13 years agoAdd a draft systimer(9) manpage.
Venkatesh Srinivas [Fri, 20 Aug 2010 00:52:50 +0000 (17:52 -0700)]
Add a draft systimer(9) manpage.

13 years agoHAMMER UTILITY - Fix buildworld issue w/ last commit
Matthew Dillon [Thu, 19 Aug 2010 15:02:10 +0000 (08:02 -0700)]
HAMMER UTILITY - Fix buildworld issue w/ last commit

* Cockpit trouble.

Reported-by: swildner
13 years agoHAMMER UTILITY - Fix seg-fault on corrupt blockmap during recovery
Matthew Dillon [Wed, 18 Aug 2010 20:56:23 +0000 (13:56 -0700)]
HAMMER UTILITY - Fix seg-fault on corrupt blockmap during recovery

* Fix a seg-fault which occurs when the recover directive hits a bad
  blockmap entry.

Reported-by: "Miro Svetlik" <miro@svetlik.be>
13 years agokernel - Fix possible race in syncache
Matthew Dillon [Wed, 18 Aug 2010 19:22:49 +0000 (12:22 -0700)]
kernel - Fix possible race in syncache

* syncache_timer_handler() can block while dropping a syncache entry,
  potentially causing the next pointer it uses in its list iteration
  to become stale.

* Use a list marker to keep tabs on the list position instead of using
  a next pointer.

* Remove critical sections, callouts do not preempt and syncache
  routines can only be entered from protocol threads or callouts.

* Document the callout code as not preempting other threads.

Reported-by: Peter Avalos <pavalos@theshell.com>
13 years agokernel - Fix excessive mbuf use in nfs_realign()
Matthew Dillon [Wed, 18 Aug 2010 18:50:56 +0000 (11:50 -0700)]
kernel - Fix excessive mbuf use in nfs_realign()

* nfs_realign() was calling m_copyback() which itself uses the deprecated
  m_getclr(), and m_getclr() only allocates non-cluster mbufs.

  This caused nfs_realign() to use an excessive number of mbufs and can
  exhaust the mbuf pool on systems with small amounts of memory.

Reported-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
13 years agoHAMMER Utility - Ignore additional failure cases during recover
Matthew Dillon [Wed, 18 Aug 2010 15:10:09 +0000 (08:10 -0700)]
HAMMER Utility - Ignore additional failure cases during recover

* Ignore bad volume specifications in data offsets during a recover
  operation.

Reported-by: "Miro Svetlik" <miro@svetlik.be>
13 years agolibkvm - kvm_get_swapinfo - fix memory leak in last commit
Matthew Dillon [Wed, 18 Aug 2010 00:52:59 +0000 (17:52 -0700)]
libkvm - kvm_get_swapinfo - fix memory leak in last commit

* Fix a memory leak

13 years agolibkvm - Adjust kvm_getswapinfo() to use the new vm.swap_info_array sysctl
Matthew Dillon [Wed, 18 Aug 2010 00:44:10 +0000 (17:44 -0700)]
libkvm - Adjust kvm_getswapinfo() to use the new vm.swap_info_array sysctl

* kvm_getswapinfo() attempts to use the new sysctl and if it fails, or
  if the kvm is operating on a kernel core file, reverts to the namelist.

13 years agokernel - Implement vm.swap_info_array sysctl
Matthew Dillon [Wed, 18 Aug 2010 00:43:02 +0000 (17:43 -0700)]
kernel - Implement vm.swap_info_array sysctl

* Track swap usage on a per-device basis

* Implement the vm.swap_info_array sysctl to retrieve the array.

13 years agokernel - add vm.swap_size sysctl
Matthew Dillon [Tue, 17 Aug 2010 16:56:28 +0000 (09:56 -0700)]
kernel - add vm.swap_size sysctl

* Add vm.swap_size sysctl to complement vm.swap_anon_use and
  vm.swap_cache_use.

Requested-by: Carlos Olmedo Escobar
13 years agoawk: Switch to awk 20100523
Stathis Kamperis [Mon, 16 Aug 2010 17:42:49 +0000 (20:42 +0300)]
awk: Switch to awk 20100523

13 years agoawk: Tweak local patch to apply cleanly to new awk
Stathis Kamperis [Mon, 16 Aug 2010 17:42:24 +0000 (20:42 +0300)]
awk: Tweak local patch to apply cleanly to new awk

13 years agoawk: Remove local patch, it's fixed upstream
Stathis Kamperis [Mon, 16 Aug 2010 17:19:10 +0000 (20:19 +0300)]
awk: Remove local patch, it's fixed upstream

13 years agoawk: Add our README files
Stathis Kamperis [Mon, 16 Aug 2010 17:15:51 +0000 (20:15 +0300)]
awk: Add our README files

13 years agoImport of awk version 20100523
Stathis Kamperis [Mon, 16 Aug 2010 17:12:59 +0000 (20:12 +0300)]
Import of awk version 20100523

13 years agoFix some minor mdoc issues.
Sascha Wildner [Tue, 17 Aug 2010 13:55:50 +0000 (15:55 +0200)]
Fix some minor mdoc issues.

13 years agoMake amdsmb(4) compilable into the kernel and add it to LINT.
Sascha Wildner [Tue, 17 Aug 2010 12:52:50 +0000 (14:52 +0200)]
Make amdsmb(4) compilable into the kernel and add it to LINT.