dragonfly.git
12 years agodfregress - An automated test driver and framework
Alex Hornung [Sun, 30 Oct 2011 01:21:59 +0000 (01:21 +0000)]
dfregress - An automated test driver and framework

 * dfregress is a simple test framework and test automation driver. It
   supports both normal userland testcases and kernel test cases.

 * It's key aim is to make it simple, if not outright dead easy, to
   write test cases. A test case is a simple program using
   printf/fprintf and exit - no magic needed. A kernel test case is a
   very small module that just needs to implement a few functions and
   call a logging and result function.

 * Sample output of the text frontend (Frontends are explained further
   down the text): http://leaf.dragonflybsd.org/~alexh/dfregress.txt

 * dfregress is very UNIXy, it uses makefiles to build the testcases,
   stdout/stderr redirection from the testcases (no fancy output
   functions needed in the testcases) and evaluates the normal return
   value of the testcase (no need to call fancy functions).

 * For kernel testcases it is a bit different - you do have to call
   functions to log output and to log the result, but it is very simple,
   hardly any overhead.

 * The test driver assumes that testcases are in the testcases/
   directory, but it supports several command line options.

 * The tests to run, including several options, are specified in the
   runlist file. An example runlist including all the testcases is
   included as config/runlist.run. Options that can be specified are:
   - timeout: (in seconds) after which the test is aborted if it hasn't
     finished.
   - test type (userland, kernel or buildonly)
   - make: which 'make' tool to use to build the test cases. Defaults to
     'make', but could also be 'gmake', etc.
   - nobuild: doesn't build the testcase and tries to directly execute
     it.
   - pre, post: external pre-run and post-run commands, e.g. to set up a
     vn device and to tear it down. This is to avoid duplication in test
     cases, the common setup can be factored out.
   - intpre, intpost: similar to the above, but it assumes that the
     testcase, when passed the parameter 'pre', will do the pre-setup,
     and when passed 'post' will do the post-test cleanup/setup/etc.
   - any number of command line arguments that are passed to the test
     case. (See the crypto/ test examples in the runlist).

 * A range of sample testcases are available in
   test/dfregress/testcases/sample, including a kernel testcase sample.

 * Note that many of the test cases in the testcases/ directory have
   been copied from elsewhere in the main repository and are,
   temporarily at least, duplicated.

 * The test driver is completely separated from the frontends. The test
   driver outputs the test run results in an XML-like format (plist)
   that can easily be parsed using proplib. Python and Ruby also have
   plist modules that could be used to parse the output.

 * The only available frontend is a simple C program that will parse the
   intermediate format to an easy to read plain text format. Additional
   frontends can be written in any language, as long as it is possible
   to load plists. Frontends are in the fe/ directory.

 * XXX: the default options (currently just the timeout) are still
   hardcoded in config.c.

 * The NOTES file gives details on how the test execution occurs and
   what result code can be raised at which point. This document, and a look
   at the generated plist, is all you need to write a new frontend that,
   for example, generates beautiful HTML output.
   For completeness sake, a part of NOTES is reproduced under the main commit
   message - specifically the part detailing the execution of a single test
   case.

======
Execution of a single test case:
======
1) chdir to testcase directory
        - if it fails, set RESULT_PREFAIL (sysbuf is of interest), goto (6)

2) build testcase (make) (unless nobuild flag is set).
        + build_buf is used for stdout/stderr
        - if there is an internal driver error (that leads to not running the
          build command), set RESULT_PREFAIL (sysbuf is of interest), goto (6)
        - if the build command has a non-zero exit value, set the result to
          BUILDFAIL, unless it's a buildonly test case, in which it is set to
          the actual result value (TIMEOUT, SIGNALLED, FAIL)
          goto (6)

3) run 'pre' command if intpre or pre is set.
        + precmd_buf is used for stdout/stderr
        - if there is an internal driver error (that leads to not running the
          command), set RESULT_PREFAIL (sysbuf is of interest), goto (6)
        - if the pre command has a non-zero exit value, set RESULT_PREFAIL and
          goto (6)

4) run actual testcase, depending on type
        + stdout_buf is used for stdout
        + stderr_buf is used for stderr
        - for BUILDONLY: set RESULT_PASS since the build already succeeded
        - for userland and kernel: run the testcase, possibly as a different
          user (depending on the runas option), set the result to the actual
          result value (TIMEOUT, SIGNALLED, FAIL, NOTRUN)
        - if there is an internal driver error (that leads to not running the
          command), RESULT_NOTRUN is set (sysbuf is of interest)

5) run 'post' command if intpost or post is set.
        + postcmd_buf is used for stdout/stderr
        - if there is an internal driver error (that leads to not running the
          command), set RESULT_POSTFAIL (sysbuf is of interest), goto (6)
        - if the post command has a non-zero exit value, set RESULT_POSTFAIL
          and goto (6)

6) clean testcase directory (make clean) (unless nobuild flag is set).
        + cleanup_buf is used for stdout/stderr and system (driver error) buffer
        - no further action.

7) results are saved.

12 years agotcp: Use the MSL set to the rt_metrics whenever possible
Sepherosa Ziehau [Mon, 14 Nov 2011 14:31:18 +0000 (22:31 +0800)]
tcp: Use the MSL set to the rt_metrics whenever possible

12 years agort_metrics: Add rmx_msl to record user-set MSL
Sepherosa Ziehau [Mon, 14 Nov 2011 14:04:45 +0000 (22:04 +0800)]
rt_metrics: Add rmx_msl to record user-set MSL

12 years agostatfs.2: Fix indentation and add a missing .Pp.
Sascha Wildner [Mon, 14 Nov 2011 02:34:53 +0000 (03:34 +0100)]
statfs.2: Fix indentation and add a missing .Pp.

12 years agostress2: Fix a bug introduced in 3647609110201ad09b8c7b945941765be8924123.
Sascha Wildner [Mon, 14 Nov 2011 02:11:56 +0000 (03:11 +0100)]
stress2: Fix a bug introduced in 3647609110201ad09b8c7b945941765be8924123.

Even though we use statvfs() for a couple of things now, we still need
to statfs() too for getting at f_mntfromname[].

12 years agokernel: Fix linux emulation build.
Sascha Wildner [Sun, 13 Nov 2011 19:47:22 +0000 (20:47 +0100)]
kernel: Fix linux emulation build.

12 years agokernel - Improve per-cpu caching of pv_entry's
Matthew Dillon [Sun, 13 Nov 2011 17:39:14 +0000 (09:39 -0800)]
kernel - Improve per-cpu caching of pv_entry's

* The vm_zone (zalloc) code needs to be replaced with objcache, but until
  we do continue improving certain critical paths in it.

* Burst fill an empty per-cpu cache to reduce overheads when working with
  large numbers of processes with large shared address spaces (postgres,
  mysql, etc).  This reduces contention under heavy use situations.

12 years agokernel - Certain sysv_shm administrative functions still need the mp_lock
Matthew Dillon [Sun, 13 Nov 2011 17:37:38 +0000 (09:37 -0800)]
kernel - Certain sysv_shm administrative functions still need the mp_lock

* Fix a few races, particularly with the NATTCH counter, that can prevent
  the deletion of shm segments.

12 years agolibc - Bring dmalloc in for x86-64
Matthew Dillon [Sun, 13 Nov 2011 17:31:01 +0000 (09:31 -0800)]
libc - Bring dmalloc in for x86-64

* Bring in a much faster allocator for x86-64.  DMalloc is a slab alloctor
  with dynamic slab sizing capabilities, allowing slabs to be used for
  all allocation sizes.  This simplifies the code paths considerably.

* DMalloc is optimized for heavy-use situations but will still retain a
  run size similar to the old nmalloc code.  The VSZ is going to be quite
  a bit bigger, though.  The best test is w/mysqld as mysql[d] allocates
  and frees memory at a very high rate.

* DMalloc is almost completely lockless.  Slabs become owned by threads
  which can then manipulate them trivially.  Frees can operate on foreign
  slabs in a lockless manner.  A depot is used primarily as a catch-all
  for thread exits.

Written-by: Matthew Dillon
12 years agoipcs - Cleanup output format
Matthew Dillon [Sun, 13 Nov 2011 00:00:33 +0000 (16:00 -0800)]
ipcs - Cleanup output format

* Cleanup the output format a bit so fields don't run into each other

12 years agokernel - Add syscall quick return path for x86-64
Matthew Dillon [Sat, 12 Nov 2011 23:04:56 +0000 (15:04 -0800)]
kernel - Add syscall quick return path for x86-64

* Flag the case where a sysretq can be performed to quickly return
  from a system call instead of having to execute the slower doreti
  code.

* This about halves syscall times for simple system calls such as
  getuid(), and reduces longer syscalls by ~80ns or so on a fast
  3.4GHz SandyBridge, but does not seem to really effect performance
  a whole lot.

Taken-From: FreeBSD (loosely)

12 years agokernel - Use MPSAFE callouts for TCP
Matthew Dillon [Sat, 12 Nov 2011 19:28:31 +0000 (11:28 -0800)]
kernel - Use MPSAFE callouts for TCP

* Use MP callouts for tcp timers.  Since the timers do not usually fire
  this isn't that big a deal but it's still far more correct and it reduces
  lock contention.

12 years agokernel - Implement degenerate timeout case for select() and poll()
Matthew Dillon [Sat, 12 Nov 2011 19:26:43 +0000 (11:26 -0800)]
kernel - Implement degenerate timeout case for select() and poll()

* When select() or poll() are called with no descriptors and only a
  timeout, call nanosleep1() instead of using tsleep() to generate
  a more precise time delay.

* Significantly improves postgresql's performance.

12 years agokernel - Expose nanosleep1() to other kernel source files
Matthew Dillon [Sat, 12 Nov 2011 19:25:38 +0000 (11:25 -0800)]
kernel - Expose nanosleep1() to other kernel source files

* Expose nanosleep1() to other kernel source files

* Add additional sysctls to control behavior.

12 years agokernel - Remove MP lock from sysv semaphore code
Matthew Dillon [Sat, 12 Nov 2011 16:53:05 +0000 (08:53 -0800)]
kernel - Remove MP lock from sysv semaphore code

* Replace with per-semaphore pool locks for now.

12 years agokernel - Fix overflows and races in zalloc()
Matthew Dillon [Sat, 12 Nov 2011 16:51:18 +0000 (08:51 -0800)]
kernel - Fix overflows and races in zalloc()

* Fix a 32 bit overflow which would crash machines with large amounts of
  ram once the number of PV entries (in bytes) exceeds the 2GB mark.

* Refactor the page allocation to allow vm_page_alloc() and friends to block.

* Don't depend on being unqueued, wire the related pages.

12 years agokernel - Add missing dsched_exit_thread() and friends
Matthew Dillon [Sat, 12 Nov 2011 06:53:58 +0000 (22:53 -0800)]
kernel - Add missing dsched_exit_thread() and friends

* In the lwp_create()/lwp_fork() failure path we have to clean up
  the dsched stuff before scrapping the LWP.

Reported-by: swildner
12 years agokernel - Fix IPI signaling issue, add a few assertions
Matthew Dillon [Sat, 12 Nov 2011 06:31:27 +0000 (22:31 -0800)]
kernel - Fix IPI signaling issue, add a few assertions

* Change the low-level IPI code to physically disable interrupts when
  waiting for the ICR status bit to clear and issuing a new IPI.  It
  appears that on Intel cpus it is possible for (with circumstantial
  evidence) a LAPIC EOI to busy the command sequencer.

  Thus if interrupts are enabled inside a critical section, even if all
  they do is EOI the LAPIC and IRET, this can prevent an IPI from being
  sent if the interrupt occurs at just the right moment during an IPI
  operation.

* Because IPIs are already limited to one per target cpu at any given
  moment via gd->gd_npoll we can also do away with the ipiq polling
  code that was inside the ICR wait.

* Add a few assertions to try to catch other possible MP problems.

  Assert that TDF_TSLEEPQ is not set when freeing a thread.

  Assert that the cpusync ipiq does not overflow.

  Assert that the vm_object hold count does not go negative.

Reported-by: ftigeot
12 years agokernel = Fix tsleep(), remove MAILBOX signals, change signalset locks for LWPs
Matthew Dillon [Sat, 12 Nov 2011 06:27:22 +0000 (22:27 -0800)]
kernel = Fix tsleep(), remove MAILBOX signals, change signalset locks for LWPs

* tsleep() was improperly calling lwkt_gettoken() and potentially blocking
  prior to sleeping, which it isn't supposed to do.

  This may have been the cause of several odd panics and corruption, though
  no smoking gun was found.

* Change access to lp->lwp_siglist to use a spinlock instead of a token.
  Add a per-LWP spinlock in addition to the per-LWP token.

* Remove MAILBOX signals (which require p->p_token).  These are no longer
  used.

12 years agokernel - Upgrade buffer space tracking variables from int to long
Matthew Dillon [Sat, 12 Nov 2011 06:20:12 +0000 (22:20 -0800)]
kernel - Upgrade buffer space tracking variables from int to long

* Several bufspace-related buffer cache parameters can now overflow a
  32 bit integer on machines with large amounts (~64G+) of memory.
  Change these to long.

  bufspace, maxbufspace, maxbufmallocspace, lobufspace, hibufspace,
  lorunningspace, hirunningspace, dirtybufspace,
  dirtybufspacehw, runningbufspace, lodirtybufspace, hidirtybufspace.

* Also requires an API change to libkcore/libkinfo which effects top.

12 years agoinstaller: Check the user-entered swap size against our actual limits, too.
Sascha Wildner [Fri, 11 Nov 2011 19:36:13 +0000 (20:36 +0100)]
installer: Check the user-entered swap size against our actual limits, too.

12 years agoinstaller: Adjust maximum swap recommendation to our current limits.
Sascha Wildner [Fri, 11 Nov 2011 19:04:02 +0000 (20:04 +0100)]
installer: Adjust maximum swap recommendation to our current limits.

Which are 32G on i386 and 512G on x86_64.

12 years agokernel - Add required critical section around tsleep_remove()
Matthew Dillon [Fri, 11 Nov 2011 18:51:28 +0000 (10:51 -0800)]
kernel - Add required critical section around tsleep_remove()

* The tsleep_remove() call requires a critical section to avoid
  racing a wakeup interrupt.

* And assert the requirement in tsleep_remove() itself.

12 years agokernel - Fix deadlock in pmap_page_protect()
Matthew Dillon [Fri, 11 Nov 2011 18:40:36 +0000 (10:40 -0800)]
kernel - Fix deadlock in pmap_page_protect()

* Fix a deadlock situation where we attempt to get a spin lock while
  interlocked.  Not a good idea.

Reported-by: ftigeot
12 years agoNuke AppleTalk support.
Sascha Wildner [Fri, 11 Nov 2011 04:20:43 +0000 (05:20 +0100)]
Nuke AppleTalk support.

It has been broken for a while, too.

Various bits and pieces still remain, mainly in documentation, which
I'll mop up on the weekend.

I hope I haven't cut too deep but I don't think so.

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

12 years agokernel - Wait for I/O to finish in vm_object_terminate()
Matthew Dillon [Fri, 11 Nov 2011 03:42:59 +0000 (19:42 -0800)]
kernel - Wait for I/O to finish in vm_object_terminate()

* It is possible for swap I/O to be in progress when terminating a VM
  object, wait for any such I/O to complete before attempting to free
  the page.

* Fixes a panic which can occur under heavy loads.

Reported-by: John Marino
12 years agokernel - Fix numerous performance problems with the pageout daemon
Matthew Dillon [Fri, 11 Nov 2011 03:31:24 +0000 (19:31 -0800)]
kernel - Fix numerous performance problems with the pageout daemon

* The VM page queues were not being fully utilized, causing the pageout
  daemon to calculate incorrect average page counts for deactivation/freeing.
  This caused the pageout daemon to dig into the active queue even when it
  did not need to.

* The pageout daemon was incorrectly calculating the maxscan value for each
  queue.  It was using the aggregate count (across all 256 queues) instead of
  the per-queue count, resulting in long stalls when memory is low.

* Clean up the PQ_L2* knobs, constants, and other cruft, reducing them to
  the essentials for our goals.

Reported-by: vsrinivas, thesjg, luxh, etc
12 years agokernel - Performance improvements during heavy memory/IO use
Matthew Dillon [Fri, 11 Nov 2011 00:32:10 +0000 (16:32 -0800)]
kernel - Performance improvements during heavy memory/IO use

* Remove the vm.vm_load logic, it was breaking things worse and fixing
  things not so much.

* Fix a bug in the pageout algorithm that was causing the PQ_ACTIVE queue
  to drain excessively, messing up the LRU/activity algorithm.

* Rip out hammer_limit_running_io and instead just call waitrunningbufspace().

* Change the waitrunningbufspace() logic to add a bit of hyseresis and to
  fairly block everyone doing write I/O, otherwise some threads may be
  blocked while other threads are allowed to proceed while the buf_daemon
  is trying to flush stuff out.

12 years agokernel - Fix p->p_lock race and remove unused procedures
Matthew Dillon [Thu, 10 Nov 2011 20:25:09 +0000 (12:25 -0800)]
kernel - Fix p->p_lock race and remove unused procedures

* Remove vm_waitproc() (move its vmspace_exitfree() call to the one place
  that calls vm_waitproc()).

* Remove cpu_proc_wait(), which only called pmap_dispose_proc().

* Remove pmap_dispose_proc(), which only had an (incorrect) assertion in it
  and otherwise did nothing.

* Wait for the p->p_lock count to drop to zero before calling
  vmspace_exitfree(), and then wait again afterwords now that there
  are absolutely no possible references to (p) left.

12 years agovkernel - Add leaf customization target
Matthew Dillon [Thu, 10 Nov 2011 20:20:53 +0000 (12:20 -0800)]
vkernel - Add leaf customization target

* Add a convenience target

12 years agokernel - Increase maximum supported physical memory to 32TB
Matthew Dillon [Thu, 10 Nov 2011 18:04:26 +0000 (10:04 -0800)]
kernel - Increase maximum supported physical memory to 32TB

* Increase the maximum supported physical memory to 32TB (untested), by
  increasing the number of DMAP PDPs we reserve in the PML4E from 1 to 32.

12 years agokernel - Allow vm_page_alloc() to return NULL in bio_page_alloc()
Matthew Dillon [Thu, 10 Nov 2011 18:03:27 +0000 (10:03 -0800)]
kernel - Allow vm_page_alloc() to return NULL in bio_page_alloc()

* Alloc the allocation race case to occur in bio_page_alloc().  Callers
  will handle the case.

Reported-by: ftigeot
12 years agokernel - Deoptimize refcount case
Matthew Dillon [Thu, 10 Nov 2011 18:02:30 +0000 (10:02 -0800)]
kernel - Deoptimize refcount case

* Make sure the compiler does not optimize the loading of *countp as the
  value can change out from under us.  It's volatile anyway but don't take
  any chances.

12 years agokernel - Remove ad-hoc increment/decrement of vm->vm_sysref
Matthew Dillon [Thu, 10 Nov 2011 18:00:57 +0000 (10:00 -0800)]
kernel - Remove ad-hoc increment/decrement of vm->vm_sysref

* Remove the ad-hoc increment/decrement of vm->vm_sysref when pulling data
  out for a ps.  Acquire p->p_token instead.

  This is an attempt to determine whether these adhoc operations are
  responsible for causing a race that results in the seg-fault issue we
  see on monster.

12 years agokernel - Fix overflows in vm_zone.c
Matthew Dillon [Wed, 9 Nov 2011 10:22:27 +0000 (02:22 -0800)]
kernel - Fix overflows in vm_zone.c

* Numerous fields have to be size_t or long and several calculations have
  to be cast to size_t.

* Allows the pv_entry zalloc zone to exceed 2GB of KVM.

12 years agokernel - Increase default shared pages per process for x86-64
Matthew Dillon [Wed, 9 Nov 2011 10:21:21 +0000 (02:21 -0800)]
kernel - Increase default shared pages per process for x86-64

* Increase from 200 to 2000 per process.  This is a temporary fix until a
  better one based on max physical memory can be found.

* For vkernel64 increase from 200 to 1000.

Reported-by: ftigeot
12 years agobsd-family-tree: Sync with FreeBSD.
Sascha Wildner [Wed, 9 Nov 2011 01:53:12 +0000 (02:53 +0100)]
bsd-family-tree: Sync with FreeBSD.

12 years agokernel - Fix lwp_create() kernel corruption and panic in error path
Matthew Dillon [Wed, 9 Nov 2011 00:10:38 +0000 (16:10 -0800)]
kernel - Fix lwp_create() kernel corruption and panic in error path

* We were forgetting to remove the lwp's thread from gd_tdallq, resulting
  in corruption of the queue.

Reported-by: swildner
12 years agokernel - Rearrange page adds in vm_add_new_page()
Matthew Dillon [Tue, 8 Nov 2011 23:41:05 +0000 (15:41 -0800)]
kernel - Rearrange page adds in vm_add_new_page()

* We were previously alternating between the head and tail of the PQ_FREE
  queues when adding new vm pages, but not zeroing the pages being placed
  at the tail.

* Instead of alternating place 1/16 of the new pages on the tail of the
  queue, zero them, and properly mark them PG_ZERO.

* This should reduce physical page fragmentation during early boot when
  drivers need to allocate contiguous low phys-memory pages.

12 years agokernel - Beef up vm_contig allocation checks
Matthew Dillon [Tue, 8 Nov 2011 23:38:16 +0000 (15:38 -0800)]
kernel - Beef up vm_contig allocation checks

* Beef up vm_contig allocation checks by also requiring the PQ_CACHE page
  to not be held or wired or unmanaged, and assert that it is not mapped
  or dirty.

* When utilizing PQ_FREE pages ignore any held pages and assert that
  the pages are not dirty in addition to not having an object.

* Do not clear PG_SBUSY when allocating a page (though it shouldn't be set
  anyway, we still shouldn't unconditionally clear the bit).

12 years agokernel - reformulate some of the pmap code to adhere to the new rules
Matthew Dillon [Tue, 8 Nov 2011 19:44:38 +0000 (11:44 -0800)]
kernel - reformulate some of the pmap code to adhere to the new rules

* hold_count can now be adjusted asynchronously so it cannot be used to
  count the number of pte's in a page table page.  Use wire_count instead.

* On i386 there is no extra wire_count for the page table page mapping itself
  so the pmap_release code should never find a page table page other than the
  page directory page itself.

* Reformulate the *ptep checks in x86-64's pmap_scan() code to avoid races.

* Document why busy pages can sometimes be found in the PQ_FREE queues.

* Document that other than finding a busy page, pages in PQ_FREE should be
  ready to go.

* It is possible for a wired page to wind up on the inactive queue, the
  pageout daemon has to deal with the case by dequeueing it.

12 years agokernel - Add callout_stop_sync()
Matthew Dillon [Tue, 8 Nov 2011 08:29:51 +0000 (00:29 -0800)]
kernel - Add callout_stop_sync()

* Add a synchronous version of callout_stop() which ensure that the
  callout function has completed operation (if it was running) before
  returning.

12 years agokernel - make adjustments to the AHCI driver to try to locate some races
Matthew Dillon [Tue, 8 Nov 2011 08:28:04 +0000 (00:28 -0800)]
kernel - make adjustments to the AHCI driver to try to locate some races

* Change the timeout handling to ensure that the expire mask is properly
  cleared and the timeout has completed processing.

* Panic upon reporting an unknown xa->state.

Reported-by: masterblaster / randy_
12 years agosyscons: Add description for machdep.enable_panic_key.
Sascha Wildner [Tue, 8 Nov 2011 03:23:13 +0000 (04:23 +0100)]
syscons: Add description for machdep.enable_panic_key.

12 years agobtpin.1: Use an item list to silence a mandoc(1) warning.
Sascha Wildner [Tue, 8 Nov 2011 02:46:24 +0000 (03:46 +0100)]
btpin.1: Use an item list to silence a mandoc(1) warning.

12 years agotcplay.3: Remove empty line.
Sascha Wildner [Tue, 8 Nov 2011 02:35:47 +0000 (03:35 +0100)]
tcplay.3: Remove empty line.

12 years agokernel - Fix itimer hard critical section panic
Matthew Dillon [Tue, 8 Nov 2011 00:26:48 +0000 (16:26 -0800)]
kernel - Fix itimer hard critical section panic

* ksignal() needs per-lwp tokens as well as the process token, the existing
  itimer code only gets the process token.

* Flag the itimer signal and issue the ksignal() in the trap's AST code
  instead of trying to issue it from the hardclock.

Reported-by: swildner
12 years agoacpi_cpu: do not apply P_LVLx_LAT rules to latencies returned by _CST
Sascha Wildner [Mon, 7 Nov 2011 18:23:35 +0000 (19:23 +0100)]
acpi_cpu: do not apply P_LVLx_LAT rules to latencies returned by _CST

ACPI specification states that if P_LVL2_LAT >100, then a system
doesn't support C2; if P_LVL3_LAT >1000, then C3 is not supported.

But there are no such rules for Cx state data returned by _CST. If a
state is not supported it should not be included into the return
package. In other words, any latency value returned by _CST is valid,
it's up to the OS and/or user to decide whether to use it.

Submitted-by: Johannes Hofmann <Johannes.Hofmann@gmx.de>
Taken-from:    FreeBSD (rev 212549)
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue2157>

12 years agoAlso remove formatted binutils220 manpages via 'make upgrade'.
Sascha Wildner [Mon, 7 Nov 2011 11:52:41 +0000 (12:52 +0100)]
Also remove formatted binutils220 manpages via 'make upgrade'.

12 years agoCPUTYPE: Fix Geode, remove C7
John Marino [Mon, 7 Nov 2011 10:57:22 +0000 (11:57 +0100)]
CPUTYPE: Fix Geode, remove C7

Upon further research, I determined that gcc44 doesn't specifically
support the C7 processor which was added yesterday.  It does support the
Geode processor, but the supported instruction sets weren't defined quite
right.

GCC 4.4 will not tune for the Atom nor Corei7 processors.  That support
isn't available until GCC 4.6.

Document: GCC 4.4.6 documentation
 Section: 3.  GCC Command options
    Para: 17. Hardware Models and Configurations
 Subpara: 15. Intel i386 and AMD x86_64 Options

12 years agosys/types.h - include sys/stdint.h for __off_t and __pid_t
Samuel J. Greear [Mon, 7 Nov 2011 07:22:41 +0000 (00:22 -0700)]
sys/types.h - include sys/stdint.h for __off_t and __pid_t

12 years agoCPUTYPE: Add support for Via C7 and AMD Geode (gcc44)
John Marino [Sun, 6 Nov 2011 20:55:09 +0000 (21:55 +0100)]
CPUTYPE: Add support for Via C7 and AMD Geode (gcc44)

12 years agolibmpfr: Upgrade to version 3.1.0 from version 2.4.2
John Marino [Sun, 6 Nov 2011 17:45:11 +0000 (18:45 +0100)]
libmpfr: Upgrade to version 3.1.0 from version 2.4.2

Like libgmp, libmpfr has the ability to tune itself to the cpu used, e.g.
core2, k8, etc.  Currently we are not taking advantage of this situation,
but in the future the CPU_TYPE variable should be examined for tuning
purposes.

libmpfr is a requirement to build gcc-4.4 and later versions.

12 years agoMerge branch 'vendor/MPFR'
John Marino [Sun, 6 Nov 2011 18:59:30 +0000 (19:59 +0100)]
Merge branch 'vendor/MPFR'

12 years agoUpgrade MPFR from 2.4.2-p3 to 3.1.0 on the vendor branch
John Marino [Sun, 6 Nov 2011 16:41:46 +0000 (17:41 +0100)]
Upgrade MPFR from 2.4.2-p3 to 3.1.0 on the vendor branch

12 years agovmstat - Adapt memory limit field for bigger sizes.
Antonio Huete Jimenez [Sun, 6 Nov 2011 10:52:24 +0000 (11:52 +0100)]
vmstat - Adapt memory limit field for bigger sizes.

For some types like filesystem inodes the limit is raised up to
KvaSize, which can be larger than the actual display field size,
so enlarge it a bit.

12 years agoSort some SEE ALSOs in manual pages.
Sascha Wildner [Sat, 5 Nov 2011 22:39:37 +0000 (23:39 +0100)]
Sort some SEE ALSOs in manual pages.

12 years agogprof: silence buildworld errors
John Marino [Sat, 5 Nov 2011 21:50:36 +0000 (22:50 +0100)]
gprof: silence buildworld errors

It seems that every binutils library and application redefines
PACKAGE_BUG REPORT, and the gprof version clashes with the libbfd
version, so it was disabled to avoid redefinition warnings during
buildworld.

12 years agolibgmp: Fix README.DELETED
John Marino [Sat, 5 Nov 2011 21:39:58 +0000 (22:39 +0100)]
libgmp: Fix README.DELETED

An experimental README.DELETED was committed.  Currently the x86 and
x86_64 files are not vendor branch, so their directories should not have
been removed before.

12 years agolibgmp: Upgrade to version 5.0.2
John Marino [Sat, 5 Nov 2011 20:31:30 +0000 (21:31 +0100)]
libgmp: Upgrade to version 5.0.2

The GNU Multiple Precision Arithmetic Library is required for gcc44 and
all newer gcc compilers.  It's alway been built with the "generic" C
files rather than the provided assembly.  It should be possible to build
gmp with a base set of assembly for x86 and x86_64, and even use
more processor-specific assembly if CPU_TYPE is set, but implementing that
will require some more work and a lot of testing.  So for now, gmp is
still built with the much slower (but more portable) C files.

BUGS FIXED
===================
1. Fat builds fixed.
2. Fixed crash for huge multiplies when old FFT_TABLE2 type of parameter
   selection tables' sentinel was smaller than multiplied operands.
3. The solib numbers now reflect the removal of the documented but
   preliminary mpn_bdivmod function; we correctly flag incompatibility
   with GMP 4.3.
4. Many minor bugs related to portability fixed.
5. The support for HPPA 2.0N now works, after an assembly bug fix.
6. A test case type error has been fixed.  The symptom of this bug
   was spurious 'make check' failures.

SPEEDUPS
===================
1.  Multiplication has been overhauled:
    (1) Multiplication of larger same size operands has been improved with
        the addition of two new Toom functions and a new internal function
        mpn_mulmod_bnm1 (computing U * V mod (B^n-1), B being the word
        base. This latter function is used for the largest products,
        waiting for a better Schoenhage-Strassen U * V mod (B^n+1)
        implementation.
    (2) Likewise for squaring.
    (3) Multiplication of different size operands has been improved with
        the addition of many new Toom function, and by selecting
        underlying functions better from the main multiply functions.
2.  Division and mod have been overhauled:
    (1) Plain "schoolbook" division is reimplemented using faster quotient
        approximation.
    (2) Division Q = N/D, R = N mod D where both the quotient and
        remainder are needed now runs in time O(M(log(N))).  This is an
        improvement of a factor log(log(N))
    (3) Division where just the quotient is needed is now O(M(log(Q))) on
        average.
    (4) Modulo operations using Montgomery REDC form now take time O(M(n))
    (5) Exact division Q = N/D by means of mpz_divexact has been improved
        for all sizes, and now runs in time O(M(log(N))).
3.  The function mpz_powm is now faster for all sizes.  Its complexity has
    gone from O(M(n)log(n)m) to O(M(n)m) where n is the size of the modulo
    argument and m is the size of the exponent.  It is also radically
    faster for even modulus, since it now partially factors such modulus
    and performs two smaller modexp operations, then uses CRT.
4.  The internal support for multiplication yielding just the lower n
    limbs has been improved by using Mulders' algorithm.
5.  Computation of inverses, both plain 1/N and 1/N mod B^n have been
    improved by using well-tuned Newton iterations, and wrap-around
    multiplication using mpn_mulmod_bnm1.
6.  A new algorithm makes mpz_perfect_power_p asymptotically faster.
7.  The function mpz_remove uses a much faster algorithm, is better tuned,
    and also benefits from the division improvements.
8.  Intel Atom and VIA Nano specific optimisations.
9.  Multiplication of large numbers has indirectly been sped up through
    better FFT tuning and processor recognition.  Since many operations
    depend on multiplication, there will be a general speedup.
10. Plus hundreds of smaller improvements and tweaks!

NEW FEATURES
===================
1.  New mpz function: mpz_powm_sec for side-channel quiet modexp
    computations.
2.  New mpn functions: mpn_sqr, mpn_and_n, mpn_ior_n, mpn_xor_n,
    mpn_nand_n, mpn_nior_n, mpn_xnor_n, mpn_andn_n, mpn_iorn_n,
    mpn_com, mpn_neg, mpn_copyi, mpn_copyd, mpn_zero.
3.  The function mpn_tdiv_qr now allows certain argument overlap.
4.  Support for fat binaries for 64-bit x86 processors has been added.
5.  A new type, mp_bitcnt_t for bignum bit counts, has been introduced.
6.  More Core i3, i5 an Core i7 processor models are recognised.

12 years agoMerge branch 'vendor/GMP'
John Marino [Sat, 5 Nov 2011 21:30:30 +0000 (22:30 +0100)]
Merge branch 'vendor/GMP'

12 years agoUpgrade GMP from 4.3.2 to 5.0.2 on the vendor branch
John Marino [Wed, 2 Nov 2011 22:54:48 +0000 (23:54 +0100)]
Upgrade GMP from 4.3.2 to 5.0.2 on the vendor branch

12 years agokernel - sysv - Bump semaphore limits
Samuel J. Greear [Sat, 5 Nov 2011 21:01:26 +0000 (15:01 -0600)]
kernel - sysv - Bump semaphore limits

* Bump kern.ipc.semmns, the total number of system semaphores, to 341.
  This count represents an array of 12-byte tracking structures, 341 of these
  consumes a single hardware page.

* Bump kern.ipc.semmni to accomodate the new semmns limit per the PostgreSQL
  calculations from
  http://developer.postgresql.org/pgdocs/postgres/kernel-resources.html

12 years agohammer - Migration to libhammer (step 1/many)
Antonio Huete Jimenez [Sat, 5 Nov 2011 18:00:20 +0000 (19:00 +0100)]
hammer - Migration to libhammer (step 1/many)

- Start using libhammer
- Migrate info directive

12 years agolibhammer - Hook it up into the build.
Antonio Huete Jimenez [Wed, 17 Aug 2011 17:34:13 +0000 (19:34 +0200)]
libhammer - Hook it up into the build.

12 years agolibhammer - Fix a misplaced #endif for the header guardian.
Antonio Huete Jimenez [Sat, 5 Nov 2011 17:49:24 +0000 (18:49 +0100)]
libhammer - Fix a misplaced #endif for the header guardian.

12 years agolibhammer - inodes field was also overlooked.
Antonio Huete Jimenez [Sat, 29 Oct 2011 18:15:45 +0000 (20:15 +0200)]
libhammer - inodes field was also overlooked.

12 years agoieee80211*(9) manual pages: Add some missing #include's.
Sascha Wildner [Sat, 5 Nov 2011 18:07:34 +0000 (19:07 +0100)]
ieee80211*(9) manual pages: Add some missing #include's.

12 years agoSync zoneinfo database with tzdata2011n from munnari.oz.au
Sascha Wildner [Sat, 5 Nov 2011 10:05:28 +0000 (11:05 +0100)]
Sync zoneinfo database with tzdata2011n from munnari.oz.au

australasia:    8.28 -> 8.29
backward:       8.10 -> 8.11
europe:         8.39 -> 8.40
northamerica:   8.50 -> 8.51
zone.tab:       8.50 -> 8.52

* australasia: Fiji has altered the end date for summer time this
    summer, moving it from February to January. It is by no means sure
    it won't shift again, but this does appear to be the current plan.

* backward, europe, zone.tab: Pridnestrovian Moldavian Republic
    (Europe/Tiraspol) has not followed much of Russia, and will not
    retain summer time - rather reverting to standard time along with
    western Europe, and Ukraine, on Oct 30, as it was earlier scheduled
    to do. This removes the Europe/Tiraspol zone (again) as the
    variation never actually happened (and returns the entry in the
    "backward" file).

* northamerica: Cuba (America/Havana) has extended summer time by two
    weeks, now to end on Nov 13, rather than the (already past) Oct 30.

12 years agokernel - Attempt to workaround low memory deadlock
Matthew Dillon [Fri, 4 Nov 2011 17:52:33 +0000 (10:52 -0700)]
kernel - Attempt to workaround low memory deadlock

* Mark the hammer flusher threads as system threads and call
  vm_wait_nominal() in the inode flush loop prior to acquiring
  an inode lock.

* This attempts to work around an issue where the pageout daemon has
  to do a BMAP indirectly via vnode_pager_put_pages(), which requires
  a dive into hammer deep enough to need the inode lock.

  The pageout daemon checks the vnode lock but has no visibility into
  the inode lock.  Only the hammer backend (theoretically) can acquire
  the inode lock without holding the vnode lock.  Hopefully this will
  improve the issue.

Reported-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
12 years agotwa(4): Remove some bogus NULL checks after kmalloc() with M_WAITOK.
Sascha Wildner [Fri, 4 Nov 2011 16:59:51 +0000 (17:59 +0100)]
twa(4): Remove some bogus NULL checks after kmalloc() with M_WAITOK.

Reported-by: alexh
12 years agokernel: Replace some bzero()s with M_ZERO in the preceding kmalloc().
Sascha Wildner [Fri, 4 Nov 2011 16:20:06 +0000 (17:20 +0100)]
kernel: Replace some bzero()s with M_ZERO in the preceding kmalloc().

12 years agotcp: Bring back MSG_EOF flag support in sosendtcp()
Sepherosa Ziehau [Fri, 4 Nov 2011 14:01:32 +0000 (22:01 +0800)]
tcp: Bring back MSG_EOF flag support in sosendtcp()

Though it was originally designed for T/TCP, it is nice to have

While I'm here, clean up the 'async' setting

12 years agosend(2): Add MSG_SYNC to allow user to disable asynchronized pru_send per-socket
Sepherosa Ziehau [Fri, 4 Nov 2011 13:33:50 +0000 (21:33 +0800)]
send(2): Add MSG_SYNC to allow user to disable asynchronized pru_send per-socket

12 years agoRemove some bogus CVS IDs.
Sascha Wildner [Fri, 4 Nov 2011 12:32:11 +0000 (13:32 +0100)]
Remove some bogus CVS IDs.

12 years agotcp: Enable asynchronized pru_send by default
Sepherosa Ziehau [Fri, 4 Nov 2011 11:35:02 +0000 (19:35 +0800)]
tcp: Enable asynchronized pru_send by default

12 years agotcp: Partly revert f2a3782
Sepherosa Ziehau [Fri, 4 Nov 2011 11:29:21 +0000 (19:29 +0800)]
tcp: Partly revert f2a3782

We do not need to sync the target netisr before disconnect or shutdown,
the problem was fixed in 392cd26 and turned out to be ipi message
ordering problem.

12 years agokernel - Fix localhost packet misordering
Matthew Dillon [Fri, 4 Nov 2011 05:25:31 +0000 (22:25 -0700)]
kernel - Fix localhost packet misordering

* netisr thread ports are based on IPIs, but when we enable asynch socket
  writes a user thread which gets moved between cpus sending async netmsgs
  while doing so can result in the netisr receiving those messages out
  of order, corrupting the data stream.

* Add TDF_FORCE_SPINPORT to allow the netisr threads to implement their
  message ports as spinports instead of threadports, which guarantees
  message ordering.

12 years agoBinutils 2.20: Effectively remove from world
John Marino [Thu, 3 Nov 2011 21:38:50 +0000 (22:38 +0100)]
Binutils 2.20: Effectively remove from world

There is no longer a reason to maintain multiple versions of binutils
in the base system.  While contrib/binutils-2.20 directory isn't being
removed quite yet, this commit effectively removed binutils 2.20 from
DragonFly.

Sometime in the future, binutils may be removed from the objformat
handler.  The value of the BINUTILSVERS variable no longer has any
effect, and the only version of binutils on the system is 2.21.

12 years agokernel - Fix bug in last commit
Matthew Dillon [Thu, 3 Nov 2011 20:41:48 +0000 (13:41 -0700)]
kernel - Fix bug in last commit

* Ooops, lwkt_gettoken->lwkt_reltoken.

Reported-by: ftigeot
12 years agoAdded AMD Features2 bits 17 (TCE), 23 (PCX_CORE) and 24 (PCX_NB) to identcpu.c for...
Markus Pfeiffer [Fri, 4 Nov 2011 17:51:47 +0000 (17:51 +0000)]
Added AMD Features2 bits 17 (TCE), 23 (PCX_CORE) and 24 (PCX_NB) to identcpu.c for pc32 and pc64

12 years agokernel - Fix /dev/mem access for memory >=4GB
Matthew Dillon [Thu, 3 Nov 2011 17:51:40 +0000 (10:51 -0700)]
kernel - Fix /dev/mem access for memory >=4GB

* The (v) variable was a u_int, chopping off the top 32 bits of a 64 bit
  physical address.  Change to a long.

12 years agokernel - Hold required token when accessing p_flags, adjust kmem access
Matthew Dillon [Thu, 3 Nov 2011 17:49:16 +0000 (10:49 -0700)]
kernel - Hold required token when accessing p_flags, adjust kmem access

* Numerous adjustments to p->p_flag were not being done with p->p_token held.
  In particular uiomove().

* Replace P_DEADLKTREAT with LWP_DEADLKTREAT in several places where it had
  not been previously converted.

* Allow DMAP access in is_globaldata_space() for x86-64

12 years agoioapic/x86_64: Per-cpu irqmap array
Sepherosa Ziehau [Thu, 3 Nov 2011 16:32:35 +0000 (00:32 +0800)]
ioapic/x86_64: Per-cpu irqmap array

12 years agoMachIntrABI/x86_64: Remove unnecessary setidt in intr_setup/teardown
Sepherosa Ziehau [Thu, 3 Nov 2011 15:06:16 +0000 (23:06 +0800)]
MachIntrABI/x86_64: Remove unnecessary setidt in intr_setup/teardown

MachIntrABI.setdefault() has already done that

12 years agoioapic/x86_64: Add missing imen_lock/unlock
Sepherosa Ziehau [Thu, 3 Nov 2011 14:58:32 +0000 (22:58 +0800)]
ioapic/x86_64: Add missing imen_lock/unlock

12 years agotcp: Allow pure asynchronized pru_send
Sepherosa Ziehau [Thu, 3 Nov 2011 13:38:49 +0000 (21:38 +0800)]
tcp: Allow pure asynchronized pru_send

- net.inet.tcp.sosnd_async is added to allow pure asynchronized pru_send.
  It is default to off currently.
- To prevent soclose() and soshutdown() from interfering TCP processing on
  the loopback interface, so_pru_sync() is added, which will make sure
  that so_pru_disconnect() and so_pru_shutdown() run only after all of the
  previous sent packets had been requeued to netisr (the semantics of the
  original half asynchronized pru_send).

12 years agogcc41: Add a missing file to CLEANFILES.
Sascha Wildner [Thu, 3 Nov 2011 10:19:20 +0000 (11:19 +0100)]
gcc41: Add a missing file to CLEANFILES.

12 years agoloader.8: Fix typo.
Sascha Wildner [Wed, 2 Nov 2011 23:53:59 +0000 (00:53 +0100)]
loader.8: Fix typo.

12 years agokernel - reformulate the maxusers auto-sizing calculation
Matthew Dillon [Wed, 2 Nov 2011 06:44:37 +0000 (23:44 -0700)]
kernel - reformulate the maxusers auto-sizing calculation

* Reformulate the maxusers auto-sizing calculation, which is used as a
  basis for mbufs and mbuf cluster calculations.  Base the values on
  limsize (basically the lower of KVM vs physical memory).

* Remove artificial limits.

* This basically effects x86-64 systems with > 4G of ram, greatly
  increasing the default maxusers value and related mbuf limits.

12 years agokernel - Fix spin-based msgports
Matthew Dillon [Wed, 2 Nov 2011 06:43:11 +0000 (23:43 -0700)]
kernel - Fix spin-based msgports

* LWKT threads can use thread/IPI or spin-based message ports.  The
  default is thread-based.  Spin-based ports had numerous problems which
  would result in panics.  This commit fixes those panics and makes the
  spinlock version viable.

* However, currently there is no performance improvement so the default
  is staying as it was.

12 years agokernel - Fix x86-64 pmap race
Matthew Dillon [Wed, 2 Nov 2011 06:42:06 +0000 (23:42 -0700)]
kernel - Fix x86-64 pmap race

* Fix a x86-64 pmap race where a pte can get ripped out from under
  the pmap_remove*() code.  Recheck the pte after locking pt_pv.

12 years agokernel - Major MP work on kq and signal processing
Matthew Dillon [Wed, 2 Nov 2011 06:38:42 +0000 (23:38 -0700)]
kernel - Major MP work on kq and signal processing

* Remove the global kq_token and move to a per-kq and per-kqlist
  pool token.  This greatly improves postgresql and mysql performance
  on MP systems.

* Adjust signal processing tokens to be per-LWP instead of per-PROC.
  Signal delivery still utilizes a per-proc token but signal distribution
  now uses a per-LWP token, which allows the trap code to only lock the
  LWP when checking for pending signals.

  This also significantly improves database performance.

* The socket code also now uses only its per-socket pool token instead
  of kq_token for its kq operations.  kq handles its own tokens.

12 years agokernel - add MAP_SIZEALIGN
Matthew Dillon [Wed, 2 Nov 2011 06:33:40 +0000 (23:33 -0700)]
kernel - add MAP_SIZEALIGN

* Add a mmap() MAP_SIZEALIGN flag which requests alignment the same
  as the size argument (different from Solaris's MAP_ALIGN which uses
  the address hint).

* Will be used in upcoming libc/stdlib/dmalloc.c work.  The dmalloc code
  will work without it just fine, too..

12 years agobuildkernel - remove COMPAT_43 and COMPAT_DF12
Matthew Dillon [Wed, 2 Nov 2011 06:31:50 +0000 (23:31 -0700)]
buildkernel - remove COMPAT_43 and COMPAT_DF12

* Remove old compats that we really should not be compiling into kernels
  any more.

  In particular, the old getpid() did some weird things which created
  unnecessary slowdowns on MP systems.

12 years agokernel - Add bsflong() asm functions
Matthew Dillon [Wed, 2 Nov 2011 06:21:59 +0000 (23:21 -0700)]
kernel - Add bsflong() asm functions

* Add bsflong() inline asm functions which operate on the 'long' data type.

12 years agoBump __DragonFly_version for the removal of <crypt.h> (to be safe).
Sascha Wildner [Tue, 1 Nov 2011 21:29:17 +0000 (22:29 +0100)]
Bump __DragonFly_version for the removal of <crypt.h> (to be safe).

12 years agopf/pf_ioctl.c: Fix whitespace error
Jan Lentfer [Tue, 1 Nov 2011 21:02:29 +0000 (22:02 +0100)]
pf/pf_ioctl.c: Fix whitespace error

12 years agoUnbreak LINT.
Sascha Wildner [Tue, 1 Nov 2011 10:34:17 +0000 (11:34 +0100)]
Unbreak LINT.

12 years agopf: convert to use kmalloc instead of zalloc
Jan Lentfer [Thu, 6 Jan 2011 10:03:55 +0000 (11:03 +0100)]
pf: convert to use kmalloc instead of zalloc