From patchwork Thu Aug 17 14:19:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Ostrovsky X-Patchwork-Id: 9906439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01F1D6024A for ; Thu, 17 Aug 2017 14:19:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECB031FF0B for ; Thu, 17 Aug 2017 14:19:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1578285DC; Thu, 17 Aug 2017 14:19:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 76BB01FF0B for ; Thu, 17 Aug 2017 14:19:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diLbt-0006OX-UW; Thu, 17 Aug 2017 14:17:21 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diLbs-0006ON-K2 for xen-devel@lists.xen.org; Thu, 17 Aug 2017 14:17:20 +0000 Received: from [193.109.254.147] by server-1.bemta-6.messagelabs.com id 2F/2E-03765-F65A5995; Thu, 17 Aug 2017 14:17:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrALMWRWlGSWpSXmKPExsUyZ7p8oG7+0qm RBh8/iVss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlnvkcXdHJVvJ61jLWBcQ1HFyMXh5DAZCaJ iW0fWLsYOYGcv4wSpye6QiQ2Mko0z+ljhnB6GCVeXD3EDFLFJmAkcfbodEYQW0RAWuLa58uMI EXMArsZJY4ensMEkhAWcJeYe34pWAOLgKpEy9a3YA28Ap4SbVc+gcUlBBQkpjx8D2UbS/TN6m OZwMizgJFhFaNGcWpRWWqRrqGBXlJRZnpGSW5iZg6QZ6aXm1pcnJiempOYVKyXnJ+7iRHoewY g2MF4/H3cIUZJDiYlUd7fs6ZECvEl5adUZiQWZ8QXleakFh9ilOHgUJLgjVsyNVJIsCg1PbUi LTMHGIQwaQkOHiUR3sUgad7igsTc4sx0iNQpRl2OVxP+f2MSYsnLz0uVEuctASkSACnKKM2DG wGLiEuMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5t0LMoUnM68EbtMroCOYgI640j4J5IiSRI SUVANjjMnyvooOlrfHbz72/7yN549h0Y2zbOtDdh5b/dQir92yPuyZt4o8S927zEg5q1N77Et sz9xb/ddX0PXstgUpNmmcHd9e3K/6aMU1+dIT97Pv7G4kr7t3NeTs6XPxKbx+4jtU9uhfuWD1 UDm/vFBq+o0nLxXX7/S5rnLsyLyJSk1X74kdfqA9RYmlOCPRUIu5qDgRAE6VtgKDAgAA X-Env-Sender: boris.ostrovsky@oracle.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1502979437!112355800!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59216 invoked from network); 17 Aug 2017 14:17:19 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-9.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 17 Aug 2017 14:17:19 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v7HEH9Zl011824 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Aug 2017 14:17:09 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v7HEH8Mg018045 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Aug 2017 14:17:08 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v7HEH8ex014036; Thu, 17 Aug 2017 14:17:08 GMT Received: from ovs104.us.oracle.com (/10.149.76.204) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 17 Aug 2017 07:17:08 -0700 From: Boris Ostrovsky To: xen-devel@lists.xen.org Date: Thu, 17 Aug 2017 10:19:52 -0400 Message-Id: <1502979592-3317-1-git-send-email-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: kevin.tian@intel.com, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, jbeulich@suse.com, jun.nakajima@intel.com, Boris Ostrovsky Subject: [Xen-devel] [PATCH] hvm: vmx/svm_cpu_up_prepare should be called only once X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP These routines are first called via CPU_UP_PREPARE notifier by the BSP and then by the booting ASP from vmx_cpu_up()/_svm_cpu_up(). Avoid the unnecessary second call. Signed-off-by: Boris Ostrovsky Reported-by: Andrew Cooper --- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 0dc9442..3e7b9fc 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1538,7 +1538,7 @@ static int _svm_cpu_up(bool bsp) return -EINVAL; } - if ( (rc = svm_cpu_up_prepare(cpu)) != 0 ) + if ( bsp && (rc = svm_cpu_up_prepare(cpu)) != 0 ) return rc; write_efer(read_efer() | EFER_SVME); diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 7854802..801e32b 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -652,7 +652,7 @@ int vmx_cpu_up(void) INIT_LIST_HEAD(&this_cpu(active_vmcs_list)); - if ( (rc = vmx_cpu_up_prepare(cpu)) != 0 ) + if ( (cpu == 0) && (rc = vmx_cpu_up_prepare(cpu)) != 0 ) return rc; switch ( __vmxon(this_cpu(vmxon_region)) )