acpi: Return "unknown D-state" in acpi_d_state_to_str() if unknown
Some ACPI debugging prints call acpi_d_state_to_str() on unset D-states
(i.e. ACPI_STATE_UNKNOWN), so return a string explicitly saying "unknown
D-state" instead of just panicking.
Fixes: 84bbfc32a3f4 ("acpi_powerres: D3cold support")
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
kern_descrip.c: Clarify allocation and freeing of fd map in fdgrowtable()
When expanding a file table, the condition for allocating a new map
is NDSLOTS(nnfiles) > NDSLOTS(onfiles) whereas for freeing the old map
is NDSLOTS(onfiles) > NDSLOTS(NDFILE).
If a previously expanded file table were to be expanded slightly again
such that the map did not need to be increased, then fdgrowtable could
still free the current map.
This does not happen currently as nnfiles is rounded up to a multiple of
NDENTRIES at the beginning of fdgrowtable() so that every enlargement
after the first enlargement will always require a larger map.
Though the logic is currently correct, it is unclear and should the
earlier rounding up of nnfiles be relaxed or remove, the logic would
be incorrect. This patch therefore adds comments and invariants checking
the size of the table and map, and updates the map free condition so
that it is absolutely clear that the old map will only be deallocated
[5 lines not shown]
lib/libifconfig: Fix pointer-sign warnings
Fix all pointer-sign warnings generated when compiling libifconfig.
One of these warnings comes from the misuse of snl_add_msg_attr_string
for a byte array. Though userland treats carpr_key as a string, it is
actually an array of bytes. Handle it as such in libifconfig.
While here, fix a small consistency nit in ifconfig_sfp_get_sfp_dump.
Signed-off-by: Ryan Moeller <rmoeller.dev at gmail.com>
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/1850
periodic/daily: show verbose zpool status when errors are detected
When zpool status -x reports errors, the output only shows basic error
counts without identifying which files are affected. Replace the
unconditional echo of the brief status with verbose output (zpool
status -v) in the error path so administrators can see exactly which
files have been damaged.
The healthy/no-pools path still shows the brief status.
PR: 223243
Signed-off-by: Po Han Chen <hypery11 at gmail.com>
Reviewed by: imp, jlduran, asomers
Pull Request: https://github.com/freebsd/freebsd-src/pull/2089
mkimg: Fix parsing of filenames containing colons
When using PART_KIND_FILE (-p type:=filename), mkimg uses a colon
to separate an optional offset (e.g., filename:offset).
strsep() was being used to split the string at the first colon.
This caused failures when the filename itself contained a colon
(e.g., "th:is").
This patch uses stat() to check if the entire string exists as a
file. If so, use it directly without splitting.
If the full string is not a valid file, fall back to splitting
at the right-most colon using strrchr().
Uses errc() to fail and exit immediately when an existing directory
is input instead of a file in PART_KIND_FILE mode.
PR: 257960
[3 lines not shown]
libpmc: surface raw TSC in pmclog events
The pmclog record header carries the raw TSC for each event. Export it
in struct pmclog_ev, fix JSON output to emit it unsigned, and preserve
the installed header ABI by overlaying pl_tsc with the legacy pl_ts
storage.
Update pmclog(3) to document the TSC semantics and the legacy alias.
Sponsored by: AMD
Signed-off-by: Andre Silva <andasilv at amd.com>
Reviewed by: imp, mhorne, Ali Mashtizadeh
Pull Request: https://github.com/freebsd/freebsd-src/pull/2085
pmcstat: print raw TSC in decoded log output
Extend pmcstat -R output to include the raw TSC for each decoded record
and print tsc_freq from the initialize record so TSC deltas can be
converted to elapsed time.
Update the pmcstat documentation to describe the decoded output and the
architecture-specific TSC behavior.
Sponsored by: AMD
Signed-off-by: Andre Silva <andasilv at amd.com>
Reviewed by: imp, mhorne, Ali Mashtizadeh
Pull Request: https://github.com/freebsd/freebsd-src/pull/2085
newsyslog.conf(5): use "rotated" instead of "trimmed"
The man page used "trimmed" to describe log rotation, which is
misleading as it suggests the file is truncated to a specific
size rather than being rotated (renamed and a new file created).
Replace all instances of "trimmed" with "rotated" to match the
actual behavior and the terminology used elsewhere in the page.
PR: 278671
Signed-off-by: Kit Dallege <xaum.io at gmail.com>
Reviewed by: imp,ziaee
Pull Request: https://github.com/freebsd/freebsd-src/pull/2099
uvscom: Fix baud rate validation in uvscom_pre_param()
The switch fell through from the supported B150–B115200 cases into default
and returned EINVAL for every speed. Break out before default so valid
rates return success, matching uvscom_cfg_param().
Signed-off-by: Weixie Cui <cuiweixie at gmail.com>
Reviewed by: imp,aokblast
Pull Request: https://github.com/freebsd/freebsd-src/pull/2110
Fix xhci detection on Raspberry Pi 400
If you use the FreeBSD pre-build Raspberry Pi image, it does not include
the specific .dtb file for the Raspberry Pi 400. On this hardware, it
will fall back to attempting to load the Raspberry Pi 4 .dtb file
instead.
The Pi 4 .dtb file reports the board compatible name as
"raspberrypi,4-model-b" The Pi 400 .dtb file reports the board
compatible name as "raspberrypi,400" However, it's even better to
use the generic name.
When using the official Pi 400 .dtb file from the Raspberry Pi Firmware
collection, the FreeBSD xhci driver currently fails to recognize this,
and thus fails to initialize the xhci device. This means no external
USB, or internal USB (which feeds the build-in keyboard)
The official Raspberry Pi FreeBSD image has been working on the Pi 400
"on accident" simply because it didn't include the Pi 400 .dtb file
[9 lines not shown]
sysctl.3: Correct kern and kern.proc type descriptions
Fix several incorrect sysctl.3 type and mutability descriptions so the
manpage matches the actual kern and kern.proc interfaces.
Signed-off-by: Tyler Waddell <tyler.waddell112 at gmail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2128
asmc: add support for MacBookPro13,1
This commit adds support for the MacBookPro13,1 (late 2016, 13-inch). The SMC
keys were collected from https://logi.wiki/index.php/SMC_Sensor_Codes. Two
temperature keys are omitted because they fail to be read: TI0P (IO Proximity)
and Ta0P (Ambient Air).
Note that the with this model the `dev.asmc.0.fan.0.minspeed` setting only
applies when the fans have been activated by the system. In my testing, the fans
did not spin up until CPU temperatures hit about 80C. At lower temperatures, the
fans will happily ignore the minimum speed and remain at 0 rpm.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2137
packages: Fix build with libucl 0.9.3
In libucl 0.9.3, macros and includes are disabled by default when
creating a new UCL parser. This breaks the package build, which
relies on includes. Fix this by explicitly passing zero flags
to ucl.parser().
MFC after: 3 days
Fixes: abda442d92fd ("contrib/libucl: Import libucl 0.9.3")
Reviewed by: kevans, bapt
Reported by: freebsd at walstatt-de.de
Sponsored by: https://www.patreon.com/bsdivy
Differential Revision: https://reviews.freebsd.org/D56266
(cherry picked from commit 63d0e3e3aa2483420f828686336d6615616363d5)
appleir: Add Apple IR receiver driver
HID driver for Apple IR receivers (USB HID, vendor 0x05ac).
Supports Apple Remote and generic IR remotes using NEC protocol.
Supported hardware:
- Apple IR Receiver (0x8240, 0x8241, 0x8242, 0x8243, 0x1440)
Apple Remote protocol (proprietary 5-byte HID reports):
- Key down/repeat/battery-low detection
- 17-key mapping with two-packet command support
- Synthesized key-up via 125ms callout timer
Generic IR remotes (NEC protocol):
- Format: [0x26][0x7f][0x80][code][~code]
- Checksum: code + ~code = 0xFF
- Default keymap with 8 common codes
- See: https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol
[9 lines not shown]
Fix read corruption after block clone after truncate
When copy_file_range overwrites a recent truncation, subsequent reads
can incorrectly determine that it is read hole instead of reading the
cloned blocks.
This can happen when the following conditions are met:
- Truncate adds blkid to dn_free_ranges
- A new TXG is created
- copy_file_range calls dmu_brt_clone which override the block pointer
and set DB_NOFILL
- Subsequent read, given DB_NOFILL, hits dbuf_read_impl and
dbuf_read_hole
- dbuf_read_hole calls dnode_block_freed, which returns TRUE because the
truncated blkids are still in dn_free_ranges
This will not happen if the clone and truncate are in the same TXG,
because the block clone would update the current TXG's dn_free_ranges,
which is why this bug only triggers under high IO load (such as
[16 lines not shown]
deb.am: propagate build errors in native-deb targets
Replace semicolons with && so build failures are not masked by the
subsequent lockfile cleanup. Use trap to ensure the lockfile is
removed on both success and failure.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18206
Closes #18424
Use AVL tree lookup in zfsctl_snapdir_vget for mounted snapshots
zfsctl_snapdir_vget resolves NFS file handles for snapshot directory
entries by calling zfsctl_snapshot_path_objset, which iterates all
snapshots via dmu_snapshot_list_next to find the matching objsetid.
With many snapshots this linear scan is expensive.
For snapshots that have been previously mounted, the path is already
cached in the in-memory AVL tree. Check the tree first with
zfsctl_snapshot_find_by_objsetid and fall back to the on-disk scan
only when the entry is not found.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Ameer Hamza <ahamza at ixsystems.com>
Closes #18429
draid: fix cksum errors after rebuild with degraded disks
Currently, when more than nparity disks get faulted during the
rebuild, only first nparity disks would go to faulted state, and
all the remaining disks would go to degraded state. When a hot
spare is attached to that degraded disk for rebuild creating the
spare mirror, only that hot spare is getting rebuilt, but not the
degraded device. So when later during scrub some other attached
draid spare happens to map to that spare, it will end up with
cksum error.
Moreover, if the user clears the degraded disk from errors, the
data won't be resilvered to it, hot spare will be detached almost
immediately and the data that was resilvered only to it will be
lost.
Solution: write to all mirrored devices during rebuild, similar
to traditional/healing resilvering, but only if we can verify
the integrity of the data, or when it's the draid spare we are
[13 lines not shown]
bpf: fix handling the read timeout on ppc64
On platforms other than amd64, BIOCSRTIMEOUT is equal to
BIOCSRTIMEOUT32. Therefore, running the COMPAT_FREEBSD32 code
basically clears tv_usec on big endian platforms. When tcpdump is
used, the timeout requested is 100ms, which gets cleared to 0 on
ppc64 platforms. This results in tcpdump showing the packets only
when the read buffer is full.
Thanks to kib for guiding me to the correct fix.
Reported by: ivy
Reviewed by: adrian, kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D56399
vm_swapout: Remove a special case from vm_swapout_map_deactivate_pages()
John points out that this probably should have been removed in commit
472888018ce, which removed a special case where we'd set desired=0 if
the target process has P_INMEM clear. It's not obvious to me that the
desired=0 case can't arise by setting an RSS limit to 0, but I'm not
sure why we'd try to go the extra mile in that case anyway.
Reported by: jhb
Reviewed by: kib
MFC after: 2 weeks
Fixes: 472888018ce1 ("proc: Remove kernel stack swapping support, part 6")
Differential Revision: https://reviews.freebsd.org/D56140
arm64: Define the .iplt section placement.
Ensure that the .plt and .ipld sections are in the executable memory segment.
MFC after: 1 week
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D56403