From patchwork Tue Jul 5 14:29:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corneliu ZUZU X-Patchwork-Id: 9214345 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 8D5886048F for ; Tue, 5 Jul 2016 14:32:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EDE823B3D for ; Tue, 5 Jul 2016 14:32:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7344024151; Tue, 5 Jul 2016 14:32:17 +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 196AE23B3D for ; Tue, 5 Jul 2016 14:32:17 +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 1bKRMT-0007AP-EP; Tue, 05 Jul 2016 14:30:05 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKRMS-00075v-G4 for xen-devel@lists.xen.org; Tue, 05 Jul 2016 14:30:04 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 1C/73-11548-B64CB775; Tue, 05 Jul 2016 14:30:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRWlGSWpSXmKPExsUSfTxjoW72kep wg5c/hS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyd+zqYCu5xV6w40c7YwDifs4uRk0NIwF3i 3ouFLF2MXED2GkaJjS+6WCGck4wSn+YdZIGp+jmlnw0isY5RYkpXN1iCTUBb4tyhe0wgtoiAt MS1z5cZQYqYBZYySjxccBUsISzgJvFw6jRGEJtFQFXi3eQLzCA2r4CrxOoVE4CmcnBICMhJLL iQDhLmBCp//voSK8RiV4mmk+/AyiUEciSO//gJVS4l8b9VCWSVhEA3i8TCE+fZIGpkJB5NvMk 2gVFoASPDKkb14tSistQiXUO9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYzAQGQA gh2MO587HWKU5GBSEuWVXVodLsSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCN+EwUE6wKDU9tSItM wcYEzBpCQ4eJRHeNpA0b3FBYm5xZjpE6hSjopQ4rzlIQgAkkVGaB9cGi8NLjLJSwryMQIcI8R SkFuVmlqDKv2IU52BUEub1B5nCk5lXAjf9FdBiJqDFP13AFpckIqSkGhin6Zqe0BFe1fhr8xn D7duE+pMVW1axG+1b5Md8bf9u48D/so6ro12b50+em1A6lWXjQtWjmp2972oYxVN/ljovMrN4 difiQ/rP5gqW6VJHngWc04j5XOXW1pS6gH2V4zcj9Y7wtfpPxNNyL05/eHJ3jvppS69gr6zg1 y7R4oty4r3lrwjPVlRiKc5INNRiLipOBADIi+3bvgIAAA== X-Env-Sender: czuzu@bitdefender.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1467729002!8504566!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 33968 invoked from network); 5 Jul 2016 14:30:03 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-2.tower-21.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 5 Jul 2016 14:30:03 -0000 Received: (qmail 19022 invoked from network); 5 Jul 2016 17:30:02 +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; 5 Jul 2016 17:30:02 +0300 Received: from smtp01.buh.bitdefender.com (unknown [10.17.80.75]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id E11777FC01 for ; Tue, 5 Jul 2016 17:30:01 +0300 (EEST) Received: (qmail 11354 invoked from network); 5 Jul 2016 17:30:01 +0300 Received: from 188-24-34-246.rdsnet.ro (HELO localhost.localdomain) (czuzu@bitdefender.com@188.24.34.246) by smtp01.buh.bitdefender.com with SMTP; 5 Jul 2016 17:30:01 +0300 From: Corneliu ZUZU To: xen-devel@lists.xen.org Date: Tue, 5 Jul 2016 17:29:56 +0300 Message-Id: <1467728996-13823-1-git-send-email-czuzu@bitdefender.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1467728717-13592-1-git-send-email-czuzu@bitdefender.com> References: <1467728717-13592-1-git-send-email-czuzu@bitdefender.com> X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp01.buh.bitdefender.com, sigver: 7.66188 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.911, Dats: 425435, Stamp: 3], Multi: [Enabled, t: (0.000009, 0.001802)], BW: [Enabled, t: (0.000016,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.002865), Flags: BB9BAF5C; 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.006871)], URL: [Enabled, t: (0.000006)], RTDA: [Enabled, t: (0.015837), Hit: No, Details: v2.3.10; Id: 2m1ghjn.1amgkn6ss.j1m8], total: 0(775) X-BitDefender-CF-Stamp: none Cc: Andrew Cooper , Tamas K Lengyel , Razvan Cojocaru , Jan Beulich Subject: [Xen-devel] [PATCH v2 5/7] x86/vm-event: minor ASSERT fix, add 'unlikely' 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 fixes: * vm_event_register_write_resume: ASSERT on non-NULL v->arch.vm_event instead of &v->arch.vm_event->write_data. * add 'unlikely' in if Signed-off-by: Corneliu ZUZU --- xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/vm_event.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index ac6d9eb..091cabe 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -475,7 +475,7 @@ void hvm_do_resume(struct vcpu *v) if ( unlikely(v->arch.vm_event) ) { - if ( v->arch.vm_event->emulate_flags ) + if ( unlikely(v->arch.vm_event->emulate_flags) ) { enum emul_kind kind = EMUL_KIND_NORMAL; diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c index 0e25e4d..2fe7808 100644 --- a/xen/arch/x86/vm_event.c +++ b/xen/arch/x86/vm_event.c @@ -83,14 +83,16 @@ void vm_event_register_write_resume(struct vcpu *v, vm_event_response_t *rsp) { if ( rsp->flags & VM_EVENT_FLAG_DENY ) { - struct monitor_write_data *w = &v->arch.vm_event->write_data; + struct monitor_write_data *w; - ASSERT(w); + ASSERT(v->arch.vm_event); /* deny flag requires the vCPU to be paused */ if ( !atomic_read(&v->vm_event_pause_count) ) return; + w = &v->arch.vm_event->write_data; + switch ( rsp->reason ) { case VM_EVENT_REASON_MOV_TO_MSR: