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

Re: [PATCH v2 4/6] tools/oxenstored: Implement Domain.rebind_evtchn


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Christian Lindig <christian.lindig@xxxxxxxxxx>
  • Date: Thu, 1 Dec 2022 11:20:58 +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=txA+m2MepZuyf0K3WmYbOOAhEQ4K7r69qQhi/nI/Mo8=; b=hBPzONfhUljsAvYqdoBZYuPUFBylE602F4gn9jp3NDN7ISYJNN1BqljP3pvXtSunjS/PlSkgQoFMqTiscJg1sJWoOh9COO7ZLAlY7wOuXEpOhyYadwwfUcX8BktLAYMvejqLbj035+DRhlzgxH8sfJayhSGcpTllSTHLZATtwPuJkFnh2FCBLQLl+nWw0/a6fSVxPJUkViDFXj5mhy7WPeUG5RwdU1uLsicPXLqosASDDyDUP/MwpCYNuDUX0CDWx7zp7dRZcMx0bPeplY3sM5aMA3Bb+Ij4xtfp8nuixIhXKarFkHW/IINa314KTUbL/SO3AQFRLIf/xsUz8DrOIg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S5goLJqthuwoqkG0WeRFwgMdHmWFju8X4CHHSScn/LcKnAEy+LQn8GcRmKknv9zG6IK2HZspuAdanqiXeeN3v9dDrnR62/0TmUeoEDQ1lnnL+B5RY16v5LZjZIQv2CrbLt6akUVoZXzzXbbUeQzKPRW4CgudHk8p6TrDu+57+lhSvRn7Osv1IOHlbZQIKYgtxfzQB+9DZ6OBtG4T12kULonU7d+63zML9sRV4iWEHVPxFiYkxnlX0D0JgjNduEfSln1/pb2oLH7n+Kcyst7Gsj9mUBtmWEdi7HrokEjnsOD9U08Z66iFzEVPt8M9e6+Iw6zr6CPvYQCiZCQo4S8bug==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Edwin Torok <edvin.torok@xxxxxxxxxx>, Rob Hoes <Rob.Hoes@xxxxxxxxxx>
  • Delivery-date: Thu, 01 Dec 2022 11:21:07 +0000
  • Ironport-data: A9a23:SK8x+Kq+v+a4Np79mhlqu5FIDOteBmIHZBIvgKrLsJaIsI4StFCzt garIBmAa/6DYzf1e9F/PYy/9koCuJfRyoM3SARtpHswHyIU+ZuZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpAFc+E0/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKm06W1wUmAWP6gR5gaEzyBNVvrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXAAgtKU6cnOix+e+AZbB8i+QsceS3BbpK7xmMzRmBZRonabbqZv2WoPN9gnI3jM0IGuvCb c0EbzYpdA7HfxBEJlYQDtQ5gfusgX78NTZfrTp5p4JuuzSVkFM3j+OrbIC9lt+iHK25mm6Tp njH5Hj4CxdcMN2ZxTuK2nmtmvXOjWXwX4d6+LiQpqAy2wfDlzR75Bs+cF6Vs9mDjXeEd/kYA RcV2gZp8JMr+xn+JjX6d1jiyJKehTYMVtwVH+Ak5QWlzqvP/x3fFmUCViRGatEtqIkxXzNC/ lOAgd7BHzFkt7yRD3WH+d+pQSiaPCEUKSoOYHECRA5dv937+tlv1FTIU8ppF7OzgpvtAzbsz juWrS84wbIOkcoM0Kb99lfC696xmqX0oscOzl2/dgqYAslRPeZJu6TABYDn0Mt9
  • Ironport-hdrordr: A9a23:OotdFKvzJAlAhZhJkKff11JW7skDstV00zEX/kB9WHVpm6yj+v xG/c5rsCMc7Qx6ZJhOo7+90cW7L080lqQFg7X5X43DYOCOggLBQL2KhbGI/9SKIVycygcy78 Zdm6gVMqyLMbB55/yKnTVRxbwbsaW6GKPDv5ag8590JzsaD52Jd21Ce36m+ksdfnggObMJUK Cyy+BgvDSadXEefq2AdwI4t7iqnaysqHr+CyR2fiIa1A==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZBNyCM7ZphV/4jEuRLBRtweaKfa5Y5D8A
  • Thread-topic: [PATCH v2 4/6] tools/oxenstored: Implement Domain.rebind_evtchn


> On 30 Nov 2022, at 16:54, Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx> wrote:
> 
> Generally speaking, the event channel local/remote port is fixed for the
> lifetime of the associated domain object.  The exception to this is a
> secondary XS_INTRODUCE (defined to re-bind to a new event channel) which pokes
> around at the domain object's internal state.
> 
> We need to refactor the evtchn handling to support live update, so start by
> moving the relevant manipulation into Domain.
> 
> No practical change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Christian Lindig <christian.lindig@xxxxxxxxxx>
> CC: David Scott <dave@xxxxxxxxxx>
> CC: Edwin Torok <edvin.torok@xxxxxxxxxx>
> CC: Rob Hoes <Rob.Hoes@xxxxxxxxxx>

Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>

The code makes changes around if-expressions and it is easy to get mislead by 
indentation which parts are covered by an if and which are not in the presence 
of sequential code. I would be more confident about this with automatic 
formatting (but also believe this is correct).

— C




> Note: This change deliberately doesn't reuse Domain.bind_interdomain, which is
> removed by the end of the refactoring.
> 
> v2:
> * New.
> ---
> tools/ocaml/xenstored/domain.ml  | 12 ++++++++++++
> tools/ocaml/xenstored/process.ml |  6 ++----
> 2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
> index ab08dcf37f62..d59a9401e211 100644
> --- a/tools/ocaml/xenstored/domain.ml
> +++ b/tools/ocaml/xenstored/domain.ml
> @@ -63,6 +63,18 @@ let string_of_port = function
> let dump d chan =
>       fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
> 
> +let rebind_evtchn d remote_port =
> +     begin match d.port with
> +     | None -> ()
> +     | Some p -> Event.unbind d.eventchn p
> +     end;
> +     let local = Event.bind_interdomain d.eventchn d.id remote_port in
> +     debug "domain %d rebind (l %s, r %d) => (l %d, r %d)"
> +           d.id (string_of_port d.port) d.remote_port
> +           (Xeneventchn.to_int local) remote_port;
> +     d.remote_port <- remote_port;
> +     d.port <- Some (local)
> +
> let notify dom =
>       match dom.port with
>       | None -> warn "domain %d: attempt to notify on unknown port" dom.id
> diff --git a/tools/ocaml/xenstored/process.ml 
> b/tools/ocaml/xenstored/process.ml
> index b2973aca2a82..2ea940d7e2d5 100644
> --- a/tools/ocaml/xenstored/process.ml
> +++ b/tools/ocaml/xenstored/process.ml
> @@ -567,11 +567,9 @@ let do_introduce con t domains cons data =
>       let dom =
>               if Domains.exist domains domid then
>                       let edom = Domains.find domains domid in
> -                     if (Domain.get_mfn edom) = mfn && 
> (Connections.find_domain cons domid) != con then begin
> +                     if (Domain.get_mfn edom) = mfn && 
> (Connections.find_domain cons domid) != con then
>                               (* Use XS_INTRODUCE for recreating the xenbus 
> event-channel. *)
> -                             edom.remote_port <- remote_port;
> -                             Domain.bind_interdomain edom;
> -                     end;
> +                             Domain.rebind_evtchn edom remote_port;
>                       edom
>               else try
>                       let ndom = Domains.create domains domid mfn remote_port 
> in
> -- 
> 2.11.0
> 


 


Rackspace

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