dragonfly.git
9 years agohammer - Fix max volumes check on mount time
Antonio Huete Jimenez [Wed, 30 Jul 2014 19:01:43 +0000 (21:01 +0200)]
hammer - Fix max volumes check on mount time

9 years agoshare/examples - Fix cdev warnings
Antonio Huete Jimenez [Tue, 8 Jul 2014 17:27:56 +0000 (19:27 +0200)]
share/examples - Fix cdev warnings

9 years agohammer2 - major simplification of algorithms part 1/many
Matthew Dillon [Wed, 30 Jul 2014 07:17:29 +0000 (00:17 -0700)]
hammer2 - major simplification of algorithms part 1/many

* Huge simplification of in-memory data structures and algorithms.
  Remove delete-duplicate, ownerq (shadow copies), dbq, dbtree, and most of
  the xid lo/hi sequencing.  Remove all the complexities related to
  managing the above elements.  Net removal of ~1500 lines of code or so.

* Blockmap deletions are now handled by the frontend, so the backend doesn't
  need to deal with shadowed deletions.  This is still fairly optimal since
  insertions are still handled by the backend during flushes.  So for quick
  create/delete operations the blockmap is never even initialized which means
  that deletions don't have to remove anything.

* Cleanup buffer cache on file removal / last-close, but allow file delete
  to simply wipe out the inode.  Don't bother iterating its indirect blocks
  or data blocks on-media but use the flush code to get rid of any chains
  still cached.

* Buffer invalidation on permanent chain deletions for modified chains.

* Major items still TODO: flush interlocks and meta-data updates.

9 years ago"Normalize" some types, s/long unsigned/unsigned long/ etc.
Sascha Wildner [Tue, 29 Jul 2014 20:45:27 +0000 (22:45 +0200)]
"Normalize" some types, s/long unsigned/unsigned long/ etc.

Just like the rest of our tree is doing it.

9 years agokernel: Completely remove the obsolete DEVICE_POLLING and SMP options.
Sascha Wildner [Tue, 29 Jul 2014 19:55:02 +0000 (21:55 +0200)]
kernel: Completely remove the obsolete DEVICE_POLLING and SMP options.

DEVICE_POLLING is IFPOLL_ENABLE and SMP is the default for some time
now.

9 years agokernel: Remove unused and unbuilt code from the userland sysvipc GSoC.
Sascha Wildner [Tue, 29 Jul 2014 19:45:17 +0000 (21:45 +0200)]
kernel: Remove unused and unbuilt code from the userland sysvipc GSoC.

In-discussion-with: profmakx

9 years agokernel: Make sysvipc syscalls non-optional.
Sascha Wildner [Tue, 29 Jul 2014 19:36:23 +0000 (21:36 +0200)]
kernel: Make sysvipc syscalls non-optional.

Before this commit, we had three related kernel options, SYSVMSG,
SYSVSEM and SYSVSHM, to enable the syscalls. They were in all our
configs, but in theory the user could disable the functionality.
Having to deal with scenarios where they are not available is
unnecessarily complicated and there seems to be no real reason to
want to disable them.

For convenience, leave the three options as no-ops for now, so
adjusting the kernel config is not necessarily needed. We'll
change them to being unknown at some later point.

This commit also removes some parts which assumed that we had
sysvmsg.ko, sysvsem.ko and sysvshm.ko modules, like FreeBSD, but
this assumption was never true on DragonFly.

9 years agousb4bsd: set D_MPSAFE for usb devices (static)
Markus Pfeiffer [Tue, 29 Jul 2014 18:52:40 +0000 (18:52 +0000)]
usb4bsd: set D_MPSAFE for usb devices (static)

9 years agousb4bsd: set D_MPSAFE for usb devices
Markus Pfeiffer [Tue, 29 Jul 2014 18:12:13 +0000 (18:12 +0000)]
usb4bsd: set D_MPSAFE for usb devices

9 years agokernel/netisr: Use __func__ in kprintfs.
Nuno Antunes [Sun, 27 Jul 2014 06:39:07 +0000 (07:39 +0100)]
kernel/netisr: Use __func__ in kprintfs.

9 years agoSync ACPICA with Intel's version 20140724.
Sascha Wildner [Sat, 26 Jul 2014 09:37:51 +0000 (11:37 +0200)]
Sync ACPICA with Intel's version 20140724.

* ACPI 5.1 is fully supported in ACPICA as of this release.

* Better handling of GPEs with no associated handler or control message.

* Timer() support in the AML Debug object.

* New -u option in acpihelp(8).

* Bug fixes & other enhancements.

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

9 years agoacpica: Exclude nsdumpdv.c, it's obsolete & its code is #ifdef'd out.
Sascha Wildner [Sat, 26 Jul 2014 07:53:01 +0000 (09:53 +0200)]
acpica: Exclude nsdumpdv.c, it's obsolete & its code is #ifdef'd out.

9 years agodrm/i915: Sync intel_ringbuffer.c with Linux 3.8.13
François Tigeot [Fri, 25 Jul 2014 06:18:59 +0000 (08:18 +0200)]
drm/i915: Sync intel_ringbuffer.c with Linux 3.8.13

* Preallocate next seqno before touching the ring

* Rearrange code to only have a single method for waiting upon the ring

* Don't allow ring tail to reach the same cacheline as head

* Implement workaround for broken CS tlb on i830/845

9 years agodrm/i915: Reduce differences with Linux 3.8.13
François Tigeot [Fri, 25 Jul 2014 06:15:23 +0000 (08:15 +0200)]
drm/i915: Reduce differences with Linux 3.8.13

Mostly in GEM code

9 years agocsprng - Add copyright & comment around sleep code
Alex Hornung [Fri, 25 Jul 2014 06:05:05 +0000 (07:05 +0100)]
csprng - Add copyright & comment around sleep code

9 years agocsprng - fix unused variable
Alex Hornung [Thu, 24 Jul 2014 20:57:39 +0000 (21:57 +0100)]
csprng - fix unused variable

9 years agocsprng - don't wait for entropy for the ratectl'ed reseed
Alex Hornung [Thu, 24 Jul 2014 20:53:33 +0000 (21:53 +0100)]
csprng - don't wait for entropy for the ratectl'ed reseed

9 years agokernel/rum: Fix TX rate control. Use usb_pause_ls instead of zsleep.
Imre Vadasz [Thu, 24 Jul 2014 18:19:39 +0000 (20:19 +0200)]
kernel/rum: Fix TX rate control. Use usb_pause_ls instead of zsleep.

* Fix TX rate control by interpreting the TX statistic counters correctly.
  Taken-From: OpenBSD

* Using usb_pause_ls instead of zsleep seems to avoid deadlocks.

9 years agokernel - Fix jumbo cluster buffer deadlock
Matthew Dillon [Thu, 24 Jul 2014 18:56:16 +0000 (11:56 -0700)]
kernel - Fix jumbo cluster buffer deadlock

* mbufjcluster_cache and mbufphdr_jcluster_cache did not have
  a nominal maintainance number set, which causes objcache to
  default to (cluster_limit / 2).  Both of these caches are fed
  from mjclmeta_cache.  The default maintainance value combined
  for these two allows mjclmeta_cache to become completely exhausted.

  The exhaustion results in an edge case when combined with the per-cpu
  caches which can deadlock the mjclmeta_cache.  The other mbuf caches
  do not have this problem because they specify maintainance divisors
  of at least 4.

* Implement kern.ipc.mjclph_cachefrac and kern.ipc.mjcl_cachefrac to
  force the two jcluster caches to return more buffers to mjclmeta_cache.
  Default to 4 and 16.

* Force all cachefrac values for all mbuf caches to not be less than 3
  to prevent sysop foot-shooting.

* Also set a fixed cachefrac of 4 for mbuf_cache, mclmeta_cache, and
  mjclmeta_cache.  The default in objcache of 2 (aka 1/2) is overkill.
  (this change is subject to review from Sephe).

Reported-by: joris
9 years agocsprng - If not enough entropy is available, sleep
Alex Hornung [Thu, 24 Jul 2014 19:41:03 +0000 (20:41 +0100)]
csprng - If not enough entropy is available, sleep

 * If no reseed has happened yet, or if we were unsuccessful in
   reseeding the prng, sleep and try again whenever a reseed
   occurred or entropy has been added to the pools.

Reported-by: YONETANI
9 years agokernel/csprng: Compile in the SHA256_*() functions by default.
Sascha Wildner [Wed, 23 Jul 2014 20:48:43 +0000 (22:48 +0200)]
kernel/csprng: Compile in the SHA256_*() functions by default.

The (non-optional) CSPRNG needs them so make sha2.c "standard" too.

Reported-by: Studbolt
9 years agokernel - Redo struct vmspace allocator and ref-count handling.
Matthew Dillon [Wed, 23 Jul 2014 01:52:47 +0000 (18:52 -0700)]
kernel - Redo struct vmspace allocator and ref-count handling.

* Get rid of the sysref-based allocator and ref-count handler and
  replace with objcache.  Replace all sysref API calls in other kernel
  modules with vmspace_*() API calls (adding new API calls as needed).

* Roll-our-own hopefully safer ref-count handling.  We get rid of exitingcnt
  and instead just leave holdcnt bumped during the exit/reap sequence.  We
  add vm_refcnt and redo vm_holdcnt.

  Now a formal reference (vm_refcnt) is ALSO covered by a holdcnt.  Stage-1
  termination occurs when vm_refcnt transitions from 1->0.  Stage-2 termination
  occurs when vm_holdcnt transitions from 1->0.

* Should fix rare reported panic under heavy load.

9 years agoDocument that tcb_segstack should not be reordered.
Michael Neumann [Wed, 23 Jul 2014 00:12:28 +0000 (02:12 +0200)]
Document that tcb_segstack should not be reordered.

9 years agoAdd field to tls_tcb to support segmented stacks in LLVM
Michael Neumann [Tue, 22 Jul 2014 23:27:48 +0000 (01:27 +0200)]
Add field to tls_tcb to support segmented stacks in LLVM

When segmented stack support is enabled, LLVM adds code in front of
every function to check if the stack is already exhausted, in which
case it calls __morestack. For this reason LLVM needs to know the lower
boundary of the stack to check against the stack pointer.
The stack boundary can be stored in this per-thread field (tcb_segstack)
and accessed via %fs:32 (x86_64) or %fs:16 (i386) from the code generated
by LLVM.

9 years agokernel: Use NELEM() in a number of places.
Sascha Wildner [Tue, 22 Jul 2014 16:35:34 +0000 (18:35 +0200)]
kernel: Use NELEM() in a number of places.

9 years agokernel/virtio: Remove a useless #ifndef (CSUM_TSO is defined there).
Sascha Wildner [Tue, 22 Jul 2014 08:07:45 +0000 (10:07 +0200)]
kernel/virtio: Remove a useless #ifndef (CSUM_TSO is defined there).

9 years agodrm/i915: Use a common fence writing routine
François Tigeot [Mon, 21 Jul 2014 13:00:54 +0000 (15:00 +0200)]
drm/i915: Use a common fence writing routine

9 years agoi915_gem.c: Simplify fence code
François Tigeot [Mon, 21 Jul 2014 09:11:52 +0000 (11:11 +0200)]
i915_gem.c: Simplify fence code

* Remove fence pipelining, it caused many spurious GPU hangs and could
  never be made to work reliably

* Simplify fence finding

* Remove an useless optimisation from flush_fence()

* Remove a few now useless struct members and associated code

9 years agodrm: Add Linux wake_up() and wait_event()
François Tigeot [Sun, 20 Jul 2014 18:56:44 +0000 (20:56 +0200)]
drm: Add Linux wake_up() and wait_event()

9 years agodrm: Remove a no longer used kmalloc type
François Tigeot [Sun, 20 Jul 2014 18:21:25 +0000 (20:21 +0200)]
drm: Remove a no longer used kmalloc type

9 years agokernel - Fix error handling in NFS async bio callbacks
Matthew Dillon [Sun, 20 Jul 2014 18:04:18 +0000 (11:04 -0700)]
kernel - Fix error handling in NFS async bio callbacks

* The NFS request may already have an error code set as-of when the
  callback occurs.  Check the code before trying to decode the possibly
  non-existant reply rpc.

9 years agounbreak kernel (netgraph) by adding missing header inclusion
John Marino [Sun, 20 Jul 2014 11:31:35 +0000 (13:31 +0200)]
unbreak kernel (netgraph) by adding missing header inclusion

9 years agoUse system's RT_ROUNDUP and RT_ADVANCE macros instead of local copies.
Nuno Antunes [Fri, 18 Jul 2014 14:12:52 +0000 (15:12 +0100)]
Use system's RT_ROUNDUP and RT_ADVANCE macros instead of local copies.

Reviewed-by: dillon
9 years agonet/route.h: Expose the ROUNDUP and ADVANCE macros.
Nuno Antunes [Fri, 18 Jul 2014 10:16:10 +0000 (11:16 +0100)]
net/route.h: Expose the ROUNDUP and ADVANCE macros.

* These macros are replicated in multiple places on the tree.  Give
  them an RT_ prefix and centralize them in net/route.h in an effort
  to reduce code duplication.

* Kernel and userland changes to use these macros will come in a
  subsequent commit.

Taken-from: NetBSD
Reviewed-by: dillon
9 years agonetgraph7: Assert the refcount is zero when freeing the item.
Nuno Antunes [Thu, 17 Jul 2014 06:51:24 +0000 (07:51 +0100)]
netgraph7: Assert the refcount is zero when freeing the item.

9 years agokernel - Revert "Fix buildworld."
Matthew Dillon [Sat, 19 Jul 2014 17:23:41 +0000 (10:23 -0700)]
kernel - Revert "Fix buildworld."

* Fix PF in a different way, by conditionalizing the inclusion of
  struct pf_state instead of conditionalizing all the use cases for
  pfvar.h.

* This reverts commit 56e2aaa4d1de560d06f713866ab834747982f839.

* Reorders pfvar.h a bit and conditionalizes struct pf_state { }.

9 years agore(4): Use MPSAFE callout
François Tigeot [Sat, 19 Jul 2014 10:02:00 +0000 (12:02 +0200)]
re(4): Use MPSAFE callout

The callout function was already protected by a serializer.

9 years agomii: Add RealTek RTL8251 phy found on an ASUS A88XM-Plus mainboard.
Imre Vadasz [Sat, 19 Jul 2014 09:54:27 +0000 (11:54 +0200)]
mii: Add RealTek RTL8251 phy found on an ASUS A88XM-Plus mainboard.

Taken-From: OpenBSD

9 years agodrm(4): This device is MPSAFE
François Tigeot [Sat, 19 Jul 2014 07:54:07 +0000 (09:54 +0200)]
drm(4): This device is MPSAFE

* And has always been since the initial import from FreeBSD 11 years ago.

* Tested with Radeon and i915 hardware for good measure.

9 years agokernel/sym: Remove an extra semicolon in a #define.
Sascha Wildner [Fri, 18 Jul 2014 18:49:02 +0000 (20:49 +0200)]
kernel/sym: Remove an extra semicolon in a #define.

9 years agokernel: Switch to mrsas(4) as the default for 'Thunderbird' series cards.
Sascha Wildner [Fri, 18 Jul 2014 17:32:57 +0000 (19:32 +0200)]
kernel: Switch to mrsas(4) as the default for 'Thunderbird' series cards.

9 years agokernel - Adjust ssb_space_prealloc() use cases
Matthew Dillon [Fri, 18 Jul 2014 16:32:46 +0000 (09:32 -0700)]
kernel - Adjust ssb_space_prealloc() use cases

* Add two flags to the signalsockbuf ssb_flags field.

  SSB_PREALLOC  - Indicates that data preallocation tracking is being used
  SSB_STOPSUPP - Indicates that SSB_STOP flow control is being used

* unix domain sockets set SSB_STOPSUPP, tcp and sctp sockets
  set SSB_PREALLOC.

* sendfile() requires that either SSB_PREALLOC or SSB_STOPSUPP be specified.

* Code now conditionalizes the use of ssb_space() vs ssb_space_prealloc()
  based on the presence of the SSB_PREALLOC flag.

Reported-by: sephe
9 years agotcp: Set upper limit for the DupThresh generated by the NCR
Sepherosa Ziehau [Fri, 18 Jul 2014 12:00:24 +0000 (20:00 +0800)]
tcp: Set upper limit for the DupThresh generated by the NCR

The DupThresh could be pretty large due to large amount of outstanding
segments on the fast local area network.  If the reception side really
lost some segments, the fast recovery would be delayed for a long time.
It would become even worse, if the reception side aggregated ACKs, i.e.
widely used LRO; it could even cause timeout retransmition, which is
highly unappreciated on the fast local area network.  Put an upper
limit for the DupThresh, currently 16, so that fast recovery could take
over segment retransmittion in a timely fashion.  The upper limit of
DupThresh could be controlled by sysctl net.inet.tcp.ncr_rxtthresh_max.

9 years agokernel - network adjustments (netisr, tcp, and socket buffer changes)
Matthew Dillon [Fri, 18 Jul 2014 06:52:54 +0000 (23:52 -0700)]
kernel - network adjustments (netisr, tcp, and socket buffer changes)

* Change sowakeup() to use an atomic fetch when testing WAIT/WAKEUP for
  a quick return.  It is now coded properly.  Previous coding is not known
  to have created any bugs.

* Change sowakeup() to use ssb_space_prealloc() instead of ssb_space()
  when testing against the transmit low-water mark.  This is a bug fix
  which primarily effects very tiny write()'s.  The prior code is not
  known to have created any problems.

* Make the netisr packet counter before doing a rollup programmer and
  change the default from 512 to 32 for the moment.  This may be changed
  back to 512 (or some number inbetween) after further testing.

  The issue here is that interrupt/netisr pipelining can cause ack aggregation
  to be delayed for too many packets.

* For TCP, when timestamps are not being used, pass the correct delta
  to tcp_xmit_timer() in our fallback.  The function expects N+1.  This
  should improve/fix incorrect rtt calculations when tcp timestamps are
  not in use.

* Fix an edge case in tcp_xmit_bandwidth_limit() where the 'ticks' global
  could change values out from under the code.  Load the global into a local
  variable.

* Change the inflight code to use (t_srtt + t_rttvar) instead of
  (t_srtt + t_rttbest) / 2.

  This needs fine-tuning, the buffer is still too big.  Expect more commits
  later.

* Call sowwakeup() when appending a mbuf to a stream.  The append can call
  sbcompress() and make a stream buffer that has hit its mbuf limit writable
  again.

* Remove the ssb_notify() macro and collapse the sorwakeup() and sowwakeup()
  macros.  They now just call sowakeup() on the appropriate sockbuf.  The
  notify test is now done in sowakeup().

9 years agokernel - turn off auto-socket sizing
Matthew Dillon [Fri, 18 Jul 2014 04:33:32 +0000 (21:33 -0700)]
kernel - turn off auto-socket sizing

* Turn off automatic socket sizing for NFS sockets.  Otherwise the socket
  buffer might be reduced to the point where the mbuf interface refuses
  to queue w/EMSGSIZE.

  TODO: We need a better fix.

9 years agokernel - Fix two NFS crashes
Matthew Dillon [Fri, 18 Jul 2014 03:54:42 +0000 (20:54 -0700)]
kernel - Fix two NFS crashes

* Fix a bug during unmount when sillyrenames are being terminated.
  When doing a forced unmount, the sillyrename vnode(s) may be VBAD.
  Do not attempt to flush the sillyrename in this case.

* Fix a bug for 'soft' mounts.  Soft failures do not properly set the
  error code which can lead to a NULL pointer dereference in the rpc
  processing code.

  Set the error code to EINTR for soft mounts whos retries have been
  exceeded.

9 years agokernel - Move wakeup*() to ouside a spin lock
Matthew Dillon [Thu, 17 Jul 2014 23:03:13 +0000 (16:03 -0700)]
kernel - Move wakeup*() to ouside a spin lock

* Move the wakeup*() calls in the linux completion interface from inside
  to outside the spinlock.  It can't be safely called from inside the
  spinlock.

Reported-by: me_
9 years agoAdded support for rcreload
Zach Crownover [Thu, 17 Jul 2014 11:26:11 +0000 (04:26 -0700)]
Added support for rcreload

Updated the man page date and links to account for the new symlink to
rcrun as well as add it in to the rcrun.sh based on the restart entry.

9 years agokernel - minor cpu idle statistics adjustment
Matthew Dillon [Thu, 17 Jul 2014 05:17:19 +0000 (22:17 -0700)]
kernel - minor cpu idle statistics adjustment

* Change the idlethread test from RQF_AST_LWKT_RESCHED to
  RQF_IDLECHECK_WK_MASK (which includes the first flag and adds a few more)
  to determine if the idle thread is actually idle or not.

* Should not materially change reported idle% as the original test handled
  the most common idle-thread-skips-halt case.

9 years agomsgport.9: lwkt_initport_spin now takes a fixed_cpuid argument.
Nuno Antunes [Thu, 17 Jul 2014 03:10:06 +0000 (04:10 +0100)]
msgport.9: lwkt_initport_spin now takes a fixed_cpuid argument.

9 years agodrm/i915: Sync intel_sprite.c with Linux 3.8.13
François Tigeot [Wed, 16 Jul 2014 19:52:17 +0000 (21:52 +0200)]
drm/i915: Sync intel_sprite.c with Linux 3.8.13

9 years agokernel - Add feature to allow sendbuf_auto to decrease the buffer size
Matthew Dillon [Wed, 16 Jul 2014 07:07:58 +0000 (00:07 -0700)]
kernel - Add feature to allow sendbuf_auto to decrease the buffer size

* sysctl net.inet.tcp.sendbuf_auto (defaults to 1) is now able to
  decrease the tcp buffer size as well as increase it.

* Inflight bwnd data is used to determine how much to decrease the
  buffer.  Inflight is enabled by default.  If you disable it
  with (net.inet.tcp.inflight_enable=0), sendbuf_auto will not
  be able to adjust buffer sizes down.

* Set net.inet.tcp.sendbuf_min (default 32768) to set the floor for
  any downward adjustment.

* Set net.inet.tcp.sendbuf_auto=2 to disable the decrease feature.

9 years agonetgraph7: Factor out and inline item reference counting code.
Nuno Antunes [Tue, 15 Jul 2014 02:16:18 +0000 (03:16 +0100)]
netgraph7: Factor out and inline item reference counting code.

* Netgraph7 assumes that nodes synchronously consume the items passed to them,
  i.e. either 1) immediatly drop the item or 2) immediatly pass the item to the
  next node.

  The previous assumption is not true for nodes that have their own internal
  item queues and defer the processing of the item.  Such nodes can use these
  routines to prevent the items from being freed too early.

* Move the apply callback check into the item reference release code.

9 years agokernel - Improve TCP socket handling at high speeds
Matthew Dillon [Wed, 16 Jul 2014 03:27:51 +0000 (20:27 -0700)]
kernel - Improve TCP socket handling at high speeds

* Add M_SOLOCKED to mbuf->m_flags.  This flag prevents sbcompress()
  from collapsing more data into a mbuf.

* Rewrite sorecvtcp() (NOTE: soreceive() could use similar treatment).
  Use M_SOLOCKED to freeze mbufs in the sockbuf with the rcvtok held,
  then do the uiomove() loop WITHOUT the rcvtok held, then finalize
  the disposal of the mbufs with rcvtok held.

  This greatly reduces contention on rcvtok against the netisr threads
  when reading large amounts of data at once and reduces cpu overhead
  for netisr and user network threads.

* Change the default transmit ssb_lowat from ssb_hiwat / 2 to ssb_hiwat / 4.
  The (previous) default maximum socket buffer size was 256KB.  The default
  lowat reduced the effective TCP transmit window to ~100KB.  This can cause
  severe buffering issues on GiGE links when multiple TCP streams are being
  routed to the same cpu.

  With this change the default max send buffer is ~180KB or so.

* Change the default kern.ipc.maxsockbuf from 256KB to 512KB.  This
  primarily effects auto-sizing of tcp buffers which in turn effects
  most TCP connections.

  This coupled with the hiwat fix greatly improves transmit throughput.

* Add more debugging info to the tcp inflight code.

9 years agodrm/i915: Sync ringbuffer code with Linux 3.8.13
François Tigeot [Tue, 15 Jul 2014 20:08:02 +0000 (22:08 +0200)]
drm/i915: Sync ringbuffer code with Linux 3.8.13

* Split hardware initialization and irq management to model-specific
  functions

* Various little fixes and workarounds to compensate for hardware
  bugs and irregular behavior

* Enable parity error interrupts

* Simplify flushing and request tracking

9 years agodrm: Fix locking issues in drm_irq.c
François Tigeot [Tue, 15 Jul 2014 20:02:10 +0000 (22:02 +0200)]
drm: Fix locking issues in drm_irq.c

* Some functions expected the drm lock to be used differently than what
  gpu drivers really did, leading to crashes

* Sync them with Linux 3.8.13

Reported-by: Johannes Hofmann
9 years agokernel - Add safety for Intel SYSRET issue
Matthew Dillon [Tue, 15 Jul 2014 19:31:50 +0000 (12:31 -0700)]
kernel - Add safety for Intel SYSRET issue

* First, insofar as we can tell DragonFly was *NOT* vulnerable to the
  Intel SYSRET issue.  We have a RQF_QUICKRET flag that determines if SYSRET
  can be used.  Any heavy weight process switch, signal delivery, signal
  return, or set_regs() call clears this flag and forces the system call to
  return via IRET.

* However, the ptrace() path is a bit convoluted.  Insofar as I can tell
  it just won't allow %rip to be changed unless the target process is in
  a SSTOPped state, meaning that a heavy weight context switch must occur
  before the new %rip is used which means we should be safe.

  Still, we are adding a safety to ptrace_set_pc() to cannonicalize the
  %rip anyway, to ensure that this bug cannot bite us indirectly in the
  future.

9 years agodrm: Reorder functions in drm_irq.c
François Tigeot [Tue, 15 Jul 2014 16:20:56 +0000 (18:20 +0200)]
drm: Reorder functions in drm_irq.c

* Reducing differences with Linux 3.8.13

* No functional change

9 years agoUpdate the pciconf(8) database.
Sascha Wildner [Tue, 15 Jul 2014 09:15:47 +0000 (11:15 +0200)]
Update the pciconf(8) database.

July 14, 2014 snapshot from http://pciids.sourceforge.net/

9 years ago<sys/protosw.h>: Use netmsg_t.
Sascha Wildner [Tue, 15 Jul 2014 09:03:03 +0000 (11:03 +0200)]
<sys/protosw.h>: Use netmsg_t.

9 years agokernel/netgraph7: Use kprintf etc. directly instead of defining printf.
Sascha Wildner [Tue, 15 Jul 2014 08:42:17 +0000 (10:42 +0200)]
kernel/netgraph7: Use kprintf etc. directly instead of defining printf.

While here, remove some commented out code from dragonfly.h

In-discussion-with: nant

9 years agokernel/netgraph: Don't grab the tty_token around ldisc_{,de}register().
Sascha Wildner [Tue, 15 Jul 2014 08:09:00 +0000 (10:09 +0200)]
kernel/netgraph: Don't grab the tty_token around ldisc_{,de}register().

The functions already grab it themselves.

Pointed-out-by: nant
9 years agokernel/netgraph7: Remove unneeded CFLAGS.
Sascha Wildner [Tue, 15 Jul 2014 07:03:41 +0000 (09:03 +0200)]
kernel/netgraph7: Remove unneeded CFLAGS.

9 years agokernel/netgraph7: Adjust SVN ID.
Sascha Wildner [Tue, 15 Jul 2014 06:53:21 +0000 (08:53 +0200)]
kernel/netgraph7: Adjust SVN ID.

9 years agokm(4): Also supports sensors in AMD Family 12h CPUs. Update manpage.
Imre Vadasz [Mon, 14 Jul 2014 19:32:27 +0000 (21:32 +0200)]
km(4): Also supports sensors in AMD Family 12h CPUs. Update manpage.

* AMD Family 12h CPUs use the same PCI device ID as Family 14h CPUs.

9 years agokernel/netgraph7: Sync ng_bt3c with current FreeBSD and port it over.
Sascha Wildner [Mon, 14 Jul 2014 18:54:56 +0000 (20:54 +0200)]
kernel/netgraph7: Sync ng_bt3c with current FreeBSD and port it over.

I can't test this hardware unfortunately since I don't own it.

9 years agopowerd - Set to max performance if killed
Matthew Dillon [Mon, 14 Jul 2014 18:16:53 +0000 (11:16 -0700)]
powerd - Set to max performance if killed

* If the powerd daemon is killed it now sets the system to maximum
  performance before exiting for consistency, instead of leaving it
  in a potentially low-power state.

9 years agokernel - Fix stability issue with net.inet.tcp.inflight*
Matthew Dillon [Mon, 14 Jul 2014 17:47:22 +0000 (10:47 -0700)]
kernel - Fix stability issue with net.inet.tcp.inflight*

* net.inet.tcp.inflight_enable is (already) turned on by default.  This
  is necessary for network stability and to reduce excessive packet buffering
  to make PF and other routing protocols on the network work better.

* There is a bug at very high bandwidths where the 'bw' calculation is
  unstable and can lead to positive feedback instead of the desired negative
  feedback, preventing the tcp buffer size from ramping up properly.
  GigE links could sometimes run a tcp stream as slow as 7 MBytes/sec due
  to the bug due to bwnd limiting the tcp buffer to ~30-50KB.

* Fix the bug by increasing the minimum delta ticks for calculating (bw)
  from 1 to 2 and changing the stab parameter to scale bw instead of adding a
  fixed number of tcp maxsegs to bwnd.  This handles the high-speed issue.
  Low speed stability issues are handled by also adding 2*maxseg to bwnd.

  With this fix, GigE links stabilize better at the ~400-450KB needed to run
  the stream at full speed.

* net.inet.tcp.inflight_stab now scales bw in 1/10% increments instead
  of adding N*tcp_maxseg/10.  The default value of 50 increases the 'bw'
  calculation used to derive bwnd by 5%.  This appears to be sufficient.

Reported-by: alexh, rob__
9 years agorc.d/random: bring back rc.conf defaults, minor fixes
Alex Hornung [Mon, 14 Jul 2014 11:43:40 +0000 (12:43 +0100)]
rc.d/random: bring back rc.conf defaults, minor fixes

 * Saving the entropy across reboots is good practice to
   avoid having a lack of entropy after restarting the
   machine. For some reason, it has been disabled by default
   for ages now.

 * This commit brings back the defaults in rc.conf to enable
   saving entropy across reboots.

 * Minor fixes to rc.d/random, such as not assuming
   /var/db/entropy is a good place to put the entropy file,
   last but not least because:
    - that location is not checked on the start part of the script,
      so it won't ever be used.
    - /var/db/entropy is most of the time a directory, for the
      cron-based entropy collection.

9 years agorandom.4 - update for new CSPRNG status
Alex Hornung [Mon, 14 Jul 2014 10:55:33 +0000 (11:55 +0100)]
random.4 - update for new CSPRNG status

9 years agokern_nrandom, rnd drivers: update for new CSPRNG
Alex Hornung [Mon, 14 Jul 2014 07:53:06 +0000 (08:53 +0100)]
kern_nrandom, rnd drivers: update for new CSPRNG

 * Identify each source of entropy with an identifier, so that
   for example the Fortuna CSPRNG can manage the pool index
   for each source.

 * Add a new sysctl, kern.rand_mode, which can be used to select
   which generator is used for /dev/random; valid values are:
    - csprng (to use only the Fortuna-based CSPRNG)
    - ibaa (to use only IBAA)
    - mixed (to XOR both csprng and ibaa in the output stream
   It defaults to "mixed".

9 years agoAdd ChaCha and CSPRNG to conf/files
Alex Hornung [Thu, 12 Jun 2014 14:32:27 +0000 (15:32 +0100)]
Add ChaCha and CSPRNG to conf/files

9 years agokernel - add a fortuna-based CSPRNG
Alex Hornung [Thu, 12 Jun 2014 14:24:21 +0000 (15:24 +0100)]
kernel - add a fortuna-based CSPRNG

 * This implements a Fortuna-based CSPRNG.

 * All entropy pools are shared across all CPUs in the system.

 * SHA256 is used instead of SHA256_d as cryptographical hash
   function.

 * ChaCha is used as stream cipher instead of AES in CTR mode.

9 years agokernel - add ChaCha algorithm (djb's merged implementation)
Alex Hornung [Thu, 12 Jun 2014 14:22:32 +0000 (15:22 +0100)]
kernel - add ChaCha algorithm (djb's merged implementation)

9 years agoglxsb(4) - use add_buffer_randomness()
Alex Hornung [Thu, 12 Jun 2014 14:23:05 +0000 (15:23 +0100)]
glxsb(4) - use add_buffer_randomness()

9 years agoigb: enable MSI-X for i354 on C2550 SoC
Sepherosa Ziehau [Mon, 14 Jul 2014 09:59:34 +0000 (10:59 +0100)]
igb: enable MSI-X for i354 on C2550 SoC

9 years agodrm - Fix bug with ttm_tt_swapin()
Matthew Dillon [Mon, 14 Jul 2014 05:15:52 +0000 (22:15 -0700)]
drm - Fix bug with ttm_tt_swapin()

* Fix deadlock due to improper handling of the vm_page PG_BUSY in
  ttm_tt_swapin().

9 years agodrm/ttm: Replace FreeBSD custom code by Linux workqueues
François Tigeot [Sun, 13 Jul 2014 09:00:12 +0000 (11:00 +0200)]
drm/ttm: Replace FreeBSD custom code by Linux workqueues

9 years agoidentcpu: Add AMD Features2 strings for bits 25 to 28
Imre Vadasz [Sun, 13 Jul 2014 11:02:00 +0000 (13:02 +0200)]
identcpu: Add AMD Features2 strings for bits 25 to 28

9 years agokgdb - Fix for new CPU_prvspace[]
Matthew Dillon [Sun, 13 Jul 2014 23:00:39 +0000 (16:00 -0700)]
kgdb - Fix for new CPU_prvspace[]

* CPU_prvspace[] is now an array of pointers to struct privatespace and
  not an array of struct privatespace.

9 years agokernel/netgraph: Remove useless Makefile.inc's.
Sascha Wildner [Sun, 13 Jul 2014 12:10:11 +0000 (14:10 +0200)]
kernel/netgraph: Remove useless Makefile.inc's.

9 years agokernel/netgraph7: Sync ubt and ubtbcmfw with current FreeBSD.
Sascha Wildner [Sun, 13 Jul 2014 18:47:23 +0000 (20:47 +0200)]
kernel/netgraph7: Sync ubt and ubtbcmfw with current FreeBSD.

Also make them compile.

We need those drivers as of FreeBSD >=8 here since that's when
FreeBSD switched to usb4bsd.

9 years agoRevert "add load_kld to rc.subr"
Alex Hornung [Sun, 13 Jul 2014 11:33:56 +0000 (12:33 +0100)]
Revert "add load_kld to rc.subr"

This reverts commit 9b9814ddce54234e4b231ecb33b1de509a0a9bd5.

We don't really need load_kld, since ifconfig loads if_vlan on its own.

9 years agorc.conf - Add support for FreeBSD-style vlan conf
Alex Hornung [Sun, 13 Jul 2014 09:56:35 +0000 (10:56 +0100)]
rc.conf - Add support for FreeBSD-style vlan conf

Obtained-from: FreeBSD

9 years agoifconfig - use correct name after cloning
Alex Hornung [Sun, 13 Jul 2014 09:45:44 +0000 (10:45 +0100)]
ifconfig - use correct name after cloning

 * When running something like 'ifconfig vlan create vlandev foo vlan
   99', the vlan would be created correctly, but SIOCSETVLAN would be
   called on 'vlan' instead of the newly created vlan device.

 * Work around this by updating ifr_name from name (which is updated by
   the clone function) after doing the actual clone callback.

9 years agonetwork.subr - use get_if_var extensively
Alex Hornung [Sun, 13 Jul 2014 07:19:55 +0000 (08:19 +0100)]
network.subr - use get_if_var extensively

9 years agoadd load_kld to rc.subr
Alex Hornung [Sun, 13 Jul 2014 07:06:13 +0000 (08:06 +0100)]
add load_kld to rc.subr

Obtained-from: FreeBSD

9 years agonetwork.subr - move get_if_var here
Alex Hornung [Sun, 13 Jul 2014 06:59:27 +0000 (07:59 +0100)]
network.subr - move get_if_var here

9 years agokernel: Use NULL for pointers.
Sascha Wildner [Sun, 13 Jul 2014 09:52:31 +0000 (11:52 +0200)]
kernel: Use NULL for pointers.

9 years agodrm: Improve the BUG() macro
François Tigeot [Sun, 13 Jul 2014 06:40:12 +0000 (08:40 +0200)]
drm: Improve the BUG() macro

9 years agonetgraph7: Fix a bug in the Makefile.
Nuno Antunes [Sat, 12 Jul 2014 15:37:52 +0000 (16:37 +0100)]
netgraph7: Fix a bug in the Makefile.

* The ng_mppc node should not be built if the NO_CRYPT make
  variable is set.

9 years agobuild - allow ABIVERS to be overridden in Makefile.usr
Matthew Dillon [Sun, 13 Jul 2014 01:06:53 +0000 (18:06 -0700)]
build - allow ABIVERS to be overridden in Makefile.usr

* Allow ABIVERS to be overridden in Makefile.usr.  (Defaults to uname -P).

9 years agokernel - More verbose boot de-spamming
Matthew Dillon [Sun, 13 Jul 2014 00:48:59 +0000 (17:48 -0700)]
kernel - More verbose boot de-spamming

* Try to fit common package siblings print lines into 80 columns.

9 years agokernel - Add two features to improve qemu emulation (64-bit only)
Matthew Dillon [Sun, 13 Jul 2014 00:31:48 +0000 (17:31 -0700)]
kernel - Add two features to improve qemu emulation (64-bit only)

* Implement a tunable for machdep.cpu_idle_hlt, allowing it to be
  set in /boot/loader.conf.  For qemu the admin might want to set
  the value to 4 (always use HLT) instead of the default 2.

* Implement a tunable and new sysctl, machdep.pmap_fast_kernel_cpusync,
  which defaults to disabled (0).  Setting this to 1 in /boot/loader.conf
  or at anytime via sysctl tells the kernel to use a one-stage pmap
  invalidation for kernel_pmap updates.  User pmaps are not affected and
  will still use two-stage invalidations.

  One-stage pmap invalidations only have to spin on the originating cpu,
  but all other cpus will not be quiesced when updating a kernel_map pmap
  entry.  This is untested as there might be situations where the kernel
  pmap is updated without an interlock (though most should be interlocked
  already).

  This second sysctl/tunable, if enabled, greatly improves qemu performance
  particularly when the number of qemu cpus is greater than the number of
  real cpus.  It probably improves real hardware system performance as well,
  but is not recommended for production at this time.

9 years agokernel - Add lwkt_cpusync_quick()
Matthew Dillon [Sun, 13 Jul 2014 00:30:04 +0000 (17:30 -0700)]
kernel - Add lwkt_cpusync_quick()

* Add a quick one-stage cpusync function to complement our two-stage
  interlock/deinterlock cpusync functions.

  The one-stage version doesn't have to spin the target cpus, only the
  originating cpu, but it can't quiesce the cpus either whereas the
  two-stage version can.

9 years agokernel - Reduce console spam in verbose mode when printing cpu sets
Matthew Dillon [Sun, 13 Jul 2014 00:20:29 +0000 (17:20 -0700)]
kernel - Reduce console spam in verbose mode when printing cpu sets

* Add helper function kprint_cpuset().

* Print cpu ranges when printing out cpu sets.

* Print cpu ranges when generating topology output for sysctl

9 years agodrm/i915: Fix flickering screen issues on some laptops
François Tigeot [Sat, 12 Jul 2014 19:22:33 +0000 (21:22 +0200)]
drm/i915: Fix flickering screen issues on some laptops

Reported-and-tested-by: luxh
9 years agokernel - Fix crypto boots and rescue boots
Matthew Dillon [Sat, 12 Jul 2014 18:49:13 +0000 (11:49 -0700)]
kernel - Fix crypto boots and rescue boots

* The kernel text+data+bss is too big, the loader's 64MB heap can't fit
  it plus modules plus the initrd image any more.  Fix by reducing the
  kernel's BSS.

* Reduce the BSS allocation for CPU_prvspace[] from 11MB (45056 x 256 cpus)
  to ~45056 for the BSP and dynamically allocate the globaldata space for
  the APs.  Also saves ~11MB of ram or so on normal systems.

* Reduce the BSS allocation for cpu_map_entry_init[].  Only the BSP needs
  MAXCPU+1 pre-cached vm_map_entry structures.  The APs can make due with
  8 or so before the VM system comes up sufficiently to dynamically allocate
  these structures.  This saves around ~6.5MB of ram on normal systems.

9 years agokm(4): Support for sensors in AMDs Kaveri and Kabini APUs
Imre Vadasz [Sat, 12 Jul 2014 15:40:31 +0000 (17:40 +0200)]
km(4): Support for sensors in AMDs Kaveri and Kabini APUs

* Add support for Family 15h Models 30h-3Fh (Kaveri) and for
  Family 16h Models 00h-0Fh (Kabini).

9 years agoFix a couple of typos in a manpage and readme file.
Sascha Wildner [Fri, 11 Jul 2014 21:27:42 +0000 (23:27 +0200)]
Fix a couple of typos in a manpage and readme file.