From nobody Wed Dec 21 18:34:04 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 4Ncht46kHCz1GhLb; Wed, 21 Dec 2022 18:34:04 +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 4Ncht44Lhrz40pq; Wed, 21 Dec 2022 18:34:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671647644; 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=LMnZdWf8XKi2yFuog5hlSsOCUviVC1f+stKtz7D6Diw=; b=Qnaemora3AUYCUJBrMZY3WmiIEj5+VsOd3jB4Wxl3L+8mvzlXAonkJN58P7+nICRz72qoG 5Pl/UIcKKkSy/bmLDKfPRMagw+NuU5Kw9NhR6YBz2XmyTwJ90dEpucE60ltCeNK3fuGHc5 FEZN+YbUnn4oWKXarACIMWU2dUgF7SWs4U88hdUWyvLkQIxjloCYmZqhOA0ppoUZB73IsT BT/BFGSPFpPMEDEvB11QrAB1AWsrHssRBuCymNe6825gaPXEA7ef+fxTnNjB/o8ggyrZ2E R3aJmLgtqP7IKl4NtTAyMvR3kjf7OS/ekjZtTHFXsbAv3g1hPju81VsY0EltZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671647644; 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=LMnZdWf8XKi2yFuog5hlSsOCUviVC1f+stKtz7D6Diw=; b=cGAJ60ZJEWoCR8eV1D/SGJZDlJgEaXtwNMhtxt0XjhB2UOyKUwoiz3IlTlQrAZ39X7WhUy i41bvndNtKSNIOD/UMT1SIuUke/9xdN7DApeMPS51aXsIadrDsV2sS/dNZB1hITCJafF7/ yT8FugUMVlX/9+TPYWvgLxHiBriVtGosqDKEB6ffyvHJhL3pHFuo/AM7K/zTuDcQllg0TV yd/RD4pdXVtCGIZSxttFEI9lUZiwaDeyDrAZ4Sl2BdAffe7iZV+sB/fFMvc8iUW0JmnolC PyHjQ9zwlfKOb+ct1td4lAoGOBIIE9e5GI9nHTmKaCo9FIIQbdguUYy93rb74Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671647644; a=rsa-sha256; cv=none; b=bbGoRgiN/VWvFAzuseUEIgjomZsETs1S0zMxbWyLHhyJfGcJumstOgLBCOnysuUg2+wtpi cTc6Fs+M4YeFRef6329EctYBQvAIY753leeFZUN5mqOXMMYLKqTRTf+rMue6VPuSwNBOTr 29ggZew5JVRbtf/2YP+kDMtH2BGUJ3iHmRny0NRp5l18Y+UuV1aRY8mUiffDmG2QwThhd8 RoJWlXCjzr7NGrdrokxsbbA23d56YaPgCcjmSycjRMX0n4sn/+MgjAEhVn7rvRFOvlBJf4 gk6kfI/bilHM8kaLCb2P0KHhlQXgI4JAFkNXaCnFmWn2GUyKGJd82Rzvv8DaUw== 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 4Ncht43MRqzQ84; Wed, 21 Dec 2022 18:34:04 +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 2BLIY426068901; Wed, 21 Dec 2022 18:34:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BLIY4L9068900; Wed, 21 Dec 2022 18:34:04 GMT (envelope-from git) Date: Wed, 21 Dec 2022 18:34:04 GMT Message-Id: <202212211834.2BLIY4L9068900@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: a20c00c60e1c - main - bhyve: Allocate struct vm_exit on the stack in vm_loop. 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/main X-Git-Reftype: branch X-Git-Commit: a20c00c60e1c022f77a7bc638f29d3d6d9456953 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a20c00c60e1c022f77a7bc638f29d3d6d9456953 commit a20c00c60e1c022f77a7bc638f29d3d6d9456953 Author: John Baldwin AuthorDate: 2022-12-21 18:32:45 +0000 Commit: John Baldwin CommitDate: 2022-12-21 18:32:45 +0000 bhyve: Allocate struct vm_exit on the stack in vm_loop. The global vmexit[] array is no longer needed to smuggle the rip value from fbsdrun_addcpu() to vm_loop(). Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D37644 --- usr.sbin/bhyve/bhyverun.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index e40229e79828..31cb7c2ceaf3 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -196,8 +196,6 @@ static cpuset_t cpumask; static void vm_loop(struct vmctx *ctx, int vcpu); -static struct vm_exit *vmexit; - static struct bhyvestats { uint64_t vmexit_bogus; uint64_t vmexit_reqidle; @@ -619,7 +617,7 @@ vmexit_inout(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) fprintf(stderr, "Unhandled %s%c 0x%04x at 0x%lx\n", in ? "in" : "out", bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), - port, vmexit->rip); + port, vme->rip); return (VMEXIT_ABORT); } else { return (VMEXIT_CONTINUE); @@ -968,6 +966,7 @@ static vmexit_handler_t handler[VM_EXITCODE_MAX] = { static void vm_loop(struct vmctx *ctx, int vcpu) { + struct vm_exit vme; int error, rc; enum vm_exitcode exitcode; cpuset_t active_cpus; @@ -982,18 +981,18 @@ vm_loop(struct vmctx *ctx, int vcpu) assert(CPU_ISSET(vcpu, &active_cpus)); while (1) { - error = vm_run(ctx, vcpu, &vmexit[vcpu]); + error = vm_run(ctx, vcpu, &vme); if (error != 0) break; - exitcode = vmexit[vcpu].exitcode; + exitcode = vme.exitcode; if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) { fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", exitcode); exit(4); } - rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); + rc = (*handler[exitcode])(ctx, &vme, &vcpu); switch (rc) { case VMEXIT_CONTINUE: @@ -1582,7 +1581,6 @@ main(int argc, char *argv[]) #endif /* Allocate per-VCPU resources. */ - vmexit = calloc(guest_ncpus, sizeof(*vmexit)); mt_vmm_info = calloc(guest_ncpus, sizeof(*mt_vmm_info)); /*