jhb [Fri, 19 Aug 2016 20:17:57 +0000 (20:17 +0000)]
MFC 303001: Add PTRACE_VFORK to trace vfork events.
First, PL_FLAG_FORKED events now also set a PL_FLAG_VFORKED flag when
the new child was created via vfork() rather than fork(). Second, a
new PL_FLAG_VFORK_DONE event can now be enabled via the PTRACE_VFORK
event mask. This new stop is reported after the vfork parent resumes
due to the child calling exit or exec. Debuggers can use this stop to
reinsert breakpoints in the vfork parent process before it resumes.
bapt [Fri, 19 Aug 2016 19:26:16 +0000 (19:26 +0000)]
MFC r303354,303373,303404,304045,304192
Set date and time formats back to what they were before CLDR
While CLDR brings us a good and up to date source data to generate locales for
all databses we are using for locales, it is not the case of LC_TIME. Where it
does not defines the informations we need.
Put back all the date and time formats from the old locales.
Make it statically for now (in order to be able to merge it now into
11.0-RELEASE). The generation tools will be updated soon.
That gives us time to properly work on LC_TIME during the 12 timeframe.
While here fix abbreviated month for af_ZA (which are already fixed in CLDR
data upstream)
In locales where AP/PM was not defined before CLDR data, remove again the AP/PM
informations
For locales where AP/PM was defined before CLDR data, keep the CLDR information
which was properly translated.
bdrewery [Fri, 19 Aug 2016 16:56:52 +0000 (16:56 +0000)]
MFC r303929,r303930,r303931,r303932,r303933:
r303929:
Fix -S with -b not atomically updating the destination file.
r303930:
Support -v for -l.
r303931:
Fix -S with -l not being atomic.
r303932:
Fix -b failure not restoring flags on the destination file.
r303933:
Squelch a false-positive Clang static analyzer warning.
vangyzen [Thu, 18 Aug 2016 21:47:00 +0000 (21:47 +0000)]
MFC r304246
PCIe HotPlug: Detect bridges that are not really HotPlug capable
Some devices report that they have an MRL when they actually
do not. Since they always report that the MRL is open, child
devices would be ignored. Try to detect these devices and
ignore their claim of HotPlug support. Specifically,
if there is an open MRL but the Data Link Layer is active,
the MRL is not real.
Revert r303645 to re-enable HotPlug support for slots with
power controllers, since it works correctly in my testing.
Start the DLL state-change timer if Presence /or/ MRL state changes,
along with other conditions. Previously, we started the timer iff
Presence changed. If there is an MRL, it must be closed for power
to be turned on, so Presence is unlikely to change on an MRL-close event.
Add a printf() of interesting registers on HotPlug interrupts and
commands (one from erj@). These were very useful for debugging.
Guard them with bootverbose, since they're spam in normal operation.
In collaboration with: jhb
Relnotes: yes (re-enable HotPlug support for slots with power controllers)
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D7509
badger [Thu, 18 Aug 2016 14:10:36 +0000 (14:10 +0000)]
MFC r302783:
Add explicit detection of KVM hypervisor
Set vm_guest to a new enum value (VM_GUEST_KVM) when kvm is detected and use
vm_guest in conditionals testing for KVM.
Also, fix a conditional checking if we're running in a VM which caught only
the generic VM case, but not more specific VMs (KVM, VMWare, etc.). (Spotted
by: vangyzen).
Sponsored by: Dell Inc.
Approved by: vangyzen (mentor)
tuexen [Thu, 18 Aug 2016 12:51:26 +0000 (12:51 +0000)]
MFC r304146:
Ensure that sctp_it_ctl.cur_it does not point to a free object (during
a small time window).
Thanks to Byron Campen for reporting the issue and
suggesting a fix.
The code was successfully tested with FreeBSD, Linux, Solaris and Windows
guests. This interface is predictably slower (about 2x) then virtio-net,
but it is very helpful for guests not supporting virtio-net by default.
Thanks to Jeremiah Lott and Peter Grehan for doing original heavy lifting.
mav [Thu, 18 Aug 2016 11:15:35 +0000 (11:15 +0000)]
MFC r302947: In AHCI_IRQ_MODE_AFTER mode do not clear interrupts below.
This is probably a NOP change since IS register is not activery used for
interrupts below the shared, but it looked odd to clear interrupts we did
not handle.
mav [Thu, 18 Aug 2016 09:36:45 +0000 (09:36 +0000)]
MFC r303514: Fix NTBT_QP_LINKS negotiation.
I believe it never worked correctly for more the one queue even in Linux.
This fixes case when one of consumer drivers is not loaded on one side,
but its queues still announced as ready if something else brought link up.
mav [Thu, 18 Aug 2016 09:35:31 +0000 (09:35 +0000)]
MFC r303494: Once more refactor KPI between ntb_transport(4) and if_ntb(4).
New design allows to attach multiple consumers to ntb_transport(4) instance.
Previous design obtained from Linux theoretically allowed that, but was not
practically usable (Linux also has only one consumer driver now).
mav [Thu, 18 Aug 2016 09:34:39 +0000 (09:34 +0000)]
MFC r303429, r303437:
Once more refactor KPI between NTB hardware and consumers.
New design allows hardware resources to be split between several consumers.
For example, one BAR can be dedicated for remote memory access, while other
resources can be used for packet transport for virtual Ethernet interface.
And even without resource split, this code allows to specify which consumer
driver should attach the hardware.
From some points this makes the code even closer to Linux one, even though
Linux does not provide the described flexibility.
mav [Thu, 18 Aug 2016 09:30:55 +0000 (09:30 +0000)]
MFC r303266: Postpone ntb_get_msix_info() till we need to negotiate MSIX.
Calling it earlier increases the window when MSIX info may change.
This change does not solve the problem completely, but seems logical.
Complete solution should probably include link reset in case of MSIX
remap to trigger new negotiation, but we have no way to get notified
about that now.
mav [Thu, 18 Aug 2016 09:29:35 +0000 (09:29 +0000)]
MFC r302531: Revert odd change, setting limit registers before base.
I don't know what errata is mentioned there, I was unable to find it, but
setting limit before the base simply does not work at all. According to
specification attempt to set limit out of the present window range resets
it to zero, effectively disabling it. And that is what I see in practice.
Fixing this properly disables access for remote side to our memory until
respective xlat is negotiated and set. As I see, Linux does the same.
mav [Thu, 18 Aug 2016 09:28:59 +0000 (09:28 +0000)]
MFC r302529: Remove callout_reset(link_work) from ntb_transport_attach().
At that point link is quite likely not established yet, so messing with
scratch registers is premature there. Original commit message mentioned
code diff reduction from Linux, but this line is not present in Linux now.
mav [Thu, 18 Aug 2016 09:27:11 +0000 (09:27 +0000)]
MFC r302508: Disable SB01BASE_LOCKUP workaround when split BARs disabled.
For some reason hack with sending MSI-X interrupts by writing to remote
LAPIC memory works only for 32-bit BARs, that are available only if split
BARs mode is enabled in BIOS. If it is not, complain loudly and fall back
to less efficient workaround.
mav [Thu, 18 Aug 2016 09:26:21 +0000 (09:26 +0000)]
MFC r302499: Improve checksum "offload" support.
For compatibility reasons make driver not report any checksum offload by
default, since there is indeed none. But if administrator knows that
interface is used only for local traffic, he can enable fake checksum
offload manually on both sides to save some CPU cycles, since the data
are already protected by CRC32 of PCIe link.
mav [Thu, 18 Aug 2016 09:23:59 +0000 (09:23 +0000)]
MFC r302493: Reimplement doorbell register emulation for NTB_SB01BASE_LOCKUP.
This allows at least first three doorbells to work very close to normal
hardware, properly signaling events to upper layers without spurious or
lost events. Doorbells above the first three may still report spurious
events due to lack of reliable information, but they are rarely used.
mav [Thu, 18 Aug 2016 09:22:11 +0000 (09:22 +0000)]
MFC r302491: Switch ctx_lock from mutex to rmlock.
It is odd idea to serialize different MSI-X vectors. Use of rmlocks
here allows them to execute in parallel, but still protects ctx.
If upper layers require any additional serialization -- they can
do it by themselves.
mav [Thu, 18 Aug 2016 09:18:23 +0000 (09:18 +0000)]
MFC r302484: NewBus'ify NTB subsystem.
This follows NTB subsystem modularization in Linux, tuning it to FreeBSD
native NewBus interfaces. This change allows to support different types
of hardware with different drivers, support multiple NTB instances in a
system, ntb_transport module use for needs other then if_ntb, etc.
mav [Thu, 18 Aug 2016 09:16:59 +0000 (09:16 +0000)]
MFC r302482: Fix NTB_SDOORBELL_LOCKUP workaround.
Since SBARxSZ register can be write-once, it can be unusable for disabling
the SBAR. For such case also set SBARxBASE to zero to not intersect with
config BAR.
1) All situations with glob(3) error return codes are well defined by
POSIX, so rewrite old sporadic errors processing to match those
definitions.
Including subcases:
Both C99 and POSIX directly prohibits any standard function to set errno
to 0. Breaking this rule in 2001 NetBSD hack was imported which attempts
to workaround very limited glob(3) return codes amount.
Use POSIX-compatible workaround now with E2BIG which can't comes from
other functions used instead of prohibited 0.
Process errors happpens in (*readdirfunc)() too, as POSIX requires.
Per POSIX GLOB_NOCHECK should return original pattern,
unmodified, if no matches found. But our code strips all '\'
returning it. Rewrite the code to allow to return original pattern.
GLOB_ERR and gl_errfunc are supposed to work only for real directories
per POSIX, so don't act on missing or plain files for ENOENT or ENOTDIR
(as TODO in the code suggested).
Remove the hack in the manpage describing how to skip ENOENT and ENOTDIR
in gl_errfunc, it is unneeded now.
Per POSIX GLOB_ERR must be considered even if gl_errfunc is not set,
old code skips it in that case.
2) For near MAXPATHLEN long pathes old glob(3) code can operate on
truncated results, prevent it in several places.
3) Results was not sorted according to collate as POSIX requires.
4) globtilde() forget to convert expanded user home dir from multibyte to
wide chars. Moreover, those chars are addded as not protected, so
can be treated as special chars.
5) Backward hack for EILSEQ in g_Ctoc() was not implemented, so all
pathes with illegal byte sequences are skipped as result, implement it now.
6) GLOB_BRACE was somehow broken. First it repeatedly calls glob0() in
globexp1() recursive calls, but glob0() was not supposed to be called
repeatedly in the original code. It finalize results by possible adding
original pattern for no match case, may return GLOB_NOMATCH error and
by sorting all things. Original pattern adding or GLOB_NOMATCH error
can happens each time glob0() called repeatedly, and sorting happens
for one item only, all things are never sorted. Second, f.e. "a{a"
pattern does not match "a{a" file but match "a" file instead.
Third, some errors (f.e. for limits or overflow) can be ignored
by GLOB_BRACE code because it forces return (0).
Add non-finalizing flag to glob0() and make globexp0() wrapper around
recursively called globexp1() to finalize things like glob0() does.
Reorganize braces code to work correctly.
7) Don't allow MB_CUR_MAX * strlen overallocation hits GLOB_LIMIT_STRING
(ARG_MAX) limit, use final string length, not malloced space for it.
kp [Wed, 17 Aug 2016 09:23:40 +0000 (09:23 +0000)]
MFC r302497:
pf: Map hook returns onto the correct error values
pf returns PF_PASS, PF_DROP, ... in the netpfil hooks, but the hook callers
expect to get E<foo> error codes.
Map the returns values. A pass is 0 (everything is OK), anything else means
pf ate the packet, so return EACCES, which tells the stack not to emit an ICMP
error message.
ache [Wed, 17 Aug 2016 09:07:43 +0000 (09:07 +0000)]
MFC r302831
To mimic system glob, we definitely don't need manual upper/lower hack.
The author clearly disagree in the comment, so this patch will be not
submitted upstream.
ache [Wed, 17 Aug 2016 08:51:47 +0000 (08:51 +0000)]
MFC r302824
1) Eliminate possibility to call __*collate_range_cmp() with inclomplete
locale (which cause core dump) by removing whole 'table' argument
by which it passed.
2) Restore __collate_range_cmp() in __sccl().
3) Collating [a-z] range in regcomp() work only for single bytes locales
(we can't do it now for other ones). In previous code only first 256
wchars are considered and all others are just silently dropped from the
range.
dim [Tue, 16 Aug 2016 18:56:56 +0000 (18:56 +0000)]
Similar to r256297, disable assertions in llvm and clang for the
stable/11 branch. This reduces the size of the clang executable, and
improves its performance. Also bump FREEBSD_CC_VERSION to make some
version number room for the branch.
manu [Tue, 16 Aug 2016 09:12:45 +0000 (09:12 +0000)]
MFC r303974:
ename pcduino3b.dts to pcduino3.dts
The only difference between 3 and 3B is the size of the RJ45 port.
And now we have a uboot port that expect pcduino3.dts to be present.
jhb [Mon, 15 Aug 2016 21:10:41 +0000 (21:10 +0000)]
MFC 302900,302902,302921,303461,304009:
Add a mask of optional ptrace() events.
302900:
Add a test for user signal delivery.
This test verifies we get the correct ptrace event details when a signal
is posted to a traced process from userland.
302902:
Add a mask of optional ptrace() events.
ptrace() now stores a mask of optional events in p_ptevents. Currently
this mask is a single integer, but it can be expanded into an array of
integers in the future.
Two new ptrace requests can be used to manipulate the event mask:
PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK
sets the current event mask.
The current set of events include:
- PTRACE_EXEC: trace calls to execve().
- PTRACE_SCE: trace system call entries.
- PTRACE_SCX: trace syscam call exits.
- PTRACE_FORK: trace forks and auto-attach to new child processes.
- PTRACE_LWP: trace LWP events.
The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have
been replaced by PTRACE_SCE and PTRACE_SCX. PTRACE_FORK replaces
P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS.
The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for
compatibility but now simply toggle corresponding flags in the
event mask.
While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both
modify the event mask and continue the traced process.
302921:
Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL.
303461:
Note that not all optional ptrace events use SIGTRAP.
New child processes attached due to PTRACE_FORK use SIGSTOP instead of
SIGTRAP. All other ptrace events use SIGTRAP.
304009:
Remove description of P_FOLLOWFORK as this flag was removed.
rstone [Mon, 15 Aug 2016 15:23:45 +0000 (15:23 +0000)]
MFC r303836
Don't enqueue NULL on a drbr
In one corner case in the bxe TX path, a NULL mbuf could be enqueued onto
a drbr queue. This could case a KASSERT to fire with INVARIANTS enabled,
or the processing of packets from the queue to be prematurely ended later
on.
Submitted by: Matt Joras (matt.joras AT isilon.com)
Reviewed by: davidcs
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7041
ed [Mon, 15 Aug 2016 11:16:43 +0000 (11:16 +0000)]
MFC r303923:
Make cpu_set_user_tls() work when called on the running thread.
On all the other architectures, this function can also be called on the
currently running thread. In this case, we shouldn't fix up the address
in the PCB, but also patch up the register itself. Otherwise it will not
become active and will simply become overwritten by the next switch.
hselasky [Mon, 15 Aug 2016 09:07:26 +0000 (09:07 +0000)]
MFC r303870:
Fix for use after free.
Clear the device description to avoid use after free because the
bsddev is not destroyed when the mlx5en module is unloaded. Only when
the parent mlx5 module is unloaded the bsddev is destroyed. This fixes
a panic on listing sysctls which refer strings in the bsddev after the
mlx5en module has been unloaded.
hselasky [Mon, 15 Aug 2016 08:58:55 +0000 (08:58 +0000)]
MFC r303765:
Keep a reference count on USB keyboard polling to allow recursive
cngrab() during a panic for example, similar to what the AT-keyboard
driver is doing.
hselasky [Mon, 15 Aug 2016 08:56:25 +0000 (08:56 +0000)]
MFC r303837:
Switch to the new block based LRO input function for the mlx5en
driver. This change significantly increases the overall RX aggregation
ratio for heavily loaded networks handling 10-80 thousand simultaneous
connections.
Remove the turbo LRO code and all references to it which has now been
superceeded by the tcp_lro_queue_mbuf() function.
bapt [Sun, 14 Aug 2016 22:43:48 +0000 (22:43 +0000)]
MFC: r303685
truss: fix uninitialized trussinfo->curthread in add_threads()/enter_syscall
trussinfo->curthread must be initialized before calling enter_syscall(),
it is used by t->proc->abi->fetch_args().
Without that truss is segfaulting and the attached program also crash.
ae [Sun, 14 Aug 2016 20:19:47 +0000 (20:19 +0000)]
MFC r303374:
Due to dropped mbuf in netisr queue route(8) can fall into infinity
loop of reading the rtsock's feed. When it used by some scripts,
this leads to growing number of not finished route(8) instances and
thus growing number of rtsock consumers. Add SIGALRM handler to prevent this.