From nobody Tue Oct 24 14:37:46 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 4SFF5l1YQMz4y6Vj; Tue, 24 Oct 2023 14:37:47 +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 4SFF5l0xCzz4lBK; Tue, 24 Oct 2023 14:37:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698158267; 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=ePjS6KX5bmTdl5s8N5HIm1jokUc6BSoWVpU2hiUstWI=; b=wyjMlIRwmBExm1QK2xlVn6hI7iLhFNYVnj0Sx5x/AN9s7+bHqGvPeb8Rg2QVR5+D9sHgdJ qyIfs2i9CFFysj7XUmx9ErfbT51xVVIRYZnC5EK9uheoSNCFBTCGRhu/Ka5elx3Zowaqkm 7W/4/2dtRVcToFkH5XAajTLzw8f3T/ir/Thd61oSEcppoVXo5UhG4kahjVgBEys2uTXy8i 6na8VZNVQ27TdPWzrsJIyUFSpObV7LI/QCUJQ8akr8a+ZlICVbT2ea0/5yfnwlOkFnvF0P j9KFalBmGYxoqxObKMNJXCyaMR7tbXPapHaK2CwSsyENuHtHgZIndyZKZzHcaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698158267; a=rsa-sha256; cv=none; b=tXbsjYiH7gaezP8qPpN3BVUn4IQ6oLKDX9+lX7v91ZZx5vVVCcZrPtlv6y6lxXcZAH3tam MFJrZpc4/XseRNikhpdx31PgAB9MPGiQfejCJyuRoZa8STBI8z0r34LcHMch9w+hR0oloB MEvyCmzpehT93gguxOffSgVjoZKLKuvJXn88DpyYOicXGEdd955JFsBXt3GbtNt9pb33xw 7e+ihHSKVz2Ef6v4P6JqX+LThGufVNqf6sDRUnh/7p6gNO2+xjT5s5obMxAVfJrUIzNqkf kiurV6d+s/dVOsDLUqbKhtjjS5odyoC2OoZ+MNsseUx4fOvDsxjn2QR3HBCSCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698158267; 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=ePjS6KX5bmTdl5s8N5HIm1jokUc6BSoWVpU2hiUstWI=; b=Bnvn1y5IUYfNtY7cL62lWoUMybQdK+qUH3Nu9jtvapIXC7AjGE5tLIAJLw2fAWBM+zxzlE fkqLg0or7RPEiQ+85uz8MCmApH1XTTEwYHaLujm5XoG39X59IUCjijEfmK5UfBj4QOXGQZ fyO6M0lzOHXPqIzu/ij/x5w6dQ5zyxbrMo0UIrxDCJvot5XIIatIRrJTq7MgkHS6PD5WRU 5xGV3Q7bdNNeiOMUv3vzM9KvdJ5JBctE3XPubequshYTMTNm+aQAhL1KSmcHmOZXs+Y9Kv tFum2JA26z9UZcIihFOSdXg/E2fmWUM2308o3xuPUFN39elPYbaV/pQ1k05FJw== 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 4SFF5l02lTzBt2; Tue, 24 Oct 2023 14:37:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39OEbkk8089703; Tue, 24 Oct 2023 14:37:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39OEbk5b089700; Tue, 24 Oct 2023 14:37:46 GMT (envelope-from git) Date: Tue, 24 Oct 2023 14:37:46 GMT Message-Id: <202310241437.39OEbk5b089700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: ecadbb2905b4 - releng/14.0 - vmx: Prefer consistent naming for loader tunables 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: ecadbb2905b41f288ee239d40c64f8be6a27eb62 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=ecadbb2905b41f288ee239d40c64f8be6a27eb62 commit ecadbb2905b41f288ee239d40c64f8be6a27eb62 Author: Zhenlei Huang AuthorDate: 2023-10-19 17:18:25 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-24 14:35:51 +0000 vmx: Prefer consistent naming for loader tunables The following loader tunables do have corresponding sysctl MIBs but with different names. That may be historical reason. Let's prefer consistent naming for them so that it will be easier to read and maintain. 1. hw.vmm.l1d_flush -> hw.vmm.vmx.l1d_flush 2. hw.vmm.l1d_flush_sw -> hw.vmm.vmx.l1d_flush_sw 3. hw.vmm.vmx.use_apic_pir -> hw.vmm.vmx.cap.posted_interrupts 4. hw.vmm.vmx.use_apic_vid -> hw.vmm.vmx.cap.virtual_interrupt_delivery 5. hw.vmm.vmx.use_tpr_shadowing -> hw.vmm.vmx.cap.tpr_shadowing Old names are kept for compatibility. Meanwhile, add sysctl flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly. Reviewed by: corvink, jhb, kib, #bhyve Approved by: re (gjb) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D42251 (cherry picked from commit f3ff0918ffcdbcb4c39175f3f9be70999edb14e8) (cherry picked from commit 9e48b627aed346bf5e950134a581218d3097eb7c) --- sys/amd64/vmm/intel/vmx.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c index 51c6afe5a7da..317ed7e5d7fb 100644 --- a/sys/amd64/vmm/intel/vmx.c +++ b/sys/amd64/vmm/intel/vmx.c @@ -192,15 +192,18 @@ SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, invpcid, CTLFLAG_RD, &cap_invpcid, 0, "Guests are allowed to use INVPCID"); static int tpr_shadowing; -SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, tpr_shadowing, CTLFLAG_RD, +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, tpr_shadowing, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &tpr_shadowing, 0, "TPR shadowing support"); static int virtual_interrupt_delivery; -SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, virtual_interrupt_delivery, CTLFLAG_RD, +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, virtual_interrupt_delivery, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &virtual_interrupt_delivery, 0, "APICv virtual interrupt delivery support"); static int posted_interrupts; -SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, posted_interrupts, CTLFLAG_RD, +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, posted_interrupts, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &posted_interrupts, 0, "APICv posted interrupt support"); static int pirvec = -1; @@ -213,10 +216,10 @@ SYSCTL_UINT(_hw_vmm_vmx, OID_AUTO, vpid_alloc_failed, CTLFLAG_RD, &vpid_alloc_failed, 0, NULL); int guest_l1d_flush; -SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, l1d_flush, CTLFLAG_RD, +SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, l1d_flush, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &guest_l1d_flush, 0, NULL); int guest_l1d_flush_sw; -SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, l1d_flush_sw, CTLFLAG_RD, +SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, l1d_flush_sw, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &guest_l1d_flush_sw, 0, NULL); static struct msr_entry msr_load_list[1] __aligned(16); @@ -832,8 +835,12 @@ vmx_modinit(int ipinum) &tmp); if (error == 0) { tpr_shadowing = 1; +#ifndef BURN_BRIDGES TUNABLE_INT_FETCH("hw.vmm.vmx.use_tpr_shadowing", &tpr_shadowing); +#endif + TUNABLE_INT_FETCH("hw.vmm.vmx.cap.tpr_shadowing", + &tpr_shadowing); } if (tpr_shadowing) { @@ -854,8 +861,12 @@ vmx_modinit(int ipinum) procbased2_vid_bits, 0, &tmp); if (error == 0 && tpr_shadowing) { virtual_interrupt_delivery = 1; +#ifndef BURN_BRIDGES TUNABLE_INT_FETCH("hw.vmm.vmx.use_apic_vid", &virtual_interrupt_delivery); +#endif + TUNABLE_INT_FETCH("hw.vmm.vmx.cap.virtual_interrupt_delivery", + &virtual_interrupt_delivery); } if (virtual_interrupt_delivery) { @@ -881,8 +892,12 @@ vmx_modinit(int ipinum) } } else { posted_interrupts = 1; +#ifndef BURN_BRIDGES TUNABLE_INT_FETCH("hw.vmm.vmx.use_apic_pir", &posted_interrupts); +#endif + TUNABLE_INT_FETCH("hw.vmm.vmx.cap.posted_interrupts", + &posted_interrupts); } } } @@ -899,7 +914,10 @@ vmx_modinit(int ipinum) guest_l1d_flush = (cpu_ia32_arch_caps & IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY) == 0; +#ifndef BURN_BRIDGES TUNABLE_INT_FETCH("hw.vmm.l1d_flush", &guest_l1d_flush); +#endif + TUNABLE_INT_FETCH("hw.vmm.vmx.l1d_flush", &guest_l1d_flush); /* * L1D cache flush is enabled. Use IA32_FLUSH_CMD MSR when @@ -911,8 +929,12 @@ vmx_modinit(int ipinum) if (guest_l1d_flush) { if ((cpu_stdext_feature3 & CPUID_STDEXT3_L1D_FLUSH) == 0) { guest_l1d_flush_sw = 1; +#ifndef BURN_BRIDGES TUNABLE_INT_FETCH("hw.vmm.l1d_flush_sw", &guest_l1d_flush_sw); +#endif + TUNABLE_INT_FETCH("hw.vmm.vmx.l1d_flush_sw", + &guest_l1d_flush_sw); } if (guest_l1d_flush_sw) { if (nmi_flush_l1d_sw <= 1)