dragonfly.git
7 years agoRevamp alt compiler handling for clang 3.9.1 import.
zrj [Mon, 5 Dec 2016 18:11:24 +0000 (20:11 +0200)]
Revamp alt compiler handling for clang 3.9.1 import.

Many users are still constantly asking weather llvm/clang compiler could be
added into a base as an alternative to current used ones (gcc50 and gcc47).
There are few issues in doing that:
 * It is very hard to keep both compiler flavors in harmony while one or the
   other is being updated. There were always two base compilers in base system
   in DragonFly and common practice still is to replace previous alternative
   compiler with an updated version, performing tests and then flip them up.
 * With clang introduction, this scheme would break badly due to both using
   slightly different c++ capabilities, flags support (WARNS mechanism), etc.
 * Different incompatible libraries libLLVM + libc++ vs libstdc++, also clang
   requiring a lot of effort to rewrite cmake logic into Makefiles for make(1).
 * SBU costs, gcc47 only has ~4min buildtime overhead at -j5 level(i7 laptop)
   while even clang38 tests has shown two-fold increase in buildworld time.
 * How DPorts infrastructure would handle both flavors? License roadmap?

So to make compromise it was chosen to provide a way for users and developers
to select the alternative compiler they like while keeping all groups happy,
ones continuing to enjoy the very fast world rebuilds and others having a way
to further develop and integrate clang into the infrastructure. Since DragonFly
is currently x86_64 only, we might as well experiment more with compilers.

This changeset adds some flexibility when it comes to handling base system
compilers. Even if it would be decided that clang does not fit very well in
DragonFly base system (due to complexities, updating/patching problems and
compilation times), we at least will have a very clean way for adding,
testing and finally making base default upcoming gcc70 and later. All of this
would be possible without disturbing both primary and alternative default
compilers, while developers and users will be testing both base and dports.
Also as a bonus we will be able to add compilers like pcc and scc that have
no native c++ frontend support too while reusing default compiler parts.
For now I am keeping this expansion undocumented and candidate for a revert.

While there mark few places for further work to reduce amount of ORDER: for
faster/better parallelism in btools/ctools bootstrapping stages.

Bootstrap is still fine from DragonFly 4.0.6-RELEASE.

7 years agodocs - Modernize swapcache(8)
Matthew Dillon [Tue, 6 Dec 2016 23:11:12 +0000 (15:11 -0800)]
docs - Modernize swapcache(8)

* Give swapcache(8) an update taking into account our growing knowledge of
  the capabilities and limitations of flash storage.

7 years agohammer - Disallow modifying ioctls when filesystem is read-only
Matthew Dillon [Tue, 6 Dec 2016 22:36:32 +0000 (14:36 -0800)]
hammer - Disallow modifying ioctls when filesystem is read-only

* Disallow modifying ioctls if the filesystem has been mounted read-only
  or gone into read-only mode due to an I/O error.

* This is only a partial fix.  There are still error-pathing problems
  in numerous procedures, particularly the node locking code, that might
  result in a token life-lock.

Reported-by: Peter Avalos
7 years agolibc - Take care of minor buffer overrun in link_ntoa()
Matthew Dillon [Tue, 6 Dec 2016 22:34:24 +0000 (14:34 -0800)]
libc - Take care of minor buffer overrun in link_ntoa()

* Take care of a minor buffer overrun in link_ntoa().  It is unlikely
  that any program produces the conditions required to trigger the
  problem.

Taken-from: FreeBSD-SA-16:37.libc
Reported-by: swildner, zrj, others
7 years agosbin/hammer: Fix direntry message in hammer recover
Tomohiro Kusumi [Tue, 6 Dec 2016 18:19:14 +0000 (03:19 +0900)]
sbin/hammer: Fix direntry message in hammer recover

name could have already been free'd, so move it to the beginning.
Also enable it only on -v, just like inode/data rectype cases.

7 years agosbin/hammer: Fix inode/data messages in hammer recover
Tomohiro Kusumi [Tue, 6 Dec 2016 17:47:04 +0000 (02:47 +0900)]
sbin/hammer: Fix inode/data messages in hammer recover

Based on other printf messages where "file" indicates regfile,
the first one should be "inode" rather than "file" because it
could be both directory and regfile.

The second one could be "file" because it's for file data, but
just sync with the first format.

7 years agosbin/hammer: Minor cleanup for hammer recover
Tomohiro Kusumi [Tue, 6 Dec 2016 13:14:06 +0000 (22:14 +0900)]
sbin/hammer: Minor cleanup for hammer recover

The reason for moving "info.pfs_id = dict->pfs_id;" is because
PT_FIGURE only requires strlen of "PFS%05d" (max 65535), and
dict->pfs_id never changes during path lookup by design.

7 years agodntpd - Fix memory leak
Matthew Dillon [Tue, 6 Dec 2016 18:13:11 +0000 (10:13 -0800)]
dntpd - Fix memory leak

* Every log line leaked a bit of memory.  Fixed.

7 years agovkernel: Add a dummy cpu_smp_stopped() function (unbreaks build).
zrj [Tue, 6 Dec 2016 08:14:32 +0000 (10:14 +0200)]
vkernel: Add a dummy cpu_smp_stopped() function (unbreaks build).

Follow-up to 63cff0361caa40216fcb16f79855de833431274b

7 years agokernel - Increase worst-case maximum exec rate
Matthew Dillon [Tue, 6 Dec 2016 00:49:04 +0000 (16:49 -0800)]
kernel - Increase worst-case maximum exec rate

* The pid reuse algorithm limits the maximum fork rate.  This limit
  was set too low.  Increase the limit from 10000/sec to 100000/sec.
  Currently our opteron maxes out at 43000/sec.

  Note that with 999999 pids and a 10-second mandatory reuse time
  floor there isn't much of a point increasing the limit beyond
  100000/sec.

  100,000/sec.  Currently our opteron maxes out at around
  43,000/sec (vfork/exec/wait3/exit of a small static binary).

* The domain reuse array was increased to 1MB to accomodate this
  change.  In addition, update the array in a cache-friendly manner.

* Modify test/sysperf/exec1 to take a nprocesses argument for the
  timing run.

7 years agokernel - Remove unused process_exit and process_exec eventhandlers
Matthew Dillon [Mon, 5 Dec 2016 23:26:46 +0000 (15:26 -0800)]
kernel - Remove unused process_exit and process_exec eventhandlers

* Remove these two eventhandlers.  They are not used in DragonFly.

* Fixes an unnecessary global lock bottleneck in exec and exit.

Suggested-by: Mateusz Guzik (mjg_)
7 years agokernel - Spiff up locks a bit
Matthew Dillon [Mon, 5 Dec 2016 23:07:43 +0000 (15:07 -0800)]
kernel - Spiff up locks a bit

* Do a little optimization of _spin_lock_contested().  The critical path
  is able to avoid two atomic ops in the initialization portion of the
  contested path.

* Optimize _spin_lock_shared_contested() to use atomic_fetchadd_long()
  to add a shared-lock count instead of atomic_cmpset_long().  Shared
  spinlocks are used heavily and this will prevent a lot of unnecessary
  spinning when many cpus are using the same lock at the same time.

* Hold fdp->fd_spin across fdp->fd_cdir and fdp->fd_ncdir modifications.
  This completes other work which caches fdp->fd_ncdir and avoids having
  to obtain the spin-lock when the cache matches.

Discussed-with: Mateusz Guzik (mjg_)

7 years agokernel - Make kern_proc cache-friendly
Matthew Dillon [Mon, 5 Dec 2016 23:01:10 +0000 (15:01 -0800)]
kernel - Make kern_proc cache-friendly

* Make the proc_tokens[], allprocs[], allpgrps[], and allsessn[]
  arrays cache-friendly by aggregating them into a cache-aligned
  struct procglob.

* Doesn't do much for the token array, but should help
  allprocs/allpgrps/allsessn scans whos structures were previously
  8-byte aligned.

7 years agosbin/hammer: Add hammer strip command
Tomohiro Kusumi [Sun, 4 Dec 2016 09:57:15 +0000 (18:57 +0900)]
sbin/hammer: Add hammer strip command

This command is inspired by hammer recover command, and does
opposite of what recover command does.

This command zero clears zone-8(B-Tree) big-blocks, zone-9(meta)
big-blocks, and then the whole volume header, except that volume
signature field is overwritten with "STRIPPED" instead of zeros.
After running, a filesystem is no longer mountable or recoverable
with hammer recover command. This command is also fast as it only
zero clears good enough ondisk data to make it unmountable and
unrecoverable.

Keep in mind that this command does _not_ zero clear user data.
Users would normally use a software designed to completely shred
a filesystem. This command is not designed to shred a filesystem.
The name "strip" gives better idea of what it really does than
using "shred"/etc.

-- example
 # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null
 # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
 # cd /HAMMER
 # dd if=/dev/urandom of=./out bs=1M count=120000
 120000+0 records in
 120000+0 records out
 125829120000 bytes transferred in 1766.417077 secs (71234094 bytes/sec)
 # cd
 # umount /HAMMER
 # hammer -f /dev/da1:/dev/da2:/dev/da3 strip
 You have requested that HAMMER filesystem (TEST) be stripped
 Do you really want to do this? [y/n] y
 Stripping HAMMER filesystem (TEST) in 5 4 3 2 1.. starting destruction pass
 8000000021000000
 9000000021800000
 800000019c000000
 800000030c000000
 800000047e000000
 80000005f7000000
 8000000767000000
 80000008d8000000
 8000000a51800000
 8000000bc5000000
 8000000d37800000
 8000000ead000000
 800000101e800000
 8000001193000000
 8000001304000000
 8000001478800000
 80000015ee000000
 8000001760800000
 80000018d1800000
 8000001a47000000
 8000001bb6000000
 801000013c000000
 /dev/da1
 /dev/da2
 /dev/da3
 # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
 mount: Invalid argument
 mount_hammer: /dev/da1: Invalid volume signature 4445505049525453

7 years agosbin/hammer: Make hammer_parsedevs() take open(2) flag
Tomohiro Kusumi [Sun, 4 Dec 2016 09:26:22 +0000 (18:26 +0900)]
sbin/hammer: Make hammer_parsedevs() take open(2) flag

This is for the next commit.
No functional change.

7 years agosbin/hammer: Add "[y/n]" before getyn()
Tomohiro Kusumi [Sun, 4 Dec 2016 14:44:00 +0000 (23:44 +0900)]
sbin/hammer: Add "[y/n]" before getyn()

7 years agosbin/hammer: Fix recursively called hammer_parsedevs()
Tomohiro Kusumi [Sun, 4 Dec 2016 09:21:17 +0000 (18:21 +0900)]
sbin/hammer: Fix recursively called hammer_parsedevs()

c2b74c42 had to change recursively called hammer_parsedevs() as well.

7 years agokernel - Remove debugging kprintf
Matthew Dillon [Mon, 5 Dec 2016 17:25:56 +0000 (09:25 -0800)]
kernel - Remove debugging kprintf

* Remove the 'exit race handled' debugging kprintf.

7 years agokernel - Try to idle cpus when in panic()
Matthew Dillon [Mon, 5 Dec 2016 17:21:19 +0000 (09:21 -0800)]
kernel - Try to idle cpus when in panic()

* Try to use MONITOR/MWAIT to idle cpus while they are stopped in a panic(),
  instead of hard-looping.  This significantly reduces power consumption while
  in a paniced state and is particularly helpful on laptops.

Reported-by: tuxillo
7 years agokernel - more kmalloc and nlookup performance optimizations
Matthew Dillon [Mon, 5 Dec 2016 17:15:44 +0000 (09:15 -0800)]
kernel - more kmalloc and nlookup performance optimizations

* Give the pcpu counters in struct malloc_type their own cache line per
  cpu.  This removes a large kmalloc/kfree bottleneck on multi-socket
  systems

* Avoid having to ref, lock, and GETATTR intermediate directory components
  in nlookup() by adding the NCF_WXOK flag.  This flag is set in the ncp
  when the directory permissions are at least 555.  This saves significant
  overhead in all situations, including single-threaded.

Discussed-with: Mateusz Guzik (mjg_)

7 years agoncurses: Fix parallel buildworld race.
zrj [Mon, 5 Dec 2016 14:08:47 +0000 (16:08 +0200)]
ncurses: Fix parallel buildworld race.

* MKexpanded.sh uses cc -E on source having curses.priv.h -> term.h chain.
  Be safe and delay until all GENHDRS are created first.

No funtional change for final libprivate_ncurses{,w}.a,
just for reproducibility of buildworld intermediates.

7 years agokernel - Skip vmm_shutdown() when in a panic
Matthew Dillon [Mon, 5 Dec 2016 00:09:23 +0000 (16:09 -0800)]
kernel - Skip vmm_shutdown() when in a panic

* vmm_shutdown() calls cpusync and assumes that the system is basically
  in working order.  This is definitely not the case from a panic.
  Conditionalize the code to be skipped if shutting-down due to a panic.

* Fixes a number of situations where the panic code locks up and refuses
  to dump when called with debug.debugger_on_panic=0.

7 years agosyscons - Set cons_unavail when blanking framebuffer screen from syscons.
Imre Vadász [Sat, 3 Dec 2016 20:13:03 +0000 (21:13 +0100)]
syscons - Set cons_unavail when blanking framebuffer screen from syscons.

* This makes us treat panics while the screen is blanked in KMS mode
  similar to panics while X is running. In both cases we have no
  possibility left to display the syscons console.

* This also sets the cons_unavail flag, when the KMS driver is unloaded
  and the framebuffer console becomes unusable, until a new framebuffer
  is registered for syscons (which will clear cons_unavail again).

7 years agodrm: Use fb_blank hooks from drm_fb_helper.c as a syscons screensaver.
Imre Vadász [Thu, 17 Nov 2016 22:34:13 +0000 (23:34 +0100)]
drm: Use fb_blank hooks from drm_fb_helper.c as a syscons screensaver.

* When the KMS framebuffer is registered in syscons, a screensaver is
  registered in syscons, which uses the fb_blank callback (if provided
  by the drm driver) for turning the display off.

* The syscons screensaver can be used by e.g. running "vidcontrol -t 30"
  for a 30s "screensaver" timeout), or via the Shift-Pause shortcut (for
  instantly enabling the "screensaver").

7 years agokernel: Fix stop_cpus()/restart_cpus() usages when panicing.
Imre Vadász [Sat, 3 Dec 2016 20:15:13 +0000 (21:15 +0100)]
kernel: Fix stop_cpus()/restart_cpus() usages when panicing.

* If we are panicing (i.e. panicstr != NULL), Debugger() should make sure
  that cpus are stopped when it returns. So call stop_cpus() explicitly
  if Debugger() does an early return (i.e. in the cons_unavail case), and
  don't call restart_cpus() at the end if we are panicing.

* This should make sure that Debugger()'s behaviour matches the
  expectations of panic() in sys/kern/kern_shutdown.c.

7 years agokernel - set default locale name for smbfs
Matthew Dillon [Sun, 4 Dec 2016 17:45:53 +0000 (09:45 -0800)]
kernel - set default locale name for smbfs

* Set default locale name for smbfs to "ISO8859-1".

7 years agotest - Adjust blib and sc1
Matthew Dillon [Sun, 4 Dec 2016 17:44:45 +0000 (09:44 -0800)]
test - Adjust blib and sc1

* convert loops to loops/sec, and add a parameter to syscall1.c to
  allow the number of threads to be specified.

7 years agokernel - Overhaul namecache operations to reduce SMP contention
Matthew Dillon [Sun, 4 Dec 2016 17:21:45 +0000 (09:21 -0800)]
kernel - Overhaul namecache operations to reduce SMP contention

* Overhaul the namecache code to remove a significant amount of cacheline
  ping-ponging from the namecache paths.  This primarily effects
  multi-socket systems but also improves multi-core single-socket systems.

  Cacheline ping-ponging in the critical path can constrict a multi-core
  system to roughly ~1-2M operations per second running through that path.
  For example, even if looking up different paths or stating different
  files, even something as simple as a non-atomic ++global_counter
  seriously derates performance when it is being executed on all cores at
  once.

  In the simple non-conflicting single-component stat() case, this improves
  performance from ~2.5M/second to ~25M/second on a 4-socket 48-core opteron
  and has a similar improvement on a 2-socket 32-thread xeon, as well as
  significantly improves namecache perf on single-socket multi-core systems.

* Remove the vfs.cache.numcalls and vfs.cache.numchecks debugging counters.
  These global counters caused significant cache ping-ponging and were only
  being used for debugging.

* Implement a poor-man's referenced-structure pcpu cache for struct mount
  and struct namecache.  This allows atomic ops on the ref-count for these
  structures to be avoided in certain critical path cases.  For now limit
  to ncdir and nrdir (nrdir particularly, which is usually the same across
  nearly all processes in the system).  Eventually we will want to expand
  this cache to handle more cases.

  Because we are holding refs persistently, add a bit of infrastructure to
  clear the cache as necessary (e.g. when doing an unmount, for example).

* Shift the 'cachedvnodes' global to a per-cpu accumulator, then roll-up
  the counter back to the global approximately once per second.  The code
  critical paths adjust only the per-cpu accumulator, removing another
  global cache ping-pong from nearly all vnode and nlookup paths.

* The nlookup structure now 'Borrows' the ucred reference from td->td_ucred
  instead of crhold()ing it, removing another global ref/unref from all
  nlookup paths.

* We have a large hash table of spinlocks for nchash, add a little pad
  from 24 to 32 bytes.  Its ok that two spin locks share the same cache
  line (its a huge table), adding the pad cleans up cacheline-crossing
  cases.

* Add a bit of pad to put mount->mnt_refs on its own cache-line verses
  prior fields which are accessed shared.  But don't bother isolating it
  completely.

7 years agokernel - Reduce spinning on shared spinlocks
Matthew Dillon [Sun, 4 Dec 2016 17:10:25 +0000 (09:10 -0800)]
kernel - Reduce spinning on shared spinlocks

* Improve spinlock performance by removing unnecessary extra reads,
  using atomic_fetchadd_int() to avoid a cmpxchg loop, and allowing
  the SHARED flag to remain soft-set on the 1->0 transition.

* The primary improvement here is that multiple cpu's obtaining the
  same shared spinlock can now do so via a single atomic_fetchadd_int(),
  whereas before we had multiple atomics and cmpxchg loops.  This does not
  remove the cacheline ping-pong but it significantly reduces unnecessary
  looping when multiple cpu cores are heavily loading the same shared spin
  lock.

* Trade-off is against the case where a spinlock's use-case switches from
  shared to exclusive or back again, which requires an extra atomic op to
  deal with.  This is not a common case.

* Remove spin->countb debug code, it interferes with hw cacheline operations
  and is no longer desireable.

Discussed-with: Mateusz Guzik (mjg_)

7 years agohammer - Remove global VOP counters
Matthew Dillon [Sun, 4 Dec 2016 17:06:25 +0000 (09:06 -0800)]
hammer - Remove global VOP counters

* Remove global VOP counters.  These were only used for debugging.
  Removing these globals significantly improves concurrent VOP operations
  on multi-core systems, particularly multi-socket systems, by removing
  a cache ping-pong bottleneck.

Discussed-with: Mateusz Guzik (mjg_)

7 years agoRename cpumask.9 -> CPUMASK.9
Sascha Wildner [Sun, 4 Dec 2016 11:34:08 +0000 (12:34 +0100)]
Rename cpumask.9 -> CPUMASK.9

7 years agolibefivar: Fix wrong MLINKS.
Sascha Wildner [Sat, 3 Dec 2016 13:29:52 +0000 (14:29 +0100)]
libefivar: Fix wrong MLINKS.

7 years agoAdd a minimal nvmectl(8) manual page.
Sascha Wildner [Sat, 3 Dec 2016 13:12:58 +0000 (14:12 +0100)]
Add a minimal nvmectl(8) manual page.

7 years agolibusbhid: Remove some unneeded compat code.
Sascha Wildner [Sat, 3 Dec 2016 10:35:59 +0000 (11:35 +0100)]
libusbhid: Remove some unneeded compat code.

7 years agokernel - Fix smbfs readdir and umount
Matthew Dillon [Fri, 2 Dec 2016 21:57:02 +0000 (13:57 -0800)]
kernel - Fix smbfs readdir and umount

* Fix a bug in smbfs's readdir that was causing an empty list and also
  a later deadlock.

* Fix a bug in smbfs's umount that was panicing the machine.

7 years agokernel - Remove NETSMBCRYPTO option (make it the default)
Matthew Dillon [Fri, 2 Dec 2016 21:33:19 +0000 (13:33 -0800)]
kernel - Remove NETSMBCRYPTO option (make it the default)

* Remove the NETSMBCRYPTO option entirely, and make its function the
  default.

7 years agokernel: Remove some ep(4) driver remains.
Sascha Wildner [Fri, 2 Dec 2016 21:47:56 +0000 (22:47 +0100)]
kernel: Remove some ep(4) driver remains.

It was removed in August (3a609f3dbc).

7 years agosmbfs - Fix mount_smbfs authentication error (but 'ls' still broken)
Matthew Dillon [Fri, 2 Dec 2016 00:32:27 +0000 (16:32 -0800)]
smbfs - Fix mount_smbfs authentication error (but 'ls' still broken)

* Fixes an authentication error with mount_smbfs.  Most windows file servers
  require a later crypto rev and man-in-the-middle protection.

* Note however that while mounting works, and files can be copied by name,
  'ls' currently returns empty and the mount appears to get stuck, so more
  work is needed.

7 years agosyscons - Add need_unlock arg to sc_clean_up and sc_wait_scrn_saver_stop.
Imre Vadász [Tue, 29 Nov 2016 22:04:46 +0000 (23:04 +0100)]
syscons - Add need_unlock arg to sc_clean_up and sc_wait_scrn_saver_stop.

* This should fix issues with VT switching when the screen is blanked.

7 years agokernel - Cleanup macros
Matthew Dillon [Thu, 1 Dec 2016 20:52:08 +0000 (12:52 -0800)]
kernel - Cleanup macros

* Fix ssb_insert_knote() and friends to use do { ... } while(0) intead
  of { }, which fixes a double-statement issue with the macro.

7 years agokernel - Fix bug in socket_wait() (used by samba)
Matthew Dillon [Thu, 1 Dec 2016 20:50:01 +0000 (12:50 -0800)]
kernel - Fix bug in socket_wait() (used by samba)

* socket_wait() was not properly initializing the temporary kqueue
  structure, resulting in corruption that prevented the event from being
  properly deleted.

* Fixes mount_smbfs panic.

Reported-by: dflyum
7 years agopoll.2: Add some information about the ppoll() syscall.
Imre Vadász [Thu, 1 Dec 2016 20:31:02 +0000 (21:31 +0100)]
poll.2: Add some information about the ppoll() syscall.

* Explain timeout and newsigmask arguments. (inspired by FreeBSD's poll(2))

* Mention that ppoll() can be used for precise timeouts like the ppoll()
  in Linux.

7 years ago<sys/{ipc,stat}.h>: Remove duplicate inclusion of <sys/cdefs.h>.
Sascha Wildner [Thu, 1 Dec 2016 07:36:38 +0000 (08:36 +0100)]
<sys/{ipc,stat}.h>: Remove duplicate inclusion of <sys/cdefs.h>.

7 years agoSort SEE ALSO in some manual pages.
Sascha Wildner [Wed, 30 Nov 2016 07:26:31 +0000 (08:26 +0100)]
Sort SEE ALSO in some manual pages.

7 years agodrm/i915: build firmware handling code
François Tigeot [Tue, 29 Nov 2016 21:39:09 +0000 (22:39 +0100)]
drm/i915: build firmware handling code

7 years agofirmware(9): Change type of data pointer
François Tigeot [Tue, 29 Nov 2016 21:23:16 +0000 (22:23 +0100)]
firmware(9): Change type of data pointer

* from const void * to const uint8_t *

* Avoiding tedious and error-prone void * conversions in Linux drivers

7 years agoexamples/rconfig: Fix CD/PXE check in two scripts.
Sascha Wildner [Tue, 29 Nov 2016 21:16:01 +0000 (22:16 +0100)]
examples/rconfig: Fix CD/PXE check in two scripts.

7 years agoFix manual pages for s/struct device */device_t/.
Sascha Wildner [Tue, 29 Nov 2016 18:54:01 +0000 (19:54 +0100)]
Fix manual pages for s/struct device */device_t/.

7 years agombuf.9: Adjust for removal of m_devget()'s 'copy' argument.
Sascha Wildner [Tue, 29 Nov 2016 18:23:19 +0000 (19:23 +0100)]
mbuf.9: Adjust for removal of m_devget()'s 'copy' argument.

7 years agosyscons - Add range check for color value in KDSBORDER ioctl.
Imre Vadász [Mon, 28 Nov 2016 23:31:08 +0000 (00:31 +0100)]
syscons - Add range check for color value in KDSBORDER ioctl.

* Only values 0..15 are handled correctly for scp->border at the moment.

7 years agosyscons - Add option for the default terminal border color to kernel config.
Imre Vadász [Mon, 28 Nov 2016 22:22:27 +0000 (23:22 +0100)]
syscons - Add option for the default terminal border color to kernel config.

* The default terminal border can be set to e.g. darkgrey by adding
  option SC_BORDER_COLOR="FG_DARKGREY"
  to the kernel configuration.

7 years agoefivar.3: Fix prototypes in the SYNOPSIS.
Sascha Wildner [Tue, 29 Nov 2016 13:07:47 +0000 (14:07 +0100)]
efivar.3: Fix prototypes in the SYNOPSIS.

7 years agoFix some typos in manual pages.
Sascha Wildner [Tue, 29 Nov 2016 12:52:06 +0000 (13:52 +0100)]
Fix some typos in manual pages.

7 years agoboot/efi: Add paging to the 'memmap' and 'configuration' commands.
Sascha Wildner [Mon, 28 Nov 2016 22:36:52 +0000 (23:36 +0100)]
boot/efi: Add paging to the 'memmap' and 'configuration' commands.

Taken-from: FreeBSD

7 years agoboot/efi: Add three new commands, efi-show, efi-set and efi-unset.
Sascha Wildner [Mon, 28 Nov 2016 22:35:25 +0000 (23:35 +0100)]
boot/efi: Add three new commands, efi-show, efi-set and efi-unset.

For accessing EFI variables. These replace the nvram command.

Taken-from: FreeBSD

7 years agolibstand: Add uuid_{from,to}_string() and uuid_create_nil() (from libc).
Sascha Wildner [Mon, 28 Nov 2016 22:34:44 +0000 (23:34 +0100)]
libstand: Add uuid_{from,to}_string() and uuid_create_nil() (from libc).

Taken-from: FreeBSD

7 years agohammer2 - Revamp flush and xopq mechanism, stabilization
Matthew Dillon [Mon, 28 Nov 2016 20:18:54 +0000 (12:18 -0800)]
hammer2 - Revamp flush and xopq mechanism, stabilization

* Originally the xopq mechanism was meant to allow multiple worker
  threads to share the same queue in a NxM configuration, but for
  all intents and purposes we changed to a one-queue-per-thread
  mechanic.  Formalize this by associating the queue directly with
  the thread structure.

* Separate out strategy-related XOPs from vnop-related XOPs, using half
  the worker threads for strategy XOPs and the other half for vnop XOPs.
  This fixes at least one deadlock which could occur if a strategy XOP
  was queued after a vnop on the same worker thread.  Since the
  buffers related to the strategy XOP were locked, it could prevent
  the vnop ahead of it from being able to execute.

* Cleanup the xopq sleep/wakeup mechanism and also fix a 30-60 second
  stall when a xop-xop dependency is present on the same queue.  The
  clearing of the older xop was not waking up the worker thread.

* Revamp the transaction code, putpages via UIO_NOCOPY vop_write's,
  and vop_strategy, to allow all buffer-cache-related I/Os to execute
  concurrent with a flush.  This fixes several deadlocks and long stalls
  that could occur during flushes.  Nominal modifying vnops will still
  interlock with flushes, for now.

* Remove the PREFLUSH flag, it is no longer relevant.

* NOTE - Flush code probably doesn't completely handle modifying races
  yet and needs more work.  However, such races should be restricted to
  buffer-cache-related I/Os only and thus it should be possible to
  interlock them on an inode-by-inode basis.

7 years agofsstress - Fix compiler warning
Matthew Dillon [Mon, 28 Nov 2016 18:47:17 +0000 (10:47 -0800)]
fsstress - Fix compiler warning

* Remove annoying compiler warning.

7 years agokernel - Remove buffer flush debug message
Matthew Dillon [Mon, 28 Nov 2016 18:45:54 +0000 (10:45 -0800)]
kernel - Remove buffer flush debug message

* Remove the "dirty bufs left after final pass" debug message.  This case
  can occur normally during heavy I/O, particularly with the concurrency
  DragonFly now allows.

7 years agokernel - Fix deadlock in vm_page_repurpose()
Matthew Dillon [Mon, 28 Nov 2016 18:41:53 +0000 (10:41 -0800)]
kernel - Fix deadlock in vm_page_repurpose()

* vm_page_repurpose() was hard+soft busying the underlying VM page,
  which can deadlock against putpages or other I/O.

* Only hard-busy the page, then add an SBUSY test to the failure case
  (we don't want to repurpose a page undergoing I/O after all!).

7 years agokernel/ath: Limit check index variables before using them.
Sascha Wildner [Mon, 28 Nov 2016 17:46:11 +0000 (18:46 +0100)]
kernel/ath: Limit check index variables before using them.

7 years agoboot/efi: Use strtoul().
Sascha Wildner [Mon, 28 Nov 2016 14:49:05 +0000 (15:49 +0100)]
boot/efi: Use strtoul().

Reduces diffs with FreeBSD.

7 years agolibstand: Add strtoul().
Sascha Wildner [Mon, 28 Nov 2016 14:47:18 +0000 (15:47 +0100)]
libstand: Add strtoul().

Taken-from: FreeBSD

7 years ago<machine/limits.h>: Add some i386 limits which libstand's strtol() needs.
Sascha Wildner [Mon, 28 Nov 2016 14:40:02 +0000 (15:40 +0100)]
<machine/limits.h>: Add some i386 limits which libstand's strtol() needs.

7 years agoSync zoneinfo database with tzdata2016j from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Mon, 28 Nov 2016 07:45:51 +0000 (08:45 +0100)]
Sync zoneinfo database with tzdata2016j from ftp://ftp.iana.org/tz/releases

* Saratov, Russia switches from +03 to +04 on 2016-12-04 at 02:00.
    This hives off a new zone Europe/Saratov from Europe/Volgograd.
    (Thanks to Yuri Konotopov and Stepan Golosunov.)

* The new zone Asia/Atyrau for Atyraū Region, Kazakhstan, is like
    Asia/Aqtau except it switched from +04/+05 to +05/+06 in spring
    1999, not fall 1994.  (Thanks to Stepan Golosunov.)

* Asia/Gaza and Asia/Hebron now use "EEST", not "EET", to denote
    summer time before 1948.  The old use of "EET" was a typo.

* The 'Theory' file now documents UT.

* iso3166.tab now accents "Curaçao", and commentary now mentions
    the names "Cabo Verde" and "Czechia".  (Thanks to Jiří Boháč.)

7 years agosyscons - Clean up log messages for KMS console.
Imre Vadász [Mon, 21 Nov 2016 22:12:05 +0000 (23:12 +0100)]
syscons - Clean up log messages for KMS console.

* This was printing two lines of kernel messages for every virtual terminal
  that was switched to a new KMS framebuffer configuration.
  Instead only print the display resolution when the framebuffer is
  registered with syscons, and print the font scaling information for
  each VT only when debugging is enabled in syscons.

7 years agodrm: Improve integration with syscons. Move taskqueue handling to syscons.
Imre Vadász [Sun, 20 Nov 2016 21:01:40 +0000 (22:01 +0100)]
drm: Improve integration with syscons. Move taskqueue handling to syscons.

* Adds asynctd_lk to syscons' softc to synchronize unregister_framebuffer
  code with the asynchronous screen refresh threads.

* Use a generation counter in syscons to check if sc_update_render() needs
  to update the VT resolution/mode. Remove struct fb_info *fbi pointer
  from scr_stat, and always check the struct fb_info *fbi pointer in the
  softc struct instead.

* Use videio_in_progress flag to make initial fb_set_par call a bit safer.

* Moves driver callbacks from struct fb_info itself into struct fb_ops,
  and adds fb_blank and fb_debug_enter callbacks which will be wired up
  in future commits.

* Add unregister_framebuffer() function to syscons, which is needed for
  cleanly detaching a drm graphics driver which is used as framebuffer
  console. The screen will turn off, blank or display a frozen screen,
  after the graphics driver has detached.

* Use drm_fb_helper_unregister_framebuffer() and drm_fb_helper_release_fbi()
  functions in radeon and i915, which are needed for cleanly detaching the
  drivers.

* With radeonkms detaching and re-attaching is working very reliably
  on an AMD G-T44R APU (i.e. HD6250 graphics).

* Detaching i915 on a Haswell notebook barely worked with several errors,
  and trying to re-attach i915 caused the machine to hang.

7 years agosyscons - Make sure we draw the terminal border during syscons startup.
Imre Vadász [Sun, 27 Nov 2016 22:01:30 +0000 (23:01 +0100)]
syscons - Make sure we draw the terminal border during syscons startup.

* Try drawing the border first in scinit. If we use the UEFI framebuffer,
  and efi_fb_info.vaddr is still NULL, we call sc_set_border again in
  scmeminit() when efi_fb_info.vaddr will be definitely non-NULL.

* This makes sure that we clear any garbage left from the UEFI bootloader
  stage on the screen, after ae88e4ee083dbf5a51e10cae2cdf213e2a7c5225.

7 years agosigpause.3: Add missing comma.
Sascha Wildner [Mon, 28 Nov 2016 00:06:51 +0000 (01:06 +0100)]
sigpause.3: Add missing comma.

7 years agoefivar.{3,8}: Fix some mdoc issues.
Sascha Wildner [Mon, 28 Nov 2016 00:04:54 +0000 (01:04 +0100)]
efivar.{3,8}: Fix some mdoc issues.

efivar.3: Remove extra semicolons, fix section ordering, add SEE ALSO.

efivar.8: Fix wrong .El, add SEE ALSO, add parentheses.

7 years agolibefivar: Remove unneeded WARNS setting (lib/Makefile.inc has it).
Sascha Wildner [Sun, 27 Nov 2016 23:51:45 +0000 (00:51 +0100)]
libefivar: Remove unneeded WARNS setting (lib/Makefile.inc has it).

7 years agomdoc.local: Add definition for '.Lb libefivar'.
Sascha Wildner [Sun, 27 Nov 2016 23:51:18 +0000 (00:51 +0100)]
mdoc.local: Add definition for '.Lb libefivar'.

7 years agokernel/efirt: Make efirt compilable into the kernel and add to LINT64.
Sascha Wildner [Sun, 27 Nov 2016 23:36:28 +0000 (00:36 +0100)]
kernel/efirt: Make efirt compilable into the kernel and add to LINT64.

7 years agokernel/efirt: Hook efirt.ko into the build.
Sascha Wildner [Sun, 27 Nov 2016 23:35:40 +0000 (00:35 +0100)]
kernel/efirt: Hook efirt.ko into the build.

7 years agoMove efirt.ko's source to sys/dev/misc/efirt.
Sascha Wildner [Sun, 27 Nov 2016 23:35:00 +0000 (00:35 +0100)]
Move efirt.ko's source to sys/dev/misc/efirt.

7 years agorc.subr: Add ${name}_env and ${name}_prepend.
Michael Neumann [Sun, 27 Nov 2016 21:51:40 +0000 (22:51 +0100)]
rc.subr: Add ${name}_env and ${name}_prepend.

${name}_env is an argument list which will be passed to env(1).
${name}_prepend is simply prepended to the command line for $command.

This fixes issues I had with starting up www/h2o as described [here][1].

Taken-From: FreeBSD (commit 77616d41a2ce3744b35e68b8a3c12e562283a322)

[1]: https://github.com/DragonFlyBSD/DeltaPorts/issues/663

7 years agosys/dev/disk/dm: Make init/destroy handlers optional
Tomohiro Kusumi [Sun, 27 Nov 2016 05:35:27 +0000 (14:35 +0900)]
sys/dev/disk/dm: Make init/destroy handlers optional

Some targets don't need to do anything in init/destroy handler,
as there is no private data to init/cleanup, so make them optional.

table_en->target_config can be set to NULL regardless of destroy
handler or its result.

7 years agosys/dev/disk/dm: Remove dm_table_init_target() call with NULL
Tomohiro Kusumi [Sun, 27 Nov 2016 05:21:11 +0000 (14:21 +0900)]
sys/dev/disk/dm: Remove dm_table_init_target() call with NULL

These can be removed after 41a68322.

7 years agosyscons - Fix syscons with UEFI fb when drm fb is registered during boot.
Imre Vadász [Sat, 26 Nov 2016 22:49:01 +0000 (23:49 +0100)]
syscons - Fix syscons with UEFI fb when drm fb is registered during boot.

* Fix sc->fbi related checks in register_framebuffer() and scinit(), to
  patch up the case where the drm framebuffer is registered before
  syscons' late initialization (i.e. the actual syscons attach function)
  runs.

* Change some of the SC_EFI_FB checks in scinit() to check instead for
  sc->fbi != NULL.

7 years agokernel/pc64: Don't fill uefi framebuffer with 0x77 during early boot.
Imre Vadász [Sun, 27 Nov 2016 00:43:19 +0000 (01:43 +0100)]
kernel/pc64: Don't fill uefi framebuffer with 0x77 during early boot.

* This memset was only meant for debugging uefi boot, and just produces an
  annoying flick or a short delay during UEFI boot now.

7 years agosys/dev/disk/dm: Remove obvious/redundant/disabled kprintfs
Tomohiro Kusumi [Sat, 26 Nov 2016 10:21:01 +0000 (19:21 +0900)]
sys/dev/disk/dm: Remove obvious/redundant/disabled kprintfs

7 years agosys/dev/disk/dm: Cleanups
Tomohiro Kusumi [Sat, 26 Nov 2016 05:58:26 +0000 (14:58 +0900)]
sys/dev/disk/dm: Cleanups

This part is unclear for no reason.

7 years agosys/dev/disk/dm: Remove dm_dev::dev_type
Tomohiro Kusumi [Sat, 26 Nov 2016 05:17:43 +0000 (14:17 +0900)]
sys/dev/disk/dm: Remove dm_dev::dev_type

This is unused, and also not necessary.

dm core shouldn't need to be aware of target driver type.
Target dependent actions are handled by target dependent handlers.
dm targets have oop-like structure, so we don't want/need
dm core to be able to do things like below.

Also see d471f1f9 and 49784e7d.

switch (dev->dev_type) {
case DM_LINEAR_DEV:
    do_something_specific_to_linear(); break;
case DM_STRIPE_DEV:
    do_something_specific_to_striped(); break;
case ...:
    ...; break;
}

7 years agosys/dev/disk/dm: Remove dm/targets/ directory and move its entries to dm/
Tomohiro Kusumi [Sat, 26 Nov 2016 03:46:41 +0000 (12:46 +0900)]
sys/dev/disk/dm: Remove dm/targets/ directory and move its entries to dm/

Device mapper targets' path
sys/dev/disk/dm/targets/<name>/dm_target_<name>.c
are too deep for no reason.

This commit removes targets/ directory which isn't necessary at all,
assuming userspace has no dependencies on this (and it shouldn't either).

Neither NetBSD (sys/dev/dm/dm_target_*.c) nor Linux kernel (drivers/md/dm*.c)
has a directory tree like this, which is better.

7 years agolibc: Fix up compat-43 a bit.
Sascha Wildner [Sat, 26 Nov 2016 15:55:19 +0000 (16:55 +0100)]
libc: Fix up compat-43 a bit.

* Functions in libc/compat-43 aren't syscalls so move their manual
  pages to section 3.

* Move the stuff that is still POSIX to libc/gen: creat, gethostid,
  getwd, killpg. compat-43 isn't the right place for them.

* While here, a non-existant .PATH in compat-43/Makefile.inc.

7 years agoipfw3: 'or' supports more filters
Bill Yuan [Sat, 26 Nov 2016 11:51:21 +0000 (11:51 +0000)]
ipfw3: 'or' supports more filters

7 years agosyscons - Remove unneeded NULL check from register_framebuffer().
Imre Vadász [Sat, 26 Nov 2016 00:25:56 +0000 (01:25 +0100)]
syscons - Remove unneeded NULL check from register_framebuffer().

* While there use tabs for indenting register_framebuffer() to reduce
  diff of a following change.

7 years agosyscons - Handle kms framebuffer activation better when not in text mode.
Imre Vadász [Fri, 25 Nov 2016 00:26:32 +0000 (01:26 +0100)]
syscons - Handle kms framebuffer activation better when not in text mode.

* We shouldn't just silently remove the GRAPHICS_MODE or UNKNOWN_MODE flags,
  instead try to handle those cases a bit more graceful.

* This avoid's Xorg's VT being silently switched back from UNKNOWN_MODE
  to text mode, when the drm driver module is automatically loaded while
  Xorg is starting.

7 years agodrm/radeon: restore the fbdev mode in lastclose
Imre Vadász [Sat, 19 Nov 2016 20:33:54 +0000 (21:33 +0100)]
drm/radeon: restore the fbdev mode in lastclose

restore the fbdev state if a drm app like X is killed.

Taken-From: Linux git 8c70e1cda04b966b50ddfefafbd0ea376ed8edd5

7 years agoiwm - Reduce gratuitous differences with Linux iwlwifi in struct naming.
Imre Vadász [Fri, 25 Nov 2016 22:13:42 +0000 (23:13 +0100)]
iwm - Reduce gratuitous differences with Linux iwlwifi in struct naming.

* Rename some structs and struct members for firmware handling.

7 years agodrm/linux: add circ_buf.h needed for guc client bits
zrj [Fri, 25 Nov 2016 10:41:12 +0000 (11:41 +0100)]
drm/linux: add circ_buf.h needed for guc client bits

Found on github implemented by mattmacy@ FreeBSD repo

7 years agodrm/linux: Add request_firmware_nowait()
François Tigeot [Fri, 25 Nov 2016 09:07:48 +0000 (10:07 +0100)]
drm/linux: Add request_firmware_nowait()

7 years agodrm/linux: Improve request_firmware() compatibility
François Tigeot [Fri, 25 Nov 2016 08:06:16 +0000 (09:06 +0100)]
drm/linux: Improve request_firmware() compatibility

request_firmware() takes a pointer to a Linux struct device as
third parameter.

7 years agobinutils227: Symlink liblto_plugin.so from default base gcc compiler too.
zrj [Sun, 20 Nov 2016 14:06:25 +0000 (16:06 +0200)]
binutils227: Symlink liblto_plugin.so from default base gcc compiler too.

Now that alternative binutils are updated, further work towards making
binutils 2.27 as default can continue.
Also documment bfd-plugins/ directory in hier(7).

7 years agortld: Fix handling of DT_TEXTREL for object with multiple read-only segments.
zrj [Fri, 16 Sep 2016 04:47:19 +0000 (07:47 +0300)]
rtld: Fix handling of DT_TEXTREL for object with multiple read-only segments.

Taken-from: FreeBSD (r296319)

7 years agoRetire the binutils-2.24.
zrj [Sun, 20 Nov 2016 13:47:14 +0000 (15:47 +0200)]
Retire the binutils-2.24.

Remove contrib sources and build Makefiles.

7 years agoReplace binutils 2.24 with latest binutils 2.27.
zrj [Sat, 19 Nov 2016 18:52:45 +0000 (20:52 +0200)]
Replace binutils 2.24 with latest binutils 2.27.

7 years agobinutils227: Add build dirs.
zrj [Sat, 19 Nov 2016 18:50:38 +0000 (20:50 +0200)]
binutils227: Add build dirs.

It is unclear weather -Wl,z,relro should be on by default in ld.gold.

7 years agobinutil227: Add DF README's and local modifications.
zrj [Sat, 19 Nov 2016 17:46:44 +0000 (19:46 +0200)]
binutil227: Add DF README's and local modifications.

7 years agoMerge remote-tracking branch 'origin/vendor/BINUTILS227'
zrj [Thu, 24 Nov 2016 15:28:14 +0000 (17:28 +0200)]
Merge remote-tracking branch 'origin/vendor/BINUTILS227'