The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=9ea13242985dc145b2471cc8f651be87c6a74bfe
commit 9ea13242985dc145b2471cc8f651be87c6a74bfe Author: John De Boskey <[email protected]> AuthorDate: 2026-06-30 21:29:50 +0000 Commit: Chuck Tuffli <[email protected]> CommitDate: 2026-06-30 22:18:20 +0000 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 --- usr.sbin/bhyve/bhyverun.c | 14 ++++++++++---- 1 file 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
