Summary: | virtualized kernel panics on process exit running under pmcstat | ||
---|---|---|---|
Product: | Base System | Reporter: | John F. Carr <jfc> |
Component: | kern | Assignee: | Mitchell Horne <mhorne> |
Status: | Open --- | ||
Severity: | Affects Only Me | CC: | asomers, grahamperrin, markj, mhorne |
Priority: | --- | Keywords: | crash |
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any | ||
See Also: | https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268897 |
Description
John F. Carr
2023-01-14 00:05:52 UTC
It appears that bhyve does not support virtualized performance counters, neither on AMD or Intel. Thus, the assertion is triggered because reading the counter configuration register will always return a value of zero. The AMD hwpmc class should detect when this support is disabled and bail from the initialization routine. I will work on this change. This is still reproducible on main, for what it's worth: root@freebsd:~ # pmcstat -p instructions ls .cshrc .panic: [amd,519] PMC0, CPU3 "K8-0" already stopped cpuid = 3 time = 1730036956 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00b3b31b30 vpanic() at vpanic+0x136/frame 0xfffffe00b3b31c60 panic() at panic+0x43/frame 0xfffffe00b3b31cc0 amd_stop_pmc() at amd_stop_pmc+0x105/frame 0xfffffe00b3b31cf0 pmc_process_exit() at pmc_process_exit+0x281/frame 0xfffffe00b3b31d80 exit1() at exit1+0x370/frame 0xfffffe00b3b31df0 sys_exit() at sys_exit+0xd/frame 0xfffffe00b3b31e00 amd64_syscall() at amd64_syscall+0x158/frame 0xfffffe00b3b31f30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00b3b31f30 --- syscall (1, FreeBSD ELF64, exit), rip = 0x2cf749f1674a, rsp = 0x2cf7462af8f8, rbp = 0x2cf7462af910 --- KDB: enter: panic [ thread pid 3157 tid 100141 ] Stopped at kdb_enter+0x33: movq $0,0x1056282(%rip) A comment in pmc_amd_initialize says there is no CPUID flag for performance counters. It may be necessary to do a trial wrmsr and see if the value written sticks. |