From nobody Wed May 11 18:56:11 2022 X-Original-To: dev-commits-src-all@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 3DBB21ACE88D; Wed, 11 May 2022 18:56:12 +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 4Kz3yz4B7cz4dZm; Wed, 11 May 2022 18:56:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652295371; 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=utRZ4kgLGYfMN/SCkrWOX/CdFX6OTsgoNSi4R7W6lk4=; b=ayNHSD7KWL0G7GWR4qjJaXksR3Ei86bOy1L5/53RRY7P4tla7WtXuRxnatMpD6iOcoASw4 UHu4jlI8k1xuY0h+tj/ae4lJwu4ntKqIyXq3aH431K73LRo8t4hEx+K5pqUJw3pCaQ2S2a hbpAKXjHk6+gd34eGgeZsFI+iyJEvud1MIFZy9ApWxkPWJslaI0sSA2ZpVoDYyHwgR19gO ucsYH7P5jitaIcMJojnzq57R0ZGKBH7KhqtOjQ7npDBVmYsMmegRW6r2w6OhqK2GfDP2aL ckbKH6RvDwuJ6gP0XEBjjNIFCN0Jl4OcvxLkdQ8m9EfSoInvbUqoLkB25YoyPw== 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 28CA51F177; Wed, 11 May 2022 18:56:11 +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 24BIuB2l049125; Wed, 11 May 2022 18:56:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24BIuB4K049124; Wed, 11 May 2022 18:56:11 GMT (envelope-from git) Date: Wed, 11 May 2022 18:56:11 GMT Message-Id: <202205111856.24BIuB4K049124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 31649c585002 - stable/13 - bhyve: Use vm_get_topology to query kernel's maximum vCPU count. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 31649c58500230531e848ecc77283097668bfda6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652295371; 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=utRZ4kgLGYfMN/SCkrWOX/CdFX6OTsgoNSi4R7W6lk4=; b=uCjtqBjsqwNXYEFjHUfFdTxg6bXb0yKh8O2PlioQ+Qb8j3f3uTZQSHzOvDJRa6lvu/L3uB j1hdDYxC6QLcuk3u9TTa8iXARsCwyHs2krJ0vgWjtNjEJb4ZbTFi1v4h1nnuUIXA0kIhRK BBh9skAhSXVLNzhp4XP4ElLmAxee1JJVNz75qhhNw3/jLPbiZZ42OgFrq9rV6hWyi59SnY ywnhf+Osx3MYq3jqXF+/MRwWBopHHMnn5Cp+18mv06Ioviz7l7IWShSGm6R4XwDvSyxeQJ ewmUSM20hBQKYj+5G63hDfhsVTlpQbBpZKqTMc72lcGXFC4BwLP1Dmbs18CZYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652295371; a=rsa-sha256; cv=none; b=cSAPnvKu/30gwLvnrnnV00PQYO3d6Dbq0NVO7EdYuHx4Qbmb96okSI/e7ghIcvqaYfYkqh WKs+PFyHWTyrV0PA9NnGsMhdVi9rItZ0zmoNSi3nDlybCC+xGy3mLi0pzv287SGFatFxKG 7ZhG+UxeHQBTrcrhyz2iUzGI2V927Qt5iYms8DObCZnRpa0OWu4bnIxjpDpVSv4jY6WlSf 6xqhwINIgXnIddDPizgEw7/dz1nVp9qCGTw+indNg/b9ZgnA9zPpkXmNT9vJ6Pc9N3s2KQ wrTSjIKdTXOytJwm0EcJNwXthg1VlPMeSHOHt4pomIJTK/gt4+6V4PSepM6uNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=31649c58500230531e848ecc77283097668bfda6 commit 31649c58500230531e848ecc77283097668bfda6 Author: John Baldwin AuthorDate: 2022-03-09 23:39:23 +0000 Commit: John Baldwin CommitDate: 2022-05-11 18:53:12 +0000 bhyve: Use vm_get_topology to query kernel's maximum vCPU count. Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D34493 (cherry picked from commit c76e4b89d9b87b2450107b29f229d374dc156352) --- 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 3a474fcdf270..3a2b91c760e4 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1000,16 +1000,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); }