Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/bhyverun.c
Context not available. | |||||
char *vmname; | char *vmname; | ||||
int guest_ncpus; | int guest_ncpus; | ||||
uint64_t sockets; | |||||
grehan: uint16_t -> uint16_t | |||||
uint64_t cores; | |||||
uint64_t threads; | |||||
uint64_t maxcpus; | |||||
char *guest_uuid_str; | char *guest_uuid_str; | ||||
static int guest_vmexit_on_hlt, guest_vmexit_on_pause; | static int guest_vmexit_on_hlt, guest_vmexit_on_pause; | ||||
Context not available. | |||||
} | } | ||||
static int | static int | ||||
topology_parse(const char *opt) | |||||
{ | |||||
char *cp, *str; | |||||
int i, tmp; | |||||
str = strdup(opt); | |||||
if ((cp = strchr(str, ',')) != NULL) { | |||||
for (i = 0; str; i++) { | |||||
if (sscanf(str, "cpus=%d", &tmp) == 1) | |||||
guest_ncpus = tmp; | |||||
else if (sscanf(str, "sockets=%d", &tmp) == 1) | |||||
sockets = tmp; | |||||
else if (sscanf(str, "cores=%d", &tmp) == 1) | |||||
cores = tmp; | |||||
else if (sscanf(str, "threads=%d", &tmp) == 1) | |||||
Done Inline Actionsmaxcpus is currently a no-op so it doesn't need to be exposed. No harm in having it in the internal api though. grehan: maxcpus is currently a no-op so it doesn't need to be exposed. No harm in having it in the… | |||||
threads = tmp; | |||||
#ifdef notyet /* Do not expose this until vmm.ko implements it */ | |||||
else if (sscanf(str, "maxcpus=%d", &tmp) == 1) | |||||
maxcpus = tmp; | |||||
#endif | |||||
else | |||||
return (-1); | |||||
if (cp == NULL) | |||||
str = NULL; | |||||
else { | |||||
str = ++cp; | |||||
cp = strchr(str, ','); | |||||
} | |||||
} | |||||
} else { | |||||
if (sscanf(str, "cpus=%d", &tmp) == 1) | |||||
guest_ncpus = tmp; | |||||
else if (sscanf(str, "%d", &tmp) == 1) | |||||
guest_ncpus = tmp; | |||||
else | |||||
return (-1); | |||||
} | |||||
if (guest_ncpus != sockets * cores * threads) | |||||
return (-1); | |||||
else | |||||
return(0); | |||||
} | |||||
static int | |||||
pincpu_parse(const char *opt) | pincpu_parse(const char *opt) | ||||
{ | { | ||||
int vcpu, pcpu; | int vcpu, pcpu; | ||||
Context not available. | |||||
exit(1); | exit(1); | ||||
} | } | ||||
Done Inline ActionsShould check an error return here. grehan: Should check an error return here. | |||||
} | } | ||||
error = vm_set_topology(ctx, sockets, cores, threads, maxcpus); | |||||
if (error) { | |||||
perror("vm_set_topology"); | |||||
exit(1); | |||||
} | |||||
return (ctx); | return (ctx); | ||||
} | } | ||||
Context not available. | |||||
progname = basename(argv[0]); | progname = basename(argv[0]); | ||||
gdb_port = 0; | gdb_port = 0; | ||||
guest_ncpus = 1; | guest_ncpus = 1; | ||||
sockets = cores = threads = 1; | |||||
maxcpus = 0; | |||||
memsize = 256 * MB; | memsize = 256 * MB; | ||||
mptgen = 1; | mptgen = 1; | ||||
rtc_localtime = 1; | rtc_localtime = 1; | ||||
Context not available. | |||||
} | } | ||||
break; | break; | ||||
case 'c': | case 'c': | ||||
guest_ncpus = atoi(optarg); | if (topology_parse(optarg) !=0) { | ||||
errx(EX_USAGE, "invalid cpu topology " | |||||
"'%s'", optarg); | |||||
} | |||||
break; | break; | ||||
case 'C': | case 'C': | ||||
memflags |= VM_MEM_F_INCORE; | memflags |= VM_MEM_F_INCORE; | ||||
Context not available. |
uint16_t -> uint16_t