dragonfly.git
7 years agokernel - Adjust vmm_guest_sync_addr()
Matthew Dillon [Sat, 28 Jan 2017 08:16:35 +0000 (00:16 -0800)]
kernel - Adjust vmm_guest_sync_addr()

* Adjust vmm_guest_sync_addr() to invalidate the current cpu's tlb
  only for VMM when called with (NULL, NULL).

7 years agokernel - Change vm_fault_page[_quick]() semantics + vkernel fixes
Matthew Dillon [Sat, 28 Jan 2017 08:08:05 +0000 (00:08 -0800)]
kernel - Change vm_fault_page[_quick]() semantics + vkernel fixes

* vm_fault_page[_quick]() needs to be left busied for PROT_WRITE so
  modifications made by the caller do not race other operations in the
  kernel.  Modify the API to accomodate the behavior.

* Fix procfs write race with new vm_fault_page() API.

* Fix bugs in ept_swapu32() and ept_swapu64() (vkernel + VMM)

* pmap_fault_page_quick() doesn't understand EPT page tables, have it
  fail for that case too.  This fixes bugs in vkernel + VMM mode.

* Also do some minor normalization of variables names in pmap.c

* vkernel/pmap - Use atomic_swap_long() to modify PTEs instead of a
  simple (non-atomic) assignment.

* vkernel/pmap - Fix numerous bugs in the VMM and non-VMM code for
  pmap_kenter*(), pmap_qenter*(), etc.

* vkernel/pmap - Collapse certain pmap_qremove_*() routines into the
  base pmap_qremove().

7 years agokernel - Remove ffs_rawread() (2)
Matthew Dillon [Sat, 28 Jan 2017 08:00:54 +0000 (00:00 -0800)]
kernel - Remove ffs_rawread() (2)

* Remove conf/files entry

7 years agokernel - Remove numerous user VM page functions
Matthew Dillon [Fri, 27 Jan 2017 23:05:11 +0000 (15:05 -0800)]
kernel - Remove numerous user VM page functions

* Remove vmapbuf() and vunmapbuf(), they are unsafe.

* Remove xio_init_ubuf() - It is not used and is unsafe.

* Remove vm_fault_quick_hold_pages() - It is not used as is unsafe.

7 years agokernel - Remove direct mapping of user buffers to CAM
Matthew Dillon [Fri, 27 Jan 2017 23:04:03 +0000 (15:04 -0800)]
kernel - Remove direct mapping of user buffers to CAM

* Remove direct mappings, always bounce.  Nothing uses this code any
  more and vmapbuf/vunmapbuf are about to go away, so just bounce.

7 years agokernel - Remove ffs_rawread()
Matthew Dillon [Fri, 27 Jan 2017 22:56:47 +0000 (14:56 -0800)]
kernel - Remove ffs_rawread()

* Remove ffs_rawread(), because we will be removing vmapbuf/vunmapbuf soon
  as well (because it isn't safe).

7 years agovkernel - Partial fix to EPT swapu32 and swapu64
Matthew Dillon [Fri, 27 Jan 2017 21:56:33 +0000 (13:56 -0800)]
vkernel - Partial fix to EPT swapu32 and swapu64

* EPT needed swapu32/swapu64 functions, write them.

* Fix bounds checking bug in std_swapu32()

* Misc cleanups.

7 years agokernel - Prune pcpu vmzone a bit
Matthew Dillon [Fri, 27 Jan 2017 18:33:15 +0000 (10:33 -0800)]
kernel - Prune pcpu vmzone a bit

* Put a cap of 16MB worth of entries in the vm_zone pcpu cache, per cpu.
  This cap is triggered on large-memory systems which would otherwise
  set too high a limit on the vmzone pcpu caches.

  This primarily affects pvzone, limiting the pcpu pmap pv_entry cache
  to around 200000 elements (~800MB worth of page mappings).

* Reduces the amount of memory waste on a large-memory system.  For example,
  before roughly 2GB worth of unused pv_entry's could accumulate on a
  32-way system with 128GB of ram during nominal use.  Now only around 512MB
  worth of unused pv_entry's can accumulate.

* Note that we do not want to set this cap too low because it is absolutely
  necessary for concurrent fork/exec/wait/exit performance.

* Increase the zone_burst from the global cache to the pcpu cache from
  32 to 128 elements to further reduce unnecessary lock collisions in
  zalloc().

7 years agofetch.9/store.9: Adjust for recent changes.
Sascha Wildner [Fri, 27 Jan 2017 18:29:23 +0000 (19:29 +0100)]
fetch.9/store.9: Adjust for recent changes.

7 years agokernel/usb4bsd: Use pci_alloc_1intr() for MSI allocation in xhci_pci.c.
Imre Vadász [Fri, 27 Jan 2017 12:28:39 +0000 (13:28 +0100)]
kernel/usb4bsd: Use pci_alloc_1intr() for MSI allocation in xhci_pci.c.

* The existing pci_alloc_msi() call was still expecting the FreeBSD API,
  causing a panic on single-cpu machines when trying to allocate an MSI.
  SMP machines didn't panic, but were accidentally always using CPU1 for
  the xhci MSI interrupt.

7 years agosdhci - Use pci_alloc_1intr in sdhci pci attachement.
Imre Vadász [Wed, 11 Jan 2017 11:47:14 +0000 (12:47 +0100)]
sdhci - Use pci_alloc_1intr in sdhci pci attachement.

7 years agomsdosfs - Mount ricoh camera cards
Matthew Dillon [Fri, 27 Jan 2017 05:52:10 +0000 (21:52 -0800)]
msdosfs - Mount ricoh camera cards

* Ricoh cameras mis-format their sdcards, mis-programming the 64-bit
  pm_nxtfree field with a 32-bit-truncated -1.  Allow the case so we
  can finish mounting the card.

Reported-by: luxh
7 years agokernel - Fix improper dereference in the vmspace subsystem
Matthew Dillon [Thu, 26 Jan 2017 22:45:20 +0000 (14:45 -0800)]
kernel - Fix improper dereference in the vmspace subsystem

* Fix an improper deref in the vmspace subsystem (used by vkernels),
  which could cause host memory to become corrupt.

7 years agovkernrel - Synchronize w/master, adjust for vmm_guest_sync_addr() changes
Matthew Dillon [Thu, 26 Jan 2017 19:37:58 +0000 (11:37 -0800)]
vkernrel - Synchronize w/master, adjust for vmm_guest_sync_addr() changes

* synchronize suword, fuword, etc naming conventions with master.

* Use the new vmm_guest_sync_addr() ABI to more safely make adjustments
  to virtual page tables.

7 years agokernel - Refactor suword, fuword, etc. change vmm_guest_sync_addr()
Matthew Dillon [Thu, 26 Jan 2017 19:35:47 +0000 (11:35 -0800)]
kernel - Refactor suword, fuword, etc.  change vmm_guest_sync_addr()

* Rename the entire family of functions to reduce confusion.

* Change how vmm_guest_sync_addr() works.  Instead of loading one value
  into a target location we exchange the two target locations, with the
  first address using an atomic op.  This will allow the vkernel to
  drop privs and query pte state atomically.

7 years agokernel - Accomodate high-ncpu + low-mem configurations
Matthew Dillon [Thu, 26 Jan 2017 19:34:31 +0000 (11:34 -0800)]
kernel - Accomodate high-ncpu + low-mem configurations

* Make some adjustments to accomodate high cpu core count but low physical
  memory configurations.  This mainly accomodates test configurations.

  Do set pageout minimums or targets to unreasonable values in these
  configurations.

7 years agovkernel - Refactor pmap
Matthew Dillon [Thu, 26 Jan 2017 02:31:48 +0000 (18:31 -0800)]
vkernel - Refactor pmap

* Refactor the pmap code.  Use vm_page locking to protect PTEs.

* Change the accounting from using vm_page->hold_count to using
  vm_page->wire_count.

* Replace unlocked pt/pd/pdp lookups with explicit page tests for non-kernel
  pmaps.

7 years agokernel - Remove object->agg_pv_list_count
Matthew Dillon [Thu, 26 Jan 2017 02:30:43 +0000 (18:30 -0800)]
kernel - Remove object->agg_pv_list_count

* Remove the object->agg_pv_list_count field.  It represents an unnecessary
  global cache bounce, was only being used to help report vkernel RSS,
  and wasn't working very well anyway.

7 years agokernel - Optimize lwp-specific signaling. (2)
Matthew Dillon [Thu, 26 Jan 2017 01:39:01 +0000 (17:39 -0800)]
kernel - Optimize lwp-specific signaling. (2)

* Fix bug in last sig commit.

7 years agovkernel - Clock optimizations, pre-zero 'ram'.
Matthew Dillon [Wed, 25 Jan 2017 19:18:20 +0000 (11:18 -0800)]
vkernel - Clock optimizations, pre-zero 'ram'.

* The vkernel now defaults to using an imprecise (host-tick-resolution)
  timer.

* The vkernel now pre-faults all of its 'system' memory at startup in order
  to avoid dynamically faulting it in after it has gone MP (which creates
  a lot of contention on the host machine).

7 years agokernel - Optimize lwp-specific signaling.
Matthew Dillon [Wed, 25 Jan 2017 17:25:40 +0000 (09:25 -0800)]
kernel - Optimize lwp-specific signaling.

* Optimize the signal code to remove most instances of needing proc->p_token
  when lwp-specific signals are sent.

* Add a CURSIG_LCK_TRACE() macro which can now return with p_token held, and
  pass the status to postsig() which then consumes it.

* lwpsignal() now tries very hard to avoid acquiring proc->p_token.

* Significantly improves vkernel operation under heavy (vkernel) IPI loads.

7 years agokernel - Allow VM_FAULT_DIRTY to use a shared lock
Matthew Dillon [Wed, 25 Jan 2017 16:11:57 +0000 (08:11 -0800)]
kernel - Allow VM_FAULT_DIRTY to use a shared lock

* Allows VM_FAULT_DIRTY (write) faults to use a shared object lock as
  long as the evnetual page does not need to be unswapped.

* More than doubles vkernel performance when doing a parallel make
  by removing a major contention spot.

7 years agoprocfs - don't try to count rss
Matthew Dillon [Wed, 25 Jan 2017 16:11:04 +0000 (08:11 -0800)]
procfs - don't try to count rss

* Don't try to count rss.  Scanning individual pages for a 64-bit
  mapping can take forever (literally!).

* Fixes problems accessing /proc/*/map for vkernel processes.

7 years agocputimer: Update comment
Sepherosa Ziehau [Wed, 25 Jan 2017 09:19:38 +0000 (17:19 +0800)]
cputimer: Update comment

7 years agokernel - pmap and vkernel work
Matthew Dillon [Mon, 23 Jan 2017 20:20:23 +0000 (12:20 -0800)]
kernel - pmap and vkernel work

* Remove the pmap.pm_token entirely.  The pmap is currently protected
  primarily by fine-grained locks and the vm_map lock.  The intention
  is to eventually be able to protect it without the vm_map lock at all.

* Enhance pv_entry acquisition (representing PTE locations) to include
  a placemarker facility for non-existant PTEs, allowing the PTE location
  to be locked whether a pv_entry exists for it or not.

* Fix dev_dmmap (struct dev_mmap) (for future use), it was returning a
  page index for physical memory as a 32-bit integer instead of a 64-bit
  integer.

* Use pmap_kextract() instead of pmap_extract() where appropriate.

* Put the token contention test back in kern_clock.c for real kernels
  so token contention shows up as sys% instead of idle%.

* Modify the pmap_extract() API to also return a locked pv_entry,
  and add pmap_extract_done() to release it.  Adjust users of
  pmap_extract().

* Change madvise/mcontrol MADV_INVAL (used primarily by the vkernel)
  to use a shared vm_map lock instead of an exclusive lock.  This
  significantly improves the vkernel's performance and significantly
  reduces stalls and glitches when typing in one under heavy loads.

* The new placemarkers also have the side effect of fixing several
  difficult-to-reproduce bugs in the pmap code, by ensuring that
  shared and unmanaged pages are properly locked whereas before only
  managed pages (with pv_entry's) were properly locked.

* Adjust the vkernel's pmap code to use atomic ops in numerous places.

* Rename the pmap_change_wiring() call to pmap_unwire().  The routine
  was only being used to unwire (and could only safely be called for
  unwiring anyway).  Remove the unused 'wired' and the 'entry'
  arguments.

  Also change how pmap_unwire() works to remove a small race condition.

* Fix race conditions in the vmspace_*() system calls which could lead
  to pmap corruption.  Note that the vkernel did not trigger any of
  these conditions, I found them while looking for another bug.

* Add missing maptypes to procfs's /proc/*/map report.

7 years agolwp: Restore lwp syscalls (except lwp_create*) declaration.
Sepherosa Ziehau [Wed, 25 Jan 2017 02:24:36 +0000 (10:24 +0800)]
lwp: Restore lwp syscalls (except lwp_create*) declaration.

7 years agolwp: Bump version for shuffle lwp syscalls.
Sepherosa Ziehau [Wed, 25 Jan 2017 01:46:40 +0000 (09:46 +0800)]
lwp: Bump version for shuffle lwp syscalls.

7 years agocputimer: Reorder fields a bit to avoid implicit padding.
Sepherosa Ziehau [Tue, 24 Jan 2017 13:42:34 +0000 (21:42 +0800)]
cputimer: Reorder fields a bit to avoid implicit padding.

7 years agocputimer: Initialize explicitly.
Sepherosa Ziehau [Tue, 24 Jan 2017 13:27:42 +0000 (21:27 +0800)]
cputimer: Initialize explicitly.

7 years agovkernel - change hz default, optimize systimer
Matthew Dillon [Mon, 23 Jan 2017 01:15:26 +0000 (17:15 -0800)]
vkernel - change hz default, optimize systimer

* Change the hz default to 50

* Refactor the vkernel's systimer code to reduce unnecessary signaling.

* Cleanup kern_clock.c a bit, including renaming HZ to HZ_DEFAULT to avoid
  confusion.

7 years agosort - Don't live-loop threads
Matthew Dillon [Sun, 22 Jan 2017 23:35:37 +0000 (15:35 -0800)]
sort - Don't live-loop threads

* Worker threads now use a pthread_cond_t to wait for work instead of
  burning the cpu up.

7 years agokernel - Improve vm_page_register_action*() performance.
Matthew Dillon [Sun, 22 Jan 2017 23:28:05 +0000 (15:28 -0800)]
kernel - Improve vm_page_register_action*() performance.

* Improve the performance for vm_page_register_action() and related
  routines by splitting the global lock into per-hash-index locks.
  Also change from a token to lockmgr locks.

* Shift some code around in umtx_sleep() so the tsleep_interlock()
  occurs after the registration code to avoid interference with
  the new lockmgr() operations in the registration code.

7 years agovkernel - Fix vmspace_*() call bottleneck
Matthew Dillon [Sun, 22 Jan 2017 21:47:05 +0000 (13:47 -0800)]
vkernel - Fix vmspace_*() call bottleneck

* Remove a global token in most cases by caching ve's, and hold it shared
  for lookups if it cannot be found in the cache.

7 years agovkernel - Fix races in if_vke.c
Matthew Dillon [Sun, 22 Jan 2017 21:46:20 +0000 (13:46 -0800)]
vkernel - Fix races in if_vke.c

* Fix races in if_vke.c, several cpu_lfence() calls were in the wrong place.

7 years agoif_iwm - Add firmware API definitions for TX power commands.
Imre Vadász [Sun, 22 Jan 2017 21:38:31 +0000 (22:38 +0100)]
if_iwm - Add firmware API definitions for TX power commands.

* While there remove unused IWM_UCODE_TLV_CAPA_LMAC_UPLOAD definition,
  which isn't defined in iwlwifi.

Taken-From: Linux iwlwifi

7 years agokernel/if_wi: Unlock before returning.
Sascha Wildner [Sun, 22 Jan 2017 19:55:29 +0000 (20:55 +0100)]
kernel/if_wi: Unlock before returning.

7 years agovkernel - Fix pv_entry_count bug
Matthew Dillon [Sun, 22 Jan 2017 17:23:37 +0000 (09:23 -0800)]
vkernel - Fix pv_entry_count bug

* Now that we are not protected by a global vm_token, pv_entry_count
  must use atomic ops.

7 years agokernel - Fix NFS sillyrename code
Matthew Dillon [Sun, 22 Jan 2017 16:36:23 +0000 (08:36 -0800)]
kernel - Fix NFS sillyrename code

* Due to the delayed vnode reclamation changes done several years ago
  the NFS client code was not properly removing silly-renamed files
  on last-close (these are files which NFS renames to .nfs* when
  remove()'d while still open()).

* Fixed by flagging finalization on last-close if a sillyrename occurs.

7 years agosched: Add cpuset_t for FreeBSD compat
Sepherosa Ziehau [Sun, 22 Jan 2017 14:25:08 +0000 (22:25 +0800)]
sched: Add cpuset_t for FreeBSD compat

7 years agolibc: Add sched_getcpu().
Sepherosa Ziehau [Thu, 19 Jan 2017 14:03:01 +0000 (22:03 +0800)]
libc: Add sched_getcpu().

7 years agovkernel - Restabilize pmap code, redo kqueue, systimer, and console code
Matthew Dillon [Sun, 22 Jan 2017 07:43:07 +0000 (23:43 -0800)]
vkernel - Restabilize pmap code, redo kqueue, systimer, and console code

* Remove vm_token and add necessary vm_page spin locks to the vkernel's
  pmap code, improving its stability.

* Separate the systimer interrupt and console tty support from the
  kqueue subsystem.

  Uses SIGURG for systimer
  Uses SIGIO for kqueue
  Uses SIGALRM for cothread signalling

* The vkernel systimer code now uses a dedicated cothread for timing.  The
  cothread is a bit of a hack at the moment but is a more direct way of
  handling systimers.

* Attempt to fix user%/sys%/intr%/idle% in the systat -vm and
  systat -pv output.  Still isn't perfect, but it is now more
  accurate.

7 years agovkernel.7 - Update manual page
Matthew Dillon [Fri, 20 Jan 2017 22:46:41 +0000 (14:46 -0800)]
vkernel.7 - Update manual page

* Update the manual page with a better vkernel NFS client example.

7 years agovkernel: Make kptobj a static structure.
Antonio Huete Jimenez [Thu, 19 Jan 2017 08:03:16 +0000 (00:03 -0800)]
vkernel: Make kptobj a static structure.

  - There is a chicken-egg problem while allocating kptobj. Recent changes
    have made vm_object allocation to depend on kmalloc() which will call
    pmap_growkernel() when kptobj is not yet ready.

7 years agokernel: Add a new vm_object_init()
Antonio Huete Jimenez [Wed, 18 Jan 2017 23:59:27 +0000 (15:59 -0800)]
kernel: Add a new vm_object_init()

7 years agokernel: Rename vm_object_init() to vm_object_init1()
Antonio Huete Jimenez [Wed, 18 Jan 2017 22:37:31 +0000 (14:37 -0800)]
kernel: Rename vm_object_init() to vm_object_init1()

  - No functional change.

7 years agovkernel: Fix build
Antonio Huete Jimenez [Thu, 19 Jan 2017 08:02:58 +0000 (00:02 -0800)]
vkernel: Fix build

  - Partially-submitted by: zrj

7 years agolwp: vkernel actually uses some lwp_* functions
Antonio Huete Jimenez [Wed, 18 Jan 2017 22:19:42 +0000 (14:19 -0800)]
lwp: vkernel actually uses some lwp_* functions

7 years agosdhci - Simplify SDHCI_PRESENT_STATE register loop in sdhci_start_command().
Imre Vadász [Wed, 18 Jan 2017 20:34:52 +0000 (21:34 +0100)]
sdhci - Simplify SDHCI_PRESENT_STATE register loop in sdhci_start_command().

Taken-From: FreeBSD (svn r311693)

7 years agosdhci - Add a new interface method, get_card_present.
Imre Vadász [Wed, 18 Jan 2017 20:31:31 +0000 (21:31 +0100)]
sdhci - Add a new interface method, get_card_present.

Taken-From: FreeBSD (svn r311660)

7 years agoSync ACPICA with Intel's version 20170119.
Sascha Wildner [Thu, 19 Jan 2017 17:28:00 +0000 (18:28 +0100)]
Sync ACPICA with Intel's version 20170119.

Just some minor things:

* In iASL, fix an inadvertent remark.

* Remove the compiler bit width from the common signon of all tools.

* Add 2017 copyright.

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

7 years agokernel/acpica: Include <stdarg.h> only for userland compilation.
Sascha Wildner [Thu, 19 Jan 2017 18:21:59 +0000 (19:21 +0100)]
kernel/acpica: Include <stdarg.h> only for userland compilation.

We generally don't include /usr/include/*.h headers in kernel code,
and the kernel doesn't need it.

It also caused issues when compiling with clang (due to redefinitions).

Reported-by: zrj
7 years agoUpdate the pciconf(8) database.
Sascha Wildner [Thu, 19 Jan 2017 17:49:01 +0000 (18:49 +0100)]
Update the pciconf(8) database.

January 8, 2017 snapshot from http://pciids.sourceforge.net/

7 years agocpdup: When verbose, also log the successful creation of a directory.
Sascha Wildner [Wed, 18 Jan 2017 17:44:30 +0000 (18:44 +0100)]
cpdup: When verbose, also log the successful creation of a directory.

7 years agoem/emx: Retry interrupt allocation with MSI
Sepherosa Ziehau [Wed, 18 Jan 2017 09:09:04 +0000 (17:09 +0800)]
em/emx: Retry interrupt allocation with MSI

Reported-by: jh32
7 years agotools/kq_sendrecv: Fix building on FreeBSD
Sepherosa Ziehau [Wed, 18 Jan 2017 05:46:30 +0000 (13:46 +0800)]
tools/kq_sendrecv: Fix building on FreeBSD

7 years agokernel - kmemstatistics list wasn't MPSAFE
Matthew Dillon [Tue, 17 Jan 2017 22:52:22 +0000 (14:52 -0800)]
kernel - kmemstatistics list wasn't MPSAFE

* Put a spinlock around the kmemstatistics list.  This list is modified
  whenever a kmalloc area is created or destroyed, and this generally does
  not happen concurrently except with kernels run by expert hackers like
  us and get scared.

* ...Or if a machine is running synth and/or doing a lot of concurrent
  tmpfs mounts and unmounts.

Reported-by: swildner
7 years agonpx.h: fix comment alignments (cosmetic)
John Marino [Tue, 17 Jan 2017 21:24:57 +0000 (15:24 -0600)]
npx.h: fix comment alignments (cosmetic)

7 years agoExpand fpusave union to include x86_64 versions
John Marino [Tue, 17 Jan 2017 20:00:55 +0000 (14:00 -0600)]
Expand fpusave union to include x86_64 versions

The structure of envmmx remains a constant size, but changes composition
between the i386 and x86_64 versions.  While here, flesh out the
832-byte saveymm structure, also distinguishing between 32 and 64 bit
versions.

While here, convert u_char, u_short, u_int16_t, u_int32_t to standard
integers; <sys/types.h> with it's redundant guards is no longer required
although <stdint> is now needed.

This allows the fpu context to be seen on x86_64 by casting the fpusave
union to the new savexmm64 and saveymm64 structures.

7 years agotools/kq_recvserv: Add option to set receiving thread's CPU affinity.
Sepherosa Ziehau [Tue, 17 Jan 2017 15:47:55 +0000 (23:47 +0800)]
tools/kq_recvserv: Add option to set receiving thread's CPU affinity.

7 years agotools/kq_recvserv: Add option to enable SO_REUSEPORT
Sepherosa Ziehau [Tue, 17 Jan 2017 15:27:41 +0000 (23:27 +0800)]
tools/kq_recvserv: Add option to enable SO_REUSEPORT

7 years agotools/kq_sendcli: Add option to set sending thread's CPU affinity
Sepherosa Ziehau [Tue, 17 Jan 2017 14:58:47 +0000 (22:58 +0800)]
tools/kq_sendcli: Add option to set sending thread's CPU affinity

7 years agotools/kq_recvserv: Add option to set read size
Sepherosa Ziehau [Tue, 17 Jan 2017 14:59:35 +0000 (22:59 +0800)]
tools/kq_recvserv: Add option to set read size

7 years agotool/kq_sendcli: Add option to set write size.
Sepherosa Ziehau [Tue, 17 Jan 2017 14:31:40 +0000 (22:31 +0800)]
tool/kq_sendcli: Add option to set write size.

7 years agotools/kq_sendcli: Add sendfile support.
Sepherosa Ziehau [Tue, 17 Jan 2017 14:18:46 +0000 (22:18 +0800)]
tools/kq_sendcli: Add sendfile support.

Based on work done by QianYue You.

7 years agosdhci - Use the right capability field for printing the bus width.
Imre Vadász [Mon, 16 Jan 2017 12:43:20 +0000 (13:43 +0100)]
sdhci - Use the right capability field for printing the bus width.

* In sdhci_init_slot(), use the right capability field for determining
  the announced bus width based on MMC_CAP_*_BIT_DATA.

Taken-From: FreeBSD (svn r311794)

7 years agolwp: Move all lwp syscalls to sys/lwp.h
Sepherosa Ziehau [Mon, 16 Jan 2017 14:04:28 +0000 (22:04 +0800)]
lwp: Move all lwp syscalls to sys/lwp.h

Discussed-with: swildner, zrj

7 years agoparam: Bump version according to the comment.
Sepherosa Ziehau [Mon, 16 Jan 2017 03:07:59 +0000 (11:07 +0800)]
param: Bump version according to the comment.

7 years agokernel/usb4bsd: Configure the correct bMaxPacketSize for control endpoints.
Imre Vadász [Sun, 15 Jan 2017 09:55:42 +0000 (10:55 +0100)]
kernel/usb4bsd: Configure the correct bMaxPacketSize for control endpoints.

* Configure the correct bMaxPacketSize for control endpoints before
  requesting the initial complete device descriptor and not as part of
  the subsequent babble error recovery. Babble means that the received
  USB packet was bigger than than configured maximum packet size. This
  only affects enumeration of FULL speed USB devices which use a
  bMaxPacketSize different from 8 bytes. This patch might help fix
  enumeration of USB devices which exhibit USB I/O errors in dmesg
  during boot.

Taken-From: FreeBSD (svn r295928)

7 years agoWipe the start of the disk when formatting the disk with MBR, too.
Sascha Wildner [Sun, 15 Jan 2017 19:41:22 +0000 (20:41 +0100)]
Wipe the start of the disk when formatting the disk with MBR, too.

7 years agoinstaller: Add basic UEFI system setup.
Sascha Wildner [Sun, 15 Jan 2017 19:32:06 +0000 (20:32 +0100)]
installer: Add basic UEFI system setup.

GPT partition 0 is a 128MB FAT32 EFI system partition. Microsoft
recommends at least 100MB and FAT32 in [1]. Partition 1 is a
"DragonFly Label64" (aka "dragonfly" in gpt(8)) for the rest of
the disk. It is analogous to slice 1 in our MBR setup, and has the
same name, e.g. /dev/da0s1. The rest of the UEFI setup is identical
to an MBR setup. disklabel64, newfs*, and so forth.

We currently only support installing DragonFly to the whole disk
in UEFI mode, and we don't set any NVRAM EFI variables during
installation, so for now we are copying our stage 1 loader to
\EFI\BOOT\BOOTX64.EFI on the EFI system partition.

Also, there isn't any support for Secure Boot.

[1] https://technet.microsoft.com/en-us/library/hh824839.aspx#DiskPartitionRules

7 years agoAdd a uefi(8) manual page giving some info on the UEFI boot procedure.
Sascha Wildner [Sun, 15 Jan 2017 14:01:29 +0000 (15:01 +0100)]
Add a uefi(8) manual page giving some info on the UEFI boot procedure.

Adapted-from: FreeBSD

7 years agorconfig: Add a script for setting up a HAMMER/UEFI system.
Sascha Wildner [Sun, 15 Jan 2017 14:00:48 +0000 (15:00 +0100)]
rconfig: Add a script for setting up a HAMMER/UEFI system.

7 years agonrelease: Add UEFI mode capable boot media.
Sascha Wildner [Sun, 15 Jan 2017 19:29:03 +0000 (20:29 +0100)]
nrelease: Add UEFI mode capable boot media.

Add an EFI system partition to the IMG (to boot on UEFI systems) but
keep MBR (to boot on legacy BIOS systems).

The approach in https://wiki.freebsd.org/UEFI#CD.2FDVD_Boot_under_UEFI
is used to make the ISO boot on both UEFI and legacy systems.

7 years agopthread: Implement pthread_attr_{get,set}affinity_np
Sepherosa Ziehau [Sun, 15 Jan 2017 08:53:39 +0000 (16:53 +0800)]
pthread: Implement pthread_attr_{get,set}affinity_np

7 years agox86_64: Fix machdep.smp_active sysctl type.
Sepherosa Ziehau [Sun, 15 Jan 2017 08:52:42 +0000 (16:52 +0800)]
x86_64: Fix machdep.smp_active sysctl type.

7 years agolwp: Add lwp_create2 syscll, which takes cpumask for scheduling.
Sepherosa Ziehau [Sat, 14 Jan 2017 13:16:08 +0000 (21:16 +0800)]
lwp: Add lwp_create2 syscll, which takes cpumask for scheduling.

7 years agoif_iwm - Configure the PCIe LTR, fix PCI express capability accesses.
Imre Vadász [Sun, 15 Jan 2017 09:42:49 +0000 (10:42 +0100)]
if_iwm - Configure the PCIe LTR, fix PCI express capability accesses.

Taken-From: Linux iwlwifi

7 years agokernel - Add PCIER_DEVCAP2 and PCIER_DEVCTRL2 definitions to pcireg.h.
Imre Vadász [Sun, 15 Jan 2017 09:43:31 +0000 (10:43 +0100)]
kernel - Add PCIER_DEVCAP2 and PCIER_DEVCTRL2 definitions to pcireg.h.

Partly Taken-From: FreeBSD

7 years agovgapci: Remove verbose printf() messages from pci_(get/set)_powerstate().
Imre Vadász [Sun, 15 Jan 2017 09:45:30 +0000 (10:45 +0100)]
vgapci: Remove verbose printf() messages from pci_(get/set)_powerstate().

7 years ago<stddef.h>: Add max_align_t guards for future reference.
zrj [Sat, 14 Jan 2017 09:39:35 +0000 (11:39 +0200)]
<stddef.h>: Add max_align_t guards for future reference.

There are some confusion how this c++11 feature should be implemented.

7 years agodrm/linux: Remove a redundant definition of NSEC_PER_SEC
François Tigeot [Sat, 14 Jan 2017 09:39:34 +0000 (10:39 +0100)]
drm/linux: Remove a redundant definition of NSEC_PER_SEC

7 years agodrm/linux: Add local_clock()
François Tigeot [Sat, 14 Jan 2017 09:34:35 +0000 (10:34 +0100)]
drm/linux: Add local_clock()

7 years agodrm/linux: Add acpi/video.h
François Tigeot [Sat, 14 Jan 2017 09:25:21 +0000 (10:25 +0100)]
drm/linux: Add acpi/video.h

7 years agoman: Add cross references
Sepherosa Ziehau [Sat, 14 Jan 2017 08:57:55 +0000 (16:57 +0800)]
man: Add cross references

7 years agopthread: Implement pthread_{set,get}affinity_np
Sepherosa Ziehau [Sat, 14 Jan 2017 08:12:40 +0000 (16:12 +0800)]
pthread: Implement pthread_{set,get}affinity_np

7 years agolibc: Take cpusetsize into consideration for sched_getaffinity()
Sepherosa Ziehau [Sat, 14 Jan 2017 08:11:50 +0000 (16:11 +0800)]
libc: Take cpusetsize into consideration for sched_getaffinity()

7 years agolibc: Add const to the cpu_set_t for sched_setaffinity.
Sepherosa Ziehau [Sat, 14 Jan 2017 06:39:36 +0000 (14:39 +0800)]
libc: Add const to the cpu_set_t for sched_setaffinity.

7 years agolibc: Add sched_{set,get}affinity().
Sepherosa Ziehau [Sat, 14 Jan 2017 02:18:55 +0000 (10:18 +0800)]
libc: Add sched_{set,get}affinity().

Same as other sched_ fucntions, these two functions do _not_ support
the overriding pid as tid as what Linux supports.

7 years agosecurity/libressl: Fix ECDSA P-256 timing attack vulnerability
John Marino [Fri, 13 Jan 2017 22:11:37 +0000 (16:11 -0600)]
security/libressl: Fix ECDSA P-256 timing attack vulnerability

OpenBSD 6.0 errata 16, Jan 5, 2017:
Avoid possible side-channel leak of ECDSA private keys when signing.

security: CVE-2016-7056

7 years agoUpdate libressl README.DRAGONFLY for v2.4.4
John Marino [Fri, 13 Jan 2017 22:11:28 +0000 (16:11 -0600)]
Update libressl README.DRAGONFLY for v2.4.4

7 years agoMerge branch 'vendor/LIBRESSL'
John Marino [Fri, 13 Jan 2017 23:15:53 +0000 (17:15 -0600)]
Merge branch 'vendor/LIBRESSL'

7 years agoUpdate LibreSSL from version 2.4.3 => 2.4.4
John Marino [Fri, 13 Jan 2017 22:00:47 +0000 (16:00 -0600)]
Update LibreSSL from version 2.4.3 => 2.4.4

7 years agoif_iwm - Update struct iwm_scan_results_notif. Remove old/unused definitions
Imre Vadász [Fri, 13 Jan 2017 17:00:45 +0000 (18:00 +0100)]
if_iwm - Update struct iwm_scan_results_notif. Remove old/unused definitions

* Remove outdated notifications IWM_SCAN_ABORT_CMD,
  IWM_SCAN_START_NOTIFICATION and IWM_SCAN_RESULTS_NOTIFICATION.

* Remove unused enum iwm_scan_complete_status.

* Use the updated FW Api version 3 of struct iwm_scan_results_notif.

* No functional change, since struct iwm_scan_results_notif is never
  accessed in iwm at the moment.

Taken-From: Linux iwlwifi commits 1083fd7391e989be52022f0f338e9dadc048b063
            and 75118fdb63496e4611ab50380499ddd62b9de69f.

7 years ago<sys/diskmbr.h>: Rename DOSPTYP_GPT to DOSPTYP_EFI.
Sascha Wildner [Thu, 12 Jan 2017 19:33:49 +0000 (20:33 +0100)]
<sys/diskmbr.h>: Rename DOSPTYP_GPT to DOSPTYP_EFI.

The former name was rather misleading since an EFI system partition can
also exist on an MBR disk (see 79363655e5db).

7 years agokernel: Fix GPT detection a bit.
Sascha Wildner [Thu, 12 Jan 2017 18:32:11 +0000 (19:32 +0100)]
kernel: Fix GPT detection a bit.

Having a legacy MBR partition of type 0xef aka EFI system
partition is a perfectly legal case, and it is covered by
the UEFI specification too (in version 2.6, see section 12.3.1).

That means it is not a sufficient indicator that this is a
disk with a GPT, so don't automatically treat it as one. For
the partition in the PMBR on actual GPT disks, type 0xee
will always be used, so that check alone is sufficient for
what is intended here.

Background: Using legacy MBR and having an EFI system
partition at the same time is the layout most USB installation
media use in order to boot on both UEFI and legacy BIOS systems.
The upcoming UEFI installation support work will do the same.

7 years agoacpi - Incidental MPSAFE (2)
Matthew Dillon [Wed, 11 Jan 2017 21:11:48 +0000 (13:11 -0800)]
acpi - Incidental MPSAFE (2)

* The changes in a639f788 revealed bubgs in acpi_thermal's support
  threads.  These threads start executing before the main acpi device
  finishes its attach.  The mplock serialization saved us before, and
  removing it revealed the problem.

* Force serialization using the main acpi lock to prevent the support
  threads from starting up until after the main acpi attach has
  completed.

Reported-by: swildner
7 years agokernel - Change vm.swapcache.use_chflags default to 0
Matthew Dillon [Wed, 11 Jan 2017 19:02:32 +0000 (11:02 -0800)]
kernel - Change vm.swapcache.use_chflags default to 0

* Change the vm.swapcache.use_chflags default to 0, meaning that swapcache
  will generally cache everything it sees if enabled.  Can be set back to
  1 by the sysop when more sophisticated operation is desired.

7 years agokernel - kernel - Incidental MPLOCK removal (usched, affinity)
Matthew Dillon [Wed, 11 Jan 2017 18:02:55 +0000 (10:02 -0800)]
kernel - kernel - Incidental MPLOCK removal (usched, affinity)

* Affinity code needs to be protected via p->p_token and lwp->lwp_token.
  Remove use of the mplock.

* If tid is -1 getaffinity() will lookup the lowest-numbered thread,
  and setaffinity will adjust ALL threads associated with the process.

* usched doesn't need mplock2.h

7 years agokernel - Incidental MPLOCK removal
Matthew Dillon [Wed, 11 Jan 2017 17:47:56 +0000 (09:47 -0800)]
kernel - Incidental MPLOCK removal

* Remove misc #include <sys/mplock2.h> statements that are no longer needed.

* Replace mplock with acct_lock in kern_acct.c

* Replace mplock with msg_token in sysv_msg.c

* Replace mplock with p->p_token in the profiling code.

7 years agousched: Fix the returned CPU affinity make by smp_active_mask.
Sepherosa Ziehau [Wed, 11 Jan 2017 16:09:51 +0000 (00:09 +0800)]
usched: Fix the returned CPU affinity make by smp_active_mask.