diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -525,7 +525,7 @@ { char tname[MAXCOMLEN + 1]; struct mt_vmm_info *mtp; - int vcpu; + int error, vcpu; mtp = param; vcpu = mtp->mt_vcpu; @@ -533,6 +533,12 @@ snprintf(tname, sizeof(tname), "vcpu %d", vcpu); pthread_set_name_np(mtp->mt_thr, tname); + if (vcpumap[vcpu] != NULL) { + error = pthread_setaffinity_np(mtp->mt_thr, sizeof(cpuset_t), + vcpumap[vcpu]); + assert(error == 0); + } + #ifdef BHYVE_SNAPSHOT checkpoint_cpu_add(vcpu); #endif @@ -971,12 +977,6 @@ enum vm_exitcode exitcode; cpuset_t active_cpus; - if (vcpumap[vcpu] != NULL) { - error = pthread_setaffinity_np(pthread_self(), - sizeof(cpuset_t), vcpumap[vcpu]); - assert(error == 0); - } - error = vm_active_cpus(ctx, &active_cpus); assert(CPU_ISSET(vcpu, &active_cpus));