From nobody Wed Dec 21 18:34:03 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 4Ncht34XSnz1Gj1D; Wed, 21 Dec 2022 18:34:03 +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 4Ncht33mBgz40f8; Wed, 21 Dec 2022 18:34:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671647643; 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=nWzC9w8GE/TarKsqHgrAHtjYKulnsk7XRfvryuV3Eqk=; b=ITHfjZ0vT2/AHzQottFp4SUGqO8aQNjQKXigkU/TMmL4NdnpVrQxObJQcmMdqjlqaog6UY 9xUeRAKhUSoFBVUBUoJrAwXdhPqr4fdXHJ0YQU2qXqPoWitHn/LO1nRZ5CQPTl/SkyqRgE m2Dle75h2iID74c65952DhmhQnBPg9/tFa/ZXgfwNR3OwX7xcvfU1UCnz8UDryhZi3G+H0 Zpagb3RLLMwLI3QbSXPSh/rwpmWAw0u7/B7L1hm7vD8C2yT+GDGTpF/pqzyFrNvk59jb3Q voturcbXfvmvi3rg/IZlCqKzlkehEDiITDZQfTT6HAfZ/PDW21hWW6wYdmGaRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671647643; 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=nWzC9w8GE/TarKsqHgrAHtjYKulnsk7XRfvryuV3Eqk=; b=a4oFDjOy91u1vxruCb6Db+Mdby36OI/L3FDhDXPbgb7Vdq3fS2v5etHcNS8mB7I+0Aosju 2RlSZ1XzvpMB+I/njX+93DpMRIeossAcqyaElkq8xdAuqj4IvWMt5OLvdXOhVGx8bMY1hh f2Zza4om/bo4uRjMCoQkE9PQuZSQEJA5yM74I+SksN5IaJqxI5fe4+b9wslPs4BndXYKBA KjdR8QHaJmyDbnGL8Nub8WIFtp6rD7cYdiuZIGxBJGlQoSz6Yi2sYc6q/34wXbWRj8j7hR yRR+zjFuT6HmTEI1PXdeEqDvIU2LwnxiWMRXOTugxCubhbcJRBos0ftkBViVJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671647643; a=rsa-sha256; cv=none; b=EDT3gWKLB298RCNiilIsIdKfPkgRORDYX+FM5Amzz57IydGDxMGMGnLecYLjBJNGWPxsa7 JLGthR4WJZCPEWlzShXRZpmFga/W4raJ3B2RRPVzHhezAdMyH9LWUhjYuGuFaCzFBeSj1l Swwf4VH7x2QsSUkP5fVht971YzZHJoFxx/4i8pH/LXX+N4IRSsFlh/y3Qf4yIR/mfazOwF tMtpvXz8791ZJmnJIRi8ECD0zYx4ddRbG0Rn7SBuUbTKeqwR7rAm+E2MvnWf/QDr4PUxA6 NUGuJl+iLyte1y8bW+yscjXTo8sDFhLG2oXoVPlvkWMwxrAg/NXfaYMiuUimXA== 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 4Ncht32QJjzQ83; Wed, 21 Dec 2022 18:34:03 +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 2BLIY3YV068875; Wed, 21 Dec 2022 18:34:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BLIY3GA068874; Wed, 21 Dec 2022 18:34:03 GMT (envelope-from git) Date: Wed, 21 Dec 2022 18:34:03 GMT Message-Id: <202212211834.2BLIY3GA068874@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: ceb0d0b0f184 - main - bhyve: Remove some no-op code for setting RIP. 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: ceb0d0b0f184d72f31ebdaa4edc752aed78a5807 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ceb0d0b0f184d72f31ebdaa4edc752aed78a5807 commit ceb0d0b0f184d72f31ebdaa4edc752aed78a5807 Author: John Baldwin AuthorDate: 2022-12-21 18:32:24 +0000 Commit: John Baldwin CommitDate: 2022-12-21 18:32:24 +0000 bhyve: Remove some no-op code for setting RIP. fbsdrun_addcpu() read the current vCPU's RIP register from the kernel via vm_get_register() to pass along through some layers to vm_loop() which then set the register via vm_set_register(). However, this is just always setting the value back to itself. Reviewed by: corvink Differential Revision: https://reviews.freebsd.org/D37643 --- usr.sbin/bhyve/bhyverun.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 72f806e97993..e40229e79828 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -194,7 +194,7 @@ static const int BSP = 0; static cpuset_t cpumask; -static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip); +static void vm_loop(struct vmctx *ctx, int vcpu); static struct vm_exit *vmexit; @@ -540,7 +540,7 @@ fbsdrun_start_thread(void *param) #endif gdb_cpu_add(vcpu); - vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip); + vm_loop(mtp->mt_ctx, vcpu); /* not reached */ exit(1); @@ -548,7 +548,7 @@ fbsdrun_start_thread(void *param) } static void -fbsdrun_addcpu(struct vmctx *ctx, int newcpu, uint64_t rip, bool suspend) +fbsdrun_addcpu(struct vmctx *ctx, int newcpu, bool suspend) { int error; @@ -561,13 +561,6 @@ fbsdrun_addcpu(struct vmctx *ctx, int newcpu, uint64_t rip, bool suspend) if (suspend) vm_suspend_cpu(ctx, newcpu); - /* - * Set up the vmexit struct to allow execution to start - * at the given RIP - */ - vmexit[newcpu].rip = rip; - vmexit[newcpu].inst_length = 0; - mt_vmm_info[newcpu].mt_ctx = ctx; mt_vmm_info[newcpu].mt_vcpu = newcpu; @@ -973,7 +966,7 @@ static vmexit_handler_t handler[VM_EXITCODE_MAX] = { }; static void -vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) +vm_loop(struct vmctx *ctx, int vcpu) { int error, rc; enum vm_exitcode exitcode; @@ -988,9 +981,6 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) error = vm_active_cpus(ctx, &active_cpus); assert(CPU_ISSET(vcpu, &active_cpus)); - error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RIP, startrip); - assert(error == 0); - while (1) { error = vm_run(ctx, vcpu, &vmexit[vcpu]); if (error != 0) @@ -1152,7 +1142,6 @@ static void spinup_vcpu(struct vmctx *ctx, int vcpu, bool suspend) { int error; - uint64_t rip; if (vcpu != BSP) { fbsdrun_set_capabilities(ctx, vcpu); @@ -1166,10 +1155,7 @@ spinup_vcpu(struct vmctx *ctx, int vcpu, bool suspend) assert(error == 0); } - error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, &rip); - assert(error == 0); - - fbsdrun_addcpu(ctx, vcpu, rip, suspend); + fbsdrun_addcpu(ctx, vcpu, suspend); } static bool