From nobody Fri Apr 19 14:59:17 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1557512987; cv=none; d=zoho.com; s=zohoarc; b=FcaxQICK1RJ6/Vuehb+eOI8QJqkZ0JSMO8WQOAjQBN/D0oSG9eKHNxl2AqNya6NsgCN3vhckkd/Oj8iZxZwL05pCcdiol6PVWar3VUAcWER9hkGW0QG0v1jU3ooth0wlXGRm67AN5oJE0DtW4IDtn2L1KwNv1ORjuCCsJZC4fLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557512987; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=tr3H+ugH+/eq0jdFAPhKlseUjhXfG19shYOZQJdubWY=; b=K5jBIIX57Q8WaWVdyK4/GWRV4fLYxOezko50cUnwS0b72HISAc4dVMt+yO2HC9mgEwJ+U5ku1j2HU7O7CD5ek80EKa/k+cwJKvr/Ey9slQ4lKAecsojLFMofu8ilBLweomzwWNO7G8z+2TtyPfz6U8Z/DQWrDi5bb/gvzOI1QXE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1557512987117725.8512096243352; Fri, 10 May 2019 11:29:47 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hPAFf-0006vW-Lp; Fri, 10 May 2019 18:28:11 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hPAFe-0006vK-Fx for xen-devel@lists.xenproject.org; Fri, 10 May 2019 18:28:10 +0000 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 5caea7a1-7351-11e9-8980-bc764e045a96; Fri, 10 May 2019 18:28:09 +0000 (UTC) X-Inumbo-ID: 5caea7a1-7351-11e9-8980-bc764e045a96 X-IronPort-AV: E=Sophos;i="5.60,454,1549929600"; d="scan'208";a="85337735" From: Andrew Cooper To: Xen-devel Date: Fri, 10 May 2019 19:28:01 +0100 Message-ID: <1557512884-32395-2-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1557512884-32395-1-git-send-email-andrew.cooper3@citrix.com> References: <1557512884-32395-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/4] xen/watchdog: Fold exit paths to have a single unlock 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: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Christian Lindig , Pau Ruiz Safont , Julien Grall , =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This is mostly to simplify future logical changes, but it does come with a modest redunction in compiled code size (-55, 345 =3D> 290). No functional change. Signed-off-by: Andrew Cooper Reviewed-by: George Dunlap Reviewed-by: Wei Liu --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: George Dunlap CC: Edwin T=C3=B6r=C3=B6k CC: Christian Lindig CC: Pau Ruiz Safont --- xen/common/schedule.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 66f1e26..47f5d04 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1050,6 +1050,8 @@ static void domain_watchdog_timeout(void *data) =20 static long domain_watchdog(struct domain *d, uint32_t id, uint32_t timeou= t) { + long rc =3D 0; + if ( id > NR_DOMAIN_WATCHDOG_TIMERS ) return -EINVAL; =20 @@ -1064,15 +1066,15 @@ static long domain_watchdog(struct domain *d, uint3= 2_t id, uint32_t timeout) set_timer(&d->watchdog_timer[id], NOW() + SECONDS(timeout)); break; } - spin_unlock(&d->watchdog_lock); - return id =3D=3D NR_DOMAIN_WATCHDOG_TIMERS ? -ENOSPC : id + 1; + rc =3D id =3D=3D NR_DOMAIN_WATCHDOG_TIMERS ? -ENOSPC : id + 1; + goto unlock; } =20 id -=3D 1; if ( !test_bit(id, &d->watchdog_inuse_map) ) { - spin_unlock(&d->watchdog_lock); - return -EINVAL; + rc =3D -EINVAL; + goto unlock; } =20 if ( timeout =3D=3D 0 ) @@ -1085,8 +1087,10 @@ static long domain_watchdog(struct domain *d, uint32= _t id, uint32_t timeout) set_timer(&d->watchdog_timer[id], NOW() + SECONDS(timeout)); } =20 + unlock: spin_unlock(&d->watchdog_lock); - return 0; + + return rc; } =20 void watchdog_domain_init(struct domain *d) --=20 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel