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

Re: [PATCH] xen/evtchn: Add design for static event channel signaling for domUs..


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Mon, 11 Apr 2022 15:28:09 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=Gt5jAdlLFKn2FKYVejnnvArgY2fNHKot2ohec1+lUUQ=; b=b5e6ygkph/iW8cUmPzdVfY6rxa5d5iF/nmOUyHsPF59Io7xM5RdqPcnDXqSM6XIWMWntPGRDVWl/P5ZpmqnTo4vHtCgO+syDB3ASivB7LWMLin870rZDDgmL+ZEY3uOhj3busCfDEhz6f5qRxxzKd+//nsdOF5lNpCLmCiZgeYQasJlNDNxncfzDP8vAXWyXtWziG/DmZzMk6J5Am7QkIYFcGzGE7aKUOVISsQAAb4+sNIOJFFCHbCIjzJJ/GkFTeNCplGOlLe/tTdCAD6J9EQ50NaPdZxMk2NZi7eHqUWwzCkbBmHinvYzdwbWZpY69KF8jlGFJapCRRXOHPk9S4g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EyPJ2tUUFlWKDhLAVZ/n0lfwiFJfMKBXf/PDpMn7OO7PngBy+e2Jkg61EpITU0nzyTZnFxxwx0355ZJy8JCQX+f0IZSC5QHTGuOizcylpKejlQDJeXmIJCc9NUbiU1xanvyzSSENb/gLSllAgDFNqyAUJl5S2l/iPG9Me5CujuifQ5zGgCfGbw+XiQUlj3Mg8lYXf6dXGUMAsOMnAX9cR7T8daNbP5zK4EZpgjatExnEDVIJJYmXNheOuOqjHyuhjCGhQds3zrGzPyyShR+now5Et0N3ODsQbkXvZS66q/bTSr8Kvrfzek3lkYeg8sKoI6co2PL5bsVwSaUGL910LQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 11 Apr 2022 15:28:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYPsy9MfyfmFhecEGJuSNYyusIgKzm3KwAgAQXOAA=
  • Thread-topic: [PATCH] xen/evtchn: Add design for static event channel signaling for domUs..

Hi Stefano,

Thanks for reviewing the design.

> On 9 Apr 2022, at 2:00 am, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> On Wed, 23 Mar 2022, Rahul Singh wrote:
>> in dom0less system. This patch introduce the new feature to support the
>> signaling between two domUs in dom0less system.
>> 
>> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
>> ---
>> docs/designs/dom0less-evtchn.md | 96 +++++++++++++++++++++++++++++++++
>> 1 file changed, 96 insertions(+)
>> create mode 100644 docs/designs/dom0less-evtchn.md
>> 
>> diff --git a/docs/designs/dom0less-evtchn.md 
>> b/docs/designs/dom0less-evtchn.md
>> new file mode 100644
>> index 0000000000..6a1b7e8c22
>> --- /dev/null
>> +++ b/docs/designs/dom0less-evtchn.md
>> @@ -0,0 +1,96 @@
>> +# Signaling support between two domUs on dom0less system
>> +
>> +## Current state: Draft version
>> +
>> +## Proposer(s): Rahul Singh, Bertrand Marquis
>> +
>> +## Problem Statement:
>> +
>> +The goal of this work is to define a simple signaling system between Xen 
>> guests
>> +in dom0less systems.
>> +
>> +In dom0less system, we cannot make use of xenbus and xenstore that are used 
>> in
>> +normal systems with dynamic VMs to communicate between domains by providing 
>> a
>> +bus abstraction for paravirtualized drivers.
>> +
>> +One possible solution to implement the signaling system between domUs is 
>> based
>> +on event channels.
> 
> I suggest to reword this as follows:
> 
> ---
> Dom0less guests would benefit from a statically-defined memory sharing
> and signally system for communication. One that would be immediately
> available at boot without any need for dynamic configurations.
> 
> In embedded a great variety of guest operating system kernels exist,
> many of which don't have support for xenstore, grant table or other
> complex drivers. Some of them are small kernel-space applications (often
> called "baremetal", not to be confused with the term "baremetal" used in
> datacenter which means "without hypervisors") or RTOSes. Additionally,
> for safety reasons, users often need to be able to configure the full
> system statically so that it can be verified statically.
> 
> Event channels are very simple and can be added even to baremetal
> applications. This proposal introduces a way to define them statically
> to make them suitable to dom0less embedded deployments.
> ---
> 

Ok. This is really a good explanation I will add this in next version.
> 
>> +## Proposal:
>> +
>> +Event channels are the basic primitive provided by Xen for event 
>> notifications.
>> +An event channel is a logical connection between 2 domains (more 
>> specifically
>> +between dom1,port1 and dom2,port2). They essentially store one bit of
>> +information, the event of interest is signalled by transitioning this bit 
>> from
>> +0 to 1. An event is an equivalent of a hardware interrupt.
>> +
>> +Notifications are received by a guest via an interrupt from Xen to the 
>> guest,
>> +indicating when an event arrives (setting the bit). Further notifications 
>> are
>> +masked until the bit is cleared again. When a domain wants to wait for data 
>> it
>> +will block until an event arrives, and then send an event to signal that 
>> data
>> +has been consumed. Events are delivered asynchronously to guests and are
>> +enqueued when the guest is not running.
>> +
>> +Event channel communication will be established statically between two domU
>> +guests before unpausing the domains after domain creation. Event channel
>> +connection information between domUs will be passed to XEN via device tree
>> +node.
>> +
>> +Under the /chosen node, there needs to be sub nodes with compatible
>> +"xen,evtchn" that descibes the event channel connection between two domUs.
>> +
>> +The event channel sub-node has the following properties:
>> +
>> +- compatible
>> +
>> + "xen,evtchn"
>> +
>> +- xen,evtchn
>> +
>> + The property is four numbers of tuples of
>> + (local-port-domU1,domU1-phandle,local-port-domU2,domU2-phandle) where:
>> +
>> + local-port-domU1 is an integer value that will be used to allocte local
>> + port for domU1 to send an event notification to the remote domain.
>> +
>> + domU1-phandle is a single phandle to an domain to which local-port-domU1
>> + will be allocated.
>> +
>> + local-port-domU2 is an integer value that will be used to allocte local
>> + port for domU2 to send an event notification to the remote domain.
>> +
>> + domU2-phandle is a single phandle to an domain to which local-port-domU2
>> + will be allocated.
>> +
>> +Example:
>> +
>> + chosen {
>> + ....
>> +
>> + domU1: domU1 {
>> + ......
>> + };
>> +
>> + domU2: domU2 {
>> + ......
>> + };
>> +
>> + evtchn@1 {
>> + compatible = "xen,evtchn";
>> + xen,evtchn = <0xa &domU1 0xb &domU2>;
>> + };
>> +
>> + evtchn@2 {
>> + compatible = "xen,evtchn";
>> + xen,evtchn = <0xc &domU1 0xd &domU2>;
>> + };
>> + };
> 
> There is no need to use two evtchn nodes for this given that in device
> tree it is entirely normal to have multiple tuplets in a property. Also,
> it would be good to have a version number in the compatible string so
> that we can change version in the future.
> 
> 1)
> chosen {
> ....
> 
> domU1: domU1 {
> ......
> };
> 
> domU2: domU2 {
> ......
> };
> 
> evtchn {
> compatible = "xen,evtchn-v1";
> xen,evtchn = <0xa &domU1 0xb &domU2 0xc &domU1 0xd &domU2>;
> };
> };
> 

I agree if we can have multiple tuples in a property. I will modify the design 
in next version
to have multiple tuples in a property. 
> 
> I should mention that it would be also possible to use sub-nodes to
> express this information:
> 
> 2)
> domU1: domU1 {
> ...
> /* one sub-node per local event channel */
> ec1: evtchn@a {
> compatible = "xen,evtchn-v1";
> /* local-evtchn link-to-foreign-evtchn */
> xen,evtchn = <0xa &ec3>
> };
> ec2: evtchn@c {
> compatible = "xen,evtchn-v1";
> xen,evtchn = <0xc &ec4>
> };
> };
> 
> domU2: domU2 {
> ...
> ec3: evtchn@b {
> compatible = "xen,evtchn-v1";
> xen,evtchn = <0xb &ec1>
> };
> ec4: evtchn@d {
> compatible = "xen,evtchn-v1";
> xen,evtchn = <0xa &ec2>
> };
> };
> };
> 
> This format has the advantage that doesn't need a new top-level node
> type under /chosen. That is desirable few a few reasons. Today we only
> have domains (dom0 is legacy). In the future we might have nested
> domains and non-Xen domains. With System Device Tree, domains are under
> /domains instead of /chosen.
> 
> So normally I would argue to use the sub-node format because it doesn't
> need a new top-level node under /chosen. However, in this case it looks
> like the 1) format is simpler to write and also simpler to parse in Xen.
> 
> In 1), we would need to loop over xen,evtchn and for each tuplet we
> would only need to fetch the foreign domid.
> 
> In 2), we would need to check the compatible string of every
> "xen,evtchn-v1" node, and we would have to fetch from the phandle both
> the remote event channel number but also the domain-id of the parent.

> 
> So it looks like 1) is better because it is much simpler to parse. Do
> you agree?

Yes I agree with you, for this case we need to parse all the "xen,evtchn-v1” 
compatible node
and from that node, we need to find the remote event channel and dom-id from 
the phandle.

I started from this configuration and later realize that if we use this 
configuration code will become
more complex and defining the event-channel connection in DT will also not be 
simple.
> 
>> +In above example two event channel comunication will be established between
>> +domU1 and domU2.
>> +
>> + domU1 (port 0xa) <-----------------> domU2 (port 0xb)
>> + domU1 (port 0xc) <-----------------> domU2 (port 0xd)
>> +
>> +domU1 and domU2 can send the signal to remote domain via hypercall
>> +EVTCHNOP_send(.) on local port.
> 
> I think this is fine in principle. Like Jan wrote, at some point we'll
> need to specify the device tree binding to expose this information to
> the guest.

Regards,
Rahul


 


Rackspace

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