From patchwork Mon Apr 11 16:41:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 8804331 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5407EC0553 for ; Mon, 11 Apr 2016 16:44:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 868AA20166 for ; Mon, 11 Apr 2016 16:44:39 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 2999D2015E for ; Mon, 11 Apr 2016 16:44:38 +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 1apeum-0006CL-FL; Mon, 11 Apr 2016 16:42:16 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apeul-0006CB-Tc for xen-devel@lists.xen.org; Mon, 11 Apr 2016 16:42:16 +0000 Received: from [193.109.254.147] by server-5.bemta-14.messagelabs.com id 67/93-03971-7E3DB075; Mon, 11 Apr 2016 16:42:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJLMWRWlGSWpSXmKPExsUSeITHTffZZe5 wgzuLLSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oyF2y+zFyzmrtiwbS5LA+Nkzi5GTg4hAXeJ HfubWEFsCQE/iaV7XrJBxMsktk64ChZnEzCUWL2xBSwuIiAtce3zZUYQm1kgT+LAyTPMILYwU M36ve1gcRYBVYmGJbeZQGxeAU+Jvs6FTBDz5STWTf7OPoGRawEjwypGjeLUorLUIl1DQ72kos z0jJLcxMwcIM9ELze1uDgxPTUnMalYLzk/dxMj0IsMQLCD8cwK50OMkhxMSqK8O+dzhwvxJeW nVGYkFmfEF5XmpBYfYpTh4FCS4K24BJQTLEpNT61Iy8wBhhNMWoKDR0mE1wckzVtckJhbnJkO kTrFqCglzlsLkhAASWSU5sG1wUL4EqOslDAvI9AhQjwFqUW5mSWo8q8YxTkYlYR5p4JM4cnMK 4Gb/gpoMRPQ4mf/OEEWlyQipKQaGPOkL+xomcwx5WQUwxYN/8MfTMMj7TRf3N237BeLWEunm/ LHNKX3vFzSbXn3IhpnrkjN7NOdl1ZUk96sWt8ZxFnwMF7kz+Nu3SvxMzldGA/8dVxrcSvoyze nWX91eGe2qJ/KWb9z/eSZ+4JzO/8/n+9yVy7T85LByujriltFXuelLln673OVvBJLcUaioRZz UXEiADhFDhZcAgAA X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1460392934!34878494!1 X-Originating-IP: [81.196.12.70] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16170 invoked from network); 11 Apr 2016 16:42:14 -0000 Received: from smtp1.rdslink.ro (HELO smtp.rdslink.ro) (81.196.12.70) by server-16.tower-27.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 11 Apr 2016 16:42:14 -0000 Received: (qmail 2496 invoked from network); 11 Apr 2016 16:42:05 -0000 X-Mail-Scanner: Scanned by qSheff-II-2.1-r3 (http://www.enderunix.org/qsheff/) Received: from unknown (HELO t460.localdomain) (5.12.76.2) by smtp1.rdslink.ro with SMTP; 11 Apr 2016 16:41:58 -0000 From: Razvan Cojocaru To: xen-devel@lists.xen.org Date: Mon, 11 Apr 2016 19:41:54 +0300 Message-Id: <1460392914-26033-1-git-send-email-rcojocaru@bitdefender.com> X-Mailer: git-send-email 2.8.0 Cc: andrew.cooper3@citrix.com, keir@xen.org, Razvan Cojocaru , jbeulich@suse.com Subject: [Xen-devel] [PATCH] xen: Filter out MSR write events 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch only allows introspection-related MSR write events to be sent out, improving performance. Should additional events be required, they can then simply be added to the list of vmx_introspection_force_enabled_msrs[]. Signed-off-by: Razvan Cojocaru Reviewed-by: Konrad Rzeszutek Wilk --- xen/arch/x86/hvm/hvm.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index f24126d..21ba611 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3688,6 +3688,17 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content) goto out; } +static bool_t is_introspection_msr(unsigned int msr) +{ + unsigned int i; + + for ( i = 0; i < vmx_introspection_force_enabled_msrs_size; i++ ) + if ( msr == vmx_introspection_force_enabled_msrs[i] ) + return 1; + + return 0; +} + int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, bool_t may_defer) { @@ -3703,7 +3714,8 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, hvm_cpuid(1, NULL, NULL, NULL, &edx); mtrr = !!(edx & cpufeat_mask(X86_FEATURE_MTRR)); - if ( may_defer && unlikely(currad->monitor.mov_to_msr_enabled) ) + if ( may_defer && unlikely(currad->monitor.mov_to_msr_enabled) && + is_introspection_msr(msr) ) { ASSERT(v->arch.vm_event);