Previous script called acpiconf(8) (or apm(8) if ACPI wasn't supported,
although this was anyway redundant because APMIO just uses ACPI now).
Since a new generic power management interface was introduced, this isn't
sufficient, as this would only work for ACPI systems and for ACPI S3 suspend
(so no way to select suspend-to-idle). Rewrite in C to take advantage of the
new power interface.
We may want to add a switch to manually override the kern.power.suspend sysctl,
which is otherwise what the power device uses to decide which suspend type to
switch to (suspend-to-idle or firmware suspend), but this will require us to
amend the power interface.
Reviewed by: olce, imp, mhorne, ziaee
Tested by: mhorne
Approved by: olce, imp, mhorne, ziaee
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56918
Revert 88a53301e1 and d1ca01059d . They removed padlock_rng from the
amd64 build under the mistaken belief that this device was available on
32-bit processors only. But it's also available on the 64-bit Via Nano,
Nano X2, and some Zhaoxin CPUs.
PR: 295517
Fixes: 88a53301e1 ("padlock.4: only install on i386")
Fixes: d1ca01059d ("padlock(4)/nehemiah: move i386-only entropy")
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D57215
Without this change I get various undefined symbol errors when trying to
link llvm-nm and llvm-objcopy during the cross-tools stage.
Test Plan: builds now
Reviewed by: dim, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56873
QEMU warns when msize is <= 8192 due to degraded performance.
This change bumps our default msize to 128 KiB, matching the
Linux Kernel v5.15 and newer default. Linux supports even larger values,
but 128 KiB is a sensible default.
We also add a new 'msize' mount option to allow users to override
this value, and we validate it against our maximum supported MTU
(currently fixed by the UMA zone size).
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56496
Allocating large buffers with M_ZERO adds unnecessary overhead since
the data is immediately overwritten. This change embeds the tc and rc
p9_buffer structs directly into p9_req_t so we only zero the small
metadata headers. The actual data payload is allocated with M_NOWAIT.
Embedding the metadata headers by value also allows the p9fs_buf_zone
UMA items to be sized exactly to P9FS_MTU, ensuring they are nicely
aligned.
This also adds proper error handling to p9_get_request() to handle
UMA allocation failures.
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56495
I just tried building with system clang on one of my Linux systems which
happens to be version 19, and these warning suppressions are needed for
that version too: same errors as in the original commit.
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56874
To hit this, the user must be using a PEM style private key with no
corresponding .pub key adjacent to it.
OpenBSD-Commit-ID: b7150acc5322fa33f21491834d9471fbe3d30f20
(cherry picked from commit cf6c0b3b94cdc223f1b8be1ef2d93e993af5d976)
Reviewed by: emaste
This is copied from the check in kern_kill.
Reviewed by: markj, oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57244
It's not implemented on some arches. Use a plain int to count the
number of sockets in a divert lbgroup.
Reported by: Jenkins
Fixes: 895a0ae67f ("divert: Define semantics for SO_REUSEPORT_LB on divert sockets")
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
Allow SO_REUSEPORT_LB to be set on divert sockets. If set, then bind()
will add the socket to a "load-balancing group". When a divert-to rule
matches a port with an associated group, the corresponding state ID is
used to select a specific socket from the group. Packets without an
associated state are simply forwarded to the first socket in the group.
For now I only pass a state ID from pf, as I couldn't see a useful
identifier on the ipfw side.
This implementation is simple but has a caveat, that being that if
sockets are added to the group while flows are being processed, the size
of the group will change and this changes the mapping of state IDs to
sockets. So, to get a consistent mapping, the divert socket application
must bind all of its sockets before any traffic is diverted by the
firewall.
Reviewed by: glebius
MFC after: 1 month
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D56563
This includes:
- seg_max, the number of segments allowed in a single command
- {ctl,evt,req}_ringsz, the number of descriptors in a queue
- thr_per_q, the number of processing threads per request queue
- num_queues, the number of request queues
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D54073
In order to support multiple backends for virtio-scsi, we should isolate
the core of virtio-scsi from the backend-specific code. The existing
interface to CTL will become the new "CTL" backend for virtio-scsi.
Care has been taken to keep compatibility with previous configurations:
The first backend linked (CTL) will be the default backend if none is
specified, and it does provide a default configuration if no further
options such as targets are explicitly configured.
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53223
Currently, all I/O requests are queued internally, and a number of
threads will pick I/O requests of the queue and send them to CTL with
a synchronous CTL_IO ioctl. On the other hand, TMF requests are sent
to CTL immediately using the same synchronous ioctl.
Besides being unworkable for non-CTL backends such as for SCSI
passthrough, this simple approach may easily run into situations
where a TMF request operating on a particular I/O request is sent
to CTL while it is still on our queue and thus unknown to CTL.
In addition, for target and/or LUN resets we should really clear
our queue and return all outstanding I/O requests with a proper
status.
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53222
Currently, virtio-scsi supports only one target with 16383 LUNs, which
fits nicely with what CTL provides. It would be useful to support more
than that, multiple targets each with 16383 LUNs.
While this can be useful with CTL by attaching each target to another
CTL target port, this will be necessary to support SCSI passthrough.
The new syntax for configuring targets will look like this:
-s X,virtio-scsi,target=/dev/foo,target=/dev/bar,target=4:/dev/baz
This will create the following configuration nodes:
pci.0.X.0.device=virtio-scsi
pci.0.X.0.target.0=/dev/foo
pci.0.X.0.target.1=/dev/bar
pci.0.X.0.target.4=/dev/baz
The existing configuration syntax is still understood for compatibility:
(1) -s X,virtio-scsi
(2) -s X,virtio-scsi,/dev/foo
(3) -s X,virtio-scsi,dev=/dev/foo
This will create the following configuration nodes:
pci.0.X.0.device=virtio-scsi (1, 2, 3)
pci.0.X.0.target.0=/dev/cam/ctl (1)
pci.0.X.0.target.0=/dev/foo (2, 3)
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53221
On a suspend request via ioctl(), /dev/acpi (and compatible /dev/apm)
both call acpi_ReqSleepState() instead of directly calling
acpi_EnterSleepState(). The former does more checks, returns success if
the machine is already suspending, and notifies user space (via devd(8))
about the impending suspend. In other words, it seems to have been
designed for user consumption more than the latter function.
So, use acpi_ReqSleepState() in place of acpi_EnterSleepState() in
acpi_pm_func(), which is ultimately called by power_pm_suspend(), itself
called by power_ioctl(). Other callers of power_pm_suspend() (such as
the console drivers) are also user-facing facilities, so should also
benefit from this change.
Reviewed by: mhorne, imp
Tested by: mhorne
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57239
The recent IBS work intruduced a bug on older CPUs where the
IBS handler will be called on NMIs even when IBS is not initialized.
Work around this in the IBS handler by checking to see if ibs_pcpu
is NULL before accessing it.
uid_t and gid_t are uint32_t (unsigned 32bit integers).
They are printed as signed integers when calling getfacl
(and other tools using the acl_to_text() libc function).
This causes uid/gids larger than 2G (214783648) to print
as negative numbers
- which causes problem with setfacl since the acl_from_text()
libc function fails on negative numbers.
Reviewed by: rmacklem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D57179
A typo resulted in the wrong argument for a bytewise
comparison that could result in a crash if
the incorrect argument was not a valid pointer.
This patch fixes the argument.
While investigating this, I noticed that the
correct argument was not being filled in as
required, so this patch fixes that, as well.
Somehow, recovery from a NFSv4.1/4.2 server
crash worked during testing, so this was not
detected. The bug/patch only affects NFS
client mounts using NFSv4.1/4.2.
PR: 294925
Reported by: Jov <amutu@amutu.com>
MFC after: 3 days
When forwarding a print job to a remote server, we could overflow the
command buffer if a control or data file had a very long name.
MFC after: 1 week
Reported by: Joshua Rogers <joshua@joshua.hu>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D57184
This alias for the -s option has been deprecated since 2002. Time to
drop it from the documentation.
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D57183
This has been broken since IPv6 support was added in 2000. We would
validate the port number (which had to be a port number, but can now
also be a service name) and then ignore it.
MFC after: 1 week
Fixes: 08829865f6 ("IPv6 support for lpr.")
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D57181
* Instead of an error string, return the usual 0 or -1 and let the caller
figure out what, if anything, to tell the user.
* Avoid string manipulations by opening /dev first and using openat()
with O_RESOLVE_BENEATH.
* Add a boolean argument which, if false, causes ttymsg() to return
without sending the message if the tty's group-writable bit is not
set. This saves programs that respect this setting (like syslogd(8))
from having to check before calling ttymsg().
* Update all callers.
The observable effect of this change is minimal except for slightly
different error messages when ttymsg() fails. However, syslogd(8) will
no longer print spurious error messages on the console after trying and
failing to write a log message to an X11 session.
PR: 295171
MFC after: 1 week
Reviewed by: jfree, markj
Differential Revision: https://reviews.freebsd.org/D57018
Previously write_fnt_source always returned 0, silently discarding
errors. Return rv so that errors set vtfontcvt's shell exit
appropriately.
Sponsored by: The FreeBSD Foundation
* Add top level README.md, linking to in progress and todo items
* Add an 802.11 protocol overview, with todo items - this is designed
to provide a basic introduction to 802.11 for people wishing to work
on net80211 and drivers.
* DEBUG.md - cover the debug API
* DATAPATH_TRANSMIT.md - transmit datapath
* DATAPATH_RECEIVE.md - receive datapath
* PROTOCOL.md - a high level (for values of "high") overview of
the 802.11 protocol and where it intersects with net80211
Differential Revision: https://reviews.freebsd.org/D56760
This isn't supposed to be comprehensive, I want to have examples
for the common doxygen comments:
* describing a struct
* inside a struct - single line before the item
* inside a struct - same line after an item
* inside a struct - multi-line before an item
These build fine with the doxygen build in tools/kerneldoc/subsys/ .
Differential Revision: https://reviews.freebsd.org/D57056
Create a function to check if the BAR retry limit has been reached.
Use this in if_ath_tx instead of a hard-coded value.
I've been meaning to do this for a long time.
Differential Revision: https://reviews.freebsd.org/D57055
When reading from standard input with editline history enabled, increase
buffer size to accomodate long lines so that history is recorded
correctly. Cleanup el_gets() handling avoiding potentially dangerous
retention of pointers to editline buffers across calls. Ensure struct
parsefile objects are properly zero initialised when created. Remove
push argument from setinputstring() and simplify logic as it was always
called with a value of one and as was written was potentially dangerous
if ever called with a value of zero.
This commit does not fix long lines when history is enabled but editing
is not (e.g. if there is no terminal).
MFC after: 3 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/2028
Signed-off-by: Kristofer Peterson <kris@tranception.com>
When pxeboot gets a 0 as a port number from portmapper (indicating an
error), it currently happily sends NFS packets to the server's port 0
in an endless loop. Change this to instead bail out with a useful
message.
This happens, for example, with recent Linux NFS servers as many
distributions switched to TCP only NFS serving by default. FreeBSD's
pxeboot must have UDP. In this situation pxeboot asks the server's
portmapper for the UDP NFS port and since there is none gets 0.
Also add a hint to the manpage explaining this and how to fix it.
Reviewed by: ziaee, kevans, imp
Add support for automatic suspend/resume as we know it for wireless.
The problem is that the PCI driver which would normally gets the code
is the LinuxKPI PCI framework/Linux wireless driver, which we cannot
ammend or generally add extra suspend/resume code to.
A further problem is that with growing support, the LinuxKPI 802.11
(mac80211) layer also is involved in suspend/resume for WoWLAN (not
yet supported) meaning that we need to hook the suspend/resume
framework into that as well. Unlike Linux we do not have a general
suspend/resume "hook" we can hang into and we need to tie this one
to the hardware so cannot indepedently (after the driver one) run it.
The solution for FreeBSD, in order to not mangle the Linux native
drivers and get extra maintanace overhead, is to add a bus child
which inherits the general framework and thus is 2 lines + #includes
for each driver extra to add to.
The general suspend/resume framework lives in LinuxKPI (linuxkpi_80211_pm)
and imitates the normal suspend/resume path overloading it (there is
a slight code/logic duplication from the PCI code).
Given we are passed the LinuxKPI p(ci)dev, we can go and peel out the
net80211 ic from the native bsddev and that way get access to the
wireless stack. We then call into LinuxKPI 802.11 in order to do
the suspend/resume dance there, and, if needed also call the
official suspend/resume routine from the device driver after
(reverse for resume).
If any in this fails, suspend will be blocked as we will return the
error (no different to any native driver could do).
The LinuxKPI 802.11 suspend/resume code has the initial code for
doing a WoWLAN suspend (one could change the sysctl) but other bits
like access to ifnet flags etc. has to be sorted out before we can
go and support that.
The default code path calles into net80211 to clear everything
like native wireless drivers do. The one thing we need to do in
addition is to remove the vif devices from the firmware and restore
them prior to net80211 resume.
We also check for a possible HW SCAN to still be runinng on resume
and warn as that may cause problems though the scan should be stopped
before suspend (we may still get a callback). You can easily see
these problems if you suspend/resume without stopping the wlan.
Enable the PM framework for iwlwifi in the module Makefile to
be able to use all this; others can follow as tested.
In case anyone has problems with this, they can change the sysctl
back to 0 until we can figure out any further problems.
The linuxkpi_wlan.4 man page got adjusted to document this.
Sponsored by: The FreeBSD Foundation
Tested on: Dell XPS 13 (AX200), Lenovo TP X270 (AX210)
MFC after: 3 days
PR: 263632
When we no longer need a channel context and put it back on the
reserved list, zero it for all but the vif so that we get the same
state as if it was freshly allocated.
Sponsored by: The FreeBSD Foundation
Fixes: e62c92c0a5, 88cb1e17f4
MFC after: 3 days
Taking the address of an OOB array element is UB, even if not
dereferenced.
Reviewed by: des, bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57172
Both tools support controllers from both companies, so document it.
Reviewed by: ziaee (via IRC)
MFC after: immediately
Differential Revision: https://reviews.freebsd.org/D57212
Since the test assumes a 250 ms response time, there is no need to delay
for 3 seconds. Instead, delay for the minimum possible 1 second.
Also, fix some assertions in builtins/read11.0 and builtins/read12.0. If
`set -e` is in effect, `foo` in `foo && bar` is considered tested and
therefore a failure does not cause the shell to exit.
Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D55191