From patchwork Mon Jun 3 12:25:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 10972839 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 538FC14B6 for ; Mon, 3 Jun 2019 12:29:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43EA92015F for ; Mon, 3 Jun 2019 12:29:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35A10284F1; Mon, 3 Jun 2019 12:29:34 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF06D2015F for ; Mon, 3 Jun 2019 12:29:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXm42-0002pO-CX; Mon, 03 Jun 2019 12:27:46 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXm41-0002p0-P7 for xen-devel@lists.xenproject.org; Mon, 03 Jun 2019 12:27:45 +0000 X-Inumbo-ID: fb22be3a-85fa-11e9-ba71-1f5b6f9313ca Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fb22be3a-85fa-11e9-ba71-1f5b6f9313ca; Mon, 03 Jun 2019 12:27:41 +0000 (UTC) Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@MIAPEX02MSOL02.citrite.net Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=23.29.105.83; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 23.29.105.83 as permitted sender) identity=mailfrom; client-ip=23.29.105.83; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:23.29.105.83 ip4:162.221.156.50 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@MIAPEX02MSOL02.citrite.net) identity=helo; client-ip=23.29.105.83; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@MIAPEX02MSOL02.citrite.net"; x-conformance=sidf_compatible IronPort-SDR: DweiCrYQeE4cT185dbySV23iWYvyc3jibeFufp59nS06RT/tV4GtkyzaJ+M4WcNdFnKlKBe2fM D+ggoHYh/8Mdp6pqpKVs9Uc9brn+QwVcrkBITcHJLSXv9iQcdrcQC3VS2JBymRdfCDF/GMTDtp JkViCywafm0bmN0Jz6hJBqTTb5SFLzB3YZoynwSKbYTHZimvtdK3RYHkok2fv3IL7uQLjsXN1a Vpy2nUw05VUJxaHQJeGSFup5+uW3VTF86rkQ0Q2Ij7w1GsecYNhzeeI3om9Mwd78XoyVGaHdxU n5g= X-SBRS: 2.7 X-MesageID: 1239386 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 23.29.105.83 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.60,546,1549947600"; d="scan'208";a="1239386" From: Andrew Cooper To: Xen-devel Date: Mon, 3 Jun 2019 13:25:28 +0100 Message-ID: <1559564728-17167-6-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1559564728-17167-1-git-send-email-andrew.cooper3@citrix.com> References: <1559564728-17167-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 5/5] xen/vm-event: Misc fixups X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Petre Pircalabu , Andrew Cooper , Tamas K Lengyel , Razvan Cojocaru Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP * Drop redundant brackes, and inline qualifiers. * Insert newlines and spaces where appropriate. * Drop redundant NDEBUG - gdprint() is already conditional. Fix the logging level, as gdprintk() already prefixes the guest marker. No functional change. Signed-off-by: Andrew Cooper Acked-by: Razvan Cojocaru --- CC: Razvan Cojocaru CC: Tamas K Lengyel CC: Petre Pircalabu --- xen/common/vm_event.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c index 72f42b4..e872680 100644 --- a/xen/common/vm_event.c +++ b/xen/common/vm_event.c @@ -102,6 +102,7 @@ static int vm_event_enable( static unsigned int vm_event_ring_available(struct vm_event_domain *ved) { int avail_req = RING_FREE_REQUESTS(&ved->front_ring); + avail_req -= ved->target_producers; avail_req -= ved->foreign_producers; @@ -168,7 +169,7 @@ static void vm_event_wake_queued(struct domain *d, struct vm_event_domain *ved) */ void vm_event_wake(struct domain *d, struct vm_event_domain *ved) { - if (!list_empty(&ved->wq.list)) + if ( !list_empty(&ved->wq.list) ) vm_event_wake_queued(d, ved); else vm_event_wake_blocked(d, ved); @@ -216,8 +217,8 @@ static int vm_event_disable(struct domain *d, struct vm_event_domain **p_ved) return 0; } -static inline void vm_event_release_slot(struct domain *d, - struct vm_event_domain *ved) +static void vm_event_release_slot(struct domain *d, + struct vm_event_domain *ved) { /* Update the accounting */ if ( current->domain == d ) @@ -258,17 +259,16 @@ void vm_event_put_request(struct domain *d, RING_IDX req_prod; struct vcpu *curr = current; - if( !vm_event_check_ring(ved)) + if( !vm_event_check_ring(ved) ) return; if ( curr->domain != d ) { req->flags |= VM_EVENT_FLAG_FOREIGN; -#ifndef NDEBUG + if ( !(req->flags & VM_EVENT_FLAG_VCPU_PAUSED) ) - gdprintk(XENLOG_G_WARNING, "d%dv%d was not paused.\n", + gdprintk(XENLOG_WARNING, "d%dv%d was not paused.\n", d->domain_id, req->vcpu_id); -#endif } req->version = VM_EVENT_INTERFACE_VERSION; @@ -474,6 +474,7 @@ static int vm_event_grab_slot(struct vm_event_domain *ved, int foreign) static int vm_event_wait_try_grab(struct vm_event_domain *ved, int *rc) { *rc = vm_event_grab_slot(ved, 0); + return *rc; } @@ -481,13 +482,15 @@ static int vm_event_wait_try_grab(struct vm_event_domain *ved, int *rc) static int vm_event_wait_slot(struct vm_event_domain *ved) { int rc = -EBUSY; + wait_event(ved->wq, vm_event_wait_try_grab(ved, &rc) != -EBUSY); + return rc; } bool vm_event_check_ring(struct vm_event_domain *ved) { - return (ved && ved->ring_page); + return ved && ved->ring_page; } /* @@ -511,7 +514,7 @@ int __vm_event_claim_slot(struct domain *d, struct vm_event_domain *ved, if ( (current->domain == d) && allow_sleep ) return vm_event_wait_slot(ved); else - return vm_event_grab_slot(ved, (current->domain != d)); + return vm_event_grab_slot(ved, current->domain != d); } #ifdef CONFIG_HAS_MEM_PAGING