From nobody Thu Jan 26 22:35:00 2023 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 4P2wWT3LFvz3cCVP; Thu, 26 Jan 2023 22:35:01 +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 4P2wWT0T3Mz4DWZ; Thu, 26 Jan 2023 22:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674772501; 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=gPNIBhGDWus3MtseGLthivmTs+Ee0bWff6MQMoh9rOg=; b=dfX2wiIT1OYdTo+oMMNLaxw2pS59T/nIDtHduyl2rDnPQFg5ndpf9XwOy4g4rbtLrvfOku cSja7N6TFLTIOW6Lq3DQus2vHbkutcitXxi7h7VhtcK0HVA49ibxj8lRppj9VdhH810VUm IbQ7xYpjfYsOq504HlxxzX58mdCuJfZKEIEgP/brl3HjqU02c1fBlCFqAJ5TfPu0OMGB5S /oFsQ6l1rBbBEwh9U25zGfTvXdPkbaSpXXHlyfUb4V+4H7XVxH61lzqTx+zhnzSHcvDLgP 5AYlkaCjFQMKv6Zxb721rNcv+es8TdNRPdy2q8lIZuV05YzpeUpIBXSqr/edsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674772501; 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=gPNIBhGDWus3MtseGLthivmTs+Ee0bWff6MQMoh9rOg=; b=aZIU/x1nxJKh4bnuOQUFDr5nxshWWFjrvRAQo0EyQYJJJxkf2kvftx2y4oMETVYK4vWKXS Di/Hsz8lsRtOHNlsP7ckDf289LbG5oiyMb3rXivS09nFFBtM33X2HIfO4o1pmfE0s21MUG ySbABIL8sJyFVX5uYNRbltoV15V9xzefcgh3oF7FObz0yWIfKDRR2NcTgaRdSZOpoa9m9b ScrLNq/U3ybmbn5up36cxXnyTsONXOy+enaUeis8Aj30/arclvRcLizosYtH0o/BfowMM0 5s/iCm6mFTqMqm3MUyk9lIACjAovvzOZKkj2v1gd2p5I4Fz01NmhVpXyHVGXcQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674772501; a=rsa-sha256; cv=none; b=hjkGHnDU177CKeBI6dwacurFbsilr3IBVc8JpKs5b11138ZfaIqWy11aiIVSXJjz9H6RSN NS27lAkb7STIDpH5jdBzSW+aN8OdD6KOLeTat8IGLIAD9zKIlbBmytk0tB+G1z+JZSLBiW Vm7V0PGdSCbuKaRj/nfwzlhDIE/7OtqIO3LEEUbgBsNE9Hn029xIFCYX+dtiVgYeYl0YQc XnrQVhUEMszzIyPSsUhX86Hrl7WTtYYFnXeoZ/L+4oE6vRK3SGHLk3SlzwyxFhK9DRgIHJ giwSgSPZsyRxXBI3J2ontrQBS7AHWbuLbc5+A9KP+Y0QIzp7NuaUXowHPXMP2A== 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 4P2wWS6M1yzm7t; Thu, 26 Jan 2023 22:35:00 +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 30QMZ0xG051538; Thu, 26 Jan 2023 22:35:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30QMZ0E6051537; Thu, 26 Jan 2023 22:35:00 GMT (envelope-from git) Date: Thu, 26 Jan 2023 22:35:00 GMT Message-Id: <202301262235.30QMZ0E6051537@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: ec1ecab8c350 - stable/13 - bhyve: Remove some no-op code for setting RIP. 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: ec1ecab8c35014b44fad6d842c2162a2930d4057 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ec1ecab8c35014b44fad6d842c2162a2930d4057 commit ec1ecab8c35014b44fad6d842c2162a2930d4057 Author: John Baldwin AuthorDate: 2022-12-21 18:32:24 +0000 Commit: John Baldwin CommitDate: 2023-01-26 22:17:52 +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 (cherry picked from commit ceb0d0b0f184d72f31ebdaa4edc752aed78a5807) --- 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