mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Hvmloader uses the xenstore ring and then tries to reset it back to its initial state before booting the guest. Occasionally xenstored will read the ring while it is being zeroed and conclude it has been corrupted. This prevents PV drivers from loading in the guest. This patch updates the xenstore ring protocol definition, enabling a server to advertise additional features to the guest. One such feature is defined: the ability to cleanly reset the ring including the higher-level protocol, like an enhanced RESET_WATCHES for rings. This patch implements the ring reconnection features in oxenstored and hvmloader, fixing the bug. This patch also defines an 'invalid' xenstore packet type and uses this to poison the ring over a reconnect. This will make diagnosing this bug much easier in future. Signed-off-by: David Scott <dave.scott@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Reviewed-by: Jon Ludlam <jonathan.ludlam@citrix.com>
47 lines
1.7 KiB
OCaml
47 lines
1.7 KiB
OCaml
(*
|
|
* Copyright (C) 2006-2007 XenSource Ltd.
|
|
* Copyright (C) 2008 Citrix Ltd.
|
|
* Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published
|
|
* by the Free Software Foundation; version 2.1 only. with the special
|
|
* exception on linking described in file LICENSE.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*)
|
|
|
|
module Server_feature = struct
|
|
type t =
|
|
| Reconnection
|
|
end
|
|
|
|
module Server_features = Set.Make(struct
|
|
type t = Server_feature.t
|
|
let compare = compare
|
|
end)
|
|
|
|
external read: Xenmmap.mmap_interface -> string -> int -> int = "ml_interface_read"
|
|
external write: Xenmmap.mmap_interface -> string -> int -> int = "ml_interface_write"
|
|
|
|
external _internal_set_server_features: Xenmmap.mmap_interface -> int -> unit = "ml_interface_set_server_features" "noalloc"
|
|
external _internal_get_server_features: Xenmmap.mmap_interface -> int = "ml_interface_get_server_features" "noalloc"
|
|
|
|
|
|
let get_server_features mmap =
|
|
(* NB only one feature currently defined above *)
|
|
let x = _internal_get_server_features mmap in
|
|
if x = 0
|
|
then Server_features.empty
|
|
else Server_features.singleton Server_feature.Reconnection
|
|
|
|
let set_server_features mmap set =
|
|
(* NB only one feature currently defined above *)
|
|
let x = if set = Server_features.empty then 0 else 1 in
|
|
_internal_set_server_features mmap x
|
|
|
|
external close: Xenmmap.mmap_interface -> unit = "ml_interface_close" "noalloc"
|