From patchwork Fri Sep 20 16:19:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11154657 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7340D1745 for ; Fri, 20 Sep 2019 16:21:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4533F2086A for ; Fri, 20 Sep 2019 16:21:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="BMxv/X0Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4533F2086A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iBLch-0008IS-SW; Fri, 20 Sep 2019 16:19:07 +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 1iBLcg-0008IN-Hb for xen-devel@lists.xenproject.org; Fri, 20 Sep 2019 16:19:06 +0000 X-Inumbo-ID: 5d7af7d8-dbc2-11e9-9597-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5d7af7d8-dbc2-11e9-9597-12813bfff9fa; Fri, 20 Sep 2019 16:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568996346; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=stCqnNB4JBrXmMUlv51cntYfgeLmB+J54lSVrwG+vO4=; b=BMxv/X0ZIeWA8XyWBAw/O46iJ36Bnvnf4QnwV4GrJ5IM6C8MuCltnC1I 8rgrt8vVoAfzlWFSMovHMYcsRrhUEFDAGXPjloRkL0y9vC18+Y5cczjNx 8oFaHYN0J6SXcDxmmrpKrNz/6Gx6DkeWplxTAz9U3jI/dnwSTDwjDHknw A=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@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:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 7wyLFNiHZrHYjM4Pt6TddFXsjfDd53da53pKh/5D+H2QX9xbbV93Oa9fz17zL0q3pf9EWd5tAj nbqYwEeVZGkHPhzqYuv94YMnAID6xz5P/iSRnoFKbI9LDL2y43MDRtFmcw0RiI1yKlKUWIUbel 3Rq6jR+YbLaW5Qzqq6KRZhVDLFMWWSwnF9MiSIF21pPyCX8lEGRNRJZ1KtyzW0deOS/nWWZtx8 9upUYjqxGjoNwA4mFVdIQlSBFBXUVoby+y5xmX/8Z438dK2MDq6HL60uEaIYndvDqvMiNC1r/w Hrc= X-SBRS: 2.7 X-MesageID: 5856485 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,529,1559534400"; d="scan'208";a="5856485" From: Anthony PERARD To: Date: Fri, 20 Sep 2019 17:19:02 +0100 Message-ID: <20190920161902.1353598-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] tools/ocaml: Build fix following libxl API changes 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: Anthony PERARD , Ian Jackson , Christian Lindig , Wei Liu , David Scott Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The following libxl API became asynchronous and gained an additional `ao_how' parameter: libxl_domain_pause() libxl_domain_unpause() libxl_send_trigger() Adapt the ocaml binding. Build tested only. Fixes: edaa631ddcee665cdfae1cf6bc7492c791e01ef4 Fixes: 95627b87c3159928458ee586e8c5c593bdd248d8 Signed-off-by: Anthony PERARD --- Notes: Currently, all libxl API that takes an `ao_how` have `?async:'a -> unit` in the ocaml definition (and an extra unused value unit in the c stub file), is that `unit` needed ? I tried to add it, but then for stub_xl_send_trigger() I had to use CAMLparam6, and that doesn't exist. tools/ocaml/libs/xl/xenlight.ml.in | 6 +++--- tools/ocaml/libs/xl/xenlight.mli.in | 6 +++--- tools/ocaml/libs/xl/xenlight_stubs.c | 27 ++++++++++++++++++--------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/tools/ocaml/libs/xl/xenlight.ml.in b/tools/ocaml/libs/xl/xenlight.ml.in index 80e620a9be66..954e56fc740b 100644 --- a/tools/ocaml/libs/xl/xenlight.ml.in +++ b/tools/ocaml/libs/xl/xenlight.ml.in @@ -41,10 +41,10 @@ module Domain = struct external reboot : ctx -> domid -> unit = "stub_libxl_domain_reboot" external destroy : ctx -> domid -> ?async:'a -> unit -> unit = "stub_libxl_domain_destroy" external suspend : ctx -> domid -> Unix.file_descr -> ?async:'a -> unit -> unit = "stub_libxl_domain_suspend" - external pause : ctx -> domid -> unit = "stub_libxl_domain_pause" - external unpause : ctx -> domid -> unit = "stub_libxl_domain_unpause" + external pause : ctx -> domid -> ?async:'a -> unit = "stub_libxl_domain_pause" + external unpause : ctx -> domid -> ?async:'a -> unit = "stub_libxl_domain_unpause" - external send_trigger : ctx -> domid -> trigger -> int -> unit = "stub_xl_send_trigger" + external send_trigger : ctx -> domid -> trigger -> int -> ?async:'a -> unit = "stub_xl_send_trigger" external send_sysrq : ctx -> domid -> char -> unit = "stub_xl_send_sysrq" end diff --git a/tools/ocaml/libs/xl/xenlight.mli.in b/tools/ocaml/libs/xl/xenlight.mli.in index b2c06b5eed76..c08304ae8b01 100644 --- a/tools/ocaml/libs/xl/xenlight.mli.in +++ b/tools/ocaml/libs/xl/xenlight.mli.in @@ -43,10 +43,10 @@ module Domain : sig external reboot : ctx -> domid -> unit = "stub_libxl_domain_reboot" external destroy : ctx -> domid -> ?async:'a -> unit -> unit = "stub_libxl_domain_destroy" external suspend : ctx -> domid -> Unix.file_descr -> ?async:'a -> unit -> unit = "stub_libxl_domain_suspend" - external pause : ctx -> domid -> unit = "stub_libxl_domain_pause" - external unpause : ctx -> domid -> unit = "stub_libxl_domain_unpause" + external pause : ctx -> domid -> ?async:'a -> unit = "stub_libxl_domain_pause" + external unpause : ctx -> domid -> ?async:'a -> unit = "stub_libxl_domain_unpause" - external send_trigger : ctx -> domid -> trigger -> int -> unit = "stub_xl_send_trigger" + external send_trigger : ctx -> domid -> trigger -> int -> ?async:'a -> unit = "stub_xl_send_trigger" external send_sysrq : ctx -> domid -> char -> unit = "stub_xl_send_sysrq" end diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c b/tools/ocaml/libs/xl/xenlight_stubs.c index 0140780a342e..37b046df6351 100644 --- a/tools/ocaml/libs/xl/xenlight_stubs.c +++ b/tools/ocaml/libs/xl/xenlight_stubs.c @@ -622,32 +622,38 @@ value stub_libxl_domain_suspend(value ctx, value domid, value fd, value async, v CAMLreturn(Val_unit); } -value stub_libxl_domain_pause(value ctx, value domid) +value stub_libxl_domain_pause(value ctx, value domid, value async) { - CAMLparam2(ctx, domid); + CAMLparam3(ctx, domid, async); int ret; uint32_t c_domid = Int_val(domid); + libxl_asyncop_how *ao_how = aohow_val(async); caml_enter_blocking_section(); - ret = libxl_domain_pause(CTX, c_domid); + ret = libxl_domain_pause(CTX, c_domid, ao_how); caml_leave_blocking_section(); + free(ao_how); + if (ret != 0) failwith_xl(ret, "domain_pause"); CAMLreturn(Val_unit); } -value stub_libxl_domain_unpause(value ctx, value domid) +value stub_libxl_domain_unpause(value ctx, value domid, value async) { - CAMLparam2(ctx, domid); + CAMLparam3(ctx, domid, async); int ret; uint32_t c_domid = Int_val(domid); + libxl_asyncop_how *ao_how = aohow_val(async); caml_enter_blocking_section(); - ret = libxl_domain_unpause(CTX, c_domid); + ret = libxl_domain_unpause(CTX, c_domid, ao_how); caml_leave_blocking_section(); + free(ao_how); + if (ret != 0) failwith_xl(ret, "domain_unpause"); @@ -1031,20 +1037,23 @@ value stub_xl_domain_sched_params_set(value ctx, value domid, value scinfo) CAMLreturn(Val_unit); } -value stub_xl_send_trigger(value ctx, value domid, value trigger, value vcpuid) +value stub_xl_send_trigger(value ctx, value domid, value trigger, value vcpuid, value async) { - CAMLparam4(ctx, domid, trigger, vcpuid); + CAMLparam5(ctx, domid, trigger, vcpuid, async); int ret; uint32_t c_domid = Int_val(domid); libxl_trigger c_trigger = LIBXL_TRIGGER_UNKNOWN; int c_vcpuid = Int_val(vcpuid); + libxl_asyncop_how *ao_how = aohow_val(async); trigger_val(CTX, &c_trigger, trigger); caml_enter_blocking_section(); - ret = libxl_send_trigger(CTX, c_domid, c_trigger, c_vcpuid); + ret = libxl_send_trigger(CTX, c_domid, c_trigger, c_vcpuid, ao_how); caml_leave_blocking_section(); + free(ao_how); + if (ret != 0) failwith_xl(ret, "send_trigger");