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)
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)
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.
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
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/
Sascha Wildner [Wed, 18 Jan 2017 17:44:30 +0000 (18:44 +0100)]
cpdup: When verbose, also log the successful creation of a directory.
Sepherosa Ziehau [Wed, 18 Jan 2017 09:09:04 +0000 (17:09 +0800)]
em/emx: Retry interrupt allocation with MSI
Reported-by: jh32
Sepherosa Ziehau [Wed, 18 Jan 2017 05:46:30 +0000 (13:46 +0800)]
tools/kq_sendrecv: Fix building on FreeBSD
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
John Marino [Tue, 17 Jan 2017 21:24:57 +0000 (15:24 -0600)]
npx.h: fix comment alignments (cosmetic)
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.
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.
Sepherosa Ziehau [Tue, 17 Jan 2017 15:27:41 +0000 (23:27 +0800)]
tools/kq_recvserv: Add option to enable SO_REUSEPORT
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
Sepherosa Ziehau [Tue, 17 Jan 2017 14:59:35 +0000 (22:59 +0800)]
tools/kq_recvserv: Add option to set read size
Sepherosa Ziehau [Tue, 17 Jan 2017 14:31:40 +0000 (22:31 +0800)]
tool/kq_sendcli: Add option to set write size.
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.
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)
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
Sepherosa Ziehau [Mon, 16 Jan 2017 03:07:59 +0000 (11:07 +0800)]
param: Bump version according to the comment.
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)
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.
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
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
Sascha Wildner [Sun, 15 Jan 2017 14:00:48 +0000 (15:00 +0100)]
rconfig: Add a script for setting up a HAMMER/UEFI system.
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.
Sepherosa Ziehau [Sun, 15 Jan 2017 08:53:39 +0000 (16:53 +0800)]
pthread: Implement pthread_attr_{get,set}affinity_np
Sepherosa Ziehau [Sun, 15 Jan 2017 08:52:42 +0000 (16:52 +0800)]
x86_64: Fix machdep.smp_active sysctl type.
Sepherosa Ziehau [Sat, 14 Jan 2017 13:16:08 +0000 (21:16 +0800)]
lwp: Add lwp_create2 syscll, which takes cpumask for scheduling.
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
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
Imre Vadász [Sun, 15 Jan 2017 09:45:30 +0000 (10:45 +0100)]
vgapci: Remove verbose printf() messages from pci_(get/set)_powerstate().
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.
François Tigeot [Sat, 14 Jan 2017 09:39:34 +0000 (10:39 +0100)]
drm/linux: Remove a redundant definition of NSEC_PER_SEC
François Tigeot [Sat, 14 Jan 2017 09:34:35 +0000 (10:34 +0100)]
drm/linux: Add local_clock()
François Tigeot [Sat, 14 Jan 2017 09:25:21 +0000 (10:25 +0100)]
drm/linux: Add acpi/video.h
Sepherosa Ziehau [Sat, 14 Jan 2017 08:57:55 +0000 (16:57 +0800)]
man: Add cross references
Sepherosa Ziehau [Sat, 14 Jan 2017 08:12:40 +0000 (16:12 +0800)]
pthread: Implement pthread_{set,get}affinity_np
Sepherosa Ziehau [Sat, 14 Jan 2017 08:11:50 +0000 (16:11 +0800)]
libc: Take cpusetsize into consideration for sched_getaffinity()
Sepherosa Ziehau [Sat, 14 Jan 2017 06:39:36 +0000 (14:39 +0800)]
libc: Add const to the cpu_set_t for sched_setaffinity.
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.
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
John Marino [Fri, 13 Jan 2017 22:11:28 +0000 (16:11 -0600)]
Update libressl README.DRAGONFLY for v2.4.4
John Marino [Fri, 13 Jan 2017 23:15:53 +0000 (17:15 -0600)]
Merge branch 'vendor/LIBRESSL'
John Marino [Fri, 13 Jan 2017 22:00:47 +0000 (16:00 -0600)]
Update LibreSSL from version 2.4.3 => 2.4.4
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.
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).
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.
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
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.
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
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.
Sepherosa Ziehau [Wed, 11 Jan 2017 16:09:51 +0000 (00:09 +0800)]
usched: Fix the returned CPU affinity make by smp_active_mask.
Sepherosa Ziehau [Mon, 9 Jan 2017 15:48:18 +0000 (23:48 +0800)]
lwp: Add two syscalls to set/get lwp's CPU affinity mask.
Sepherosa Ziehau [Wed, 11 Jan 2017 13:25:57 +0000 (21:25 +0800)]
usched: Implement LWP lazy migration support.
Non-self migration can be achieved by just setting LWP's cpumask,
which is almost costless. The migration will happen upon next
time the target LWP is scheduled.
Reviewed-by: dillon@
Matthew Dillon [Tue, 10 Jan 2017 21:49:00 +0000 (13:49 -0800)]
kernel - Fix recursive module loading (from MPSAFE changes)
* Fix recursive module loading which I broke in the
recent MPSAFE work.
* Fix firmware loader callback deadlock.
* Fixes radeon drm lockup on startx
Reported-by: mneumann
François Tigeot [Tue, 10 Jan 2017 21:46:52 +0000 (22:46 +0100)]
drm/i1915: Disable stolen memory support
Some initialization code paths are not yet enabled, making
it crash-prone on some hardware
Matthew Dillon [Tue, 10 Jan 2017 03:11:47 +0000 (19:11 -0800)]
mmcsd - Wasn't quite MPSAFE, fix startup race (2)
* Needed to rearrange one more thing to report capacity properly.
Matthew Dillon [Tue, 10 Jan 2017 03:08:03 +0000 (19:08 -0800)]
mmcsd - Wasn't quite MPSAFE, fix startup race
* mmcsd was attaching the drive before finishing the softc setup. Being
MPSAFE, the system tried to probe the mmcsd before it could finish the
setup.
* Fixed by shifting things around a little.
Matthew Dillon [Mon, 9 Jan 2017 23:23:33 +0000 (15:23 -0800)]
kernel - Remove mplock in process trap/signal code (non-performance)
* Remove the mplock from paths that no longer need it. This is mostly
incidental, since processes do not usually recover from traps like
SIGBUS or SIGSEGV.
Imre Vadász [Mon, 9 Jan 2017 22:00:42 +0000 (23:00 +0100)]
mmcsd(4): Declare device D_MPSAFE. Move start_transaction to mmcsd thread.
* SD card commands are issued in the mmcsd thread after it takes the bio
command from the queue, so we should do the devstat_start_transaction()
there, instead of directly in mmcsd_strategy().
Matthew Dillon [Mon, 9 Jan 2017 22:38:54 +0000 (14:38 -0800)]
kernel - Make misc crypto functions MPSAFE
* Remove mplock from the crypto device code.
* Implement cryptodev_lock for cryptof_ioctl() and related functions.
* Prevent cryptof functions from imploding on concurrent access.
Matthew Dillon [Mon, 9 Jan 2017 22:38:09 +0000 (14:38 -0800)]
buf - Remove B_ORDERED, Incidental CAM MPSAFE (2)
* Remove bowrite() operation in UFS (use bwrite() instead).
Matthew Dillon [Mon, 9 Jan 2017 22:36:07 +0000 (14:36 -0800)]
kernel - Incidental MPLOCK removal (devfs)
* Fix ordering issues for devfs initialization vs libprop that previously
depended on the MPLOCK.
* Use a private devfs_token for other areas of devfs previously using
the mplock.
* Make /dev/devfs MPSAFE.
Matthew Dillon [Mon, 9 Jan 2017 22:34:11 +0000 (14:34 -0800)]
kernel - Incidental MPLOCK removal
* A few more mplocks in the moutn and umount paths. Also fix a rootmount
case (the latter being non-performance) for completeness.
Matthew Dillon [Mon, 9 Jan 2017 22:28:42 +0000 (14:28 -0800)]
kernel - Incidental MPLOCK removal (non-performance)
* varsym is MPSAFE.
Matthew Dillon [Mon, 9 Jan 2017 22:26:12 +0000 (14:26 -0800)]
kernel - Incidental MPLOCK removal (non-performance)
* proc filterops.
* kernel linkerops and kld code.
* Warn if a non-MPSAFE interrupt is installed.
* Use a private token in the disk messaging core (subr_disk) instead of
the mp token.
* Use a private token for sysv shm adminstrative calls.
* Cleanup.
Matthew Dillon [Mon, 9 Jan 2017 22:22:59 +0000 (14:22 -0800)]
kernel - Remove global debug counters from device path
* Remove global debugging counters from the device path, including
dev_dstrategy(). Improves performance when heavily concurrent I/O
is being performed.
Matthew Dillon [Mon, 9 Jan 2017 22:22:14 +0000 (14:22 -0800)]
kernel - Incidental mplock removal - NTP support
* Make the NTP support functions MPSAFE.
Matthew Dillon [Mon, 9 Jan 2017 22:20:13 +0000 (14:20 -0800)]
kernel - Incidental mplock removal
* We don't need to acquire the mplock when exec'ing the init program.
Matthew Dillon [Mon, 9 Jan 2017 22:03:46 +0000 (14:03 -0800)]
kernel - Make gpio and gpio_led MPSAFE
* Convert to a private lock.
Matthew Dillon [Mon, 9 Jan 2017 22:00:48 +0000 (14:00 -0800)]
acpi - Incidental MPSAFE
* Make ACPI devices MPSAFE (use a private token).
* Make the ACPI interupt MPSAFE.
Matthew Dillon [Mon, 9 Jan 2017 21:58:04 +0000 (13:58 -0800)]
buf - Remove B_ORDERED, Incidental CAM MPSAFE
* Remove support for B_ORDERED. Most drivers ignore it, and it is basically
unusable.
* The CAM "xpt", "pass", and "sg" devices are MPSAFE, flag them
appropriately.
Matthew Dillon [Mon, 9 Jan 2017 21:54:05 +0000 (13:54 -0800)]
kernel - Incidental MPLOCK removal (non-performance)
* Remove the MPLOCK in a ton of places that don't need it or can be
trivially tokenized or locked.
* Mostly non-performance adjustments, though the X server does use
scmouse or sysmouse.
Matthew Dillon [Mon, 9 Jan 2017 21:47:38 +0000 (13:47 -0800)]
sdhci - Use MPSAFE version for the taskqueue and callouts
* Use the MPSAFE version for the taskqueue and callouts.
François Tigeot [Mon, 9 Jan 2017 22:31:14 +0000 (23:31 +0100)]
drm/i915: Revert DisplayPort fast link training feature
DisplayPort fast link training causes screen flickering on some hw combinations
Obtained-from: Linux 4.6.7, Commit
b0f7095f8bd503eddf9a91a258e796da0058f182
François Tigeot [Mon, 9 Jan 2017 22:22:54 +0000 (23:22 +0100)]
drm/i915/psr: Try to program link training times correctly
Increase link training time to 2.5ms, fixing
flickering issues associated with PSR.
Obtained-from: Linux 4.6.7, commit
69205c5c16df0702870179c8419e89cc954bd311
Imre Vadász [Fri, 6 Jan 2017 21:47:28 +0000 (22:47 +0100)]
sdhci - Fix typo, support bits for drive types A,C,D are in capabilities.
* The drive type support flags in the capabilities register (0x40) are for
drive types A,C,D, drive type B is the default setting (value 0) of the
drive strength field in the HOST_CONTROL2 register.
Imre Vadász [Thu, 5 Jan 2017 20:17:49 +0000 (21:17 +0100)]
sdhci - Add some missing register constants, and dump some more registers.
* Adds defines for content of SDHCI_ADMA_ERR and SDHCI_HOST_CONTROL2
registers.
* Add slot type capability bits. These bits should allow recognizing
removable card slots, embedded cards and shared buses (shared bus
supposedly is always comprised of non-removable cards).
* Dump CAPABILITIES2, ADMA_ERR, HOST_CONTROL2 and ADMA_ADDRESS_LOW
registers in sdhci_dumpregs().
Imre Vadász [Thu, 5 Jan 2017 18:34:24 +0000 (19:34 +0100)]
sdhci - Use bus_dmamem_coherent for allocating memory for sdma DMA.
* While there, rename various constants which are related to SDMA (and not
going to be used for ADMA2) from *_DMA_* names to *_SDMA_*.
Sepherosa Ziehau [Mon, 9 Jan 2017 13:33:30 +0000 (21:33 +0800)]
usched: Add USCHED_SET_CPUMASK.
Sepherosa Ziehau [Mon, 9 Jan 2017 05:03:57 +0000 (13:03 +0800)]
test/passdesc: Allow specifying the payload length.
We don't suffer the following bug though.
Inspired-by: FreeBSD https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=181741
Matthew Dillon [Mon, 9 Jan 2017 04:03:38 +0000 (20:03 -0800)]
kernel - Further refactor vmstats, adjust page coloring algorithm
* Further refactor vmstats by tracking adjustments in gd->gd_vmstats_adj
and doing a copyback of the global vmstats into gd->gd_vmstats. All
code critical paths access the localized copy to test VM state, removing
most global cache ping pongs of the global structure. The global
structure 'vmstats' still contains the master copy.
* Bump PQ_L2_SIZE up to 512. We use this to localized the VM page queues.
Make some adjustments to the pg_color calculation to reduce (in fact
almost eliminate) SMP conflicts on the vm_page_queue[] between cpus
when the VM system is operating normally (not paging).
* This pumps the 4-socket opteron test system up to ~4.5-4.7M page
faults/sec in testing (using a mmap/bzero/munmap loop on 16MB x N
processes).
This pumps the 2-socket xeon test system up to 4.6M page faults/sec
with 32 threads (250K/sec on one core, 1M on 4 cores, 4M on 16 cores,
5.6M on 32 threads). This is near the theoretical maximum possible for
this test.
* In this particular page fault test, PC sampling indicates *NO* further
globals are undergoing cache ping-ponging. The PC sampling predominantly
indicates pagezero(), which is expected. The Xeon is zeroing an aggregate
of 22GBytes/sec at 32 threads running normal vm_fault's.
Matthew Dillon [Mon, 9 Jan 2017 00:02:59 +0000 (16:02 -0800)]
kernel - Refactor struct vmstats and vm_zone
* These changes significantly improve the simultaneous non-conflicting
VM fault rate. On our 4-socket opteron (48 cores, which makes a great
test case because its cache mastership stalls are so expensive), the
maximum concurrent VM fault rate increased from ~2.4M/sec to ~3.5M/sec,
and suffers no degredation after topping out.
* Refactor the fields in struct vmstats to separate out mostly
read-only variables from nominally modified variables, reducing
cache mastership stalls.
* Remove vm_shared_hit, vm_shared_count, and vm_shared_miss sysctl
statistics, removing related cache mastership stalls from the
critical path.
* Move the spinlock in vpgqueues to the base of the structure.
* Increase the vmstats slop (how large a negative value can accumulate
in pcpu stats before rolling it up).
* Fix cache mastership stalls in the zalloc() and zfree() paths by
consolidating pcpus elements into its own cache-aligned structure
and giving each pcpu its on znalloc counter.
Matthew Dillon [Sun, 8 Jan 2017 22:06:37 +0000 (14:06 -0800)]
kernel - Remove most global atomic ops for VM page statistics
* Use a pcpu globaldata->gd_vmstats to update page statistics.
* Hardclock rolls the individual stats into the global vmstats structure.
* Force-roll any pcpu stat that goes below -10, to ensure that the low-memory
handling algorithms still work properly.
Matthew Dillon [Sun, 8 Jan 2017 18:13:25 +0000 (10:13 -0800)]
kernel - Reduce size of struct spinlock
* Reduce the size of struct spinlock from 16 to 8 bytes. The description
field was not being used (we use __func__ instead). This reduces
structural bloat for a number of important structures, in particular
reducing sizeof(struct vm_page) from 136 to 128 bytes.
Matthew Dillon [Sun, 8 Jan 2017 18:03:40 +0000 (10:03 -0800)]
kernel - Move vm_page spin locks from pool to vm_page structure
* Move the vm_page spin lock from a pool to per-structure. This does bloat
the vm_page structure, but clears up an area of contention under heavy
VM loads.
Matthew Dillon [Sun, 8 Jan 2017 17:47:29 +0000 (09:47 -0800)]
kernel - Change machdep.pmap_dynamic_delete default
* Enable machdep.pmap_dynamic_delete by default only on machines with
less than 8G of ram, and disable by default on machines with 8G or more.
This feature works, but it imposes an unnecessary performance loss for
workloads which fork/exec/wait/exit a lot (bulk builds), or programs which
mmap and munmap a lot (browsers, perl, other programs).
Sascha Wildner [Sun, 8 Jan 2017 13:33:03 +0000 (14:33 +0100)]
Clean up a bit after the recent CAM work (
075c6d38244abd0b0c8).
Sascha Wildner [Sun, 8 Jan 2017 13:14:30 +0000 (14:14 +0100)]
pfil.9: Remove references to PFIL_MPSAFE (removed in
48e93b2f5147bacf8).
Matthew Dillon [Sun, 8 Jan 2017 08:33:11 +0000 (00:33 -0800)]
kernel - Fix improper mplock in mount path
* VFS_MOUNT() was being called before MNTK_ALL_MPSAFE could be set by
the filesystem, causing the operation to run with the MP token held.
* Add VFCF_MPSAFE to the vfsconf flags and specify it for MPSAFE filesystems
in their VFS_SET() specification. This flag causes MNTK_ALL_MPSAFE to
be set in mount->mnt_kern_flags prior to the VFS_MOUNT() call. Set this
flag for devfs, procfs, tmpfs, nullfs, hammer, and hammer2.
* Primarily effects synth or other bulk-builds which do a lot of mounting.
Matthew Dillon [Sun, 8 Jan 2017 07:32:00 +0000 (23:32 -0800)]
kernel - CAM cleanup 3/N - Remove unnecessary mplocks
* Remove some low-hanging fruit. The mplock is not needed for any
of these paths, they are protected by other locks.
Matthew Dillon [Sun, 8 Jan 2017 07:29:00 +0000 (23:29 -0800)]
kernel - Remove mplock from swapon/swapoff
* The mplock is no longer applicable here, the code is protected by
swap_mtx.
Matthew Dillon [Sun, 8 Jan 2017 07:19:22 +0000 (23:19 -0800)]
kernel - Cleanup PFIL_MPSAFE
* All pfil use cases are MPSAFE, so remove the PFIL_MPSAFE flag entirely
and remove the old mplock wrappers that tested it.
Matthew Dillon [Sun, 8 Jan 2017 07:11:14 +0000 (23:11 -0800)]
kernel - CAM cleanup 2/N - adjust make upgrade
* Remove ncv.ko, nsp.ko, and stg.ko.
Matthew Dillon [Sun, 8 Jan 2017 07:05:59 +0000 (23:05 -0800)]
kernel - Remove unused pmap_list
* pmap_list was used in the (now removed) 32-bit pmap code because
expansion of the kernel_pmap potentially required updating the PT
pages in all existing user pmaps. The 64-bit pmap code does not
need to do this so the list can be removed.
* Removes a global spin-lock from the pmap creation and release path.
Not a major factor for performance but a nice cleanup.
Matthew Dillon [Sun, 8 Jan 2017 07:02:31 +0000 (23:02 -0800)]
kernel - CAM cleanup 1/N - Remove ancient scsi pccard drivers ncv, nsp, stg
* Remove a number of ancient drivers that nobody could possibly be using
any more.
* Remove ncv: NCR 53C500 based SCSI host adapters.
* Remove nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters.
* Remove stg: TMC 18C30, 18C50 based PC Card SCSI host adapters.
Sepherosa Ziehau [Thu, 29 Dec 2016 12:47:10 +0000 (20:47 +0800)]
ifq: Factor out if_classq from altq_classq and use it for default ifq.
This reduces memory foot print for default ifq and could be used
by the upcoming "flow" of FQ-CoDel.
Matthew Dillon [Sat, 7 Jan 2017 03:25:15 +0000 (19:25 -0800)]
kernel - Fix swap issue, implement dynamic pmap PT/PD/PDP deletion (4)
* Track down and fix another bug. pmap_dynamic_delete was imploding
higher level page table pages still being held by higher call levels.
Add a pv_hold count check to avoid the situation.
Matthew Dillon [Sat, 7 Jan 2017 02:06:14 +0000 (18:06 -0800)]
kernel - Implement CPU localization hinting for low level page allocations
* By default vm_page_alloc() and kmem_alloc*() localize to the calling cpu.
* A cpu override may be passed in the flags to make these functions localize
differently.
* Currently implemented as a test only for the pcpu globaldata, idle
thread, and stacks for kernel threads targetted to specific cpus.