From nobody Wed Mar 09 23:57:35 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E779A1A1280D; Wed, 9 Mar 2022 23:57:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KDTdr2XLKz4cFt; Wed, 9 Mar 2022 23:57:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646870256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Emk62+8Ky8KgNPzPCX4F8auVU2SwwCxOmRGhzVMC8z4=; b=jJ2eXwDJlVQR4RkUziTd1+QYHEXewTDjtOCvAUlGRIJmDn3TnvXApGH31AslS/RFc5XCQi srkbJ0z40JrClqZmlWr1b8dyefxQDS19UVKABdwLtf/5q612GQfnDpJCSL+Lc60L8TYYdc sxCk95vbpJyXtQTJrtP1bG01Gyl2wwndEy8Ecv67HJHqNTgA+7p8mTBbYcMbZ1cSpmhNg9 PMQqm/LisjOR9cEDRiHqU1WNN73R8MyqXEEQFExRXeN6oWPhUc0heEW2FpqhRPxpMw/NYh 6DlIK+MfsPc52wp4f0GWVtqpGMy9sO7hzXWEFmqi7YNxbjo6c1BiRVTdHjsFUA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAD341A7A0; Wed, 9 Mar 2022 23:57:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 229NvZcv004821; Wed, 9 Mar 2022 23:57:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 229NvZQr004820; Wed, 9 Mar 2022 23:57:35 GMT (envelope-from git) Date: Wed, 9 Mar 2022 23:57:35 GMT Message-Id: <202203092357.229NvZQr004820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c76e4b89d9b8 - main - bhyve: Use vm_get_topology to query kernel's maximum vCPU count. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c76e4b89d9b87b2450107b29f229d374dc156352 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646870256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Emk62+8Ky8KgNPzPCX4F8auVU2SwwCxOmRGhzVMC8z4=; b=e6oHgwbyaWJyzlxa4NWWEfD1zrI75kaI63j6ceFgN6zDTnuVhjkYLgVSzLbOmP047JtIah 9GdzBZkvvtXaqzziK1Nn7nETnMl9WsYuZ8NkaMbn9T7ca/5miSm1DXqM//C80FIt0DlzYq xOeKKmh3boP6RNcDnRgNk6FyGJL+dws8XqhixojOq42MQIMyZ+bKLDDY4v/i3EGolpvumV qYvnEG8izHpnwjPqftimgY5ebY86MPRj0Uv2JYghDtgG4LybEqcw7E+n4Jk7emFNVEd36z 0UPb6zIWROe9CUuFfDanSaRzIv2ST4JNDmQS0sY/hXAbG4qnNlbqv/psJYgRzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646870256; a=rsa-sha256; cv=none; b=F/RSIYzjXrAtsubMG2zZN+/tC7ud6awQ/8hsThGuw7ajJWt0cN/ajbHwwmxkDDfxal3OmL YxURdaoFQGDi0zYwd5iUywoonTVWqsVwEBW0HoKobbTRVIuzI8RtyfeD9xq/3lwifeYLXq FN3dLyJvuncokHLpHGfvxJLPfhp03gFPsVvqOnSPFUSIJIfS1EDFEdFh9wT3XdEb7UeoYU I00eeC+PmmPz9kek1hi7kbCsyP3BwJ7AX+I3LD9cTOqziy64IKMKdw/csLtl1pL4PJG5x0 ABIsCyNJWbsNlMDIfRDMzembPb5qnhH9jNjm8hTPi9k78zLt1glorSezzYZnsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c76e4b89d9b87b2450107b29f229d374dc156352 commit c76e4b89d9b87b2450107b29f229d374dc156352 Author: John Baldwin AuthorDate: 2022-03-09 23:39:23 +0000 Commit: John Baldwin CommitDate: 2022-03-09 23:39:23 +0000 bhyve: Use vm_get_topology to query kernel's maximum vCPU count. Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D34493 --- usr.sbin/bhyve/bhyverun.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 4989915791b5..867938af050d 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1001,16 +1001,20 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) static int num_vcpus_allowed(struct vmctx *ctx) { + uint16_t sockets, cores, threads, maxcpus; int tmp, error; - error = vm_get_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, &tmp); - /* * The guest is allowed to spinup more than one processor only if the * UNRESTRICTED_GUEST capability is available. */ + error = vm_get_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, &tmp); + if (error != 0) + return (1); + + error = vm_get_topology(ctx, &sockets, &cores, &threads, &maxcpus); if (error == 0) - return (VM_MAXCPU); + return (maxcpus); else return (1); }