David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 00 of 14] Improvements to libxl VIF hotplug and ocaml bindings (v2)
Improvements to libxl VIF hotplug/unplug and ocaml bindings; xapi can now use these functions This patch set includes: 1. addition of VIF QoS parameters to libxl (this code is ported from xapi/ xenops) 2. updates to the libxl ocaml bindings to make them more usable and more easily generatable from the IDL 3. bugfixes to the "xl network-attach" command so the QoS settings can be more easily tested. FYI the corresponding xapi changes are in a branch here: https://github.com/djs55/xen-api/tree/hackathon Changes since the last submission include: * updating the whole ocaml xl module to use the new style for consistency * some dead ocaml functions were removed * documentation for the QoS parameters added to the libxl IDL * the QoS parameter was renamed to have "kb" rather than "kib" for consistency Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 01 of 14] libxl: fix memory management in "xl network-attach"
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 746e49e61dbc79797d1206a96e5b65651874b1bf # Parent a65612bcbb921e98a8843157bf365e4ab16e8144 libxl: fix memory management in "xl network-attach" The libxl_device_nic struct has strings which are initially strdup()ed and then free()ed in libxl_device_nic_destroy(). In the "network-attach" parser we need to free() the existing string and strdup((*argv) + N), rather than just copying the pointer. Signed-off-by: David Scott <dave.scott@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> diff -r a65612bcbb92 -r 746e49e61dbc tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Fri Mar 25 09:03:17 2011 +0000 +++ b/tools/libxl/xl_cmdimpl.c Wed Mar 30 18:54:28 2011 +0100 @@ -4277,12 +4277,14 @@ int main_networkattach(int argc, char ** nic.mac[i] = val; } } else if (!strncmp("bridge=", *argv, 7)) { - nic.bridge = (*argv) + 7; + free(nic.bridge); + nic.bridge = strdup((*argv) + 7); } else if (!strncmp("ip=", *argv, 3)) { free(nic.ip); nic.ip = strdup((*argv) + 3); } else if (!strncmp("script=", *argv, 6)) { - nic.script = (*argv) + 6; + free(nic.script); + nic.script = strdup((*argv) + 6); } else if (!strncmp("backend=", *argv, 8)) { if(libxl_name_to_domid(&ctx, ((*argv) + 8), &val)) { fprintf(stderr, "Specified backend domain does not exist, defaulting to Dom0\n"); @@ -4290,9 +4292,11 @@ int main_networkattach(int argc, char ** } nic.backend_domid = val; } else if (!strncmp("vifname=", *argv, 8)) { - nic.ifname = (*argv) + 8; + free(nic.ifname); + nic.ifname = strdup((*argv) + 8); } else if (!strncmp("model=", *argv, 6)) { - nic.model = (*argv) + 6; + free(nic.model); + nic.model = strdup((*argv) + 6); } else if (!strncmp("rate=", *argv, 5)) { } else if (!strncmp("accel=", *argv, 6)) { } else { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 02 of 14] tools: ocaml: rename the device_nic types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 3050abaa45d6da7edeb8c7f4efd1ae8658740329 # Parent 746e49e61dbc79797d1206a96e5b65651874b1bf tools: ocaml: rename the device_nic types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 746e49e61dbc -r 3050abaa45d6 tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -1,5 +1,5 @@ (* - * Copyright (C) 2009-2010 Citrix Ltd. + * Copyright (C) 2009-2011 Citrix Ltd. * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com> * * This program is free software; you can redistribute it and/or modify @@ -97,18 +97,22 @@ type nic_type | NICTYPE_IOEMU | NICTYPE_VIF -type nic_info -{ - backend_domid : domid; - devid : int; - mtu : int; - model : string; - mac : int array; - bridge : string; - ifname : string; - script : string; - nictype : nic_type; -} +module Device_nic = struct + type t + { + backend_domid : domid; + devid : int; + mtu : int; + model : string; + mac : int array; + bridge : string; + ifname : string; + script : string; + nictype : nic_type; + } + external add : t -> domid -> unit = "stub_xl_device_nic_add" + external del : t -> domid -> unit = "stub_xl_device_nic_del" +end type console_type | CONSOLETYPE_XENCONSOLED @@ -179,9 +183,6 @@ external domain_build : build_info -> do external disk_add : disk_info -> domid -> unit = "stub_xl_disk_add" external disk_remove : disk_info -> domid -> unit = "stub_xl_disk_remove" -external nic_add : nic_info -> domid -> unit = "stub_xl_nic_add" -external nic_remove : disk_info -> domid -> unit = "stub_xl_nic_remove" - external console_add : console_info -> build_state -> domid -> unit = "stub_xl_console_add" external vkb_add : vkb_info -> domid -> unit = "stub_xl_vkb_add" diff -r 746e49e61dbc -r 3050abaa45d6 tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -1,5 +1,5 @@ (* - * Copyright (C) 2009-2010 Citrix Ltd. + * Copyright (C) 2009-2011 Citrix Ltd. * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com> * * This program is free software; you can redistribute it and/or modify @@ -97,18 +97,22 @@ type nic_type | NICTYPE_IOEMU | NICTYPE_VIF -type nic_info -{ - backend_domid : domid; - devid : int; - mtu : int; - model : string; - mac : int array; - bridge : string; - ifname : string; - script : string; - nictype : nic_type; -} +module Device_nic : sig + type t + { + backend_domid : domid; + devid : int; + mtu : int; + model : string; + mac : int array; + bridge : string; + ifname : string; + script : string; + nictype : nic_type; + } + external add : t -> domid -> unit = "stub_xl_device_nic_add" + external del : t -> domid -> unit = "stub_xl_device_nic_del" +end type console_type | CONSOLETYPE_XENCONSOLED @@ -179,9 +183,6 @@ external domain_build : build_info -> do external disk_add : disk_info -> domid -> unit = "stub_xl_disk_add" external disk_remove : disk_info -> domid -> unit = "stub_xl_disk_remove" -external nic_add : nic_info -> domid -> unit = "stub_xl_nic_add" -external nic_remove : disk_info -> domid -> unit = "stub_xl_nic_remove" - external console_add : console_info -> build_state -> domid -> unit = "stub_xl_console_add" external vkb_add : vkb_info -> domid -> unit = "stub_xl_vkb_add" diff -r 746e49e61dbc -r 3050abaa45d6 tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 Citrix Ltd. + * Copyright (C) 2009-2011 Citrix Ltd. * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com> * * This program is free software; you can redistribute it and/or modify @@ -397,7 +397,7 @@ value stub_xl_disk_remove(value info, va CAMLreturn(Val_unit); } -value stub_xl_nic_add(value info, value domid) +value stub_xl_device_nic_add(value info, value domid) { CAMLparam2(info, domid); libxl_device_nic c_info; @@ -415,7 +415,7 @@ value stub_xl_nic_add(value info, value CAMLreturn(Val_unit); } -value stub_xl_nic_remove(value info, value domid) +value stub_xl_device_nic_del(value info, value domid) { CAMLparam2(info, domid); libxl_device_nic c_info; @@ -428,7 +428,7 @@ value stub_xl_nic_remove(value info, val INIT_CTX(); ret = libxl_device_nic_del(&ctx, &c_info, 0); if (ret != 0) - failwith_xl("nic_remove", &lg); + failwith_xl("nic_del", &lg); FREE_CTX(); CAMLreturn(Val_unit); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 03 of 14] tools: ocaml: rename the disk_info types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 6ca09bec9c49ccf3b93606fd3f5fd807c9438cc1 # Parent 3050abaa45d6da7edeb8c7f4efd1ae8658740329 tools: ocaml: rename the disk_info types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 3050abaa45d6 -r 6ca09bec9c49 tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -82,16 +82,21 @@ type disk_phystype | PHYSTYPE_FILE | PHYSTYPE_PHY -type disk_info -{ - backend_domid : domid; - physpath : string; - phystype : disk_phystype; - virtpath : string; - unpluggable : bool; - readwrite : bool; - is_cdrom : bool; -} +module Device_disk = struct + type t + { + backend_domid : domid; + physpath : string; + phystype : disk_phystype; + virtpath : string; + unpluggable : bool; + readwrite : bool; + is_cdrom : bool; + } + + external add : t -> domid -> unit = "stub_xl_device_disk_add" + external del : t -> domid -> unit = "stub_xl_device_disk_del" +end type nic_type | NICTYPE_IOEMU @@ -180,9 +185,6 @@ type sched_credit external domain_make : create_info -> domid = "stub_xl_domain_make" external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" -external disk_add : disk_info -> domid -> unit = "stub_xl_disk_add" -external disk_remove : disk_info -> domid -> unit = "stub_xl_disk_remove" - external console_add : console_info -> build_state -> domid -> unit = "stub_xl_console_add" external vkb_add : vkb_info -> domid -> unit = "stub_xl_vkb_add" diff -r 3050abaa45d6 -r 6ca09bec9c49 tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -82,16 +82,21 @@ type disk_phystype | PHYSTYPE_FILE | PHYSTYPE_PHY -type disk_info -{ - backend_domid : domid; - physpath : string; - phystype : disk_phystype; - virtpath : string; - unpluggable : bool; - readwrite : bool; - is_cdrom : bool; -} +module Device_disk : sig + type t + { + backend_domid : domid; + physpath : string; + phystype : disk_phystype; + virtpath : string; + unpluggable : bool; + readwrite : bool; + is_cdrom : bool; + } + + external add : t -> domid -> unit = "stub_xl_device_disk_add" + external del : t -> domid -> unit = "stub_xl_device_disk_del" +end type nic_type | NICTYPE_IOEMU @@ -180,9 +185,6 @@ type sched_credit external domain_make : create_info -> domid = "stub_xl_domain_make" external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" -external disk_add : disk_info -> domid -> unit = "stub_xl_disk_add" -external disk_remove : disk_info -> domid -> unit = "stub_xl_disk_remove" - external console_add : console_info -> build_state -> domid -> unit = "stub_xl_console_add" external vkb_add : vkb_info -> domid -> unit = "stub_xl_vkb_add" diff -r 3050abaa45d6 -r 6ca09bec9c49 tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 @@ -361,7 +361,7 @@ static value Val_physinfo(libxl_physinfo CAMLreturn(v); } -value stub_xl_disk_add(value info, value domid) +value stub_xl_device_disk_add(value info, value domid) { CAMLparam2(info, domid); libxl_device_disk c_info; @@ -379,7 +379,7 @@ value stub_xl_disk_add(value info, value CAMLreturn(Val_unit); } -value stub_xl_disk_remove(value info, value domid) +value stub_xl_device_disk_del(value info, value domid) { CAMLparam2(info, domid); libxl_device_disk c_info; @@ -392,7 +392,7 @@ value stub_xl_disk_remove(value info, va INIT_CTX(); ret = libxl_device_disk_del(&ctx, &c_info, 0); if (ret != 0) - failwith_xl("disk_remove", &lg); + failwith_xl("disk_del", &lg); FREE_CTX(); CAMLreturn(Val_unit); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 04 of 14] tools: ocaml: rename the console types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 6aa054dd7ba1d9bddb06a9499c1f292550f9435b # Parent 6ca09bec9c49ccf3b93606fd3f5fd807c9438cc1 tools: ocaml: rename the console types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 6ca09bec9c49 -r 6aa054dd7ba1 tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -123,12 +123,16 @@ type console_type | CONSOLETYPE_XENCONSOLED | CONSOLETYPE_IOEMU -type console_info -{ - backend_domid : domid; - devid : int; - consoletype : console_type; -} +module Device_console = struct + type t + { + backend_domid : domid; + devid : int; + consoletype : console_type; + } + + external add : t -> build_state -> domid -> unit = "stub_xl_device_console_add" +end type vkb_info { @@ -185,8 +189,6 @@ type sched_credit external domain_make : create_info -> domid = "stub_xl_domain_make" external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" -external console_add : console_info -> build_state -> domid -> unit = "stub_xl_console_add" - external vkb_add : vkb_info -> domid -> unit = "stub_xl_vkb_add" external vkb_clean_shutdown : domid -> unit = "stub_vkb_clean_shutdown" external vkb_hard_shutdown : domid -> unit = "stub_vkb_hard_shutdown" diff -r 6ca09bec9c49 -r 6aa054dd7ba1 tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -123,12 +123,16 @@ type console_type | CONSOLETYPE_XENCONSOLED | CONSOLETYPE_IOEMU -type console_info -{ - backend_domid : domid; - devid : int; - consoletype : console_type; -} +module Device_console : sig + type t + { + backend_domid : domid; + devid : int; + consoletype : console_type; + } + + external add : t -> build_state -> domid -> unit = "stub_xl_device_console_add" +end type vkb_info { @@ -185,8 +189,6 @@ type sched_credit external domain_make : create_info -> domid = "stub_xl_domain_make" external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" -external console_add : console_info -> build_state -> domid -> unit = "stub_xl_console_add" - external vkb_add : vkb_info -> domid -> unit = "stub_xl_vkb_add" external vkb_clean_shutdown : domid -> unit = "stub_vkb_clean_shutdown" external vkb_hard_shutdown : domid -> unit = "stub_vkb_hard_shutdown" diff -r 6ca09bec9c49 -r 6aa054dd7ba1 tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 @@ -433,7 +433,7 @@ value stub_xl_device_nic_del(value info, CAMLreturn(Val_unit); } -value stub_xl_console_add(value info, value state, value domid) +value stub_xl_device_console_add(value info, value state, value domid) { CAMLparam3(info, state, domid); libxl_device_console c_info; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 05 of 14] tools: ocaml: rename the vkb types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID e465e648db5f43d252a10594cbf68b2ee3732fd5 # Parent 6aa054dd7ba1d9bddb06a9499c1f292550f9435b tools: ocaml: rename the vkb types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 6aa054dd7ba1 -r e465e648db5f tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -134,27 +134,39 @@ module Device_console = struct external add : t -> build_state -> domid -> unit = "stub_xl_device_console_add" end -type vkb_info -{ - backend_domid : domid; - devid : int; -} +module Device_vkb = struct + type t + { + backend_domid : domid; + devid : int; + } + + external add : t -> domid -> unit = "stub_xl_device_vkb_add" + external clean_shutdown : domid -> unit = "stub_xl_device_vkb_clean_shutdown" + external hard_shutdown : domid -> unit = "stub_xl_device_vkb_hard_shutdown" +end -type vfb_info -{ - backend_domid : domid; - devid : int; - vnc : bool; - vnclisten : string; - vncpasswd : string; - vncdisplay : int; - vncunused : bool; - keymap : string; - sdl : bool; - opengl : bool; - display : string; - xauthority : string; -} +module Device_vfb = struct + type t + { + backend_domid : domid; + devid : int; + vnc : bool; + vnclisten : string; + vncpasswd : string; + vncdisplay : int; + vncunused : bool; + keymap : string; + sdl : bool; + opengl : bool; + display : string; + xauthority : string; + } + external add : t -> domid -> unit = "stub_xl_device_vfb_add" + external clean_shutdown : domid -> unit = "stub_xl_device_vfb_clean_shutdown" + external hard_shutdown : domid -> unit = "stub_xl_device_vfb_hard_shutdown" +end + type pci_info { @@ -189,14 +201,6 @@ type sched_credit external domain_make : create_info -> domid = "stub_xl_domain_make" external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" -external vkb_add : vkb_info -> domid -> unit = "stub_xl_vkb_add" -external vkb_clean_shutdown : domid -> unit = "stub_vkb_clean_shutdown" -external vkb_hard_shutdown : domid -> unit = "stub_vkb_hard_shutdown" - -external vfb_add : vfb_info -> domid -> unit = "stub_xl_vfb_add" -external vfb_clean_shutdown : domid -> unit = "stub_vfb_clean_shutdown" -external vfb_hard_shutdown : domid -> unit = "stub_vfb_hard_shutdown" - external pci_add : pci_info -> domid -> unit = "stub_xl_pci_add" external pci_remove : pci_info -> domid -> unit = "stub_xl_pci_remove" external pci_shutdown : domid -> unit = "stub_xl_pci_shutdown" diff -r 6aa054dd7ba1 -r e465e648db5f tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -134,27 +134,38 @@ module Device_console : sig external add : t -> build_state -> domid -> unit = "stub_xl_device_console_add" end -type vkb_info -{ - backend_domid : domid; - devid : int; -} +module Device_vkb : sig + type t + { + backend_domid : domid; + devid : int; + } + + external add : t -> domid -> unit = "stub_xl_device_vkb_add" + external clean_shutdown : domid -> unit = "stub_xl_device_vkb_clean_shutdown" + external hard_shutdown : domid -> unit = "stub_xl_device_vkb_hard_shutdown" +end -type vfb_info -{ - backend_domid : domid; - devid : int; - vnc : bool; - vnclisten : string; - vncpasswd : string; - vncdisplay : int; - vncunused : bool; - keymap : string; - sdl : bool; - opengl : bool; - display : string; - xauthority : string; -} +module Device_vfb : sig + type t + { + backend_domid : domid; + devid : int; + vnc : bool; + vnclisten : string; + vncpasswd : string; + vncdisplay : int; + vncunused : bool; + keymap : string; + sdl : bool; + opengl : bool; + display : string; + xauthority : string; + } + external add : t -> domid -> unit = "stub_xl_device_vfb_add" + external clean_shutdown : domid -> unit = "stub_xl_device_vfb_clean_shutdown" + external hard_shutdown : domid -> unit = "stub_xl_device_vfb_hard_shutdown" +end type pci_info { @@ -189,14 +200,6 @@ type sched_credit external domain_make : create_info -> domid = "stub_xl_domain_make" external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" -external vkb_add : vkb_info -> domid -> unit = "stub_xl_vkb_add" -external vkb_clean_shutdown : domid -> unit = "stub_vkb_clean_shutdown" -external vkb_hard_shutdown : domid -> unit = "stub_vkb_hard_shutdown" - -external vfb_add : vfb_info -> domid -> unit = "stub_xl_vfb_add" -external vfb_clean_shutdown : domid -> unit = "stub_vfb_clean_shutdown" -external vfb_hard_shutdown : domid -> unit = "stub_vfb_hard_shutdown" - external pci_add : pci_info -> domid -> unit = "stub_xl_pci_add" external pci_remove : pci_info -> domid -> unit = "stub_xl_pci_remove" external pci_shutdown : domid -> unit = "stub_xl_pci_shutdown" diff -r 6aa054dd7ba1 -r e465e648db5f tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 @@ -454,7 +454,7 @@ value stub_xl_device_console_add(value i CAMLreturn(Val_unit); } -value stub_xl_vkb_add(value info, value domid) +value stub_xl_device_vkb_add(value info, value domid) { CAMLparam2(info, domid); libxl_device_vkb c_info; @@ -473,7 +473,7 @@ value stub_xl_vkb_add(value info, value CAMLreturn(Val_unit); } -value stub_xl_vkb_clean_shutdown(value domid) +value stub_xl_device_vkb_clean_shutdown(value domid) { CAMLparam1(domid); int ret; @@ -488,7 +488,7 @@ value stub_xl_vkb_clean_shutdown(value d CAMLreturn(Val_unit); } -value stub_xl_vkb_hard_shutdown(value domid) +value stub_xl_device_vkb_hard_shutdown(value domid) { CAMLparam1(domid); int ret; @@ -503,7 +503,7 @@ value stub_xl_vkb_hard_shutdown(value do CAMLreturn(Val_unit); } -value stub_xl_vfb_add(value info, value domid) +value stub_xl_device_vfb_add(value info, value domid) { CAMLparam2(info, domid); libxl_device_vfb c_info; @@ -522,7 +522,7 @@ value stub_xl_vfb_add(value info, value CAMLreturn(Val_unit); } -value stub_xl_vfb_clean_shutdown(value domid) +value stub_xl_device_vfb_clean_shutdown(value domid) { CAMLparam1(domid); int ret; @@ -537,7 +537,7 @@ value stub_xl_vfb_clean_shutdown(value d CAMLreturn(Val_unit); } -value stub_xl_vfb_hard_shutdown(value domid) +value stub_xl_device_vfb_hard_shutdown(value domid) { CAMLparam1(domid); int ret; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 06 of 14] tools: ocaml: rename the pci types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 139bf305233c45c02d1b64143dc135c78e16076f # Parent e465e648db5f43d252a10594cbf68b2ee3732fd5 tools: ocaml: rename the pci types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r e465e648db5f -r 139bf305233c tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -167,15 +167,20 @@ module Device_vfb = struct external hard_shutdown : domid -> unit = "stub_xl_device_vfb_hard_shutdown" end +module Device_pci = struct + type t + { + v : int; (* domain * bus * dev * func multiplexed *) + domain : int; + vdevfn : int; + msitranslate : bool; + power_mgmt : bool; + } -type pci_info -{ - v : int; (* domain * bus * dev * func multiplexed *) - domain : int; - vdevfn : int; - msitranslate : bool; - power_mgmt : bool; -} + external add : t -> domid -> unit = "stub_xl_device_pci_add" + external remove : t -> domid -> unit = "stub_xl_device_pci_remove" + external shutdown : domid -> unit = "stub_xl_device_pci_shutdown" +end type physinfo { @@ -201,10 +206,6 @@ type sched_credit external domain_make : create_info -> domid = "stub_xl_domain_make" external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" -external pci_add : pci_info -> domid -> unit = "stub_xl_pci_add" -external pci_remove : pci_info -> domid -> unit = "stub_xl_pci_remove" -external pci_shutdown : domid -> unit = "stub_xl_pci_shutdown" - type button | Button_Power | Button_Sleep diff -r e465e648db5f -r 139bf305233c tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -167,14 +167,20 @@ module Device_vfb : sig external hard_shutdown : domid -> unit = "stub_xl_device_vfb_hard_shutdown" end -type pci_info -{ - v : int; (* domain * bus * dev * func multiplexed *) - domain : int; - vdevfn : int; - msitranslate : bool; - power_mgmt : bool; -} +module Device_pci : sig + type t + { + v : int; (* domain * bus * dev * func multiplexed *) + domain : int; + vdevfn : int; + msitranslate : bool; + power_mgmt : bool; + } + + external add : t -> domid -> unit = "stub_xl_device_pci_add" + external remove : t -> domid -> unit = "stub_xl_device_pci_remove" + external shutdown : domid -> unit = "stub_xl_device_pci_shutdown" +end type physinfo { @@ -200,10 +206,6 @@ type sched_credit external domain_make : create_info -> domid = "stub_xl_domain_make" external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" -external pci_add : pci_info -> domid -> unit = "stub_xl_pci_add" -external pci_remove : pci_info -> domid -> unit = "stub_xl_pci_remove" -external pci_shutdown : domid -> unit = "stub_xl_pci_shutdown" - type button | Button_Power | Button_Sleep diff -r e465e648db5f -r 139bf305233c tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 @@ -552,7 +552,7 @@ value stub_xl_device_vfb_hard_shutdown(v CAMLreturn(Val_unit); } -value stub_xl_pci_add(value info, value domid) +value stub_xl_device_pci_add(value info, value domid) { CAMLparam2(info, domid); libxl_device_pci c_info; @@ -570,7 +570,7 @@ value stub_xl_pci_add(value info, value CAMLreturn(Val_unit); } -value stub_xl_pci_remove(value info, value domid) +value stub_xl_device_pci_remove(value info, value domid) { CAMLparam2(info, domid); libxl_device_pci c_info; @@ -588,7 +588,7 @@ value stub_xl_pci_remove(value info, val CAMLreturn(Val_unit); } -value stub_xl_pci_shutdown(value domid) +value stub_xl_device_pci_shutdown(value domid) { CAMLparam1(domid); int ret; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 07 of 14] tools: ocaml: remove the domain_make and domain_build functions since they don''t work
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 9cbc18430c281c6082381f67dc1ee739564f20d0 # Parent 139bf305233c45c02d1b64143dc135c78e16076f tools: ocaml: remove the domain_make and domain_build functions since they don''t work The actual stubs are missing so these are currently a trap for the unwary. Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 139bf305233c -r 9cbc18430c28 tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -203,9 +203,6 @@ type sched_credit cap: int; } -external domain_make : create_info -> domid = "stub_xl_domain_make" -external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" - type button | Button_Power | Button_Sleep diff -r 139bf305233c -r 9cbc18430c28 tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -203,9 +203,6 @@ type sched_credit cap: int; } -external domain_make : create_info -> domid = "stub_xl_domain_make" -external domain_build : build_info -> domid -> build_state = "stub_xl_domain_build" - type button | Button_Power | Button_Sleep _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 08 of 14] tools: ocaml: rename the create_info types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 8ca5df5a9e813a783bc89226f902cd37a73ba09d # Parent 9cbc18430c281c6082381f67dc1ee739564f20d0 tools: ocaml: rename the create_info types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 9cbc18430c28 -r 8ca5df5a9e81 tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -15,19 +15,21 @@ exception Error of string -type create_info -{ - hvm : bool; - hap : bool; - oos : bool; - ssidref : int32; - name : string; - uuid : int array; - xsdata : (string * string) list; - platformdata : (string * string) list; - poolid : int32; - poolname : string; -} +module Domain_create_info = struct + type t + { + hvm : bool; + hap : bool; + oos : bool; + ssidref : int32; + name : string; + uuid : int array; + xsdata : (string * string) list; + platformdata : (string * string) list; + poolid : int32; + poolname : string; + } +end type build_pv_info { diff -r 9cbc18430c28 -r 8ca5df5a9e81 tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -15,19 +15,21 @@ exception Error of string -type create_info -{ - hvm : bool; - hap : bool; - oos : bool; - ssidref : int32; - name : string; - uuid : int array; - xsdata : (string * string) list; - platformdata : (string * string) list; - poolid : int32; - poolname : string; -} +module Domain_create_info : sig + type t + { + hvm : bool; + hap : bool; + oos : bool; + ssidref : int32; + name : string; + uuid : int array; + xsdata : (string * string) list; + platformdata : (string * string) list; + poolid : int32; + poolname : string; + } +end type build_pv_info { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 09 of 14] tools: ocaml: rename the build_info types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 3ca2e83310a56de7a025b2f2c50426a3b40598e4 # Parent 8ca5df5a9e813a783bc89226f902cd37a73ba09d tools: ocaml: rename the build_info types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 8ca5df5a9e81 -r 3ca2e83310a5 tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -31,40 +31,44 @@ module Domain_create_info = struct } end -type build_pv_info -{ - slack_memkb : int64; - cmdline : string; - ramdisk : string; - features : string; -} +module Domain_build_info = struct + module Hvm = struct + type t + { + pae : bool; + apic : bool; + acpi : bool; + nx : bool; + viridian : bool; + timeoffset : string; + timer_mode : int; + hpet : int; + vpt_align : int; + } + end -type build_hvm_info -{ - pae : bool; - apic : bool; - acpi : bool; - nx : bool; - viridian : bool; - timeoffset : string; - timer_mode : int; - hpet : int; - vpt_align : int; -} + module Pv = struct + type t + { + slack_memkb : int64; + cmdline : string; + ramdisk : string; + features : string; + } + end -type build_spec = BuildHVM of build_hvm_info | BuildPV of build_pv_info - -type build_info -{ - max_vcpus : int; - cur_vcpus : int; - max_memkb : int64; - target_memkb : int64; - video_memkb : int64; - shadow_memkb : int64; - kernel : string; - priv: build_spec; -} + type t + { + max_vcpus : int; + cur_vcpus : int; + max_memkb : int64; + target_memkb : int64; + video_memkb : int64; + shadow_memkb : int64; + kernel : string; + u : [ `HVM of Hvm.t | `PV of Pv.t ]; + } +end type build_state { diff -r 8ca5df5a9e81 -r 3ca2e83310a5 tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -31,40 +31,44 @@ module Domain_create_info : sig } end -type build_pv_info -{ - slack_memkb : int64; - cmdline : string; - ramdisk : string; - features : string; -} +module Domain_build_info : sig + module Hvm : sig + type t + { + pae : bool; + apic : bool; + acpi : bool; + nx : bool; + viridian : bool; + timeoffset : string; + timer_mode : int; + hpet : int; + vpt_align : int; + } + end -type build_hvm_info -{ - pae : bool; - apic : bool; - acpi : bool; - nx : bool; - viridian : bool; - timeoffset : string; - timer_mode : int; - hpet : int; - vpt_align : int; -} + module Pv : sig + type t + { + slack_memkb : int64; + cmdline : string; + ramdisk : string; + features : string; + } + end -type build_spec = BuildHVM of build_hvm_info | BuildPV of build_pv_info - -type build_info -{ - max_vcpus : int; - cur_vcpus : int; - max_memkb : int64; - target_memkb : int64; - video_memkb : int64; - shadow_memkb : int64; - kernel : string; - priv: build_spec; -} + type t + { + max_vcpus : int; + cur_vcpus : int; + max_memkb : int64; + target_memkb : int64; + video_memkb : int64; + shadow_memkb : int64; + kernel : string; + u : [ `HVM of Hvm.t | `PV of Pv.t ]; + } +end type build_state { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 10 of 14] tools: ocaml: rename the device_build_state types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 976842c93bd399493c13ce71f4d9321fe2b2ffae # Parent 3ca2e83310a56de7a025b2f2c50426a3b40598e4 tools: ocaml: rename the device_build_state types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 3ca2e83310a5 -r 976842c93bd3 tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -70,13 +70,15 @@ module Domain_build_info = struct } end -type build_state -{ - store_port : int; - store_mfn : int64; - console_port : int; - console_mfn : int64; -} +module Device_build_state = struct + type t + { + store_port : int; + store_mfn : int64; + console_port : int; + console_mfn : int64; + } +end type domid = int @@ -137,7 +139,7 @@ module Device_console = struct consoletype : console_type; } - external add : t -> build_state -> domid -> unit = "stub_xl_device_console_add" + external add : t -> Device_build_state.t -> domid -> unit = "stub_xl_device_console_add" end module Device_vkb = struct diff -r 3ca2e83310a5 -r 976842c93bd3 tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -70,13 +70,15 @@ module Domain_build_info : sig } end -type build_state -{ - store_port : int; - store_mfn : int64; - console_port : int; - console_mfn : int64; -} +module Device_build_state : sig + type t + { + store_port : int; + store_mfn : int64; + console_port : int; + console_mfn : int64; + } +end type domid = int @@ -137,7 +139,7 @@ module Device_console : sig consoletype : console_type; } - external add : t -> build_state -> domid -> unit = "stub_xl_device_console_add" + external add : t -> Device_build_state.t -> domid -> unit = "stub_xl_device_console_add" end module Device_vkb : sig _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 11 of 14] tools: ocaml: rename the physinfo types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID b8aa09368adbc3863d7ed1e008c5bffb15e3ae4c # Parent 976842c93bd399493c13ce71f4d9321fe2b2ffae tools: ocaml: rename the physinfo types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 976842c93bd3 -r b8aa09368adb tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -190,20 +190,24 @@ module Device_pci = struct external shutdown : domid -> unit = "stub_xl_device_pci_shutdown" end -type physinfo -{ - threads_per_core: int; - cores_per_socket: int; - max_cpu_id: int; - nr_cpus: int; - cpu_khz: int; - total_pages: int64; - free_pages: int64; - scrub_pages: int64; - nr_nodes: int; - hwcap: int32 array; - physcap: int32; -} +module Physinfo = struct + type t + { + threads_per_core: int; + cores_per_socket: int; + max_cpu_id: int; + nr_cpus: int; + cpu_khz: int; + total_pages: int64; + free_pages: int64; + scrub_pages: int64; + nr_nodes: int; + hwcap: int32 array; + physcap: int32; + } + external get : unit -> t = "stub_xl_physinfo" + +end type sched_credit { @@ -216,7 +220,6 @@ type button | Button_Sleep external button_press : domid -> button -> unit = "stub_xl_button_press" -external physinfo : unit -> physinfo = "stub_xl_physinfo" external domain_sched_credit_get : domid -> sched_credit = "stub_xl_sched_credit_domain_get" external domain_sched_credit_set : domid -> sched_credit -> unit = "stub_xl_sched_credit_domain_set" diff -r 976842c93bd3 -r b8aa09368adb tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -190,20 +190,24 @@ module Device_pci : sig external shutdown : domid -> unit = "stub_xl_device_pci_shutdown" end -type physinfo -{ - threads_per_core: int; - cores_per_socket: int; - max_cpu_id: int; - nr_cpus: int; - cpu_khz: int; - total_pages: int64; - free_pages: int64; - scrub_pages: int64; - nr_nodes: int; - hwcap: int32 array; - physcap: int32; -} +module Physinfo : sig + type t + { + threads_per_core: int; + cores_per_socket: int; + max_cpu_id: int; + nr_cpus: int; + cpu_khz: int; + total_pages: int64; + free_pages: int64; + scrub_pages: int64; + nr_nodes: int; + hwcap: int32 array; + physcap: int32; + } + external get : unit -> t = "stub_xl_physinfo" + +end type sched_credit { @@ -216,7 +220,6 @@ type button | Button_Sleep external button_press : domid -> button -> unit = "stub_xl_button_press" -external physinfo : unit -> physinfo = "stub_xl_physinfo" external domain_sched_credit_get : domid -> sched_credit = "stub_xl_sched_credit_domain_get" external domain_sched_credit_set : domid -> sched_credit -> unit = "stub_xl_sched_credit_domain_set" _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 12 of 14] tools: ocaml: rename the sched_credit types and functions
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 62443233adf0d2319da50210057041380d7bd07f # Parent b8aa09368adbc3863d7ed1e008c5bffb15e3ae4c tools: ocaml: rename the sched_credit types and functions The aims are: 1. make the records instantiable if they have field names in common; and 2. to make it easier to derive the names programatically from the IDL Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r b8aa09368adb -r 62443233adf0 tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -209,11 +209,15 @@ module Physinfo = struct end -type sched_credit -{ - weight: int; - cap: int; -} +module Sched_credit = struct + type t + { + weight: int; + cap: int; + } + external domain_get : domid -> t = "stub_xl_sched_credit_domain_get" + external domain_set : domid -> t -> unit = "stub_xl_sched_credit_domain_set" +end type button | Button_Power @@ -221,9 +225,6 @@ type button external button_press : domid -> button -> unit = "stub_xl_button_press" -external domain_sched_credit_get : domid -> sched_credit = "stub_xl_sched_credit_domain_get" -external domain_sched_credit_set : domid -> sched_credit -> unit = "stub_xl_sched_credit_domain_set" - external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger" external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq" external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys" diff -r b8aa09368adb -r 62443233adf0 tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -209,11 +209,16 @@ module Physinfo : sig end -type sched_credit -{ - weight: int; - cap: int; -} +module Sched_credit : sig + type t + { + weight: int; + cap: int; + } + + external domain_get : domid -> t = "stub_xl_sched_credit_domain_get" + external domain_set : domid -> t -> unit = "stub_xl_sched_credit_domain_set" +end type button | Button_Power @@ -221,9 +226,6 @@ type button external button_press : domid -> button -> unit = "stub_xl_button_press" -external domain_sched_credit_get : domid -> sched_credit = "stub_xl_sched_credit_domain_get" -external domain_sched_credit_set : domid -> sched_credit -> unit = "stub_xl_sched_credit_domain_set" - external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger" external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq" external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys" _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 13 of 14] libxl: add NIC QoS parameters
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 2501899ab12fcc128ac62b0319b7a6f0b8982a42 # Parent 62443233adf0d2319da50210057041380d7bd07f libxl: add NIC QoS parameters The parameters are: qos_kb_per_sec: maximum rate in KiB/sec qos_timeslice_usec: time period over which the average rate is enforced in usec One can now execute commands like xl network-attach ... rate=1024,50000 which should impose an average limit of 1MiB/sec, over intervals of 50ms The "rate" key in the network backend is interpreted by netback. It wants: bytes_per_interval, interval_length Signed-off-by: David Scott <dave.scott@eu.citrix.com> diff -r 62443233adf0 -r 2501899ab12f tools/libxl/libxl.c --- a/tools/libxl/libxl.c Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/libxl/libxl.c Wed Mar 30 18:54:28 2011 +0100 @@ -1194,6 +1194,8 @@ int libxl_device_nic_init(libxl_device_n libxl_xen_script_dir_path()) < 0 ) return ERROR_FAIL; nic_info->nictype = NICTYPE_IOEMU; + nic_info->qos_kb_per_sec = 0; + nic_info->qos_timeslice_usec = 0; return 0; } @@ -1205,6 +1207,7 @@ int libxl_device_nic_add(libxl_ctx *ctx, libxl__device device; char *dompath, **l; unsigned int nb, rc; + uint32_t bytes_per_interval; front = flexarray_make(16, 1); if (!front) { @@ -1263,6 +1266,14 @@ int libxl_device_nic_add(libxl_ctx *ctx, flexarray_append(back, libxl__strdup(&gc, nic->bridge)); flexarray_append(back, "handle"); flexarray_append(back, libxl__sprintf(&gc, "%d", nic->devid)); + if (nic->qos_timeslice_usec > 0) { + bytes_per_interval = (uint32_t) + (((uint64_t)nic->qos_kb_per_sec * 1024L * + (uint64_t)nic->qos_timeslice_usec) / 1000000L); + flexarray_append(back, "rate"); + flexarray_append(back, libxl__sprintf(&gc, "%u,%u", + bytes_per_interval, nic->qos_timeslice_usec)); + } flexarray_append(front, "backend-id"); flexarray_append(front, libxl__sprintf(&gc, "%d", nic->backend_domid)); diff -r 62443233adf0 -r 2501899ab12f tools/libxl/libxl.idl --- a/tools/libxl/libxl.idl Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/libxl/libxl.idl Wed Mar 30 18:54:28 2011 +0100 @@ -225,6 +225,8 @@ libxl_device_nic = Struct("device_nic", ("ifname", string), ("script", string), ("nictype", libxl_nic_type), + ("qos_kb_per_sec", uint32, False, "maximum rate in KiB/sec"), + ("qos_timeslice_usec", uint32, False, "time period over which the rate is enforced in usec"), ]) libxl_device_net2 = Struct("device_net2", [ diff -r 62443233adf0 -r 2501899ab12f tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Wed Mar 30 18:54:28 2011 +0100 @@ -880,7 +880,10 @@ static void parse_config_data(const char nic->backend_domid = 0; } } else if (!strcmp(p, "rate")) { - fprintf(stderr, "the rate parameter for vifs is currently not supported\n"); + if (sscanf(p2 + 1, "%"PRIu32",%"PRIu32, &(nic->qos_kb_per_sec), &(nic->qos_timeslice_usec)) != 2) { + fprintf(stderr, "Specified rate parameter needs to take the form: kb_per_sec,timeslice_usec\n"); + break; + } } else if (!strcmp(p, "accel")) { fprintf(stderr, "the accel parameter for vifs is currently not supported\n"); } @@ -4298,6 +4301,10 @@ int main_networkattach(int argc, char ** free(nic.model); nic.model = strdup((*argv) + 6); } else if (!strncmp("rate=", *argv, 5)) { + if (sscanf((*argv) + 5, "%u,%u", &(nic.qos_kb_per_sec), &(nic.qos_timeslice_usec)) != 2) { + fprintf(stderr, "Specified rate parameter needs to take the form: kb_per_sec,timeslice_usec\n"); + return 1; + } } else if (!strncmp("accel=", *argv, 6)) { } else { fprintf(stderr, "unrecognized argument `%s''\n", *argv); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
David Scott
2011-Mar-30 18:05 UTC
[Xen-devel] [PATCH 14 of 14] tools: ocaml: add NIC QoS parameters to the ocaml libxl interface
# HG changeset patch # User David Scott <dave.scott@eu.citrix.com> # Date 1301507668 -3600 # Node ID 852635d6df5cc507361e5a608a4953dd1eb98b0c # Parent 2501899ab12fcc128ac62b0319b7a6f0b8982a42 tools: ocaml: add NIC QoS parameters to the ocaml libxl interface Signed-off-by: David Scott <dave.scott@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> diff -r 2501899ab12f -r 852635d6df5c tools/ocaml/libs/xl/xl.ml --- a/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.ml Wed Mar 30 18:54:28 2011 +0100 @@ -122,6 +122,8 @@ module Device_nic = struct ifname : string; script : string; nictype : nic_type; + qos_kb_per_sec : int32; + qos_timeslice_usec : int32; } external add : t -> domid -> unit = "stub_xl_device_nic_add" external del : t -> domid -> unit = "stub_xl_device_nic_del" diff -r 2501899ab12f -r 852635d6df5c tools/ocaml/libs/xl/xl.mli --- a/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl.mli Wed Mar 30 18:54:28 2011 +0100 @@ -122,6 +122,8 @@ module Device_nic : sig ifname : string; script : string; nictype : nic_type; + qos_kb_per_sec : int32; + qos_timeslice_usec : int32; } external add : t -> domid -> unit = "stub_xl_device_nic_add" external del : t -> domid -> unit = "stub_xl_device_nic_del" diff -r 2501899ab12f -r 852635d6df5c tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Wed Mar 30 18:54:28 2011 +0100 @@ -225,7 +225,8 @@ static int device_nic_val(caml_gc *gc, l c_val->ifname = dup_String_val(gc, Field(v, 6)); c_val->script = dup_String_val(gc, Field(v, 7)); c_val->nictype = (Int_val(Field(v, 8))) + NICTYPE_IOEMU; - + c_val->qos_kb_per_sec = (Int_val(Field(v, 9))); + c_val->qos_timeslice_usec = (Int_val(Field(v, 10))); out: CAMLreturn(ret); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-31 08:36 UTC
Re: [Xen-devel] [PATCH 00 of 14] Improvements to libxl VIF hotplug and ocaml bindings (v2)
On Wed, 2011-03-30 at 19:05 +0100, Dave Scott wrote:> Improvements to libxl VIF hotplug/unplug and ocaml bindings; xapi can now use these functions > > This patch set includes: > 1. addition of VIF QoS parameters to libxl (this code is ported from xapi/ > xenops) > 2. updates to the libxl ocaml bindings to make them more usable and more > easily generatable from the IDL > 3. bugfixes to the "xl network-attach" command so the QoS settings can be > more easily tested. > > FYI the corresponding xapi changes are in a branch here: > > https://github.com/djs55/xen-api/tree/hackathonNot up to date with the latest API changes? I''m just curious how this ends up looking on the user side. I already acked 1 and 14/14. 2-12/14 all seem pretty mechanical. I suspect I will need to tweak things as I autogenerate things (esp. the build info tagged union stuff) but lets cross that bridge when we get there. On that basis 2-12 are all: Acked-by: Ian Campbell <ian.campbell@citrix.com> 14/14 I already acked so that just leaves 13/14 -- see you over there in a moment ;-) Thanks.> Changes since the last submission include: > * updating the whole ocaml xl module to use the new style for consistency > * some dead ocaml functions were removed > * documentation for the QoS parameters added to the libxl IDL > * the QoS parameter was renamed to have "kb" rather than "kib" for consistency > > Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx> > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-31 09:13 UTC
Re: [Xen-devel] [PATCH 13 of 14] libxl: add NIC QoS parameters
On Wed, 2011-03-30 at 19:05 +0100, Dave Scott wrote:> diff -r 62443233adf0 -r 2501899ab12f tools/libxl/xl_cmdimpl.c > --- a/tools/libxl/xl_cmdimpl.c Wed Mar 30 18:54:28 2011 +0100 > +++ b/tools/libxl/xl_cmdimpl.c Wed Mar 30 18:54:28 2011 +0100 > @@ -880,7 +880,10 @@ static void parse_config_data(const char > nic->backend_domid = 0; > } > } else if (!strcmp(p, "rate")) { > - fprintf(stderr, "the rate parameter for vifs is currently not supported\n"); > + if (sscanf(p2 + 1, "%"PRIu32",%"PRIu32, &(nic->qos_kb_per_sec), &(nic->qos_timeslice_usec)) != 2) { > + fprintf(stderr, "Specified rate parameter needs to take the form: kb_per_sec,timeslice_usec\n"); > + break; > + }The xend equivalent to the xl function is tools/python/xen/xend/server/netif.py parseRate() which seems to support a different syntax to xapi: rate_re = re.compile("^([0-9]+)([GMK]?)([Bb])/s(@([0-9]+)([mu]?)s)?$") The xend syntax seems to be e.g. 1Mb/s@1ms. I don''t know how widely used the full power of this syntax is but our general principal thus far has been to retain compatibility with xm where we can. Since the xend syntax allows for b/Mb/Kb suffixes and therefore byte granularity that suggests the base unit for qos_kb_per_sec should actually be bytes. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Mar-31 18:19 UTC
Re: [Xen-devel] [PATCH 01 of 14] libxl: fix memory management in "xl network-attach"
David Scott writes ("[Xen-devel] [PATCH 01 of 14] libxl: fix memory management in "xl network-attach""):> libxl: fix memory management in "xl network-attach"Applied, thanks all. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel