Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/bhyverun.c
Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | |||||
static char *progname; | static char *progname; | ||||
static const int BSP = 0; | static const int BSP = 0; | ||||
static cpuset_t cpumask; | static cpuset_t cpumask; | ||||
static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip); | static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip); | ||||
static struct vm_exit vmexit[VM_MAXCPU]; | static struct vm_exit *vmexit; | ||||
struct bhyvestats { | struct bhyvestats { | ||||
uint64_t vmexit_bogus; | uint64_t vmexit_bogus; | ||||
uint64_t vmexit_reqidle; | uint64_t vmexit_reqidle; | ||||
uint64_t vmexit_hlt; | uint64_t vmexit_hlt; | ||||
uint64_t vmexit_pause; | uint64_t vmexit_pause; | ||||
uint64_t vmexit_mtrap; | uint64_t vmexit_mtrap; | ||||
uint64_t vmexit_inst_emul; | uint64_t vmexit_inst_emul; | ||||
uint64_t cpu_switch_rotate; | uint64_t cpu_switch_rotate; | ||||
uint64_t cpu_switch_direct; | uint64_t cpu_switch_direct; | ||||
} stats; | } stats; | ||||
struct mt_vmm_info { | struct mt_vmm_info { | ||||
pthread_t mt_thr; | pthread_t mt_thr; | ||||
struct vmctx *mt_ctx; | struct vmctx *mt_ctx; | ||||
int mt_vcpu; | int mt_vcpu; | ||||
} mt_vmm_info[VM_MAXCPU]; | } *mt_vmm_info; | ||||
static cpuset_t *vcpumap[VM_MAXCPU] = { NULL }; | static cpuset_t **vcpumap; | ||||
static void | static void | ||||
usage(int code) | usage(int code) | ||||
{ | { | ||||
fprintf(stderr, | fprintf(stderr, | ||||
"Usage: %s [-AaCDeHhPSuWwxY]\n" | "Usage: %s [-AaCDeHhPSuWwxY]\n" | ||||
" %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" | " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" | ||||
▲ Show 20 Lines • Show All 240 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
build_vcpumaps(void) | build_vcpumaps(void) | ||||
{ | { | ||||
char key[16]; | char key[16]; | ||||
const char *value; | const char *value; | ||||
int vcpu; | int vcpu; | ||||
vcpumap = calloc(guest_ncpus, sizeof(*vcpumap)); | |||||
for (vcpu = 0; vcpu < guest_ncpus; vcpu++) { | for (vcpu = 0; vcpu < guest_ncpus; vcpu++) { | ||||
snprintf(key, sizeof(key), "vcpu.%d.cpuset", vcpu); | snprintf(key, sizeof(key), "vcpu.%d.cpuset", vcpu); | ||||
value = get_config_value(key); | value = get_config_value(key); | ||||
if (value == NULL) | if (value == NULL) | ||||
continue; | continue; | ||||
vcpumap[vcpu] = malloc(sizeof(cpuset_t)); | vcpumap[vcpu] = malloc(sizeof(cpuset_t)); | ||||
if (vcpumap[vcpu] == NULL) | if (vcpumap[vcpu] == NULL) | ||||
err(4, "Failed to allocate cpuset for vcpu %d", vcpu); | err(4, "Failed to allocate cpuset for vcpu %d", vcpu); | ||||
▲ Show 20 Lines • Show All 1,085 Lines • ▼ Show 20 Lines | #ifdef BHYVE_SNAPSHOT | ||||
* checkpointing thread for communication with bhyvectl | * checkpointing thread for communication with bhyvectl | ||||
*/ | */ | ||||
if (init_checkpoint_thread(ctx) < 0) | if (init_checkpoint_thread(ctx) < 0) | ||||
printf("Failed to start checkpoint thread!\r\n"); | printf("Failed to start checkpoint thread!\r\n"); | ||||
if (restore_file != NULL) | if (restore_file != NULL) | ||||
vm_restore_time(ctx); | vm_restore_time(ctx); | ||||
#endif | #endif | ||||
/* Allocate per-VCPU resources. */ | |||||
vmexit = calloc(guest_ncpus, sizeof(*vmexit)); | |||||
mt_vmm_info = calloc(guest_ncpus, sizeof(*mt_vmm_info)); | |||||
/* | /* | ||||
* Add CPU 0 | * Add CPU 0 | ||||
*/ | */ | ||||
fbsdrun_addcpu(ctx, BSP, BSP, rip); | fbsdrun_addcpu(ctx, BSP, BSP, rip); | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
/* | /* | ||||
Show All 21 Lines |