hwpmc_amd: rename away from K8
K8 is the ancient/initial 64-bit AMD processers. We are retaining
support for these, but our AMD hwpmc class has grown substantially. We
don't want to emphasize this old naming as it is a potential source of
confusion.
The PMC_CLASS_K8 name is retained as an alias, and still used in the K8
code in libpmc.c.
Reviewed by: Andre Silva <andasilv at amd.com> (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60100
tests/sys/pmc/amd: add IBS, row allocation, PerfEvtSel and PerfMonV2 tests
- pmc_ibs_test: the IBS class.
- pmc_ibs_fetch_op_test: Fetch and Op together (572cd669d6) and IBS
interrupt accounting (c97cea955f).
- pmcstat_ibs_test: pmcstat records and replays IBS samples.
- pmc_rowalloc_test: core row allocation.
- pmc_start_msr_test: PerfEvtSel.En and PerfCntrGlobalCtl after pmc_start().
- pmu_perfmonv2_test: the PerfMonV2 global-control path.
- amd_pmc_test_common.h: also match the AMD-<n> row names of D60100.
Reviewed by: mhorne
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Signed-off-by: Davi C.A <davi.chavesazevedo at amd.com>
Differential Revision: https://reviews.freebsd.org/D61063
tests/sys/pmc: Pass pmcstat -n before -P in pmc_callchain_ur_test
pmcstat -n sets the sampling rate only for the sampling PMCs that follow
it on the command line. pmc_callchain_ur_test passed it after -P, so
UR_RATE was never applied and the PMC sampled at the default rate from
pmc_pmu_sample_rate_get(): 65536 on AMD, and 2000003 for
inst_retired.any on Intel, about 20 times fewer samples than intended.
Move -n ahead of -P in both pmcstat invocations.
Reported by: llm-postcr
Reviewed by: mhorne
Fixes: 546a76463123
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision: https://reviews.freebsd.org/D61458
pmc: Exit with EX_OK when the pmc record time limit ends the capture
cmd_pmc_record() stores the return value of kevent() in status, which
is also its exit status. When the -t time limit elapses, the
EVFILT_TIMER branch jumps to done with status still holding kevent()'s
result, 1, so a timed recording exits with status 1, while one
interrupted with SIGINT exits with EX_OK.
Keep kevent()'s return value in its own variable and start status at
EX_OK. The kevent() failure and unknown signal cases called err() and
exited without stopping and releasing the PMCs; set status to EX_OSERR
and go through done instead, as the SIGIO case does.
pmc_cli_test and amd/pmc_frontend_test accepted status 1 to work around
this; make them require 0.
Reported by: llm-postcr
Reviewed by: mhorne
Fixes: a79a051e7d16 ("pmc: pmc record command")
[3 lines not shown]
tests/sys/pmc: Keep atf_fail reasons on a single line
Several tests put the output of pmc record, pmc info or pmcstat into the
atf_fail reason. That output spans several lines, and ATF reports a
multi-line reason as a broken test instead of a failed one, with the
captured output mangled into the error.
Copy the output to stderr, where kyua keeps it in the report, and use a
single-line reason.
Reviewed by: mhorne
Fixes: 546a76463123 ("tests/sys/pmc: add pidtrack, callchain, ...")
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision: https://reviews.freebsd.org/D61459
pkg-serve: stat the opened descriptor instead of the path
Open first and fstat() that fd, so the file checked is the one served.
O_NONBLOCK avoids blocking on a FIFO.
pkg-serve: do not leak whether a path exists
Report "ko: file not found" for non-regular files as well, so a
client cannot tell an existing path from a missing one.
pkg-serve: bound the command line length
getline(3) grows its buffer without limit, so a client could make the
process consume unbounded memory. Read commands with a bounded
reader, drain and reject lines longer than MAXLINE with
"ko: command too long", and document the limit.
libfetch: Fix buffer overruns in FTP code
* When parsing the reply to a CWD, PWD, or CDUP command, if we ran out
of space in the destination buffer, we would correctly terminate the
loop, but then incorrectly see the remaining length as non-zero,
causing us to write a terminating NUL one past the end of the buffer
and report success instead of a protocol error. Additionally, the
code would fail to notice an improperly terminated pathname, and was
hard to follow, so rewrite the entire loop.
* When comparing the current working directory to the intended working
directory to calculate the minimal operation to get from one to the
other, if the current working directory was an empty string, we would
improperly read one byte below the start of the intended working
directory.
MFC after: 1 week
Reported by: Laam Alif at Ibteda Digital Library
Differential Revision: https://reviews.freebsd.org/D61502
powerpc: save and restore VRSAVE with the vector state
VRSAVE was never saved or restored, although user code can write it
and the mcontext carries it, so every process saw the value the
previous process on that CPU had left there.
Two processes pinned to the same CPU and writing different values to
VRSAVE each read back the other's; each reads back its own now.
Reviewed by: jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61544
powerpc: move get_pcpu() to machine/pcpu.h
Every other arch defines get_pcpu() in machine/pcpu.h, powerpc has it in
machine/cpufunc.h, which is entirely under _KERNEL. lsof includes
sys/systm.h without _KERNEL first on purpose, so on powerpc cpufunc.h
turns into an empty header and pcpup later expands to a call of an
undeclared get_pcpu(). Since sys/mount.h started pulling in sys/proc.h
this breaks the lsof build on powerpc64 and powerpc64le.
Reviewed by: jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61305
snd_uaudio: Fix the MIDI TX round-robin
Nothing advances curr_cable, so umidi_bulk_write_callback() only
services cable 0, which is a problem on MIDI devices with more than one
jack.
Fixes: 039477d3e7e7 ("snd_uaudio: Simplify chan->curr_cable calculation in uaudio_bulk_write_callback()")
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
usbdevs: Add HumanWare BrailleNote Apex IDs
Add the HumanWare vendor ID and the BrailleNote Apex
product ID to support the Apex 32 BT when configured
as a screen reader terminal in USB Client mode.
This device will also serve as the starting point for
developing the FreeBSD braille(4) subsystem.
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61624
twsi: Wait for the bus to go idle before starting a transfer
The status register does not read as idle (0xf8) right after the
previous transfer ended and the module was disabled. On fast
(optimised) kernels the next transfer starts too early, sees a
different status and fails with EIO ("Bad status at start of
transfer").
On the Pine H64 this made the AXP805 write that disables the PHY
supply fail from awg_shutdown(), leaving the PHY powered and the
board hanging on warm reboot. Poll the status register for up to 1ms
before declaring the bus not idle.
Tested on: Pine H64 (5 warm reboots with a NODEBUG kernel)
Fixes: cb167e1ae954 ("twsi: do not attempt transfer if bus is not idle")
arm64 pmap: combine L3C accessed bits in pmap_mincore()
The accessed bit may be set in only some of an L3C superpage's L3
PTEs. However, when pmap_mincore() found an L3C mapping, it reported
the accessed state of the specified L3 PTE only, so mincore(2) could
fail to report MINCORE_REFERENCED for an L3C superpage that had been
accessed. When the accessed bit is not set in the specified entry, use
pmap_load_l3c() to combine the accessed bits from all of the L3C
superpage's L3 PTEs.
(cherry picked from commit 3ba68f5c5dcc9a4bcd513c28efce29afdfcb76ff)
bhyve: Reject unsupported checkpoints before saving RAM
pci_snapshot() rejects devices without a pe_snapshot callback, but
vm_checkpoint() reaches that check only after truncating checkpoint
files, pausing the VM, and saving RAM and kernel state.
Check for unsupported PCI devices at the start of vm_checkpoint(),
before creating files or pausing the VM. This preserves existing
checkpoint files when the request cannot succeed. Add
pci_can_snapshot() so that the new check and pci_snapshot() use the
same test.
Reviewed by: markj, kevans
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61003