hwpmc: Size and walk per-CPU state by CPU ID
pm_pcpu_state is indexed by CPU ID but sized by mp_ncpus, and the log
code walks CPUs 0 to mp_ncpus - 1. CPU IDs can have holes, for example
on riscv when a hart fails to start, so the array is too short and the
loops bind to an absent CPU and skip the last ones.
Size the array with pmc_cpu_max() and walk with CPU_FOREACH().
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision: https://reviews.freebsd.org/D62377
GCE: Switch to using kvmclock timecounter on GCE VMs
Currently, GCE VMs are configured to use the "ACPI-safe" timecounter,
which does not exist on modern VM hardware. The system then falls back
to TSC-low because it has a higher quality rating than kvmclock.
However, TSC-low may report incorrect time after a VM migrates to a
different host system.
Instruct GCE VMs to use the kvmclock timecounter so that timekeeping
remains accurate across live migrations.
Reported by: delphij
Reviewed by: delphij
Approved by: delphij (mentor)
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D62121
(cherry picked from commit 141e74291075785c7898763d33288b7fd8b9f06d)
bhyve: fix bootorder for PCI slots >= 10
Currently, bhyve writes slots as decimals. Firmware such as EDK2
interprets them as hexadecimals, so slot 10 becomes 16, breaking
the configured boot order.
Reviewed by: markj
Fixes: 6632a0a4e3ab ("bhyve: add helper to create a bootorder")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61997
(cherry picked from commit 653c5d3b5f9f3f157c043c0acdcfc2ba85718016)
bsdconfig: Resolve GEOM ids and names without scanning
f_device_get_all probes every DEV geom. Each probe calls
f_geom_find_by to turn a provider ref into a struct, and
f_geom_find for the gpt, geli, and nop parent names. Those walks
cover every class and geom, so a machine with a large disk set
spends its time in sh at "Probing devices".
Record each struct by id, and each geom by name, while
f_geom_get_all parses kern.geom.confxml. f_geom_find_by resolves
property id from the id map. f_geom_find resolves a non-empty name
from the name map. The same name can appear in more than one class,
so the name map stores a list of structs. A name that is still not
a shell identifier after rewriting is left for the linear scan.
f_geom_reset drops both maps.
Add an ATF test that times id and name lookups at 100 and 200
disks, and checks names that are not shell identifiers.
[3 lines not shown]
bhyve: fix bootorder for PCI slots >= 10
Currently, bhyve writes slots as decimals. Firmware such as EDK2
interprets them as hexadecimals, so slot 10 becomes 16, breaking
the configured boot order.
Reviewed by: markj
Fixes: 6632a0a4e3ab ("bhyve: add helper to create a bootorder")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61997
(cherry picked from commit 653c5d3b5f9f3f157c043c0acdcfc2ba85718016)
games/anki: fix build on powerpc64le
Since 92401c33b734 the node modules archive has the architecture in its
name, so the one for powerpc64le is missing from distinfo. It's the same
file as the amd64 one, so add it under its own name.
Approved by: portmgr (blanket)
(cherry picked from commit d861ab659356b926fd0ef15505b116aa8b048889)
sysrc: Add -u and -U
-U names a user in the jail password database and is passed to
jexec(8). It requires a running jail.
-u names a user in the host password database and is passed to
both jexec(8) and chroot(8).
The two cannot be combined, matching jexec(8).
MFC after: 2 weeks
Reported by: ngie
Reviewed by: kfv, ngie (previous revision)
Differential Revision: https://reviews.freebsd.org/D61930
vtnet: disable mq by default to work around busdma usage bugs
The busdma tag / locking isn't right for multiqueue usage, so
disable it for now until it's been resolved.
PR: kern/301386
Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D62387
bsdinstall: Fix and optimize checksum validation awk
Prevent numerical comparison for decimal-looking sha256sum output.
awk's double has a 53-bit mantissa, so largest integer it can hold
is exactly 2^53 or 9,007,199,254,740,992. The next integer is not
representable, and awk rounds it back. This means large numbers when
compared can lead to false equivalence.
For example:
a=1234567890123456789012345678901234567890123456789012345678901234
b=1234567890123456789012345678901234567890123456789012345678901235
a == b # true but should be false
Casting the sha256sum to a string fixes comparison. h/t kfv
While here ... (for script hardening):
[24 lines not shown]
bsdinstall: Fix checksum incorrect percentages
Adding an integer value lacking floating point precision to another
integer of the same results in incorrect percentage procession.
For example, when NDISTRIBUTIONS is 8, the old method of using
$percentage+100/n (where n is the constant 8 in this example) results
in 0 -> 12 -> 24 -> 36 -> 48 -> 60 -> 72 -> 84 compared to the new
i*100/n (where i counter starts with 0, +1 each dist) which results
in 0 -> 12 -> 25 -> 37 -> 50 -> 62 -> 75 -> 87.
Note that the progress display is not redrawn for the last/final dist
(to display 100, or in the previous algorithm, 96 for set of 8 dists)
and for good reason. The distextract script wipes the screen almost
immediately thereafter, and so the only way the user would see 100%
would be if checksum slept after a final render. To keep the
installer quick and snappy, we're not going to add such a sleep and
so omitting the final render is fine.
[3 lines not shown]
bsdinstall: Optimize checksum percentage calculation
Re-calculating how many words are in DISTRIBUTIONS n-times, once for
each word in DISTRIBUTIONS when the value of DISTRIBUTIONS does not
change is inefficient. So is piping to bc(1) instead of using shell
arithmetic expansion (both produce the same results, but built-in
avoids an unnecessary fork to bc(1)).
MFC after: 2 weeks
Reviewed by: kfv
Differential Revision: https://reviews.freebsd.org/D62047