linuxkpi ioctl handler: restore the user data pointer
instead of trying to hack around it with LINUX_IOCTL_MIN_PTR. Since
linux file ioctl methods expect the user address in the data argument,
this should work for all ioctls, including the variable-length cases
like ibcore.
Only do it for the FreeBSD ABI, where we know how to reliably access the
original syscall arguments.
Reviewed by: Ariel Ehrenberg <aehrenberg at nvidia.com>, markj
Discussed with: zishun.yi.dev at gmail.com
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D57612
ifconfig: Fix handling of unsupported -j option with MK_JAIL=no
The ifconfig(8) utility built with MK_JAIL=no does not support the
-j option. When the option is specified, Perror() is called without
setting errno, which can result in errno being reported as zero and
a misleading error message being displayed.
Also remove "[-j jail]" from the usage message when built with
MK_JAIL=no.
Event: Halifax Hackathon 202606
usb: Add missing mtx lock and unlock in pushing dma queue
Accessing usb_xfer_queue requires bus lock, we added this missing lock
in here to prevent racing issue.
Reviewed by: adrian
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57293
(cherry picked from commit df5e9e3da5b9b3fe63ed4aaaa19b824fd18ae0f2)
xhci: Do not drop and add bits in xhci
Drop and Add bits reset the data toggle for high-speed devices in XHCI.
The toggle bit represents the sequence number in USB 2.0 transfers. However,
a device can only recognize that the toggle bit has been reset while in
the HALT state. As a result, the host and device toggle values may
become mismatched, causing xHCI to reject the packet. This issue was
observed while testing the EZ-USB FX2 device.
The transfer may then return to the original value after a
bi-directional TD because the toggle field is only one bit wide. This
explains the reson that we can only receive packets bi-transfer in some
case. Therefore, we do not reset the toggle bit here.
Reviewed by: adrian
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57146
(cherry picked from commit 28d85db46b484589e2ee74cf4b270db066821de1)
libc: Use slow path in fenv in C++
C++ exposes cfenv functions via using ::func. Our name-mangling
mechanism rewrites all function calls causing symbols such as
std::feclearexcept to be transformed into std::__feclearexcept_int.
Since no such function exists, compilation fails.
The using ::feclearexpect declarations themselves are unaffected because
they are not function calls, which further exposes the mismatch
As a result, enable the fast path only for C and fall back to the slow
path in C++.
Reviewed by: kib
Fixes: 5bc64b7d417d
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57450
(cherry picked from commit 9c0489508695fde3bdd742edfd1b4b681aab4d19)
hwpstate_intel: Disable package control on hybrid CPU
In package control mode, the performance of all cores depends on the
most recent value written to the request field. If the last write comes
from an E-core, all cores are forced to align with the E-core
performance level, resulting in significant performance degradation.
Therefore, package control is disabled on hybrid-core systems.
Reviewed by: olce
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Framework Computer Inc
Differential Revision: https://reviews.freebsd.org/D57377
(cherry picked from commit 7b26353a59d66dc1bc611fd042a49b9e3bd13699)
xhci: Do not drop and add bits in xhci
Drop and Add bits reset the data toggle for high-speed devices in XHCI.
The toggle bit represents the sequence number in USB 2.0 transfers. However,
a device can only recognize that the toggle bit has been reset while in
the HALT state. As a result, the host and device toggle values may
become mismatched, causing xHCI to reject the packet. This issue was
observed while testing the EZ-USB FX2 device.
The transfer may then return to the original value after a
bi-directional TD because the toggle field is only one bit wide. This
explains the reson that we can only receive packets bi-transfer in some
case. Therefore, we do not reset the toggle bit here.
Reviewed by: adrian
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57146
(cherry picked from commit 28d85db46b484589e2ee74cf4b270db066821de1)
usb: Add missing mtx lock and unlock in pushing dma queue
Accessing usb_xfer_queue requires bus lock, we added this missing lock
in here to prevent racing issue.
Reviewed by: adrian
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57293
(cherry picked from commit df5e9e3da5b9b3fe63ed4aaaa19b824fd18ae0f2)
fusefs: proofread an error message in the tests
Reported by: otis
Fixes: 2c1482e3053 ("fusefs: fix a race in the pre-init tests")
MFC after: 2 weeks
Sponsored by: ConnectWise
sched_ule: sched_priority(): More accurate __unused annotation
Change a '__unused' to '__diagused', which is more precise for that use.
No functional change.
MFC after: 1 week
Event: Halifax Hackathon 202606
Sponsored by: The FreeBSD Foundation
fusefs: fix a race in the pre-init tests
These tests allow the user to customize the INIT response. But it's
necessary to block the daemon's service loop from running until those
expectations have been set. This race has never caused failures before
simply due to luck. But now it's failing on slower platforms.
PR: 296236
Reported by: siva
MFC after: 2 weeks
Sponsored by: ConnectWise
Reviewed by: siva
Differential Revision: https://reviews.freebsd.org/D57781
bnxt: Report actual link speed, rather than hard-coded 100Gbs
We need to report the actual link speed, rather than a hard-coded
100Gbs for a variety of reasons, but most importantly, as reporting
100Gbs on a 10g link breaks lacp when this NIC is in an LACP bundle
with other vendors' NICs after e98ed8d99fd4 (lacp:
Simplify lacp_compose_key()), as the fake 100g puts this nic
into a different aggregation group.
Sponsored by: Netflix
Reviewed by: glebius
Tested by: glebius
iflib: handle transient errors from isc_txd_encap()
Until we introduced support for nic ktls offload, all error returns
from isc_txd_encap() indicated a permanent failure. Iflib remapped all
those failures to ENOMEM, which was treated by the tcp stack as a
permanent error and passed back to the caller. This was done to avoid
creating "infinite loops" where a packet couldn't be mapped for
transmit, and kept being sent over and over.
Now that we have support for nic ktls offload, some ktls offload
drivers may return ENOBUFS from their encap function to indicate that,
for example, the ktls context may not yet be fully initialized. This
needs to be treated as a transient error so that the TCP stack may
re-try at a later time. To achieve this, pass the raw error back to
the caller when the encap routine returns an error aside from EFBIG.
Note that I audited all in-tree iflib drivers. Only ice and ixl ran
return anything other than 0 from their encap, which is EFBIG. both of
which are still treated as they were before.
[8 lines not shown]
hwpmc_ibs: Add more IBS register definitions
Small change to add additional IBS register definitions for the new pmc
tools. Most of the definitions are for Zen 4 and above where we get
detailed information regarding the source of a completed memory
operation.
Reviewed by: mhorne
Sponsored by: Netflix
Pull Request: https://github.com/freebsd/freebsd-src/pull/2292
hwpmc_amd: Avoid using PMCs if in use by firmware
Some firmwares use the PMCs to monitor OS performance. We can't be
certain that the BIOS would detect any change to the counters if we
reprogram them. In cases where the firmware is using the PMCs to
control power management this could have dangerous side effects or
unexpected performance effects.
During initialization, detect if any of the counters are enabled and
fail if so.
Reported by: Sandipan Das
Reviewed by: mhorne
MFC after: 1 week
Sponsored by: Netflix
Pull Request: https://github.com/freebsd/freebsd-src/pull/2277
ctl: Use CAM_PRIORITY_NORMAL for queued CCBs
Previously this was using CAM_PRIORITY_NONE which tripped over the
assertion added in b4b166b8c46b8.
PR: 293076
Reported by: Ken J. Thomson <thomsonk at yandex.com>
Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D56995
(cherry picked from commit 887841731be60a958e471b9fd79261169b67b7ad)
ctld: Simplify pidfile rename handling in conf::apply
Explicitly copy the pidfile path from the initial configuration file
to the kernel-derived configuration to avoid having to check if the
old path is empty as a special case in conf::apply().
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D56533
(cherry picked from commit 9306d0449ba6fffadf08d5ab61aea596369e03f4)
ctld: Add a dedicated conf method for shutting down
Currently the main loop creates an empty config and applies it to
force a shutdown of all of the existing configuration. While this is
functional and does avoid duplicating some code, it is also a bit
clunky and requires a special hack in the pidfile path handling
in the conf::apply method.
Instead, use a dedicated conf::shutdown method which tears down the
CTL ports and LUNs and closes the sockets.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D56532
(cherry picked from commit f1c5de5fab9d5cada11935418db11e19ebff7e34)
arm64: Adjust the kernel stack pointer at the end of fork_trampoline
All other paths that return from the kernel to userspace pop the user
trapframe off of the kernel stack pointer before returning to
userspace in restore_registers. fork_trampoline was missing this, so
all of the user faults after fork pushed another trapframe leaving a
trapframe's worth of wasted space on the kstack.
This would be fatal after a future change to remove duplicate
initialization of td_frame in cpu_fork() as without this fix each time
a thread was recycled it would "lose" another trapframe's worth of
space.
Reviewed by: kib, andrew
Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
(cherry picked from commit a1e07f21dc7458d85bd0d04c294f0389d4591666)
arm64/iommu: Add a missing close parenthesis
Fixes: 6dc813301a17 ("sys: Use is_pci_device instead of direct comparisons to devclasses")
Sponsored by: Chelsio Communications
(cherry picked from commit 8de34a84224b9a353bc0a9d6d3f95540b0e72707)
ctld: Only check physical port linking in a single configuration context
Commit 969876fcee57 moved struct pport from being per-configuration to
being a "global" object shared across multiple configurations. As a
result, the check for duplicate ports actually spanned across
configurations, such that reloading a configuration would now think
that existing physical ports were already linked.
The linking field in pport added in the C++-ification (commit
6acc7afa34aa) faithfully replicated this bug (albeit simpler as I had
noticed that the TAILQ links weren't used after the earlier commit).
To restore the desired behavior, remove the linking field from struct
pport entirely and use a local unordered_map in conf::add_pports which
tracks if a given pport is claimed by more than one target.
PR: 293076
Reported by: Ken J. Thomson <thomsonk at yandex.com>
Fixes: 969876fcee57 ("ctld: parse config file independently of getting kernel info")
[3 lines not shown]
ctld: Refactor ioctl port handling
- Normalize ioctl port names when the port name is first added to
the configuration. This can catch potential duplicate port names
sooner and helps with other parts of this change.
- When recognizing existing ioctl ports, always expand the name to
include the physical and virtual port numbers. This permits binding
ioctl/0/0 or ioctl/1/0 to a target, for example.
- When adding physical ports to a target, first check for an existing
kernel port to reuse. This handles both ioctl and non-ioctl ports
and removes the need for the conf::add_port method for ioctl ports
to check in kports.
- If an existing kport isn't found when adding physical ports, check
to see if the port name is an ioctl port. If so, call conf::add_port
to add an ioctl port. This add_port method overload is now simpler
as it always creates a new port.
[11 lines not shown]
amd64: Drop segment descriptor details from trap messsages
Segment descriptor contents are fixed on amd64 and not very interesting
compared to the other values that are displayed.
While here, include both the thread and process details of the current
thread and drop redundant output of the trap number.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D56989
(cherry picked from commit 00b96a777845d9b558b2303cbef03ba5197b593a)