aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn De Boskey <jwd@FreeBSD.org>2026-06-30 21:29:50 +0000
committerChuck Tuffli <chuck@FreeBSD.org>2026-06-30 22:18:20 +0000
commit9ea13242985dc145b2471cc8f651be87c6a74bfe (patch)
treea8723d716f7c4d030e932d223857b90e1d3a61f2
parent1361901baac43997daafd6ed41d3cdec6c119110 (diff)
bhyve: Add CPU pinning diagnostic message
When pinning a vcpu to a hostcpu fails, print out a diagnostic message to stderr indicating the failing CPU pair. MFC after: 1 month Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D57619
-rw-r--r--usr.sbin/bhyve/bhyverun.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index b5e7a4709fb4..8cbc19fcfef8 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -566,15 +566,21 @@ fbsdrun_start_thread(void *param)
{
char tname[MAXCOMLEN + 1];
struct vcpu_info *vi = param;
- int error;
snprintf(tname, sizeof(tname), "vcpu %d", vi->vcpuid);
pthread_set_name_np(pthread_self(), tname);
if (vcpumap[vi->vcpuid] != NULL) {
- error = pthread_setaffinity_np(pthread_self(),
- sizeof(cpuset_t), vcpumap[vi->vcpuid]);
- assert(error == 0);
+ if (pthread_setaffinity_np(pthread_self(),
+ sizeof(cpuset_t), vcpumap[vi->vcpuid]) != 0) {
+ int i;
+ warn("Error pinning vcpu %d to host cpuset@%p", vi->vcpuid,
+ vcpumap[vi->vcpuid]);
+ CPU_FOREACH_ISSET(i, vcpumap[vi->vcpuid]) {
+ warnx("cpu %d enabled\n", i);
+ }
+ exit(BHYVE_EXIT_ERROR);
+ }
}
#ifdef BHYVE_SNAPSHOT