> On 8 Nov 2022, at 15:34, Edwin Török <edvin.to...@citrix.com> wrote: > > Avoid this by trying to keep the eventchn file descriptor open across > live updates, using the new xenevtchn_fdopen API, similar to how C > xenstored works. > > However an old enough oxenstored won't have kept the evtchn fd open and > won't have saved it in the update stream, so handle that case by > reopening the evtchn as a fallback. > > A followup commit will avoid rebind the guest remote port (we cannot > rely on the remote port staying the same, e.g. the windows PV drivers > change it) > > Signed-off-by: Edwin Török <edvin.to...@citrix.com> > --- > Reason for inclusion in 4.17: > - fixes live update in oxenstored, making future security updates easier > if the base code already has this patch > > Changes since v2: > - new in v3 > --- > tools/ocaml/xenstored/domains.ml | 1 + > tools/ocaml/xenstored/event.ml | 7 ++- > tools/ocaml/xenstored/xenstored.ml | 71 +++++++++++++++++++++--------- > 3 files changed, 56 insertions(+), 23 deletions(-)
Acked-by: Christian Lindig <christian.lin...@citrix.com> > + let require_doms () = > + match !doms with > + | None -> > + let missing_eventchnfd = !eventchnfd = None in > + if missing_eventchnfd then > + warn "No event channel file descriptor available in dump!"; > + let eventchn = Event.init ?fd:!eventchnfd () in > + let domains = createdoms eventchn in > + if missing_eventchnfd then > + Event.bind_dom_exc_virq eventchn; > + doms := Some domains; > + domains > + | Some d -> d I like to use the “when” clause in these situations in order to keep the match cases flat even at the cost of a slight code duplication. But it’s a matter of taste. | None when !eventchnfd = None -> Or match !doms, !eventchnfd with | None, None -> |