From nobody Wed May 11 18:56:08 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 AA10E1ACE4E5; Wed, 11 May 2022 18:56:09 +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 4Kz3yx2c3lz4dRb; Wed, 11 May 2022 18:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652295369; 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=vTUVPpeVyltAAr0zO4h71fKU7rU0l0Tjw4VKjeZFMKs=; b=CD3mEXk55wYzQRhfnhnXUp0ctUDSbjHIzK4jxpJDyjytrXbK4D3RJYopzxeTc7DSNZlbb2 IzT/OcOvYMmSK3/0LObbxDv50H7HNwvpL/lSqWQx7fnd+xXCCdD6KxKzvrpXWnfnlw40E5 ly0gSkY8/ZQLXh6Cv6Ga423UFwI0TTOOHp+isWN0qcLbENNi79ZY4z/hN727Wy3VmNNM8I cLUzbdNCAzyR2vGTQMKYhmSxNvspb7KyPBIvufUEfsYCabpYVfFfrfykTXVdnj1ranB5Ww mSljIuelwXXJuxZgBHRjgPqEAh3aWZ+qsMr8M8kuO9CNfZr0pCqic1KMnvhlSQ== 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 D6CCE1F4CC; Wed, 11 May 2022 18:56:08 +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 24BIu8Je049077; Wed, 11 May 2022 18:56:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24BIu8fH049076; Wed, 11 May 2022 18:56:08 GMT (envelope-from git) Date: Wed, 11 May 2022 18:56:08 GMT Message-Id: <202205111856.24BIu8fH049076@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: a4153a7b77e8 - stable/13 - bhyve: Allocate dynamic arrays to hold per-VCPU state. 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: a4153a7b77e8c65bb89b6623cf168833ba4ab7e3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652295369; 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=vTUVPpeVyltAAr0zO4h71fKU7rU0l0Tjw4VKjeZFMKs=; b=APFJxCek3XFn2LL0SwMXqeRhn5H14uZN22cDLvPWRbbQl/OVNT+rKHSI528wqbr1TUcT9O 0Oebo0UwoIz3ekRR8CkfoE//XoSohUgxtUsv6d+ZTSNO5la+VJk6zDuE5DRe9t9he4ZLTF UM/kok2EWKo7K0c9wkIkikrS14uet08WU5xzKKeUneXSX2C1F3CLceuTCg77VdOi/AgbIF 40Ug0nIJnaWvSy8uFkl5SDBvCBDcfEFKi926OCCQNajdz6WJfggJVW/57Ij7KhrzLqe1fK TU1jDOSJPB1R/ARnHhUM366skt5IYlDRKHniH1WJhVV+7Dt0ZKPT9OAUvCkRtA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652295369; a=rsa-sha256; cv=none; b=KJXpj9pqoOzejptUTXSndPm6C9jg1nil491bY8jOD9f42bePB6/4vX3ZHiMRNBDUYT0mOV +PPdc8PO7yRmVzveEvAfyQzDftZ3mfAwEMa4U7CdZdkroNVzNaaIrZ1UAuWu9kNpyw8YDx Y6VlnKlY/UMaWPYGXZJRYeFzEznJ3D+b3CeCW1z+Z3B+DAU7pxJU26f2/7ziWKsbBODN2z J011DlNbRusJ/MJT1JA1kUNI2J/ihFF+mno0gl0KUdWxrmXB2tjkWy34DBGRbCB3+dUFZX KAa7I4Tq0y53b8csl3hPNnORAacS0gugn4Ur3dgTnNatMWyQKxNjA8xESaJDQg== 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=a4153a7b77e8c65bb89b6623cf168833ba4ab7e3 commit a4153a7b77e8c65bb89b6623cf168833ba4ab7e3 Author: John Baldwin AuthorDate: 2022-03-09 23:39:08 +0000 Commit: John Baldwin CommitDate: 2022-05-11 18:51:41 +0000 bhyve: Allocate dynamic arrays to hold per-VCPU state. This avoids hardcoding VM_MAXCPU in userspace. Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D34491 (cherry picked from commit 7261f82156fb35d4a5e928769041c5987f700cda) --- usr.sbin/bhyve/bhyverun.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 8a1a82cefc7c..43032b9f78fa 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -196,7 +196,7 @@ static cpuset_t cpumask; 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 { uint64_t vmexit_bogus; @@ -212,10 +212,10 @@ struct bhyvestats { struct mt_vmm_info { pthread_t mt_thr; struct vmctx *mt_ctx; - int mt_vcpu; -} mt_vmm_info[VM_MAXCPU]; + int mt_vcpu; +} *mt_vmm_info; -static cpuset_t *vcpumap[VM_MAXCPU] = { NULL }; +static cpuset_t **vcpumap; static void usage(int code) @@ -471,6 +471,7 @@ build_vcpumaps(void) const char *value; int vcpu; + vcpumap = calloc(guest_ncpus, sizeof(*vcpumap)); for (vcpu = 0; vcpu < guest_ncpus; vcpu++) { snprintf(key, sizeof(key), "vcpu.%d.cpuset", vcpu); value = get_config_value(key); @@ -1550,6 +1551,10 @@ main(int argc, char *argv[]) vm_restore_time(ctx); #endif + /* Allocate per-VCPU resources. */ + vmexit = calloc(guest_ncpus, sizeof(*vmexit)); + mt_vmm_info = calloc(guest_ncpus, sizeof(*mt_vmm_info)); + /* * Add CPU 0 */