jhb@ pointed out an extra plural in this phrase and a gramatical error,
so reword a little to be less awkward to fix both issues.
Sponsored by: Netflix
The original %b description string is wrong.
Sponsored by: The FreeBSD Foundation
Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D30805
Fix a last minute change from d4a4960c65
based on review feedback in where a function now gets called before
it is declared which did not fully get merged back to my commit branch.
Noticed by: CI, jkim
MFC after: 10 days
X-MFC with: d4a4960c65
Sponsored-by: The FreeBSD Foundation
Some code manually calls local_bh_disable() and spin_lock() but
then calls spin_unlock_bh() (or vice versa).
Our code then calls local_bh_disable() again from spin_lock()
which means we have the thread pin count increased twice and that
means we get out of synch and are still pinned when returning to
user space.
Avoid this by adding the explicit local_bh_{enable,disable}() to
the spin_[un]lock_bh() versions.
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30711
In sg_pcopy_from_buffer() is an error in that skip can underflow
and lead to bogus page arithmetics which may lead to memory corruption
or more likely panics. Once we found a s/g page to copy into there
is nothing to skip anymore so simply set skip to 0.
Sponsored by: The FreeBSD Foundation
MFC after: 5 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30676
Restructure some code and add support for various "managed" versions
for PCI resource management.
This is beyond of what iwlwifi needs but some was found with other
wireless drivers and it mostly all goes together.
Add one FreeBSD sepcific feature returning the resource rather than
the handle to allow us to use bus_*() functions in drivers directly.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30558
Given we are manually setting up the "device" in PCI in some cases,
we need to initialise the list and lock for device devres here as well
as otherwise we will panic on the uninitialised lock.
Sponsored by: The FreeBSD Foundation
MFC after: 5 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30681
Move request_irq() to an internal function which serves request_irq()
and the newly added request_threaded_irq() and devm_request_threaded_irq().
Likewise factor out parts of free_irq() to also be used with
devm_free_irq(). Add the storage and call to a thread_handler in case
of IRQ_WAKE_THREAD.
This is needed for the iwlwifi driver.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30549
Add dummy functions for dealing with "HotPlug" events which we currently
do not support.
Add pci_dev_get(), pci_find_ext_capability() and pci_pme_capable().
The added pcie_find_root_port() is a bit special as we need to create
another linux pci device; for that make lkpinew_pci_dev() public
which is also helpful for other cases when we want to use the Linux
routines to check for device identifiers only and need a container
for the "bsddev" to use natively. This has proven to avoid basic
checking code for the sake of rewriting it to native field names
elsewhere. Given we cache the newly created "root" we also need to
make sure we clean it up.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30521
dmam_pool_create() is a "managed" version of dma_pool_create() which
will cleanup everything left when the device goes away using the
devres framework. For that add an internal cleanup function to be
called from devres release.
This is used by at least one wireless driver.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30520
Add two new (though untested) functions to linux/device.h which are
dealing with manually managing the device/driver and are used by
at least one wireless driver. We may have to re-fine them in the
future.
Move the devres declarations further up so they can be used earlier
in the file.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D30519
Given all the code does operate on struct ifnet, the last step in this
longer series of changes now is to rename struct net_device to
struct ifnet (that is what it was defined to in the LinuxKPi code).
While mlx4 and OFED are "shared" code the decision was made years ago
to not write it based on the netdevice KPI but the native ifnet KPI
for most of it. This commit simply spells this out and with that
frees "struct netdevice" to be re-done on LinuxKPI to become a more
native/mixed implementation over time as needed by, e.g., wireless
drivers.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30515
While currently the ifp gets cast to a net_device and then returned
and consumers are expecting an ifp again, allow parallel usage now and
in the future by extending and also passing the ifp directly back in
the netdev_notifier_info. Add a function to return the ifp instead of
the net_device.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Suggested by: hselasky
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30522
The sockstat is using password database operations to obtain
the username. Such operations are disallowed in capability mode.
For such operations Casper is required.
Reported by: olivier@
Tested by: olivier@
The get_proto_type function is used before creating the Casper function.
This is why we have to distinguish when the Casper service is allocated or not.
Reported by: olivier@
Tested by: olivier@
Document aspects of system time keeping. Hz is the nominal rate that we
interrupt the system and is known and the 'tick' period of 1 / hz.
hardclock is the routine that does various bits of timekeeping. stathz
and profhz are documented as historical relics that are deprecated
and replaced by hwpmc.4 and others.
Reviewed by: phk@, mav@ and gnn@ (previous version)
Obtained from: hardclock.9 from NetBSD (with FreeBSD adjustments)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30802
It can still be enabled as usual in /etc/periodic.conf
PR: 256253
Reported by: delphij
Submitted by: Miroslav Lachman <000.fbsd@quip.cz>
MFC after: 2 weeks
Old certctl commands still work for compatability, but are deprecated.
Approved by: secteam (gordon)
Differential Revision: https://reviews.freebsd.org/D30807
Accept the old rc.conf variable if the new one is not present for
compatability.
Approved by: imp
Differential Revision: https://reviews.freebsd.org/D30806
The "config" line in config files has been obsolete since FreeBSD 4.x
when we moved to having the boot loader pass in the root device. Remove
it.
MFC After: 1 week
Sponsored by: Netflix
Codify our standard practice with $FreeBSD$
o New code only needs it if it might land in stable/12
o Old code should retain it until stable/12 is unsupported
o We'll do a bulk remove in the future: don't do it proactively.
o Give advice about how to tag files derived from other files
in the tree.
Reviewed by: bcr, allanjude,ceri
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30789
This results in a significant improvement in the runtime of sort(1) when
radix sort cannot be used. This comes at the expense of increased
memory usage, but this is small relative to sort's overall memory usage.
PR: 255551
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30319
In dt_cc.c when the provider is an empty string, accessing
strlen(pdp->dtpd_provider) - 1 will result in a pdp->dtpd_provider[-1]
access.
Similarly, in dt_ident.c, if p2 is a NULL pointer, doing a p2++ on it is
undefined behaviour.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Google
Differential Revision: https://reviews.freebsd.org/D30778
so that PHYS_TO_VM_PAGE() and consequently physcopyin() work for them
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30785
When we introduced libpfctl in bnsmpd this was done incorrectly, and a
GETRULE call was replaced by pfctl_add_rule().
Change it to pfctl_get_rule().
Reviewed by: donner
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Fix a bug in the LPM SEQ benchmark (missing break inside a switch block)
by restructuring the test loop, while introducing additional two
synthetic test options:
ANN: scan only the address space announced in current RIB
REP: repeat lookups over several keys in a sliding window scheme
The total of eight combinations of test options are now available
through dedicated sysctl hooks.
Differential Revision: <https://reviews.freebsd.org/D30311>
Reviewed by: melifaro
MFC after: 3 days
armv6 and armv7 systems already were 1000Hz. The other armv5 were a
mix of 100 and 1000. This changes them to 1000. Should there be
issues, we can add options HZ=100 to the systems that have bad
performance at the drop of a hat.
mips is a lot more complicated. But most of the systems are already
1000HZ. The hardware exceptions are all fast enough to run at
1000Hz. MALTA is our primary emulator, and history has shown emulators
tend to like 100Hz better, so run those systems at 100Hz. As with arm,
any system that shows a huge performance regression can reverted to
100Hz easily.
This was going to be committed well in advance of the 13 branch, but
it was delayed and forgotten til now.
Discussed on: #bsdmips ages ago
Sponsored by: Netflix
/dev/fuse is always ready for writing, so it's kind of dumb to poll it.
But some applications do it anyway. Better to return ready than EINVAL.
MFC after: 2 weeks
Reviewed by: emaste, pfg
Differential Revision: https://reviews.freebsd.org/D30784
The fusefs driver will print warning messages about FUSE servers that
commit protocol violations. Previously it would print those warnings on
every violation, but that could spam the console. Now it will print
each warning no more than once per lifetime of the mount. There is also
now a dtrace probe for each violation.
MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: emaste, pfg
Differential Revision: https://reviews.freebsd.org/D30780
Otherwise, the lli tool (enable by WITH_CLANG_EXTRAS) won't link on arm,
stating that __register_frame is undefined. This function is normally
provided by libunwind, but explicitly not for the ARM Exception ABI.
Reported by: oh
PR: 255570
MFC after: 6 weeks
Noticed while porting the recent truss compat32 changes to CheriBSD.
This also fixes i386 tracing by zero-extending user addresses instead
of sign-extending them.
Reviewed By: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30211
Deciding whether to combine two values to a 64-bit one should be based on
the process ABI, and not dependent on whether truss is compiled for an
LP64 ABI. This is a follow-up cleanup for D27625. I found this while
looking for uses of the `__LP64__` macro (since using this is wrong for
CHERI systems).
Test Plan: truss still works. Since I tested on AMD64 and all syscalls
in the trace have their quad argument last there was no difference
in the output. Should fix output for compat32 on MIPS64 though.
Reviewed By: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D27637
Attempting to parse the output as UTF-8 exposed an out-of-bounds read
in vis(3) (see https://reviews.freebsd.org/D30771). However, I don't
think it makes much sense to decode this output at all. Additionally,
passing one byte at a time will almost certainly result in incorrect
output for multi-byte characters.
Reviewed By: brooks
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30772
I found this while running kdump(1) on a CheriBSD system due to a
capability length violation when printing the /etc/libmap.conf read()
system call: it crashed immediately after printing the first line.
Found by: CHERI
Reviewed By: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30771
ipfw_chk() might call m_pullup() and thus can change the mbuf chain
head. In this case, the new chain head has to be returned to the pfil
hook caller, otherwise the pfil hook caller is left with a dangling
pointer.
Note that this affects only the link-layer hooks installed when the
net.link.ether.ipfw sysctl is set to 1.
PR: 256439, 254015, 255069, 255104
Fixes: f355cb3e6
Reviewed by: ae
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30764