Project

General

Profile

Actions

Feature #14691

open

vmm_ctl_ioctl needs to express VM_MAXCPU for utilities

Added by Dan McDonald 15 days ago. Updated 15 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
bhyve
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Recent changes in BHYVE have excluded the header symbol MAX_CPUS from userland programs. One of the SmartOS utilities requires this (to prevent a user from overprovisioning a BHYVE VM). Currently we're going to need to define it in the utility itself.

Currently also there are mentions of:

vmm.c: vm->maxcpus = VM_MAXCPU; /* XXX temp to keep code working */

which may change someday. To that end, we should have a vmm_ctl_ioctl that lets us have it (or even the whole maximum-possible topology the way an actual BHYVE process has it).

Actions #1

Updated by Andy Fiddaman 15 days ago

You want this (from bhyverun.c, slightly editted)

static int
num_vcpus_allowed(struct vmctx *ctx)
{
        uint16_t sockets, cores, threads, maxcpus;
       int error;

        error = vm_get_topology(ctx, &sockets, &cores, &threads, &maxcpus);
        if (error == 0)
                return (maxcpus);
        else
                return (1);
}

Actions

Also available in: Atom PDF