tpm_crb: Use locality registers only with plain CRB
The locality release wait times out on every command on a Framework 13
(Pluton start method), logging every 10 seconds.
Reported by: emaste, tuexen
Reviewed by: kbowling
Approved by: kbowling
Fixes: bfe4be85a935 ("tpm_crb: wait for idle and locality release after each command")
tests/sys/pmc: add pidtrack, callchain, pmc(8), RAPL and AMD tests
Add to the suite of ATF tests for hwpmc(4). Vendor-neutral tests go in
tests/sys/pmc; tests that depend on AMD hardware interfaces go in
tests/sys/pmc/amd, which is only built on amd64.
tests/sys/pmc:
pmc_pidtrack_test process-mode PMCs follow their PID: a live
self-read counts the process' own work, an idle
process sharing the CPU with a busy one does not
pick up its work, and the count survives a
context switch
pmc_callchain_ur_test pmcstat -U collects user callchains through the
PMC_UR ring; regression test for the KASSERTs
fixed in rGaf3929c5152b and rG66118c3f1011
pmc_cli_test pmc(8): missing log, list-events, record/info
round trip with the "instructions" alias
pmcstat_tsc_test (amd64) tsc_freq in the initlog record, TSC
column of pmcstat -R, tsc in pmc filter -j,
[29 lines not shown]
asmc: do not enable the sudden motion sensor on the MMIO backend
The interrupt filter reads the PIO interrupt port, but sc_ioport is NULL
under MMIO; the capability test only probed for keys, which says nothing
about the backend.
No MMIO-capable machine has a sudden motion sensor anyway. It existed to
park the heads of spinning disks.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61383
libpmc: Strip leading zeros from the cpuid model
Upstream's mapfile.csv lists models without leading zeros, so entries
for models below 10h had to be fixed up by hand on every import. Strip
them before matching and use the entries as imported.
Add tests to validate the functionality.
Reviewed by: mhorne, Ali Mashtizadeh <ali at mashtizadeh.com>
Sponsored by: Advanced Micro Devices, Inc.
MFC after: 1 week
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision: https://reviews.freebsd.org/D60790
iflib: rate limit deferred tx ring drain
When simple_tx gives up & return ENOBUFS because the tx ring is full,
we were doing a GROUPTASK_ENQUEUE(&txq->ift_task) each time.
On a tx ring that has overflowed and is being hammered on
by a fast UDP sender, this can result in a massive increase in
context switches (I've seen over 30M ctxw/sec due to this, and
the ctxsw codepath taking roughly 50% CPU).
This change removes the GROUPTASK_ENQUEUE() and replaces it
with a call to a callout which drains the tx ring. The callout time is
determined based on the link speed, estimating how long it would take
for a large fraction of of a ring containing full-MTU packets to drain.
This removes the 30M ctxsw / sec in my test case and reduces it
to roughly a doubling of ctxsws.
Reviewed by: kbowling
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D61313
iflib: simplify TXQ_AVAIL
Simply the TXQ_AVAIL() macro to avoid using
get_inuse(txq->ift_size, txq->ift_cidx, txq->ift_pidx, txq->ift_gen)
and instead define it in terms of txq->ift_in_use.
Note that in_use is equivalent, because it is updated at the same time
as cidx/pidx and gen, and under the same serialization. The advantage
is that its cheaper due to using one read and no branches, and
safer, since unlocked reads get an atomic snapshot of availability,
but an unlocked read of multiple counters can produce inconsistent
results.
Reviewed by: kbowling, kgalazka
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D61279
pw: reject ' and ` in user/group names
pw_checkname() already refuses $ ( ) and freinds, but backtick and
single quote slipped thru, so `pw useradd 'foo`id`'` went in just
fine. Thats command substitution in any unquoted context. Add both
to badchars, plus a test.
Reported by: Harry Sintonen (Reversec)
Sponsored by: Entersekt
MFC after: 2 weeks
Approved by: bapt
Differential Revision: https://reviews.freebsd.org/D61392
OpenSSH: Update to 10.6p2
Full release notes are available at
https://www.openssh.org/txt/release-10.6p2 .
Selected items from the upstream release notes:
Future deprecation notice
-------------------------
* scp(1): begin deprecating the -R flag, which is used to perform a
remote-to-remote copy by executing scp on a remote host. This
option is a fragile optimisation that is difficult to use because
it requires credentials on the remote host. It also creates
security risks if the shell quoting rules on the remote system
where the copy is performed differ from the client's expectations.
From OpenSSH 10.6, this option will continue to work but will
cause a deprecation warning to be emitted to standard error. In
[6 lines not shown]
OpenSSH: Update to 10.6p1
This release contains security fixes and small bugfixes.
Full release notes are available at
https://www.openssh.com/txt/release-10.6 .
Selected items from the upstream release notes:
Security
========
* ssh-agent(1): fix an interaction between agent locking and the
session-bind at openssh.com extension that is used to identify
forwarded agents. These binding requests were refused when the
agent was locked, with the result that operations that were
intended to be limited to local use only could be performed
remotely, including the ability to add PKCS#11 tokens and make
use of keys that had destination restrictions applied.
[33 lines not shown]
axp81x: Serialize the register accesses
The registers were accessed with iicbus_transfer(), which does not own
the bus. The interrupt driven transfers of the Allwinner twsi
controller drop their mutex while they sleep waiting for the interrupt,
so two accesses can overlap, and the PMU shares its bus with other
devices, an RTC for instance. Use iicbus_transfer_excl() so that the
accesses are arbitrated.
The regulators share the enable registers and the regulator framework
only serializes the accesses to a single regulator. Protect the
read-modify-write of these registers with a lock, so that regulators
enabled at the same time cannot lose each other's update.
No failure was seen without this, it is there for correctness.
Tested on: A64, H6
axp81x: Add support for the AXP805 and AXP806
The AXP805 and AXP806 are regulator only PMUs, with different registers
than the AXP803 and AXP813, and without a battery, ADC sensors or GPIO.
Add the regulators (voltage ranges from the datasheet and the Linux
driver) and the interrupts: the power key short press powers the system
off and the die temperature is sent to devd. The battery, sensors,
thresholds, shutdown handler and GPIO bus are not set up for them.
Tested on a Pine H64 (AXP805 on the R_I2C).
axp81x: Do not change the voltage of a regulator in range
axp8xx_regnode_init() set every regulator described in the FDT to its
minimum voltage, even if the firmware had already set a voltage in the
range. For a regulator that is in use, like the one of the CPU, this can
make the system crash. Only set the voltage when the current one is out
of the range.
Tested on: A64, H6
axp81x: Skip the regulators that have no name in the FDT
A regulator that is not used is described in the FDT by a node without
regulator-name, and regulator_parse_ofw_stdparam() fails for it, which
printed two errors at every boot. Skip these nodes, and only tell about
it when booting verbose.
axp81x: Get the voltage of the regulators with a single range
axp8xx_regnode_get_voltage() failed when the regulator has no second
step, which is the case of the ones with a single range. Only the first
step is mandatory, as in axp8xx_regnode_set_voltage().
Tested on: A64, H6
axp81x: Check the errors of the register accesses
axp8xx_regnode_enable() wrote back a value computed from a register it
failed to read, which clears the enable bits of all the other
regulators of that register. Return an error instead, and do the same
in the other regnode methods, which used an uninitialised value when an
access failed.
Also initialise udelay in axp8xx_regnode_init(), as
axp8xx_regnode_set_voltage() can now fail before setting it.
Tested on: A64, H6
axp81x: Fix the register accesses
The register pointer was written without IIC_M_NOSTOP, so the controller
sends a STOP before the read message. On the Allwinner H6 (twsi) this
makes the reads return garbage without any error.
Set IIC_M_NOSTOP on it, and send the register and its value in a single
write message, like the other PMIC drivers do.
Tested on: A64, H6
axp81x: Add a function to get the regulator definition
Move the lookup of the regulator definitions out of axp8xx_attach().
This also fixes an off-by-one: the test was i <= nitems(common), so the
first regulator of the per-chip table (dc1sw or dcdc7) was never
registered and one entry past the end of the common table was read.
Tested on: A64
twsi: Do not clear the interrupt flag when changing the control bits
twsi_control_set() and twsi_control_clear() read the control register,
change some bits and write it back. On the controllers where the
interrupt flag is cleared by writing a 1 to it (iflag_w1c), this clears
it as the flag is read as set.
In the polled mode this breaks the repeated start: START is set with
the flag cleared by the write, the hardware sends the repeated start at
once, and the flag is then cleared a second time, which loses the event
and leaves the controller with the status of the previous transfer.
Transfers with a repeated start fail with IIC_ESTATUS on an Allwinner
H6 until the controller works with interrupts.
Mask the flag out of the value that is written back, unless the caller
asks for it.
Tested on: H6
aw_rsb: Accept a write in a single message
The driver only took a write as two messages, the offset and then the
data. A write on an I2C bus is a single message that starts with the
register, which is how a driver that can be on I2C or on RSB, like
axp81x, does it. Split such a message into the two the controller
needs.
Tested on: A64
axp81x: Move the sensors, sysctls and thresholds out of attach
Add one function for each of them: axp8xx_add_sensors(),
axp8xx_add_sysctls() and axp8xx_get_thresholds().
No functional change. This is a preparation to support PMUs without a
battery, like the AXP805, with this driver.
netipsec: Release the SA inside the vnet context in AH and IPComp callbacks
The error paths of ah_input_cb(), ah_output_cb(), ipcomp_input_cb() and
ipcomp_output_cb() called CURVNET_RESTORE() before key_freesav() and
key_freesp(). When the callback runs on a crypto return thread, no
vnet is set after the restore, and key_freesav() panics with "vnet is
not set" on INVARIANTS kernels. Without INVARIANTS, the last reference
would be released without a vnet.
Restore the vnet last, as the ESP callbacks do.
Reviewed by: mjg
Fixes: 8a9269edd71a ("ipsec: sprinkle CURVNET_ASSERT_SET")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D61386
kobj: Make the containers of pointers to base classes constant
The containers (arrays) will not be modified during runtime.
Reviewed by: kib, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D61297
ixgbe: Attach the MDIO bus after iflib drops the context lock
ixgbe_mdio_attach() ran from ixgbe_if_attach_post(), which iflib calls
with the context lock held. Attaching the MDIO bus there also probes
and attaches the devices on it, and their register accesses go through
ixgbe_mdio_readreg_c22() and ixgbe_mdio_writereg_c22(), which take the
same lock. A driver on the bus that was in the kernel or loaded by
loader(8) therefore recursed on the non-recursive iflib sx lock as soon
as it touched a register: INVARIANTS kernels panic in _sx_xlock_hard(),
others recurse silently.
Wrap iflib_device_attach() and attach the MDIO bus once it has
returned, so the children take the context lock like any later MDIO
access does.
Reviewed by: kbowling
Fixes: cfec995c87f3 ("ixgbe: add MDIO bus support")
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D61199