dragonfly.git
8 years agotmpfs - Fix write-append/mmap-read race
Matthew Dillon [Sat, 4 Jul 2015 04:55:10 +0000 (21:55 -0700)]
tmpfs - Fix write-append/mmap-read race

* tmpfs_write() was not extending the target file atomically with the
  write via a file node lock.  Although the vnode is locked exclusively,
  this only prevents read() and write() related races.  lseek() and memory
  mapped reads could still race.

* Adjust the NODE LOCK to cover the entire tmpfs_write() operation.  This
  fixes races against lseek() or stat() which would otherwise allow the
  new post-append file size to be returned before the write completes.

-Matt

Reported-by: Ben Woolley <tautolog@gmail.com>
8 years agodrm/i915: Sync with Linux 3.14 a tiny bit
François Tigeot [Fri, 3 Jul 2015 20:21:00 +0000 (22:21 +0200)]
drm/i915: Sync with Linux 3.14 a tiny bit

The get_page() and set_pages_uc() Linux functions have been
implemented, we can use them.

8 years agosbin/hammer: Use const char* for string literal args
Tomohiro Kusumi [Fri, 3 Jul 2015 13:51:23 +0000 (22:51 +0900)]
sbin/hammer: Use const char* for string literal args

8 years agosys/vfs/hammer: Change "xxx-map" to "xxxmap"
Tomohiro Kusumi [Fri, 3 Jul 2015 13:50:45 +0000 (22:50 +0900)]
sys/vfs/hammer: Change "xxx-map" to "xxxmap"

- "xxxmap"s seem to be canonical terms rather than "xxx-map"s
  where "xxx"s are name of zones.

- This commit only changes comments. Variable names and other
  comments, etc already have "xxxmap".

8 years ago<sys/lock.h>: Fix comment typo.
Sascha Wildner [Fri, 3 Jul 2015 12:35:07 +0000 (14:35 +0200)]
<sys/lock.h>: Fix comment typo.

Submitted-by: Yellow Rabbit <yrabbit@sdf.lonestar.org>
8 years agosys/vfs/hammer: Change "bigblock" to "big-block"
Tomohiro Kusumi [Thu, 2 Jul 2015 14:41:06 +0000 (23:41 +0900)]
sys/vfs/hammer: Change "bigblock" to "big-block"

- There are(or were) several terms for 8MB chunk, for example
  "big-block", "bigblock", "big block", "large-block", etc but
  "big-block" seems to be the canonical term.

- Changes are mostly comments and some in printf and hammer(8).
  Variable names (e.g. xxx_bigblock_xxx) remain unchanged.

- The official design document as well as much of the existing
  code (excluding variable and macro names) use "big-block".
  https://www.dragonflybsd.org/hammer/hammer.pdf

- Also see e04ee2de and the previous commit.

8 years agosys/vfs/hammer: Change "big block" to "big-block"
Tomohiro Kusumi [Thu, 2 Jul 2015 14:08:07 +0000 (23:08 +0900)]
sys/vfs/hammer: Change "big block" to "big-block"

- This word refers to 8MB chunk in hammer's blockmap layers,
  not literally "big" "block".

- Changes are mostly comments and some in printf and hammer(8).

- The official design document as well as much of the existing
  code (excluding variable and macro names) use "big-block".
  https://www.dragonflybsd.org/hammer/hammer.pdf

- Also see e04ee2de.

8 years agosys/vfs/hammer: Revert one line from ccdea23
Tomohiro Kusumi [Thu, 2 Jul 2015 13:50:12 +0000 (22:50 +0900)]
sys/vfs/hammer: Revert one line from ccdea23

- This needed to be kept with "btree" zone.

- No binary diff since these two macros are the same,
  and also this code has been #if0'd.

8 years agokernel - Improve basic entropy collector
Matthew Dillon [Wed, 1 Jul 2015 17:07:21 +0000 (10:07 -0700)]
kernel - Improve basic entropy collector

* Faster time-buffered period in first 120 seconds after boot to help seed
  the generator.  This helps when other sources such as RDRAND are not available.

* Use a systimer instead of tsleep to make the 'random' loop delay more random.

* Do a better job incorporating interrupt randomness with a combination of
  counter and low TSC bits.

* Get rid of the double-time-buffering restrictions (one in the thread, one in
  NANOUP_EVENT().  Also incorporate the low TSC bits in different bit positions
  to try to avoid XOR deconstruction against tv_nsec.

Reported-by: tuxillo
8 years agokernel/acpi_thermal: Fix comment typo.
Sascha Wildner [Tue, 30 Jun 2015 16:41:20 +0000 (18:41 +0200)]
kernel/acpi_thermal: Fix comment typo.

8 years agobsd-family-tree: Sync with FreeBSD (for DragonFly 4.2.0).
Sascha Wildner [Wed, 1 Jul 2015 09:35:08 +0000 (11:35 +0200)]
bsd-family-tree: Sync with FreeBSD (for DragonFly 4.2.0).

8 years agosyscons - reenable cursor
Matthew Dillon [Tue, 30 Jun 2015 21:47:46 +0000 (14:47 -0700)]
syscons - reenable cursor

* Cursor was accidently disabled in a prior commit,
  reenable it.

Reported-by: swildner
8 years agodrm - Used fixed start address instead of vm_map_hint() in i915_gem_mmap_ioctl()
Matthew Dillon [Tue, 30 Jun 2015 19:46:02 +0000 (12:46 -0700)]
drm - Used fixed start address instead of vm_map_hint() in i915_gem_mmap_ioctl()

* We tried to fix i915_gem_mmap_ioctl() returning a valid 'NULL' address for
  the requested mapping by passing the vm_map_hint() address into it.  This
  worked, but for reasons unknown wound up destabilizing X11 itself.

* So, instead of using 0, and instead of using vm_map_hint(), the 'hint'
  starting address is now fixed at PAGE_SIZE (0x0000000000001000).  And this
  seems to solve the destabilization.

8 years agohammer2 - xop stabilization - part 2/many
Matthew Dillon [Tue, 30 Jun 2015 06:37:20 +0000 (23:37 -0700)]
hammer2 - xop stabilization - part 2/many

* The xop mechanics do a quorum calculation, and will also do quorum
  calculations for the inode cluster (not yet in).  This calculation is
  primarily based on the bref.modify_tid.

  Each backend XOP now needs its own modify_tid to properly distinguish
  between and eventually serialize dependent backend ops.

* Implement discrete modify_tid (mtid) reservations in
  hammer2_xop_alloc().  Remove the old modify_tid reservation code that only
  incremented it on a per-flush basis.

* The flush code will acquire a unique modify_tid which is greater than all
  prior modify_tids in stage 2 (after it clears PREFLUSH).

* The hammer2_xop_alloc() code is too messy returning the union structure,
  return a void * instead so the caller can just assign it to the correct
  sub-union structure.

8 years agokernel - Add atomic_fetchadd_64()
Matthew Dillon [Tue, 30 Jun 2015 06:36:00 +0000 (23:36 -0700)]
kernel - Add atomic_fetchadd_64()

* Add an atomic_fetchadd_64() function which hammer2 needs.  This might
  not be possible on e.g. 32-bit architectures for porting purposes but
  for now I don't want to put a lock around the hammer2 functions that
  need it.

8 years agopowerd: Support Intel Performance and Energy Bias Hint
Sepherosa Ziehau [Mon, 29 Jun 2015 14:54:47 +0000 (22:54 +0800)]
powerd: Support Intel Performance and Energy Bias Hint

According to <<Intel Software Developer's Manual>>
"... guide the hardware heuristic of power management features to favor
 increasing dynamic performance or conserve energy consumption."

hint 0  - Max performance.
hint 15 - Max energy saving.

8 years agohammer2 - xop stabilization - part 1/many
Matthew Dillon [Tue, 30 Jun 2015 00:10:49 +0000 (17:10 -0700)]
hammer2 - xop stabilization - part 1/many

* Create XOP threads on-demand, they are needed sometimes even on PFSs
  which don't normally need it.

* For spmp roots, count PFSTYPE_SUPROOT as a master to simplify the cluster
  validation code.

* Allow hammer2_inode_get() to only repoint part of an inode's cluster.

* Stabilize the slave synchronizer (a little, requires more).

* Remove more dead code.

8 years agoipfw3: join same filters with or operator
Bill Yuan [Sun, 28 Jun 2015 10:30:43 +0000 (18:30 +0800)]
ipfw3: join same filters with or operator

example:
ipfw3 add allow icmp to <ip addr 1> or <ip addr 2> ...

8 years agoConvert acpi_timer to using ACPICA functions.
Sascha Wildner [Mon, 29 Jun 2015 08:05:38 +0000 (10:05 +0200)]
Convert acpi_timer to using ACPICA functions.

8 years agoipfw3: filter from/to supports me/any/subnet
Bill Yuan [Sat, 27 Jun 2015 13:38:17 +0000 (21:38 +0800)]
ipfw3: filter from/to supports me/any/subnet

usage:
ipfw3 add allow udp to any
ipfw3 add allow icmp from me
ipfw3 add allow icmp from 192.168.1.0/24

8 years agopowerd: Save usched mask for later use, e.g. by perf-energy bias
Sepherosa Ziehau [Sun, 28 Jun 2015 13:40:58 +0000 (21:40 +0800)]
powerd: Save usched mask for later use, e.g. by perf-energy bias

8 years agocpumask: Add XORMASK
Sepherosa Ziehau [Sun, 28 Jun 2015 12:59:38 +0000 (20:59 +0800)]
cpumask: Add XORMASK

8 years agoacpi/pstate: Allow users to set _PDL
Sepherosa Ziehau [Sun, 28 Jun 2015 12:06:40 +0000 (20:06 +0800)]
acpi/pstate: Allow users to set _PDL

Reported-by: swildner
8 years agoacpi/pstate: Rename sysctl node available_bin to avail
Sepherosa Ziehau [Sun, 28 Jun 2015 11:51:19 +0000 (19:51 +0800)]
acpi/pstate: Rename sysctl node available_bin to avail

And hide sysctl node available from sysctl list.

8 years agohammer2 - Refactor frontend part 17
Matthew Dillon [Sun, 28 Jun 2015 23:49:48 +0000 (16:49 -0700)]
hammer2 - Refactor frontend part 17

This ends the major refactoring.  All major cluster ops have been converted
to XOPs.  The new XOP APIs will be stabilized in subsequent commits, issues
will primarily be slave scan deadlocks.

* Refactor the fsync and slave scan code to use the XOP interface.

* Cleanup hammer2_cluster.c, removing numerous functions which are no
  longer used.

8 years agoFix some typos in variable names.
Sascha Wildner [Sun, 28 Jun 2015 22:26:26 +0000 (00:26 +0200)]
Fix some typos in variable names.

8 years agokernel/acpica: Simplify machine dependent initialization a bit.
Sascha Wildner [Sun, 28 Jun 2015 12:48:43 +0000 (14:48 +0200)]
kernel/acpica: Simplify machine dependent initialization a bit.

8 years agodloader: Bump the max. line length in includes (e.g. loader.conf) to 1024.
Sascha Wildner [Sun, 28 Jun 2015 09:52:54 +0000 (11:52 +0200)]
dloader: Bump the max. line length in includes (e.g. loader.conf) to 1024.

Some ACPICA debugging settings (such as a lists of layers and levels for
debug.acpi.layer and debug.acpi.level, see acpi(4)) can easily get longer
than 256.

Another likely candidate are hw.acpi.{install,remove}_interface.

8 years agoacpiexec(8): Fix a crash with the '!!' command.
Sascha Wildner [Sat, 27 Jun 2015 19:25:19 +0000 (21:25 +0200)]
acpiexec(8): Fix a crash with the '!!' command.

Taken from the ACPICA repository.

ACPICA commit log:

commit 3715a26caadc1847940e2759490410748a433b59
Author: Robert Moore <Robert.Moore@intel.com>
Date:   Wed Jun 24 08:42:44 2015 -0700

    Debugger: Fix problem with the !! command.

    Prevent infinite loop caused by incorrectly entering the !!
    command into the history buffer. ACPICA BZ 1171.

8 years agohammer2 - Refactor frontend part 16/many
Matthew Dillon [Sat, 27 Jun 2015 17:34:48 +0000 (10:34 -0700)]
hammer2 - Refactor frontend part 16/many

* Replace cluster ops with more frontend/backend XOPs.  Use XOPs to
  resolve the root inode, handle the hidden directory, create the
  hidden directory, and to run the unlinkq in the hidden directory.

* Cleanup additional cluster ops that can use ip->meta instead.

* Simplify hammer2_inode_unlock(), it is no longer cluster-centric so
  do not pass-in a cluster to unlock and drop.

* hammer2 show - dump pfs fields for the super-root

* hammer2 set* directives, change the HAMMER2IOC_INODE_SET API slightly.

* newfs_hammer2 - name the super root directory for show output convenience.

8 years agosbin/hammer: Add hammer volume-blkdevs command
Tomohiro Kusumi [Sat, 27 Jun 2015 16:03:29 +0000 (01:03 +0900)]
sbin/hammer: Add hammer volume-blkdevs command

- Many of the low-level hammer commands (e.g. show, blockmap,
  checkmap, etc) require -f option with blkdevs format argument,
  however hammer command does not provide a way to confirm volumes
  in blkdevs format. One often has to manually type devices with
  colons to generate blkdevs format via volume-list command.

- hammer volume-blkdevs prints a list of volumes in blkdevs format
  which is just a different version of volume-list but useful.

- hammer volume-list and volume-blkdevs are basically the same.
  The only difference is volume-list uses '\n' for separator and
  volume-blkdevs uses ':' for separator.

  # hammer volume-list /HAMMER
  /dev/da1
  /dev/da2
  /dev/da3
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da2:/dev/da3
  #

8 years agortld(1): Use standard boolean type from <stdbool.h>.
Sascha Wildner [Sat, 27 Jun 2015 17:04:59 +0000 (19:04 +0200)]
rtld(1): Use standard boolean type from <stdbool.h>.

8 years agokernel: Use 'normal' types (i.e., uint8_t instead of __uint8_t).
Sascha Wildner [Sat, 27 Jun 2015 16:24:58 +0000 (18:24 +0200)]
kernel: Use 'normal' types (i.e., uint8_t instead of __uint8_t).

8 years agokernel/acpica: Change button type to int.
Sascha Wildner [Sat, 27 Jun 2015 07:17:48 +0000 (09:17 +0200)]
kernel/acpica: Change button type to int.

Even though it can have only two values, it's not really a variable meant
to be either true or false.

8 years agopowerd: Move TurboOpt test to the beginning of the condition list
Sepherosa Ziehau [Sat, 27 Jun 2015 14:59:32 +0000 (22:59 +0800)]
powerd: Move TurboOpt test to the beginning of the condition list

8 years agoacpi/pstate: Evaluate _OST after successful _PPC processing
Sepherosa Ziehau [Sat, 27 Jun 2015 14:22:36 +0000 (22:22 +0800)]
acpi/pstate: Evaluate _OST after successful _PPC processing

8 years agoacpi/pstate: Support _PDL, which limits number of usable P-States
Sepherosa Ziehau [Sat, 27 Jun 2015 13:46:26 +0000 (21:46 +0800)]
acpi/pstate: Support _PDL, which limits number of usable P-States

Reported-by: swildner
8 years agoacpi/pstate: Fix _PPC support
Sepherosa Ziehau [Sat, 27 Jun 2015 13:10:47 +0000 (21:10 +0800)]
acpi/pstate: Fix _PPC support

Reported-by: swildner
8 years agopowerd: Make sure that all CPUs are found before we move on
Sepherosa Ziehau [Sat, 27 Jun 2015 08:39:07 +0000 (16:39 +0800)]
powerd: Make sure that all CPUs are found before we move on

8 years agopowerd: Utilize new acpi/pstate sysctl node for available frequencies
Sepherosa Ziehau [Sat, 27 Jun 2015 08:16:41 +0000 (16:16 +0800)]
powerd: Utilize new acpi/pstate sysctl node for available frequencies

While I'm here, clean up CPU power domain frequency change.

8 years agoacpi/pstate: Add binary form for available CPU power domain frequencies
Sepherosa Ziehau [Sat, 27 Jun 2015 04:13:20 +0000 (12:13 +0800)]
acpi/pstate: Add binary form for available CPU power domain frequencies

8 years agopowerd: Fix usched cpumask setting
Sepherosa Ziehau [Fri, 26 Jun 2015 14:31:52 +0000 (22:31 +0800)]
powerd: Fix usched cpumask setting

CPU power domain does not necessarily contain CPUs, whose ids are
contiguous.

8 years agopowerd: Use linked list for CPU power domain
Sepherosa Ziehau [Fri, 26 Jun 2015 12:49:33 +0000 (20:49 +0800)]
powerd: Use linked list for CPU power domain

On some multiple CPU packages systems, CPU power domains' id could
be pretty sparse.

8 years agopowerd: Avoid magic number and nuke set-only CpuToDom
Sepherosa Ziehau [Thu, 25 Jun 2015 14:38:24 +0000 (22:38 +0800)]
powerd: Avoid magic number and nuke set-only CpuToDom

8 years agohammer2 - Refactor frontend part 15/many
Matthew Dillon [Sat, 27 Jun 2015 02:23:45 +0000 (19:23 -0700)]
hammer2 - Refactor frontend part 15/many

* Cleanup pass, remove dead cluster API functions and other dead code.

* Cluster not completely gone yet, the synchronization code, a few ioctls,
  and portions of vfsops are still using it.

8 years agohammer2 - Refactor frontend part 14/many
Matthew Dillon [Sat, 27 Jun 2015 02:12:26 +0000 (19:12 -0700)]
hammer2 - Refactor frontend part 14/many

* Implement nlink, nremove, nrmdir, and nrename.

  The hardlink handling in nlink and nremove were the most difficult
  here, but the resulting design is actually cleaner than the complex
  do-everything routines I had before.

* Remove the old hardlink handling clutter in the inode and cluster code.

8 years agohammer2 - Refactor frontend part 13/many
Matthew Dillon [Fri, 26 Jun 2015 05:53:23 +0000 (22:53 -0700)]
hammer2 - Refactor frontend part 13/many

* Fix improper unlock in xop_scanlhc.

* Move the flush sequencing to the XOP backend.

* Make a kmalloc'd copy of the namecache name for backends still
  in-progress when the frontend returns (we will need to do something
  similar for bio data too).

* Do not pass the nch to hammer2_unlink_file(), pass more portable
  integer state instead.

8 years agokernel - Fix syscons deadlock during panic
Matthew Dillon [Fri, 26 Jun 2015 21:05:40 +0000 (14:05 -0700)]
kernel - Fix syscons deadlock during panic

* The system console can deadlock during a panic if a cpu is stopped
  while holding syscons_mtx.

* The new asynchronous update thread makes this problem more likely to occur.

* Fix the problem by recoding syscons_lock() to detect the panic or shutdown
  condition and loop for up to 0.5 seconds trying to get the syscons_mtx.
  If it is unable to acquire it, it reinitializes the mutex.

* We still have issues with VT switching away from X.

8 years agodump(8): Remove some old code.
Sascha Wildner [Fri, 26 Jun 2015 16:09:30 +0000 (18:09 +0200)]
dump(8): Remove some old code.

8 years agosys/vfs/hammer: Fix comments on zones
Tomohiro Kusumi [Thu, 25 Jun 2015 20:21:46 +0000 (05:21 +0900)]
sys/vfs/hammer: Fix comments on zones

- zone-3 is also converted to zone-2 just like zone >= 8.

- "meta" is the actual name for zone-9 although meta means
  the same as record.

8 years agosys/vfs/hammer: Define HAMMER_ZONE2_MAPPED_INDEX for zone# assertions
Tomohiro Kusumi [Thu, 25 Jun 2015 19:06:04 +0000 (04:06 +0900)]
sys/vfs/hammer: Define HAMMER_ZONE2_MAPPED_INDEX for zone# assertions

- Define HAMMER_ZONE2_MAPPED_INDEX as zone-8(btree zone) index and
  use this (instead of zone-8 index) to test if the given zone# is
  is valid zone#. This makes better sense as "btree" zone itself
  doesn't have much meaning with regards to checking zone# range
  (e.g. meta zone or large/small data zones could have been defined
  as zone-8 when hammer was designed and it would still work with
  the non-btree-zone-8).

- This is similar to the way HAMMER_RECTYPE_ENTRY_START is defined
  and used to lookup range of records.

8 years agosbin/newfs_hammer: Cleanup zone index
Tomohiro Kusumi [Thu, 25 Jun 2015 18:45:47 +0000 (03:45 +0900)]
sbin/newfs_hammer: Cleanup zone index

- Use HAMMER_ZONE_BTREE_INDEX instead of 8.

8 years agohammer2 - Refactor frontend part 12/many
Matthew Dillon [Fri, 26 Jun 2015 02:43:31 +0000 (19:43 -0700)]
hammer2 - Refactor frontend part 12/many

* Refactor the strategy_write code to use the XOP interface.
  The new strategy_write uses the standard XOP interface to distribute
  BIOs to XOP threads.  As with the read code, this also tends to
  distribute the compression across available cpus.

* Get rid of the dedicated BIO threading code (wthread* in hammer2_pfs).

8 years agohammer2 - Refactor frontend part 11/many
Matthew Dillon [Thu, 25 Jun 2015 22:06:15 +0000 (15:06 -0700)]
hammer2 - Refactor frontend part 11/many

* Add XOPs for nresolve and most inode creation.  The inode creation support
  backs all inode-creation XOPs.

* Remove the on-stack hammer2_trans_t structure and remove the passing
  of &trans to all modifying operations.

  This methodology added significant list-management overhead and isn't
  a good fit with the new frontend/backend mechanics.  The removal also
  simplifies the API for many support functions.

  Replace with a temporary version that embeds a single, simplified
  hammer2_trans_t in each hammer2_pfs_t.  Ultimately we will need
  to fan-out to per-node (per hammer2_mount_t) transaction control
  in a way that doesn't stall-out the frontend.

8 years agorc.subr: Add common functions for run_rc_command
François Tigeot [Thu, 25 Jun 2015 09:52:40 +0000 (11:52 +0200)]
rc.subr: Add common functions for run_rc_command

They are required by some ports rc scripts, the bind and haproxy
ports being the most obvious users.

Obtained-from: FreeBSD

8 years agohammer2 - Refactor frontend part 10/many
Matthew Dillon [Wed, 24 Jun 2015 06:28:15 +0000 (23:28 -0700)]
hammer2 - Refactor frontend part 10/many

* New file hammer2_xops.c will contain the backend XOPs.  In this
  commit, just hammer2_xop_readdir() so far.

8 years agohammer2 - Refactor frontend part 9/many
Matthew Dillon [Wed, 24 Jun 2015 06:01:54 +0000 (23:01 -0700)]
hammer2 - Refactor frontend part 9/many

* Create initial frontend/backend XOP infrastructure.

  frontend:
hammer2_xop_alloc()
hammer2_xop_start()
...  hammer2_xop_collect() loop ...
hammer2_xop_retire(xop, HAMMER2_XOPMASK_VOP)

  backend:
(backend is called with the shared xop structure in separate
 backend threads for each node belonging to the cluster appropriate
 for the operation).

... issue chain calls as needed ...
... hammer2_xop_feed() ... (feed chains back to frontend)
hammer2_xop_feed(NULL) (feed NULL chain)
hammer2_xop_retire(xop, 1U << clindex)

  The XOP contains a FIFO, allowing the backend to pipeline results when
  appropriate (e.g. readdir).  If a sequence of results are expected, the
  backend should finish with a NULL chain.  If not, the backend can just feed
  back whatever is expected.  Often this will just be the chain representing
  the inode.

  The frontend calls hammer2_xop_collect() to collect results from all the
  backend nodes.  The collect function handles quorum validation and
  consolidates the results from a sufficient number of cluster nodes into
  a single result for the frontend.

* The frontend can disconnect from the operation at any time in order to
  be able to return a result, even if backend elements are still running.
  This typically occurs when a sufficient number of nodes in the cluster
  have responded to validate the quorum.

  This also allows backend nodes to stall indefinitely without stalling the
  frontend.

* Because frontend concurrency is lost due to the bulk of the work being
  done by the backend, the hammer2 mount code will allocate ~16 or so
  work threads per node to distribute potentially many frontend operations.

* Most frontend operations use existing cache layers to retains frontend
  concurrency.  Specifically, inode meta-data access and modifications,
  and logical buffer cache operations (when cached), and cached vnodes
  via the namecache.  If the cache is not available, operations will
  wind up using the VOP/XOP infrastructure, including buffer-cache
  strategy routines (in an upcoming commit).

* Implement readdir() using the new infrastructure as an initial test.

* Fix an ip->meta synchronization bug related to hardlinks that was
  introduced by the ip->meta local copy work.

8 years agokernel - Add zero-on-instantiate objcache ctor
Matthew Dillon [Wed, 24 Jun 2015 05:59:15 +0000 (22:59 -0700)]
kernel - Add zero-on-instantiate objcache ctor

* When creating kmalloc-backed pools, M_ZERO cannot be passed to
  objcache_get() because the underlying kmalloc only occurs when
  the objcache is not recycling a cached entry.

* Add a feature to the objcache whereby the allocation from backing
  store is zero'd.  The reuse case will not be zerod, so users of
  this type of objcache must properly reset/cleanup fields before
  disposing of the object.

* Used by HAMMER2.

8 years agousched: Fix kern.usched_global_cpumask sysctl type.
Sepherosa Ziehau [Tue, 23 Jun 2015 15:32:52 +0000 (23:32 +0800)]
usched: Fix kern.usched_global_cpumask sysctl type.

8 years agopowerd: Make sure that cpu0 is in the usched global cpumask.
Sepherosa Ziehau [Tue, 23 Jun 2015 14:56:15 +0000 (22:56 +0800)]
powerd: Make sure that cpu0 is in the usched global cpumask.

8 years agopowerd: Fix # of supported cpus
Sepherosa Ziehau [Tue, 23 Jun 2015 14:48:10 +0000 (22:48 +0800)]
powerd: Fix # of supported cpus

8 years agoSync zoneinfo database with tzdata2015e from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Tue, 23 Jun 2015 21:24:02 +0000 (23:24 +0200)]
Sync zoneinfo database with tzdata2015e from ftp://ftp.iana.org/tz/releases

* africa: Morocco suspends DST from 2015-06-14 03:00 through
    2015-07-19 02:00, not 06-13 and 07-18 as we had guessed.
    (Thanks to Milamber.)

* northamerica: Assume Cayman Islands will observe DST starting next year,
    using US rules. Although it isn't guaranteed, it is the most likely.

* southamerica: Typo fix.

8 years agoi386 removal, part 9/x: Remove the 32 bit vkernel platform code.
Sascha Wildner [Tue, 23 Jun 2015 20:41:44 +0000 (22:41 +0200)]
i386 removal, part 9/x: Remove the 32 bit vkernel platform code.

8 years agoi386 removal, part 8/x: Remove i386 DragonFly 1.2 compat kernel code.
Sascha Wildner [Mon, 22 Jun 2015 18:13:19 +0000 (20:13 +0200)]
i386 removal, part 8/x: Remove i386 DragonFly 1.2 compat kernel code.

Reclaim all the COMPAT_DF12 type syscalls since they never existed on
x86_64.

8 years agoi386 removal, part 7/x: Remove the old i386 DragonFly 1.2 compat libraries.
Sascha Wildner [Mon, 22 Jun 2015 17:59:42 +0000 (19:59 +0200)]
i386 removal, part 7/x: Remove the old i386 DragonFly 1.2 compat libraries.

8 years agoi386 removal, part 6/x: Remove i386 parts of the ISA and PCI buses.
Sascha Wildner [Mon, 22 Jun 2015 03:42:37 +0000 (05:42 +0200)]
i386 removal, part 6/x: Remove i386 parts of the ISA and PCI buses.

8 years agokernel: Include generic headers which will take care of platforms.
Sascha Wildner [Mon, 22 Jun 2015 03:41:49 +0000 (05:41 +0200)]
kernel: Include generic headers which will take care of platforms.

8 years agoi386 removal, part 5/x: Remove i386 parts of the HighPoint RAID drivers.
Sascha Wildner [Mon, 22 Jun 2015 03:01:38 +0000 (05:01 +0200)]
i386 removal, part 5/x: Remove i386 parts of the HighPoint RAID drivers.

8 years agoi386 removal, part 4/x: Remove i386 specific code from libc.
Sascha Wildner [Mon, 22 Jun 2015 02:41:21 +0000 (04:41 +0200)]
i386 removal, part 4/x: Remove i386 specific code from libc.

8 years agoSync ACPICA with Intel's version 20150619.
Sascha Wildner [Sun, 21 Jun 2015 22:10:12 +0000 (00:10 +0200)]
Sync ACPICA with Intel's version 20150619.

* Replace various macros like ACPI_STRLEN with the standard C library
  functions across the tree.

* Add support for OSDT table, to override existing namespace objects
  from DSDT/SSDTs.

* Handle systems with two FACS tables better.

* Add a feature to allow for systems that do not contain an FACS.

* Fix wrong GUID strings for NFIT tables.

* Support for _CLS in AcpiGetObjectInfo().

* Update TCPA and TPM2 table definitions to a more recent TCG ACPI spec.

* Add definitions for the ACPI 6.0 GIC version field in MADT.

* Various fixes and enhancements in the tools.

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.

8 years agoipfw3: show NAT records
Bill Yuan [Sun, 21 Jun 2015 13:49:29 +0000 (21:49 +0800)]
ipfw3: show NAT records

show all 'NAT records' which relate to the 'NAT config 1'
which is same as 'ip show nat translation' in CISCO routers.

usage:
ipfw3 nat 1 show state

8 years agosysctl.3: Fix struct types for the KERN_BOOTTIME and KERN_PROC nodes.
Imre Vadász [Sun, 21 Jun 2015 10:25:40 +0000 (12:25 +0200)]
sysctl.3: Fix struct types for the KERN_BOOTTIME and KERN_PROC nodes.

8 years agoAdd IPFIREWALL3 to LINT64.
Sascha Wildner [Sat, 20 Jun 2015 23:49:49 +0000 (01:49 +0200)]
Add IPFIREWALL3 to LINT64.

8 years agoi386 removal, part 3/x: Remove more apm related files via 'make upgrade'.
Sascha Wildner [Sat, 20 Jun 2015 18:52:50 +0000 (20:52 +0200)]
i386 removal, part 3/x: Remove more apm related files via 'make upgrade'.

8 years agoi386 removal, part 2/x: Remove i386 specific kernel config files.
Sascha Wildner [Sat, 20 Jun 2015 04:20:10 +0000 (06:20 +0200)]
i386 removal, part 2/x: Remove i386 specific kernel config files.

Which are: GENERIC, LINT, SOEKRIS, VKERNEL

8 years agoi386 removal, part 1/x: Remove 'real' APM and associated stuff.
Sascha Wildner [Sat, 20 Jun 2015 03:40:29 +0000 (05:40 +0200)]
i386 removal, part 1/x: Remove 'real' APM and associated stuff.

Notes:

* 'apm' is now an alias for 'acpiconf -i 0', because some people got used
  to checking their battery status typing 'apm'.

* powerd(8) recently gained the ability to shut down on low battery. Any
  remaining functionality from the former battd(8) could be added to it.

8 years agokernel/syscons - Fix excessive cpu latency during scrolling
Matthew Dillon [Fri, 19 Jun 2015 16:21:55 +0000 (09:21 -0700)]
kernel/syscons - Fix excessive cpu latency during scrolling

* Scrolling a high-resolution (e.g. 4K monitor) kms console with the syscons
  spinlock held can prevent the cpu from being able to service interrupts
  for very long periods of time, enough to cause clicking and other audio
  issues.

* The previous hack tried to fix this by allowing yields inside the render
  loop, but this was not stable and did not completely solve the clicking.

* The new solution is to shove large screen updates off to a cothread which
  will then run the update lockless, allowing interrupts.  Minor frame buffer
  corruption can occur during scrolling but will be quickly cleaned up.

  This feature is disabled if the system is in the middle of a panic or
  shutdown.

8 years ago<sys/cdefs.h>: Define __LONG_LONG_SUPPORTED for C++11.
Sascha Wildner [Fri, 19 Jun 2015 16:17:51 +0000 (18:17 +0200)]
<sys/cdefs.h>: Define __LONG_LONG_SUPPORTED for C++11.

The recent typo fix had more implications than I initially thought of.
In particular, since C++11, __LONG_LONG_SUPPORTED is needed for C++,
but e.g. c++ -std=c++11 also defines __STRICT_ANSI__. It worked before
only because of not catching that __STRICT_ANSI__ with the typo in place.

So define __LONG_LONG_SUPPORTED for C++11 (or later) too, and also expose
the {U}INT{8,16,32,64,MAX}_C macros and the standard limits from
<cpu/int_limits.h> for C++11. FreeBSD has it like that and it is correct
from what I gather from the C++11 standard.

On the 4.2 and 4.0 release branches, just to be conservative, I
reverted the typo fix instead.

Reported-by: Rimvydas Jasinskas <rimvydas.jasinskas@gmail.com>
Taken-from:  FreeBSD

8 years agoacpi/cstate: Allow forcing busmastering status and arbitration for C3
Sepherosa Ziehau [Fri, 19 Jun 2015 06:35:28 +0000 (14:35 +0800)]
acpi/cstate: Allow forcing busmastering status and arbitration for C3

8 years agox86_64/mwait: Sysctl write is protected; no need to protect it again here.
Sepherosa Ziehau [Wed, 17 Jun 2015 14:53:53 +0000 (22:53 +0800)]
x86_64/mwait: Sysctl write is protected; no need to protect it again here.

8 years agokernel - Sync uaudio to fix clicking issue
Matthew Dillon [Fri, 19 Jun 2015 04:07:42 +0000 (21:07 -0700)]
kernel - Sync uaudio to fix clicking issue

* Sync USB audio to FreeBSD 82e528e78860c as of May 8 2015.

* Fixes clicking issues due to broken audio synchronization.

Testing-by: tm512
8 years agokernel - Sync ehci controller with FreeBSD
Matthew Dillon [Fri, 19 Jun 2015 02:34:32 +0000 (19:34 -0700)]
kernel - Sync ehci controller with FreeBSD

* Sync ehci controller w/FreeBSD to FreeBSD 8c1b21d9ef,
  ehci.c and ehci.h only.

* Contains better fix for doorbell issue from FreeBSD devs.

* Fixes numerous ehci port issues that the older hack had not fixed.

Testing-by: tm512, dillon
8 years agosyslogd(8): Get rid of an unnecessary goto and label, add braces too.
Sascha Wildner [Thu, 18 Jun 2015 17:06:07 +0000 (19:06 +0200)]
syslogd(8): Get rid of an unnecessary goto and label, add braces too.

8 years agoUse <sys/param.h>'s roundup() in a few places.
Sascha Wildner [Thu, 18 Jun 2015 16:12:21 +0000 (18:12 +0200)]
Use <sys/param.h>'s roundup() in a few places.

8 years agorestore(8): Remove unused macro.
Sascha Wildner [Thu, 18 Jun 2015 16:11:41 +0000 (18:11 +0200)]
restore(8): Remove unused macro.

8 years agohammer2 - Fix buildworld
Matthew Dillon [Thu, 18 Jun 2015 03:30:17 +0000 (20:30 -0700)]
hammer2 - Fix buildworld

* Add meta abstraction to libstand's hammer2.c

8 years agohammer2 - Refactor frontend part 8/many
Matthew Dillon [Thu, 18 Jun 2015 00:08:54 +0000 (17:08 -0700)]
hammer2 - Refactor frontend part 8/many

* Continue work to consolidate master copy of node-independent inode
  meta-data into ip->meta.  Use ip->meta as the master (there may still
  be a few places where that isn't happening).

* Remove related cluster ops when not needed.  Includes vop_getattr,
  vop_setattr.

* Remove bogus clearing of HAMMER2_INODE_MODIFIED outside of
  hammer2_inode_fsync().

* Better handling of the HAMMER2_INODE_RESIZED flag.  Also optimize the
  standard extension case when not crossing the DIRECTDATA boundary by
  not setting the flag.  e.g. most write-append cases.

8 years agohammer2 - Refactor frontend part 7/many
Matthew Dillon [Wed, 17 Jun 2015 18:00:19 +0000 (11:00 -0700)]
hammer2 - Refactor frontend part 7/many

* Start fleshing out the XOP infrastructure.  The frontend will use this
  infrastructure to replicate VOPs to per-node threads for cluster operation.

  The basic idea here is for a VOP to allocate an xop and throw it into a
  xop_group (of which several are available).  ALL nodes associated with
  that xop_group will then process the xop each in their own thread.

  The xop can be detached from the frontend once the cluster operation
  completes, if interruptability is desired due to a stalled cluster,
  or once the operation has run on a sufficient number of nodes but still
  might be running or stalled on remaining nodes.

* Rename hammer2_syncthr.c, it is now more generic.

8 years agohammer2 - Refactor frontend part 6/many
Matthew Dillon [Wed, 17 Jun 2015 15:02:06 +0000 (08:02 -0700)]
hammer2 - Refactor frontend part 6/many

* Move strategy_write support code from hammer2_vfsops.c to
  hammer2_strategy.c.

8 years agohammer2 - Refactor frontend part 5/many
Matthew Dillon [Wed, 17 Jun 2015 07:12:21 +0000 (00:12 -0700)]
hammer2 - Refactor frontend part 5/many

* Separate the inode lock from the cluster lock.  Add a new (possibly
  temporary) API function hammer2_inode_cluster() which handles initial
  ip cluster locking.

* Begin using the meta-data cached in ip->meta and ip->bref.

* Cache bref statistics in ip->bref (might be temporary).

8 years agohammer2 - Refactor frontend part 4/many
Matthew Dillon [Wed, 17 Jun 2015 06:10:40 +0000 (23:10 -0700)]
hammer2 - Refactor frontend part 4/many

* Embed the inode's meta-data (hammer2_inode_meta) in the
  in-memory hammer2_inode structure, making it accessible
  once the inode has been loaded without having to reissue
  I/O.

* In preparation for separating the cluster locking from the
  inode locking.

8 years agohammer2 - Refactor frontend part 3/many
Matthew Dillon [Wed, 17 Jun 2015 05:24:24 +0000 (22:24 -0700)]
hammer2 - Refactor frontend part 3/many

* Compartmentalize the inode mostly node-independent meta-data portion of
  the inode on-disk data structure.

* The filename and directdata/block-table part of the inode data structure
  is left out.

8 years agohammer2 - Refactor frontend part 2/many
Matthew Dillon [Wed, 17 Jun 2015 01:40:07 +0000 (18:40 -0700)]
hammer2 - Refactor frontend part 2/many

* Move the CHAIN_UNLINKED flag to INODE_ISUNLINKED.

* This allows the removal of hammer2_cluster_isunlinked(),
  hammer2_cluster_set_chainflags(), and hammer2_cluster_clr_chainflags().

* Greatly simplifies hammer2_vop_inactive(), in particular removes a
  cluster lock and related I/O.

* Greatly simplifies hammer2_vop_reclaim(), in particular removes a
  cluster lock and related I/O.

8 years agohammer2 - Refactor frontend part 1/many
Matthew Dillon [Wed, 17 Jun 2015 01:19:22 +0000 (18:19 -0700)]
hammer2 - Refactor frontend part 1/many

This sequence of commits will refactor the frontend to distribute cluster
operations for VOPs to per-node thread sets.  Trying to code async locking
and I/O across multiple nodes is too complex and prone to bugginess.  Instead,
operations will be distributed to individual nodes and compete for completion,
with the frontend returning the instant sufficient progress has been made.

Remaining operations will continue in the background (or abort) even after
the frontend returns.

* Separate out strategy code.

8 years agodrm: Change MSI handling
Markus Pfeiffer [Mon, 15 Jun 2015 20:30:07 +0000 (20:30 +0000)]
drm: Change MSI handling

8 years agoi915_gem_mmap_ioctl - Align the mmap to 256KB
Matthew Dillon [Wed, 17 Jun 2015 18:21:17 +0000 (11:21 -0700)]
i915_gem_mmap_ioctl - Align the mmap to 256KB

* Appears to improve performance and potentially fix a few reported issues.
  It is not clear why aligning the virtual address has this effect.

8 years agopowerd: Linger a little bit if battery life is low
Sepherosa Ziehau [Wed, 17 Jun 2015 12:39:34 +0000 (20:39 +0800)]
powerd: Linger a little bit if battery life is low

So that we could have time to plugin AC line.

And in addition to logging messages on console, alarming audio
alert, since most laptop users will use X; they will not notice
the console messages.  Audio alert is enabled by default and
could be disabled by -Q.

While I'm here, fix powerd.8 and allow disabling battery life
monitoring if 0 is passed to -P.

Suggested-by: seallyhs
8 years agoipfw3: support bpf filter in layer4 module
Bill Yuan [Wed, 17 Jun 2015 01:35:05 +0000 (09:35 +0800)]
ipfw3: support bpf filter in layer4 module

syntax:
bpf "<bpf string>"
e.g.
ipfw3 add allow all bpf "icmp and src 8.8.8.8"

bpf can be used to filter the packet payload.

pcap_compile_nocap was used to compile the bpf string
and bpf_filter for the filtering.

8 years agoipfw3: misc - fix MACRO name
Bill Yuan [Tue, 16 Jun 2015 15:00:06 +0000 (23:00 +0800)]
ipfw3: misc - fix MACRO name

8 years agoipfw3: filter 'established' in layer4 module
Bill Yuan [Tue, 16 Jun 2015 14:55:51 +0000 (22:55 +0800)]
ipfw3: filter 'established' in layer4 module

matches TCP packets that has the RST or ACK bits set.