Commit Graph

250168 Commits

Author SHA1 Message Date
Adrian Chadd
5add701776 [ath_rate_sample] Fix logic for determining whether to bump up an MCS rate.
* Fix formatting, cause reasons;
* Put back the "and the chosen rate is within 90% of the current rate" logic;
* Ensure the best rate and the current rate aren't the same; this ...
* ... fixes the packets_since_switch[] tracking to actually conut how many
  frames since the rate switched, so now I know how stable stuff is; and
* Ensure that MCS can go up to a higher MCS at this or any other spatial stream.
  My previous quick hack attempt was doing > rather than >= so you had to go
  to both a higher root MCS rate (0..7) and spatial stream. Eg, you couldn't
  go from MCS0 (1ss) to MCS8 (2ss) this way.

The best rate and switching rate logic still have a bunch more work to do
because they're still quite touchy when it comes to average tx time but at least
now it's choosing higher rates correctly when it wants to try a higher rate.

Tested:

* AR9380, STA mode
2020-05-16 01:56:06 +00:00
Colin Percival
2e09b2590e Send Lid status notification via devd from acpi_lid_status_update.
Some laptops don't send ACPI "lid status changed" notifications upon
opening the lid if the system was currently suspended.  In r358219
this was partially fixed, updating the "lid_status" variable upon
resume even if there is no "status changed" notification from ACPI.

Unfortunately the fix in r358219 did not include notifying userland
via devd; this causes problems on systems using upowerd (e.g. KDE),
since upowerd remembers the most recent devd notification about the
lid status rather than querying the sysctl to get the current status.

This showed up as two symptoms when KDE's "When laptop lid closed: Sleep"
option is set:
1. 50% of the time, closing the lid would not trigger S3 sleep.
2. 50% of the time, plugging/unplugging AC power would trigger S3 sleep.

PR:		246477
MFC after:	3 days
2020-05-16 01:50:28 +00:00
Mark Johnston
c1be839971 pf: Add a new zone for per-table entry counters.
Right now we optionally allocate 8 counters per table entry, so in
addition to memory consumed by counters, we require 8 pointers worth of
space in each entry even when counters are not allocated (the default).

Instead, define a UMA zone that returns contiguous per-CPU counter
arrays for use in table entries.  On amd64 this reduces sizeof(struct
pfr_kentry) from 216 to 160.  The smaller size also results in better
slab efficiency, so memory usage for large tables is reduced by about
28%.

Reviewed by:	kp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24843
2020-05-16 00:28:12 +00:00
Christian S.J. Peron
cfc1018761 Fix typo that snuck in
Reported by:	Jose Luis Duran
MFC after:	1 week
2020-05-15 23:44:52 +00:00
John Baldwin
4d48b0cf29 Don't remove ubsec(4) manual page for WITHOUT_USB=yes.
In head this manpage has been removed entirely, but ubsec(4) is a PCI
device and not a USB device.

MFC after:	1 week
2020-05-15 22:56:59 +00:00
John Baldwin
713d00e7b6 Remove Doxyfile for sys/dev/ubsec since it has been removed. 2020-05-15 22:55:49 +00:00
John Baldwin
f13fe6f8e9 Remove the ubsecstats tool since ubsec(4) has been removed.
Reported by:	markj
2020-05-15 22:55:28 +00:00
Christian S.J. Peron
2182de2dd3 Bump revision date to today.
MFC after:	1 week
2020-05-15 20:29:41 +00:00
Christian S.J. Peron
61a33bf98c Remove references to pdwait4(2). This syscall was never implemented
and its presence just creates confusion.

Discussed with:	cem
MFC after:	1 week
2020-05-15 20:24:08 +00:00
Adrian Chadd
af72b23b65 [ath] [ath_rate_sample] le oops, trim out an #if 1 that I didn't fully delete.
Cool, so now I know it's about 3 weeks between starting on freebsd coding
and breaking the build again. Queue dunce cap.
2020-05-15 20:03:53 +00:00
Adrian Chadd
cce6344402 [ath] [ath_rate] Extend ath_rate_sample to better handle 11n rates and aggregates.
My initial rate control code was .. suboptimal.  I wanted to at least get MCS
rates sent, but it didn't do anywhere near enough to handle low signal level links
or remotely keep accurate statistics.

So, 8 years later, here's what I should've done back then.

* Firstly, I wasn't at all tracking packet sizes other than the two buckets
  (250 and 1600 bytes.)  So, extend it to include 4096, 8192, 16384, 32768 and
  65536.  I may go add 2048 at some point if I find it's useful.

  This is important for a few reasons.  First, when forming A-MPDU or AMSDU
  aggregates the frame sizes are larger, and thus the TX time calculation
  is woefully, increasingly wrong.  Secondly, the behaviour of 802.11 channels
  isn't some fixed thing, both due to channel conditions and radios themselves.
  Notably, there was some observations done a few years ago on 11n chipsets
  which noticed longer aggregates showed an increase in failed A-MPDU sub-frame
  reception as you got further along in the transmit time.  It could be due to
  a variety of things - transmitter linearity, channel conditions changing,
  frequency/phase drift, etc - but the observation was to potentially form
  shorter aggregates to improve BER.

* .. and then modify the ath TX path to report the length of the aggregate sent,
  so as the statistics kept would line up with the correct bucket.

* Then on the rate control look-up side - i was also only using the first frame
  length for an A-MPDU rate control lookup which isn't good enough here.
  So, add a new method that walks the TID software queue for that node to
  find out what the likely length of data available is.  It isn't ALL of the
  data in the queue because we'll only ever send enough data to fit inside the
  block-ack window, so limit how many bytes we return to roughly what ath_tx_form_aggr()
  would do.

* .. and cache that in the first ath_buf in the aggregate so it and the eventual
  AMPDU length can be returned to the rate control code.

* THEN, modify the rate control code to look at them both when deciding which bucket
  to attribute the sent frame on.  I'm erring on the side of caution and using the
  size bucket that the lookup is based on.

Ok, so now the rate lookups and statistics are "more correct".  However, MCS rates
are not the same as 11abg rates in that they're not a monotonically incrementing
set of faster rates and you can't assume that just because a given MCS rate fails,
the next higher one wouldn't work better or be a lower average tx time.

So, I had to do a bunch of surgery to the best rate and sample rate math.
This is the bit that's a WIP.

* First, simplify the statistics updates (update_stats()) to do a single pass on
  all rates.
* Next, make sure that each rate average tx time is updated based on /its/ failure/success.
  Eg if you sent a frame with { MCS15, MCS12, MCS8 } and MCS8 succeeded, MCS15 and MCS
  12 would have their average tx time updated for /their/ part of the transmission,
  not the whole transmission.
* Next, EWMA wasn't being fully calculated based on the /failures/ in each of the
  rate attempts.  So, if MCS15, MCS12 failed above but MCS8 didn't, then ensure
  that the statistics noted that /all/ subframes failed at those rates, rather than
  the eventual set of transmitted/sent frames.   This ensures the EWMA /and/ average
  TX time are updated correctly.
* When picking a sample rate and initial rate, probe rates aroud the current MCS
  but limit it to MCS0..7 /for all spatial streams/, rather than doing crazy things
  like hitting MCS7 and then probing MCS8 - MCS8 is basically MCS0 but two spatial
  streams.  It's a /lot/ slower than MCS7.  Also, the reverse is true - if we're at
  MCS8 then don't probe MCS7 as part of it, it's not likely to succeed.
* Fix bugs in pick_best_rate() where I was /immediately/ choosing the highest MCS
  rate if there weren't any frames yet transmitted.  I was defaulting to 25% EWMA and
  .. then each comparison would accept the higher rate.  Just skip those; sampling
  will fill in the details.

So, this seems to work a lot better.  It's not perfect; I'm still seeing a lot of
instability around higher MCS rates because there are bursts of loss/retransmissions
that aren't /too/ bad.  But i'll keep iterating over this and tidying up my hacks.

Ok, so why this still something I'm poking at? rather than porting minstrel_ht?

ath_rate_sample tries to minimise airtime, not maximise throughput.  I have
extended it with an EWMA based on sub-frame success/failures - high MCS rates
that have partially successful receptions still show super short average frame
times, but a /lot/ of retransmits have to happen for that to work.
So for MCS rates I also track this EWMA and ensure that the rates I'm choosing
don't have super crappy packet failures.  I don't mind not getting lower
peak throughput versus minstrel_ht; instead I want to see if I can make "minimise
airtime" work well.

Tested:

* AR9380, STA mode
* AR9344, STA mode
* AR9580, STA/AP mode
2020-05-15 18:51:20 +00:00
Michael Reifenberger
9a8fc6bba3 Introduce sysputpage() to display large page size with human readable format.
Using UI units allows to fit larger numbers in columns.
Stop calling v_page_size - this is a value that doesn't change at runtime.
Renamed WINDOW *wnd to *wd to avoid conflict with global *wnd variable.
Use bit-shift to convert page size to byte.

PR:             246458
Submitted by:   ota@j.email.ne.jp
MFC after: 2 weeks
Differential Revision:  D24834
2020-05-15 17:37:08 +00:00
Conrad Meyer
8a68ae80f6 vmm(4), bhyve(8): Expose kernel-emulated special devices to userspace
Expose the special kernel LAPIC, IOAPIC, and HPET devices to userspace
for use in, e.g., fallback instruction emulation (when userspace has a
newer instruction decode/emulation layer than the kernel vmm(4)).

Plumb the ioctl through libvmmapi and register the memory ranges in
bhyve(8).

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D24525
2020-05-15 15:54:22 +00:00
Michael Tuexen
e240ce42bf Allow only IPv4 addresses in sendto() for TCP on AF_INET sockets.
This problem was found by looking at syzkaller reproducers for some other
problems.

Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D24831
2020-05-15 14:06:37 +00:00
Randall Stewart
777b88d60f This fixes several skyzaller issues found with the
help of Michael Tuexen. There was some accounting
errors with TCPFO for bbr and also for both rack
and bbr there was a FO case where we should be
jumping to the just_return_nolock label to
exit instead of returning 0. This of course
caused no timer to be running and thus the
stuck sessions.

Reported by: Michael Tuexen and Skyzaller
Sponsored by: Netflix Inc.
Differential Revision:	https://reviews.freebsd.org/D24852
2020-05-15 14:00:12 +00:00
Konstantin Belousov
a2b127ae7b Improve comment for compat32 handling of sysctl hw.pagesizes.
Explain why truncation works as intended.
Reformat.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2020-05-15 13:53:10 +00:00
Konstantin Belousov
6820cbed71 Revert r361077 to recommit with proper message. 2020-05-15 13:52:39 +00:00
Konstantin Belousov
e00594d962 Implement RTLD_DEEPBIND.
PR:	246462
Tested by:	Martin Birgmeier <d8zNeCFG@aon.at>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D24841
2020-05-15 13:50:08 +00:00
Andrew Turner
fd1f4df2be Remove arm64_idcache_wbinv_range as it's unused.
Sponsored by:	Innovate UK
2020-05-15 13:33:48 +00:00
Hans Petter Selasky
160c25d031 Assign process group of the TTY under the "proctree_lock".
This fixes a race where concurrent calls to doenterpgrp() and
leavepgrp() while TIOCSCTTY is executing may result in tp->t_pgrp
changing value so that tty_rel_pgrp() misses clearing it to NULL. For
more details refer to the use of pgdelete() in the kernel.

No functional change intended.

Panic backtrace:
__mtx_lock_sleep() # page fault due to using destroyed mutex
tty_signal_pgrp()
tty_ioctl()
ptsdev_ioctl()
kern_ioctl()
sys_ioctl()
amd64_syscall()

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-05-15 12:47:39 +00:00
Benedict Reuschling
44318fb2f9 Fix SYNPOSIS section to point to the proper include directive.
netgraph(3) points to #include <netgraph/netgraph.h>, which is kernel only.
The man page refers to the user-space part of the netgraph module, which is
located in <netgraph.h>.

Submitted by:	lutz_donnerhacke.de
Approved by:	bcr
Differential Revision:	https://reviews.freebsd.org/D23814
2020-05-15 12:04:39 +00:00
Konstantin Belousov
1659238a0c Implement RTLD_DEEPBIND.
PR:	246462
Tested by:	Martin Birgmeier <d8zNeCFG@aon.at>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D24841
2020-05-15 11:58:01 +00:00
Aleksandr Fedorov
8ffb1c8ce1 bhyve: Fix processing of netgraph backend options.
After r360820, additional parameters are passed through the argument 'opts', and the name of the backend through the argument 'devname'. So, there is no need to skip the backend name from the 'opts' argument.
2020-05-15 11:03:27 +00:00
Conrad Meyer
02ec64dffc ObsoleteFiles: pdwait4.2.gz
A belated follow-up to r320058.
2020-05-15 03:54:25 +00:00
Ryan Moeller
66005c453d jail: Add exec.prepare and exec.release command hooks
This change introduces new jail command hooks that run before and after any
other actions.

The exec.prepare hook can be used for example to invoke a script that checks
if the jail's root exists, creating it if it does not. Since arbitrary
variables in jail.conf can be passed to the command, it can be pretty useful
for templating jails.

An example use case for exec.release would be to remove the filesystem of an
ephemeral jail.

The names "prepare" and "release" are borrowed from the names of similar hooks
in libvirt.

Reviewed by:	jamie, manpages, mmacy
Approved by:	mmacy (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24829
2020-05-14 23:38:11 +00:00
Kyle Evans
1d2e31af14 pf tests: fix up a couple WARNS= 6 nits
common_init_tbl is only used within this single CU, so it should be marked
static.

WARNS=6 also complained about the var defined by
`ATF_TC_WITH_CLEANUP(getastats);` being unused, which turns out to be
because it's not been hooked up in ATF_TP_ADD_TCS. kp@ did not immediately
recall any reason for this, and the case passes on my local system, so hook
it up.

Note that I've not yet set WARNS= 6 here. Investigation is underway to see
if we can feasibly default WARNS to 6 for src builds to catch directories
too deep to inherit a WARNS from the top-level subdirectories' Makefile.inc.
Those particular WARNS settings will be subsequently removed as they become
redundant with a more-global default.

MFC after:	1 week
2020-05-14 23:20:58 +00:00
Peter Grehan
ec048c7550 Hide host CPUID 0x15 TSC/Crystal ratio/freq info from guest
In recent Linux (5.3+) and OpenBSD (6.6+) kernels, and with hosts that
support CPUID 0x15, the local APIC frequency is determined directly
from the reported crystal clock to avoid calibration against the 8254
timer.

However, the local APIC frequency implemented by bhyve is 128MHz, where
most h/w systems report frequencies around 25MHz. This shows up on
OpenBSD guests as repeated keystrokes on the emulated PS2 keyboard
when using VNC, since the kernel's timers are now much shorter.

Fix by reporting all-zeroes for CPUID 0x15. This allows guests to fall
back to using the 8254 to calibrate the local APIC frequency.

Future work could be to compute values returned for 0x15 that would
match the host TSC and bhyve local APIC frequency, though all dependencies
on this would need to be examined (for example, Linux will start using
0x16 for some hosts).

PR:	246321
Reported by:	Jason Tubnor (and tested)
Reviewed by:	jhb
Approved by:	jhb, bz (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D24837
2020-05-14 22:18:12 +00:00
Konstantin Belousov
dcc6ef1644 Add memalign(3), mostly for glibc compatibility.
Reviewed by:	emaste, imp (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D24307
2020-05-14 21:12:08 +00:00
Konstantin Belousov
0532a7a2df Fix r361037.
Reorder flag manipulations and use barrier to ensure that the program
order is followed by compiler and CPU, for unlocked reader of so_state.

In collaboration with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D24842
2020-05-14 20:17:09 +00:00
Jakub Wojciech Klama
134e17798c Import lib9p 7ddb1164407da19b9b1afb83df83ae65a71a9a66.
Approved by:	trasz
MFC after:	1 month
Sponsored by:	Conclusive Engineering (development), vStack.com (funding)
2020-05-14 19:57:52 +00:00
Mark Johnston
b19149bc56 Fix the i386 build after r361033.
Reported by:	Jenkins
2020-05-14 17:56:44 +00:00
Konstantin Belousov
39845728a1 Fix spurious ENOTCONN from closed unix domain socket other' side.
Sometimes, when doing read(2) over unix domain socket, for which the
other side socket was closed, read(2) returns -1/ENOTCONN instead of
EOF AKA zero-size read. This is because soreceive_generic() does not
lock socket when testing the so_state SS_ISCONNECTED|SS_ISCONNECTING
flags. It could end up that we do not observe so->so_rcv.sb_state bit
SBS_CANTRCVMORE, and then miss SS_ flags.

Change the test to check that the socket was never connected before
returning ENOTCONN, by adding all state bits for connected.

Reported and tested by:	pho
In collaboration with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D24819
2020-05-14 17:54:08 +00:00
Kyle Evans
26a4a61a28 inetd(8): Add comments to all examples
Submitted by:	debdrup (with some minor changes by kevans)
Reviewed by:	bcr (manpages)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D24818
2020-05-14 17:52:29 +00:00
Ed Maste
e7acb013a1 ObsoleteFiles.inc: use date (not xxxx) for ubsec removal 2020-05-14 17:19:07 +00:00
Mark Johnston
e76aab6ae2 Call acpi_pxm_set_proximity_info() slightly earlier on x86.
This function is responsible for setting pc_domain in each pcpu
structure.  Call it from the main function that starts APs, rather than
a separate SYSINIT.  This makes it easier to close the window where
UMA's per-CPU slab allocator may be called while pc_domain is
uninitialized.  In particular, the allocator uses pc_domain to allocate
domain-local pages, so allocations before this point end up using domain
0 for everything.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24757
2020-05-14 16:07:27 +00:00
Mark Johnston
dc2b320563 Allocate UMA per-CPU counters earlier.
Otherwise anything counted before SI_SUB_VM_CONF is discarded.  However,
it is useful to be able to see stats from allocations done early during
boot.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24756
2020-05-14 16:06:54 +00:00
Mark Johnston
821c4e77c5 Assert that page table traversal functions don't operate on superpages.
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24828
2020-05-14 15:49:37 +00:00
Benedict Reuschling
9367806da8 Add new stats(7) man page and hook it up to the build.
This man page contains stat utilities that are available in
the base system. This is a better approach than looking them
up via "apropos stat" or similar commands.

Thanks to Daniel Ebdrup Jensen for writing the original page
and incorporating the feedback given.

Submitted by:	Daniel Ebdrup Jensen
Reviewed by:	0mp, allanjude, brueffer, bcr
Approved by:	bcr
MFC after:	3 days
Relnotes:	yes (new stats(7) man page)
Differential Revision:	https://reviews.freebsd.org/D24417
2020-05-14 09:18:50 +00:00
Adrian Chadd
3347e196e2 [ath] Extend the colours to 4, not 2.
There's 8 bins in the upcoming changeset to ath/ath_rate, so I need
more colours.  Yeah, I know.
2020-05-14 05:01:18 +00:00
Brandon Bergren
3dbb9df36b [PowerPC] Fix wrong instructions in _savegpr_X.
We were accidentally using stfd instead of stw in our SAVEGPR macro.

This has almost certainly been causing crashes when compiling with -Os.

Reviewed by:	jhibbits (in irc)
MFC after:	3 days
Sponsored by:	Tag1 Consulting, Inc.
2020-05-14 04:00:35 +00:00
Kyle Evans
5e6c628e4f certctl: follow-up to r361022, prune blacklist as well
Otherwise, removals from the blacklist may not get processed as they should.

While we're here, restructure these to not bother with mkdir(1) if we've
already tested them to exist.

MFC after:	3 days
2020-05-14 03:30:27 +00:00
Kyle Evans
bb33c91077 certctl(8): don't completely nuke $CERTDESTDIR
It's been reported/noted that a well-timed `certctl rehash` will completely
obliterate $CERTDESTDIR, which may get used by ports or system
administrators. While we can't guarantee the certctl semantics when other
non-certctl-controlled bits live here, we should make some amount of effort
to play nice.

Pruning all existing links, which we'll subsequently rebuild as needed, is
sufficient for our needs. This can still be destructive, but it's perhaps
less likely to cause issues.

I also note that we should probably be pruning /etc/ssl/blacklisted upon
rehash as well.

Reported by:	cem's dovecot server
MFC after:	3 days
2020-05-14 03:25:12 +00:00
Conrad Meyer
b21ae0ff6f vfs_extattr: Allow extattr names up to the full max
Extattr names are allowed to be 255 bytes -- not 254 bytes plus trailing
NUL.  Provide a 256 buffer so that copyinstr() has room for the trailing
NUL.

Re-enable test for maximal name lengths.

PR:		208965
Reported by:	asomers
Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D24584
2020-05-14 03:01:23 +00:00
Li-Wen Hsu
b18e0a534f Only skip sys.net.if_clone_test.epair_stress in CI env
PR:		246443
Sponsored by:	The FreeBSD Foundation
2020-05-13 20:37:46 +00:00
Li-Wen Hsu
bf3dd13d41 Temporarily skip sys.net.if_bridge_test.stp in CI as it always times out
PR:		244229
Sponsored by:	The FreeBSD Foundation
2020-05-13 20:36:38 +00:00
Li-Wen Hsu
40988c2456 Temporarily skip sys.net.if_clone_test.epair_stress
This case timed out so often

PR:		246443
Sponsored by:	The FreeBSD Foundation
2020-05-13 19:29:14 +00:00
Warner Losh
fd26063f4a Add nvd alias back to nda now that it actually works. 2020-05-13 19:17:35 +00:00
Warner Losh
ae1cce524e Reimplement aliases in geom
The alias needs to be part of the provider instead of the geom to work
properly. To bind the DEV geom, we need to look at the provider's names and
aliases and create the dev entries from there. If this lives in the GEOM, then
it won't propigate down the tree properly. Remove it from geom, add it provider.

Update geli, gmountver, gnop, gpart, and guzip to use it, which handles the bulk
of the uses in FreeBSD. I think this is all the providers that create a new name
based on their parent's name.
2020-05-13 19:17:28 +00:00
John Baldwin
f272bc03cc Trim a few more things I missed from xform_enc.h.
An extern declaration for the now-removed Blowfish encryption
transform, and an include of the DES header.
2020-05-13 18:36:02 +00:00
John Baldwin
07a34ce381 Remove unused header for DES.
The NFS port doesn't use any of the DES functions.
2020-05-13 18:35:02 +00:00