From patchwork Thu Jun 2 22:52:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas K Lengyel X-Patchwork-Id: 9151231 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 EFDDB607D9 for ; Thu, 2 Jun 2016 22:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2F5E26D19 for ; Thu, 2 Jun 2016 22:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7A7828331; Thu, 2 Jun 2016 22:54:58 +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 681C928330 for ; Thu, 2 Jun 2016 22:54:58 +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 1b8bTd-0008So-M7; Thu, 02 Jun 2016 22:52:33 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8bTc-0008Si-Tc for xen-devel@lists.xenproject.org; Thu, 02 Jun 2016 22:52:33 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id BB/E4-27700-0B8B0575; Thu, 02 Jun 2016 22:52:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeJIrShJLcpLzFFi42K5GHrNSXf9joB wg+3nVC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyWjuKCMxIVN9pkGxh3CXYxcnIICUxnlHj3 kaOLkYtDQuAdi8SOzqdMIAkJgRiJKQ9+s0DYFRJL5jeyQjRoSNy+2cgO0iAkMJFJ4vu53cwgC TYBbYm217vAikQElCTurZrMBFLELPCRUeJfzwlGkISwQKBEw8lWsA0sAqoS83/8BmvgFXCWmL lxBtRmOYnL0x+wTWDkXcDIsIpRozi1qCy1SNfQTC+pKDM9oyQ3MTNH19DAVC83tbg4MT01JzG pWC85P3cTIzAcGIBgB+P5056HGCU5mJREeRljA8KF+JLyUyozEosz4otKc1KLDzHKcHAoSfCK bgfKCRalpqdWpGXmAAMTJi3BwaMkwtu8DSjNW1yQmFucmQ6ROsVozLHl97W1TBzbpt5byyTEk peflyolznsWpFQApDSjNA9uECxiLjHKSgnzMgKdJsRTkFqUm1mCKv+KUZyDUUmYVwTkHp7MvB K4fa+ATmECOqXgkT/IKSWJCCmpBkbTVVmaAf+99onemH3juqHQvmM/DW7ZFurwHXh8Pv3uLJG 83ijtO1z3FqadiXVlNn37o91Tx6Lj3lOjV9u8hONygn3clGQfn/KX95jrXDOjxHFtVuiHJWeV +o95z5i1RqOgYm6WjLCSNINruLJScs3Oc7UtvUeC/qUzi74IzdI6l3jwzIP/B5VYijMSDbWYi 4oTAd2gsLeTAgAA X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1464907950!6575088!1 X-Originating-IP: [209.85.214.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9706 invoked from network); 2 Jun 2016 22:52:31 -0000 Received: from mail-it0-f66.google.com (HELO mail-it0-f66.google.com) (209.85.214.66) by server-14.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 2 Jun 2016 22:52:31 -0000 Received: by mail-it0-f66.google.com with SMTP id k76so5711303ita.1 for ; Thu, 02 Jun 2016 15:52:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jWOL+8QLXoUbdqAJo+qWJNeYJbaPihqAmVYLTFziHBc=; b=gzk0o9WOEdhmPXGrDmhW4y//SOqSk07Q1aJQtxBCS8kO2hvjBoe+8WFRRD1l2Y5B64 MlW3E2JcDwjLA/PtdEi14SQfM7cdgA9TYf7ziDkaNSBv+eQuZf97ImSJSGDjK7pQDyTm PV5wtMDXMDex5WIIhJybdfPRiKvRGwSLgGh/13HKdggSSrQK20csIrR8zA9QFj6rtGXh WwAgibfd9zSsSoR34Pwr1tvmzcB0uxVXDO68YjrK98sDHWKgufVScuo5pQaKd8K4/W6B /1daszOagxj2Sm1DInibkJITrumILeU1AynBDGUOkkytmufOQksI0bFGykDF0rNZxGHu 1yeA== X-Gm-Message-State: ALyK8tK+hWs9B7XR/ufgSUKbHRNELqMMKhC1RqN55PRbKpunZPWeS7M9RJoOBnWWbP4QiQ== X-Received: by 10.36.65.162 with SMTP id b34mr1391791itd.30.1464907950235; Thu, 02 Jun 2016 15:52:30 -0700 (PDT) Received: from l1.lan (c-73-14-35-59.hsd1.co.comcast.net. [73.14.35.59]) by smtp.gmail.com with ESMTPSA id t91sm1484649ioi.26.2016.06.02.15.52.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 15:52:29 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Thu, 2 Jun 2016 16:52:18 -0600 Message-Id: <1464907946-19242-1-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 Cc: Kevin Tian , Tamas K Lengyel , Jun Nakajima , Razvan Cojocaru , Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH v5 1/9] vm_event: clear up return value of vm_event_monitor_traps 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 The return value has not been clearly defined, with the function never returning 0 which seemingly indicated a condition where the guest should crash. In this patch we define -rc as error condition where the notification was not sent, 0 where the notification was sent and the vCPU is not paused and 1 that the notification was sent and that the vCPU is paused. Signed-off-by: Tamas K Lengyel Acked-by: Razvan Cojocaru Reviewed-by: Jan Beulich Acked-by: Razvan Cojocaru Reviewed-by: Jan Beulich Acked-by: Kevin Tian --- Cc: Jun Nakajima Cc: Kevin Tian Cc: Jan Beulich Cc: Andrew Cooper Cc: Razvan Cojocaru --- xen/arch/x86/hvm/event.c | 4 ++-- xen/arch/x86/hvm/vmx/vmx.c | 6 +++--- xen/common/vm_event.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/hvm/event.c b/xen/arch/x86/hvm/event.c index 56c5514..5772c6b 100644 --- a/xen/arch/x86/hvm/event.c +++ b/xen/arch/x86/hvm/event.c @@ -47,8 +47,8 @@ bool_t hvm_event_cr(unsigned int index, unsigned long value, unsigned long old) .u.write_ctrlreg.old_value = old }; - vm_event_monitor_traps(curr, sync, &req); - return 1; + if ( vm_event_monitor_traps(curr, sync, &req) >= 0 ) + return 1; } return 0; diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 3acf1ab..097d97c 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -3392,11 +3392,11 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) break; } else { - int handled = + int rc = hvm_event_breakpoint(regs->eip, HVM_EVENT_SOFTWARE_BREAKPOINT); - if ( handled < 0 ) + if ( !rc ) { struct hvm_trap trap = { .vector = TRAP_int3, @@ -3410,7 +3410,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) hvm_inject_trap(&trap); break; } - else if ( handled ) + else if ( rc > 0 ) break; } diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c index 2906407..fe86fb9 100644 --- a/xen/common/vm_event.c +++ b/xen/common/vm_event.c @@ -801,7 +801,7 @@ int vm_event_monitor_traps(struct vcpu *v, uint8_t sync, * If there was no ring to handle the event, then * simply continue executing normally. */ - return 1; + return 0; default: return rc; }; @@ -810,6 +810,7 @@ int vm_event_monitor_traps(struct vcpu *v, uint8_t sync, { req->flags |= VM_EVENT_FLAG_VCPU_PAUSED; vm_event_vcpu_pause(v); + rc = 1; } if ( altp2m_active(d) ) @@ -821,7 +822,7 @@ int vm_event_monitor_traps(struct vcpu *v, uint8_t sync, vm_event_fill_regs(req); vm_event_put_request(d, &d->vm_event->monitor, req); - return 1; + return rc; } void vm_event_monitor_guest_request(void)