From nobody Sat May 4 23:58:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1564497870; cv=none; d=zoho.com; s=zohoarc; b=ECgZcbHSVVNoABeSiwVGeZc0L0eWUKyG1zHp+dZWrE4IkBGS5dqiN0D+fDdLb6Iws/b+Y4mKb0P4LSeoLQzvynnpYZwmtvBIRIxXZ66gq/FpbRDprlfARyKVqxP7DuNZMG9xtIKVUo95MT9eM4+JNpQ9H2Euj4y2oW4+Tqr2Vj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564497870; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=HAH1Wx6m3hIUGwTdMMvg2DIE8tSrG4Fqn3fvWJcaXes=; b=mnBQ9+TDixv7qZg4fBzSDLbUM85Cv91SSHyAPFdDVO2kdN2r/30LQnBJythXPvGem6OzqbSJhS58L2oUULBM1FHl0EmTnRFMjcwYdezfEj35BQU9S/nBbsL3ZpvQ0dM3+u7yaFcCTGf7i/60kTntMigjU2e/nfB98SZB+NzGklg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1564497870185716.4104840674225; Tue, 30 Jul 2019 07:44:30 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hsTLE-0002IT-0f; Tue, 30 Jul 2019 14:43:04 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hsTLC-0002IO-MX for xen-devel@lists.xenproject.org; Tue, 30 Jul 2019 14:43:02 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 52c0f792-b2d8-11e9-bc9c-d39caf7c6a82; Tue, 30 Jul 2019 14:42:59 +0000 (UTC) X-Inumbo-ID: 52c0f792-b2d8-11e9-bc9c-d39caf7c6a82 Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Kh0OAuT9qdWKMisAP1QEoIH9GwQEdv6ypcTTpxrDH/KFjQ/o5bn4P6jpghyrRtfSV2wh+KSosl lyabAF/bYuE1FN0mVU+ZXa524cvOmfm6UeR8j8nLDUIr6WO9/f3uJIN+J9zmYDtW2XivBLSiAc Bci64Y4iUAT199Hl8oDDw/QHDJLotnOONZ2ScUny0zQouoseLl2Soc800xQ+szWYLJiXO3Zig8 2/fuo2940/a+wepzQ1E3iUFdIEDFX10PUytbDfyOx/JTIxagQJfUu4f0MlUpeXMyk0a6SKZruw 6oA= X-SBRS: 2.7 X-MesageID: 3745848 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,327,1559534400"; d="scan'208";a="3745848" From: Andrew Cooper To: Xen-devel Date: Tue, 30 Jul 2019 15:42:55 +0100 Message-ID: <20190730144255.6126-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/vvmx: Fix nested virt on VMCS-Shadow capable hardware X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Jan Beulich , Wei Liu , Andrew Cooper , Jun Nakajima , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" c/s e9986b0dd "x86/vvmx: Simplify per-CPU memory allocations" had the wrong indirection on its pointer check in nvmx_cpu_up_prepare(), causing the VMCS-shadowing buffer never be allocated. Fix it. This in turn results in a massive quantity of logspam, as every virtual vmentry/exit hits both gdprintk()s in the *_bulk() functions. Switch these to using printk_once(). The size of the buffer is chosen at compile time, so complaining about it repeatedly is of no benefit. Finally, drop the runtime NULL pointer checks. It is not terribly appropri= ate to be repeatedly checking infrastructure which is set up from start-of-day, and in this case, actually hid the above bug. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Kevin Tian --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Jun Nakajima CC: Kevin Tian --- xen/arch/x86/hvm/vmx/vvmx.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 332623d006..f38f3a9930 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -43,7 +43,7 @@ int nvmx_cpu_up_prepare(unsigned int cpu) uint64_t **vvmcs_buf; =20 if ( cpu_has_vmx_vmcs_shadowing && - (vvmcs_buf =3D &per_cpu(vvmcs_buf, cpu)) =3D=3D NULL ) + *(vvmcs_buf =3D &per_cpu(vvmcs_buf, cpu)) =3D=3D NULL ) { void *ptr =3D xzalloc_array(uint64_t, VMCS_BUF_SIZE); =20 @@ -922,11 +922,10 @@ static void vvmcs_to_shadow_bulk(struct vcpu *v, unsi= gned int n, if ( !cpu_has_vmx_vmcs_shadowing ) goto fallback; =20 - if ( !value || n > VMCS_BUF_SIZE ) + if ( n > VMCS_BUF_SIZE ) { - gdprintk(XENLOG_DEBUG, "vmcs sync fall back to non-bulk mode, " - "buffer: %p, buffer size: %d, fields number: %d.\n", - value, VMCS_BUF_SIZE, n); + printk_once(XENLOG_ERR "%pv VMCS sync too many fields %u\n", + v, n); goto fallback; } =20 @@ -962,11 +961,10 @@ static void shadow_to_vvmcs_bulk(struct vcpu *v, unsi= gned int n, if ( !cpu_has_vmx_vmcs_shadowing ) goto fallback; =20 - if ( !value || n > VMCS_BUF_SIZE ) + if ( n > VMCS_BUF_SIZE ) { - gdprintk(XENLOG_DEBUG, "vmcs sync fall back to non-bulk mode, " - "buffer: %p, buffer size: %d, fields number: %d.\n", - value, VMCS_BUF_SIZE, n); + printk_once(XENLOG_ERR "%pv VMCS sync too many fields %u\n", + v, n); goto fallback; } =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel