From nobody Fri Apr 26 05:52:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=1570099727; cv=none; d=zoho.com; s=zohoarc; b=HRB8E38uJN9FSRqeO67G+vgpyhaos9vYhivxinnLjvU8MDc+TbjBh976J5RTOatbrvRhOtgUhRK0MNDiN78ybqlfZUr3iGnlNU7dmJ6KXZ2rVzqO/nDwB9LhFKe2bpHPPeEhmAxWQk3smLu5TJojBLKRH3hM0LImj8Bxzqznyzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570099727; 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=c5xr0tBnrLrNQhqI557yExBArb3gUlNeJ6x/VXG6fZc=; b=RjEHvA8Wef35wtEU5deam9iUOwm+JB44UOBPgRC6lBAG5Qkdp06umfr6Tvd9qMzCkm6nYGPaA/Ga5OFPd+z1O31YcIHlrrxh1jAD6q8iFjqRuOh8wutv15UsF1ze0eWpLz5mRijRrKCOElM69bM6IDXJEGm0zifEd65jZ13ouEI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 1570099727611956.0350228064408; Thu, 3 Oct 2019 03:48:47 -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 1iFye6-0006j0-7O; Thu, 03 Oct 2019 10:47:42 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFye5-0006iu-LX for xen-devel@lists.xenproject.org; Thu, 03 Oct 2019 10:47:41 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 38956e90-e5cb-11e9-8c93-bc764e2007e4; Thu, 03 Oct 2019 10:47:40 +0000 (UTC) X-Inumbo-ID: 38956e90-e5cb-11e9-8c93-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1570099661; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=liEiyw+6y/d0YDdGw8y8kT6b8wWf8DaiEXg7V/pd84c=; b=Je9KFhisIwfz7s9msHWIBWCEvsoP869WKr5U6rpr/iCwxBqv7DvCVieg WYGJszW3FAAl6QrafByUoFWh8PWoOaGyPnMWgauf23fCtR1cLmiCtP8fW IAFZb1m5+mj0frVL06LhPJTXGRMrTJJ8VRX+LlyON6pNsS8IKnSLTq7nf 4=; Authentication-Results: esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: wVzKrJekys3VlwPJSc3b7RvE37InacZq8sKtZkVbPQm9sgImNIy2YlMiZSaJg62qhEQsVNLoTd 8esGE4CyXn7IO5HSsZ0XimH25mluDDy3NiC+aHSM8Dvsbc3q0iqKq5Xeveff8jxmAuKdUER9qQ QEKisIg0eOY+0P3ajUfyJSB0Z0uXNtLDfMc9DxEihXdljRbvd7EZecwsheZpdra2rslSKqOxAI HTJ/jHaCC0oRwcEQq6D/hJfMJTC+TiaInF99oZE8yIiHatxrSGjlz2yjP3CL9w84zeq6mskONP 5xo= X-SBRS: 2.7 X-MesageID: 6482308 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,251,1566878400"; d="scan'208";a="6482308" From: Andrew Cooper To: Xen-devel Date: Thu, 3 Oct 2019 11:47:36 +0100 Message-ID: <20191003104736.32259-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/vvmx: Fix the use of RDTSCP when it is intercepted at L0 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: Juergen Gross , Kevin Tian , Jun Nakajima , Wei Liu , Andrew Cooper , Chris Brannon , Jan Beulich , Sarah Newman , =?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" X-ZohoMail-DKIM: fail (Header signature does not verify) Linux has started using RDTSCP as of v5.1. This has highlighted a bug in X= en, where virtual vmexit simply gives up. (XEN) d1v1 Unhandled nested vmexit: reason 51 (XEN) domain_crash called from vvmx.c:2671 (XEN) Domain 1 (vcpu#1) crashed on cpu#2: Handle RDTSCP in the virtual vmexit hander in the same was as RDTSC intercepts. Reported-by: Sarah Newman Signed-off-by: Andrew Cooper Tested-by: Chris Brannon Reviewed-by: Wei Liu --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Jun Nakajima CC: Kevin Tian CC: Juergen Gross This probably wants backporting to all stable trees, even though nested virt isn't supported, and therefore ought to qualify for 4.13 at this point. --- xen/arch/x86/hvm/vmx/vvmx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index fdf449bfd1..6696bd6240 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -2491,6 +2491,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs, nvcpu->nv_vmexit_pending =3D 1; break; case EXIT_REASON_RDTSC: + case EXIT_REASON_RDTSCP: ctrl =3D __n2_exec_control(v); if ( ctrl & CPU_BASED_RDTSC_EXITING ) nvcpu->nv_vmexit_pending =3D 1; @@ -2501,6 +2502,8 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs, * avoiding changing guest_tsc and messing up timekeeping in L1 */ msr_split(regs, hvm_get_guest_tsc(v) + get_vvmcs(v, TSC_OFFSET= )); + if ( exit_reason =3D=3D EXIT_REASON_RDTSCP ) + regs->rcx =3D v->arch.msrs->tsc_aux; update_guest_eip(); =20 return 1; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel