From nobody Sat Sep 21 05:37:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1675200601; cv=none; d=zohomail.com; s=zohoarc; b=K3hdymvFeJhwOaapW53yt7S3HT3oLLnK/QzWofCGwmKRVuZi6y8NdQoOtGyBDWfQ65il5aqGs3BTftOde5JMkSBJn4EGkUezYPxQe3vvF0gAjBLRkZwm2lhRW5Sb10ewnfGGg2HjUmaXlZu8tyre81cvE3t3y6DtbaX36IMd1uY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675200601; 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; bh=6WvvWDdgfDzpkKM3DodqxFrF3iPnq3Gob5/g0RSuphQ=; b=G7zHiICSmJ9nJD89t0gPV1wkExCpusDzE+Amnd9uux19YZivuIPclPo0izO9qe/fagmmISuOf5AzVIWto0cDtG0RfK8rK0d8w1zGn2BzGbVz3m82I5d/wzKdO/wOOCyQkwBLFPyfkkewwwfgCY2AEYKzTGF0ZSe1xcb8/pT35GU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1675200601295130.23696571066182; Tue, 31 Jan 2023 13:30:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.487849.755604 (Exim 4.92) (envelope-from ) id 1pMyC7-0001QU-Q9; Tue, 31 Jan 2023 21:29:35 +0000 Received: by outflank-mailman (output) from mailman id 487849.755604; Tue, 31 Jan 2023 21:29:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMyC7-0001PN-LU; Tue, 31 Jan 2023 21:29:35 +0000 Received: by outflank-mailman (input) for mailman id 487849; Tue, 31 Jan 2023 21:29:33 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMyC5-0000Nm-Kb for xen-devel@lists.xenproject.org; Tue, 31 Jan 2023 21:29:33 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 58685249-a1ae-11ed-b63b-5f92e7d2e73a; Tue, 31 Jan 2023 22:29:31 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 58685249-a1ae-11ed-b63b-5f92e7d2e73a DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1675200571; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D6fomBGSmJOQ8kYSoARFYZfJ7J0cbqAWh1IAdPyYhsE=; b=JYEzherDJoTOePts40n4Aw3VyqbG07cKdW3/nIiXhQDQl4rtz2h72RNi PL75zCAHkKhjEVHCL41hn6+/1ve1Xfp2v5iOkk7UP2tD4wymOE25Z025/ vQcXVrnvZa+PdpAgj8BOfli07zt620i73jBCXIWNkrrA5xeZQaVIQjE/c k=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 95499181 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.123 X-Policy: $RELAYED IronPort-Data: A9a23:UaIn26Dp78IZrxVW/yjjw5YqxClBgxIJ4kV8jS/XYbTApG8ghmNWy TcbCG+EOvyDYmOgL4t1O4Ti9RsHuZ/Wm9M1QQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nNHuCnYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFtMpvlDs15K6p4GpD5wRlDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw0/5SWVMJ1 +IhMTkAYjTY28uE8qOCY7w57igjBJGD0II3v3hhyXfSDOo8QICFSKLPjTNa9G5u3IYUR6+YP pdHL2M1N3wsYDUWUrsTILs4kP2lmT/UdDpApUjOjaE2/3LS3Ep6172F3N/9K4HWFJQMzh/wS mTu2zrFWkslF8Wl8BWZ8m6QivTwwy3UcddHfFG/3qEz2wDCroAJMzUGWF3+rfSnh0qWX9NEN 1dS6icotbI19kGgUp/6RRLQiHKNoBM0QddbFOw+rgaXxcLpDx2xXzZeCGQbMZp/6ZFwHGZxv rOUoz/3LRV3leWnDlCDz66doD+WYnQ8H10TXAZRGGPp/OLfiI00ixvOSPNqH6i0ksD5FFnM/ tyakMQtr+5N1JBWjs1X6XiC2mvx/caREmbZ8y2NBgqYAhVFiJlJjmBCwXzS9r5+IYmQVTFtV 1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A pzYNGoHrQ+0qmCYA6HvCTs X-IronPort-AV: E=Sophos;i="5.97,261,1669093200"; d="scan'208";a="95499181" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Christian Lindig , David Scott , =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , Rob Hoes Subject: [PATCH 4/7] tools/ocaml/evtchn: Misc cleanup Date: Tue, 31 Jan 2023 21:29:10 +0000 Message-ID: <20230131212913.6199-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20230131212913.6199-1-andrew.cooper3@citrix.com> References: <20230131212913.6199-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1675200601743100009 * Remove local integers when all we're returning is Val_int() of another variable. The CAMLlocal*() can't be optimised automatically, as it's registered with the GC. * Rename "virq_type" to "virq" and "_port" to "port". * In stub_eventchn_pending(), rename 'port' to 'rc', to be consistent with all other stubs that return xenevtchn_port_or_error_t. * In stub_eventchn_unmask(), check for rc =3D=3D -1 to be consistent with = all other stubs. No practical change. Signed-off-by: Andrew Cooper --- CC: Christian Lindig CC: David Scott CC: Edwin T=C3=B6r=C3=B6k CC: Rob Hoes --- tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 45 +++++++++++------------= ---- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/li= bs/eventchn/xeneventchn_stubs.c index d7881ca95f98..34dcfed30275 100644 --- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c +++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c @@ -98,17 +98,15 @@ CAMLprim value stub_eventchn_fdopen(value fdval) CAMLprim value stub_eventchn_fd(value xce_val) { CAMLparam1(xce_val); - CAMLlocal1(result); xenevtchn_handle *xce =3D xce_of_val(xce_val); int fd; =20 + /* Don't drop the GC lock. This is a simple read out of memory */ fd =3D xenevtchn_fd(xce); if (fd =3D=3D -1) caml_failwith("evtchn fd failed"); =20 - result =3D Val_int(fd); - - CAMLreturn(result); + CAMLreturn(Val_int(fd)); } =20 CAMLprim value stub_eventchn_notify(value xce_val, value port) @@ -131,37 +129,34 @@ CAMLprim value stub_eventchn_bind_interdomain(value x= ce_val, value domid, value remote_port) { CAMLparam3(xce_val, domid, remote_port); - CAMLlocal1(port); xenevtchn_handle *xce =3D xce_of_val(xce_val); xenevtchn_port_or_error_t rc; =20 caml_enter_blocking_section(); - rc =3D xenevtchn_bind_interdomain(xce, Int_val(domid), Int_val(remote_por= t)); + rc =3D xenevtchn_bind_interdomain(xce, Int_val(domid), + Int_val(remote_port)); caml_leave_blocking_section(); =20 if (rc =3D=3D -1) caml_failwith("evtchn bind_interdomain failed"); - port =3D Val_int(rc); =20 - CAMLreturn(port); + CAMLreturn(Val_int(rc)); } =20 -CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq_type) +CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq) { - CAMLparam2(xce_val, virq_type); - CAMLlocal1(port); + CAMLparam2(xce_val, virq); xenevtchn_handle *xce =3D xce_of_val(xce_val); xenevtchn_port_or_error_t rc; =20 caml_enter_blocking_section(); - rc =3D xenevtchn_bind_virq(xce, Int_val(virq_type)); + rc =3D xenevtchn_bind_virq(xce, Int_val(virq)); caml_leave_blocking_section(); =20 if (rc =3D=3D -1) caml_failwith("evtchn bind_virq failed"); - port =3D Val_int(rc); =20 - CAMLreturn(port); + CAMLreturn(Val_int(rc)); } =20 CAMLprim value stub_eventchn_unbind(value xce_val, value port) @@ -183,35 +178,31 @@ CAMLprim value stub_eventchn_unbind(value xce_val, va= lue port) CAMLprim value stub_eventchn_pending(value xce_val) { CAMLparam1(xce_val); - CAMLlocal1(result); xenevtchn_handle *xce =3D xce_of_val(xce_val); - xenevtchn_port_or_error_t port; + xenevtchn_port_or_error_t rc; =20 caml_enter_blocking_section(); - port =3D xenevtchn_pending(xce); + rc =3D xenevtchn_pending(xce); caml_leave_blocking_section(); =20 - if (port =3D=3D -1) + if (rc =3D=3D -1) caml_failwith("evtchn pending failed"); - result =3D Val_int(port); =20 - CAMLreturn(result); + CAMLreturn(Val_int(rc)); } =20 -CAMLprim value stub_eventchn_unmask(value xce_val, value _port) +CAMLprim value stub_eventchn_unmask(value xce_val, value port) { - CAMLparam2(xce_val, _port); + CAMLparam2(xce_val, port); xenevtchn_handle *xce =3D xce_of_val(xce_val); - evtchn_port_t port; int rc; =20 - port =3D Int_val(_port); - caml_enter_blocking_section(); - rc =3D xenevtchn_unmask(xce, port); + rc =3D xenevtchn_unmask(xce, Int_val(port)); caml_leave_blocking_section(); =20 - if (rc) + if (rc =3D=3D -1) caml_failwith("evtchn unmask failed"); + CAMLreturn(Val_unit); } --=20 2.11.0