Skip to content

Commit ff63a08

Browse files
committed
Xen 4.1: Adjust for minor differences in upstream xc bindings
Signed-off-by: Ian Campbell <[email protected]> Signed-off-by: Zheng Li <[email protected]>
1 parent 7a408f7 commit ff63a08

File tree

11 files changed

+38
-26
lines changed

11 files changed

+38
-26
lines changed

ocaml/xenops/balloon.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let _low_mem_balloon = "Low-mem balloon"
2626
let _high_mem_balloon = "High-mem balloon"
2727

2828
(** Indicates whether or not we're running with XIU (Xen-In Userspace) *)
29-
let on_xiu () = Xc.using_injection ()
29+
let on_xiu () = Xc.is_fake ()
3030

3131
(** Reads /proc/xen/balloon into a string * int64 option association list *)
3232
let parse_proc_xen_balloon () =

ocaml/xenops/device.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,8 @@ let add ~xs ~devid ~netty ~mac ~carrier ?mtu ?(rate=None) ?(protocol=Protocol_Na
745745
let extra_private_keys = extra_private_keys @
746746
(match mtu with | Some mtu when mtu > 0 -> [ "MTU", string_of_int mtu ] | _ -> []) @
747747
(match netty with
748-
| Netman.Bridge b -> [ "bridge", b; "bridge-MAC", if(Xc.using_injection ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
749-
| Netman.Vswitch b -> [ "bridge", b; "bridge-MAC", if(Xc.using_injection ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
748+
| Netman.Bridge b -> [ "bridge", b; "bridge-MAC", if(Xc.is_fake ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
749+
| Netman.Vswitch b -> [ "bridge", b; "bridge-MAC", if(Xc.is_fake ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff"; ]
750750
| Netman.DriverDomain -> []
751751
| Netman.Nat -> []) @
752752
(match rate with | None -> [] | Some(rate, timeslice) -> [ "rate", Int64.to_string rate; "timeslice", Int64.to_string timeslice ]) in

ocaml/xenops/domain.ml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ let trigger_power ~xc domid = Xc.domain_trigger_power xc domid
829829
let trigger_sleep ~xc domid = Xc.domain_trigger_sleep xc domid
830830
831831
let vcpu_affinity_set ~xc domid vcpu cpumap =
832+
(*
832833
let bitmap = ref Int64.zero in
833834
if Array.length cpumap > 64 then
834835
invalid_arg "affinity_set";
@@ -838,16 +839,22 @@ let vcpu_affinity_set ~xc domid vcpu cpumap =
838839
Array.iteri (fun i has_affinity ->
839840
if has_affinity then bitmap := bit_set !bitmap i
840841
) cpumap;
841-
Xc.vcpu_affinity_set xc domid vcpu !bitmap
842+
(*Xc.vcpu_affinity_set xc domid vcpu !bitmap*)
843+
*)
844+
Xc.vcpu_affinity_set xc domid vcpu cpumap
845+
842846
843847
let vcpu_affinity_get ~xc domid vcpu =
848+
(*
844849
let pcpus = (Xc.physinfo xc).Xc.max_nr_cpus in
845850
(* NB we ignore bits corresponding to pCPUs which we don't have *)
846851
let bitmap = Xc.vcpu_affinity_get xc domid vcpu in
847852
let bit_isset bitmap n =
848853
(Int64.logand bitmap (Int64.shift_left 1L n)) > 0L in
849854
let cpumap = Array.of_list (List.map (bit_isset bitmap) (List.range 0 pcpus)) in
850855
cpumap
856+
*)
857+
Xc.vcpu_affinity_get xc domid vcpu
851858
852859
let get_uuid ~xc domid =
853860
Uuid.uuid_of_int_array (Xc.domain_getinfo xc domid).Xc.handle
@@ -962,19 +969,20 @@ let cpuid_set ~xc ~hvm domid cfg =
962969
let tmp = Array.create 4 None in
963970
let cfgout = List.map (fun (node, constr) ->
964971
cpuid_cfg_to_xc_cpuid_cfg tmp constr;
965-
let ret = Xc.domain_cpuid_set xc domid hvm node tmp in
972+
let ret = Xc.domain_cpuid_set xc domid (*hvm*) node tmp in
966973
let ret = cpuid_cfg_of_xc_cpuid_cfg ret in
967974
(node, ret)
968975
) cfg in
969976
cfgout
970977
971978
let cpuid_apply ~xc ~hvm domid =
972-
Xc.domain_cpuid_apply xc domid hvm
979+
(*Xc.domain_cpuid_apply xc domid hvm*)
980+
Xc.domain_cpuid_apply_policy xc domid
973981
974-
let cpuid_check cfg =
982+
let cpuid_check ~xc cfg =
975983
let tmp = Array.create 4 None in
976984
List.map (fun (node, constr) ->
977985
cpuid_cfg_to_xc_cpuid_cfg tmp constr;
978-
let (success, cfgout) = Xc.cpuid_check node tmp in
986+
let (success, cfgout) = Xc.cpuid_check xc node tmp in
979987
(success, (node, (cpuid_cfg_of_xc_cpuid_cfg cfgout)))
980988
) cfg

ocaml/xenops/domain.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,4 @@ val cpuid_rtype_of_char : char -> cpuid_rtype
206206

207207
val cpuid_set : xc: Xc.handle -> hvm: bool -> domid -> cpuid_config -> cpuid_config
208208
val cpuid_apply : xc: Xc.handle -> hvm: bool -> domid -> unit
209-
val cpuid_check : cpuid_config -> (bool * ((int64 * int64 option) * (cpuid_reg * cpuid_rtype array) list)) list
209+
val cpuid_check : xc: Xc.handle -> cpuid_config -> (bool * ((int64 * int64 option) * (cpuid_reg * cpuid_rtype array) list)) list

ocaml/xenops/netman.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let online vif netty =
2727
Netdev.Link.arp dev false;
2828
Netdev.Link.multicast dev false;
2929
Netdev.Link.set_addr dev
30-
(if(Xc.using_injection ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff");
30+
(if(Xc.is_fake ()) then "fe:fe:fe:fe:fe:fe" else "fe:ff:ff:ff:ff:ff");
3131
Netdev.Addr.flush dev
3232
in
3333
match netty with

ocaml/xenops/xenguestHelper.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let connect (args: string list) (fds: (string * Unix.file_descr) list) : t =
4141
(* Need to send commands and receive responses from the
4242
slave process *)
4343

44-
let using_xiu = Xc.using_injection () in
44+
let using_xiu = Xc.is_fake () in
4545

4646
let last_log_file = "/tmp/xenguest.log" in
4747
(try Unix.unlink last_log_file with _ -> ());

ocaml/xenstored/event.ml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
*)
1414
(**************** high level binding ****************)
1515
type t = {
16-
fd: Unix.file_descr;
16+
handle: Eventchn.handle;
1717
mutable virq_port: int;
1818
}
1919

20-
let init () = { fd = Eventchn.init (); virq_port = -1; }
21-
let bind_virq eventchn = eventchn.virq_port <- Eventchn.bind_virq eventchn.fd
22-
let bind_interdomain eventchn domid port = Eventchn.bind_interdomain eventchn.fd domid port
23-
let unbind eventchn port = Eventchn.unbind eventchn.fd port
24-
let notify eventchn port = Eventchn.notify eventchn.fd port
25-
let read_port eventchn = Eventchn.read_port eventchn.fd
26-
let write_port eventchn port = Eventchn.write_port eventchn.fd port
20+
let init () = { handle = Eventchn.init (); virq_port = -1; }
21+
let fd eventchn = Eventchn.fd eventchn.handle
22+
let bind_dom_exc_virq eventchn = eventchn.virq_port <- Eventchn.bind_dom_exc_virq eventchn.handle
23+
let bind_interdomain eventchn domid port = Eventchn.bind_interdomain eventchn.handle domid port
24+
let unbind eventchn port = Eventchn.unbind eventchn.handle port
25+
let notify eventchn port = Eventchn.notify eventchn.handle port
26+
let pending eventchn = Eventchn.pending eventchn.handle
27+
let unmask eventchn port = Eventchn.unmask eventchn.handle port

ocaml/xenstored/xenstored.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ let _ =
249249

250250
if cf.restart then (
251251
DB.from_file store domains cons "/var/run/xenstored/db";
252-
Event.bind_virq eventchn
252+
Event.bind_dom_exc_virq eventchn
253253
) else (
254254
if !Disk.enable then (
255255
info "reading store from disk";
@@ -261,9 +261,9 @@ let _ =
261261
Store.mkdir store (Perms.Connection.create 0) localpath;
262262

263263
if cf.domain_init then (
264-
let usingxiu = Xc.using_injection () in
264+
let usingxiu = Xc.is_fake () in
265265
Connections.add_domain cons (Domains.create0 usingxiu domains);
266-
Event.bind_virq eventchn
266+
Event.bind_dom_exc_virq eventchn
267267
);
268268
);
269269

@@ -275,7 +275,7 @@ let _ =
275275
Logging.init cf.activate_access_log (fun () -> DB.to_file store cons "/var/run/xenstored/db");
276276

277277
let spec_fds = [ rw_sock; ro_sock ] @
278-
(if cf.domain_init then [ eventchn.Event.fd ] else []) in
278+
(if cf.domain_init then [ Event.fd eventchn ] else []) in
279279

280280
let xc = Xc.interface_open () in
281281

@@ -285,22 +285,22 @@ let _ =
285285
debug "new connection through socket";
286286
Connections.add_anonymous cons cfd can_write
287287
and handle_eventchn fd =
288-
let port = Event.read_port eventchn in
288+
let port = Event.pending eventchn in
289289
finally (fun () ->
290290
if port = eventchn.Event.virq_port then (
291291
let (notify, deaddom) = Domains.cleanup xc domains in
292292
List.iter (Connections.del_domain cons) deaddom;
293293
if deaddom <> [] || notify then
294294
Connections.fire_spec_watches cons "@releaseDomain"
295295
)
296-
) (fun () -> Event.write_port eventchn port);
296+
) (fun () -> Event.unmask eventchn port);
297297
and do_if_set fd set fct =
298298
if List.mem fd set then
299299
fct fd in
300300

301301
do_if_set rw_sock rset (accept_connection true);
302302
do_if_set ro_sock rset (accept_connection false);
303-
do_if_set eventchn.Event.fd rset (handle_eventchn)
303+
do_if_set (Event.fd eventchn) rset (handle_eventchn)
304304
in
305305

306306
let last_stat_time = ref 0. in

scripts/init.d-squeezed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SUBSYS_FILE="/var/lock/subsys/squeezed"
2525
. /etc/init.d/functions
2626

2727
if [ -e /var/xapi/xiu-xc ]; then
28+
export XENCTRL_OSDEP=/opt/xensource/lib/xenctrl/osdep_xiu.so
2829
export XIU=/var/xapi/xiu
2930
fi
3031

scripts/init.d-xapi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if [ -f /etc/sysconfig/xapi ]; then
1616
fi
1717

1818
if [ -e /var/xapi/xiu-xc ]; then
19+
export XENCTRL_OSDEP=/opt/xensource/lib/xenctrl/osdep_xiu.so
1920
export XIU=/var/xapi/xiu
2021
fi
2122

0 commit comments

Comments
 (0)