[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-4.17 v3 10/15] tools/ocaml/xenstored: keep eventchn FD open across live update


  • To: Edwin Torok <edvin.torok@xxxxxxxxxx>
  • From: Christian Lindig <christian.lindig@xxxxxxxxxx>
  • Date: Wed, 9 Nov 2022 13:59:28 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=53lqmJ+nw6CoBPDdxqm7IMGChyE06LlyF8vVrF6SPLA=; b=bVvfgrh1jenrJj2NVog3vEH5RbZweDA5RKTEruZiXEFoxQMCFLx+eToiHGqgYfpFSHvvgkQ1nVdQYH84bTrqtdQJruHz8qmSOf1jPVA0dGkSmYm+AIERJIgR7m971cj7QPYjRlB4esvsdyg+ZWhbBj9lk4Ik2Jm6VF7YjutUwyBWkS6zdYWDj3AVfL5Iatl3+EKBXWCcbU8pp+X6Jy0Z8m3725oVr+8kY8eK/kWVhJJ1rIHwMH47i7eBtyDN6HSnsbV+10n5+VDl9QBnvBPUVyP+sgC5zZm9rUOnzAabQnJXd1J2pxFNxpcgwZ/ald1+d0P7hG1ZckrLygDm2u0BGQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PoBDlx6F1D17chfBxBCH27sWDYiLmJ9HGROl0q5wGHbw7qOhqwkvIAXvOTpNYEjiV+3eOIIF7zJMQa5Feu4aSEvHMKU8Q+e9Ceu7E1PB8FDL8kDmQw+UlI+p3Xu6n5LPaO+6SBDhqQ9tO81L+RklF2hDX9FNwfYTCd0K25Kl9GKxxz2YDnttdk3iFmnYc3plA+mEqxM8iMBIhL7jO5YhxpdQxzgMvh3gUn82oWxQ6Ad3ivHZuoNtShRGO7qYEJi/YklDsI2XaX9rlbTZ4TDfYAk83lSf6c8uaGmLmP26blgOfQnZdhR8k5/ymOmxyHg3oVd/qoHfm+HIWe9zYdmiBQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, David Scott <dave@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Wed, 09 Nov 2022 13:59:41 +0000
  • Ironport-data: A9a23:EjqnjK5JiUV4NKHT+yXUkwxRtAbGchMFZxGqfqrLsTDasY5as4F+v jQdUWnVafrcZWSgf9ElPtyx8kgEvJbcxoBiGgE9/n9mHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraBYnoqLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+4pwehBtC5gZkPKkT7QeE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5mz O00MykDRRm/q+/v8pipZep8lN0PBZy+VG8fkikIITDxK98DGMqGaYOaoNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OkUooj+SF3Nn9I7RmQe1enlyZv X7H9mK/BhAcON2Q4TGE7mitlqnEmiaTtIc6ROHkqaU63QH7Kmo7Nl4kSHSRvPCCpw2vdI5YE 2cY3Hcjov1nnKCsZpynN/Gim1aUsxhZV9dOHukS7ACW1rGS8wufHnIDTDNKdJohrsBebRwn0 EWY2ezgAzNHuaeQD3ma89+8oTqsNAAPIGQFZCtCShEKi/H8pKkjgxSJScxseJNZlfXwEDD0h jqM/C43guxJidZRjvrnu1fanziru57FCBYv4RnaVX6k6QU/Y5O5Y4uv6h7Q6vMowJulc2Rtd UMsw6C2hN3ix7nU/MBRaI3hxI2U2ss=
  • Ironport-hdrordr: A9a23:sqW4G6yq5KTjtBUHij3tKrPxj+skLtp133Aq2lEZdPULSKGlfp GV9sjziyWetN9IYgBapTiBUJPwIk81bfZOkMQs1MSZLXPbUQyTXc1fBOrZsnfd8kjFmtK1up 0QFJSWZOeQMbE+t7eD3ODaKadu/DDkytHPuQ629R4EIm9XguNbnn5E422gYy9LrXx9dP4E/e 2nl696TlSbGUg/X4CePD0oTuLDr9rEmNbNehgdHSMq7wGIkHeB9KP6OwLw5GZebxp/hZMZtU TVmQ3w4auu99uhzAXH6mPV55NK3PP819p4AtCWgMR9EESttu/oXvUjZ1SxhkFxnAid0idvrD AKmWZmAy1H0QKSQohym2qq5+Cv6kd215ao8y7kvZKqm72EeNt9MbsOuWsRSGqm12Mw+N57y6 5FxGSfqt5eCg7Bhj3045zSWwhtjVfcmwtqrQaC50YvLrf2RYUh2rD3xnklZqsoDWb/8sQqAe NuBMbT6LJfdk6bdWnQui1qzMa3Vno+Ex+aSgxa0/blmAR+jTR81Q8V1cYflnAP+NY0TIRF/f 3NNuBtmKtVRsEbYKphDKMKQNexCGbKXRXQWVjiaWjPBeUCITbAupT36LI66KWjf4EJ1oI7nN DbXFZRpQcJCjbT4A21reh2Gzz2MRaAtG7Wu7BjDrBCy83BbauuNzGfQ1YzlMblq+kDA6TgKo SOBK4=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY84hU2UIFubhrZESPqs29nIiL/a42n+KA
  • Thread-topic: [PATCH for-4.17 v3 10/15] tools/ocaml/xenstored: keep eventchn FD open across live update


> On 8 Nov 2022, at 15:34, Edwin Török <edvin.torok@xxxxxxxxxx> 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.torok@xxxxxxxxxx>
> ---
> 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.lindig@xxxxxxxxxx>


> +    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 ->
| 

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.