From patchwork Sat Jul 9 04:12:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corneliu ZUZU X-Patchwork-Id: 9221969 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 5AE1D60467 for ; Sat, 9 Jul 2016 04:15:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D9A5285A5 for ; Sat, 9 Jul 2016 04:15:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 422FF285D1; Sat, 9 Jul 2016 04:15:09 +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 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 2B740285AE for ; Sat, 9 Jul 2016 04:15:08 +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 1bLjdV-00019Y-JW; Sat, 09 Jul 2016 04:13:01 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bLjdT-00018q-Mc for xen-devel@lists.xen.org; Sat, 09 Jul 2016 04:12:59 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 86/6A-23871-AC970875; Sat, 09 Jul 2016 04:12:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRWlGSWpSXmKPExsUSfTxjoe6pyoZ wg5Vn5CyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oyta9ewFlzgrnj59jp7A+M7ji5GTg4hAXeJ pQdnMXcxcgHZaxglFm17xwThnGSUONn/kRWiyk3i9LlTjBD2OkaJphM6IDabgLbEuUP3mEBsE QFpiWufLzOCNDMLzGaU+H7wKVizsICTxJorS9hBbBYBVYm1sw8wg9i8Ai4Sm19tAopzcEgIyE ksuJAOEuYUcJU49/Y11F4XiRv7JoHNlxDIkVj5bBZUuZTE/1YlkFUSAj0sEptndbJB1MhIPJp 4k20Co9ACRoZVjBrFqUVlqUW6RiZ6SUWZ6RkluYmZObqGBsZ6uanFxYnpqTmJScV6yfm5mxiB gVjPwMC4g/HVcb9DjJIcTEqivBdsG8KF+JLyUyozEosz4otKc1KLDzHKcHAoSfCuqADKCRalp qdWpGXmAGMCJi3BwaMkwnsYJM1bXJCYW5yZDpE6xagoJc67AyQhAJLIKM2Da4PF4SVGWSlhXk YGBgYhnoLUotzMElT5V4ziHIxKwrwdIFN4MvNK4Ka/AlrMBLTYIKAeZHFJIkJKqoFxw2Jb09C Tj89ySDvf+unAZXio9tvePxqRFn796sY6Xid0Tp0yPLJf7NWSNQ0VlmfD2zze6F3er+a84+rF umd/mNhvH4kPOdS53uLBBU3+yOeR/x+UKm+arrm/cOHhBRvWfOu8GLbv8O4wraKuh3fNVPds3 ulqveGkGa+NdsWGBylTZTIPWvlXKbEUZyQaajEXFScCAC9wSDG+AgAA X-Env-Sender: czuzu@bitdefender.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1468037578!49596785!1 X-Originating-IP: [91.199.104.161] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18865 invoked from network); 9 Jul 2016 04:12:58 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-2.tower-31.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 9 Jul 2016 04:12:58 -0000 Received: (qmail 11713 invoked from network); 9 Jul 2016 07:12:57 +0300 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.bbu.dsd.mx.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 9 Jul 2016 07:12:57 +0300 Received: from smtp03.buh.bitdefender.org (unknown [10.17.80.77]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id 44E7E7FC02 for ; Sat, 9 Jul 2016 07:12:57 +0300 (EEST) Received: (qmail 4330 invoked from network); 9 Jul 2016 07:12:57 +0300 Received: from 188-24-34-246.rdsnet.ro (HELO localhost.localdomain) (czuzu@bitdefender.com@188.24.34.246) by smtp03.buh.bitdefender.org with SMTP; 9 Jul 2016 07:12:57 +0300 From: Corneliu ZUZU To: xen-devel@lists.xen.org Date: Sat, 9 Jul 2016 07:12:07 +0300 Message-Id: <1468037527-6474-1-git-send-email-czuzu@bitdefender.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1468037509-6428-1-git-send-email-czuzu@bitdefender.com> References: <1468037509-6428-1-git-send-email-czuzu@bitdefender.com> X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp03.buh.bitdefender.org, sigver: 7.66242 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.911, Dats: 425852, Stamp: 3], Multi: [Enabled, t: (0.000008, 0.001727)], BW: [Enabled, t: (0.000006,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.002322), Flags: 85D2ED72; NN_NO_CONTENT_TYPE; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.008799)], URL: [Enabled, t: (0.000005)], RTDA: [Enabled, t: (0.010945), Hit: No, Details: v2.3.10; Id: 2m1ghk0.1amgknva0.15bd6], total: 0(775) X-BitDefender-CF-Stamp: none Cc: Andrew Cooper , Kevin Tian , Jan Beulich , Jun Nakajima Subject: [Xen-devel] [PATCH 01/16] x86/vmx_update_guest_cr: minor optimization 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 Minor optimization @ vmx_update_guest_cr: checks if v->arch.hvm_vmx.exec_control was modified before actually calling vmx_update_cpu_exec_control(v). Signed-off-by: Corneliu ZUZU --- xen/arch/x86/hvm/vmx/vmx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 0776d12..0798245 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1433,8 +1433,10 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr) if ( paging_mode_hap(v->domain) ) { /* Manage GUEST_CR3 when CR0.PE=0. */ + uint32_t old_ctls = v->arch.hvm_vmx.exec_control; uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING); + v->arch.hvm_vmx.exec_control &= ~cr3_ctls; if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) ) v->arch.hvm_vmx.exec_control |= cr3_ctls; @@ -1444,7 +1446,8 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr) monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3) ) v->arch.hvm_vmx.exec_control |= CPU_BASED_CR3_LOAD_EXITING; - vmx_update_cpu_exec_control(v); + if ( old_ctls != v->arch.hvm_vmx.exec_control ) + vmx_update_cpu_exec_control(v); } if ( !nestedhvm_vcpu_in_guestmode(v) )