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

[xen staging] xenstored: send an evtchn notification on introduce_domain



commit fc2b57c9af462d67df871b080c0897156a616b7d
Author:     Luca Miccio <lucmiccio@xxxxxxxxx>
AuthorDate: Fri May 13 14:07:28 2022 -0700
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
CommitDate: Tue May 24 16:18:08 2022 -0700

    xenstored: send an evtchn notification on introduce_domain
    
    When xs_introduce_domain is called, send out a notification on the
    xenstore event channel so that any (dom0less) domain waiting for the
    xenstore interface to be ready can continue with the initialization.
    Before sending the notification, clear XENSTORE_RECONNECTING.
    
    The extra notification is harmless for domains that don't require it.
    
    In xs_wire.h update the commment on top of XENSTORE_RECONNECTING to
    generalize its meaning to suit the dom0less use-case better. Also
    improve docs/misc/xenstore-ring.txt.
    
    Signed-off-by: Luca Miccio <lucmiccio@xxxxxxxxx>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
 docs/misc/xenstore-ring.txt       | 8 +++++++-
 tools/xenstore/xenstored_domain.c | 4 ++++
 xen/include/public/io/xs_wire.h   | 2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xenstore-ring.txt b/docs/misc/xenstore-ring.txt
index b338b21b19..f3d6ca4264 100644
--- a/docs/misc/xenstore-ring.txt
+++ b/docs/misc/xenstore-ring.txt
@@ -111,7 +111,13 @@ Assuming the server has advertised the feature, the guest 
can initiate
 a reconnection by setting the the Connection state to 1 ("Ring close
 and reconnect is in progress") and signalling the event channel.
 The guest must now ignore all fields except the Connection state and
-wait for it to be set to 0 ("Ring is connected")
+wait for it to be set to 0 ("Ring is connected").
+
+In certain circumstances (e.g. dom0less guests with PV drivers support)
+it is possible for the guest to find the Connection state already set to
+1 by someone else during xenstore initialization. In that case, like in
+the previous case, the guest must ignore all fields except the
+Connection state and wait for it to be set to 0 before proceeding.
 
 The server will guarantee to
 
diff --git a/tools/xenstore/xenstored_domain.c 
b/tools/xenstore/xenstored_domain.c
index 80ba1d627b..de88bf2a68 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -493,6 +493,10 @@ static struct domain *introduce_domain(const void *ctx,
                /* Now domain belongs to its connection. */
                talloc_steal(domain->conn, domain);
 
+               /* Notify the domain that xenstore is available */
+               interface->connection = XENSTORE_CONNECTED;
+               xenevtchn_notify(xce_handle, domain->port);
+
                if (!is_master_domain && !restore)
                        fire_watches(NULL, ctx, "@introduceDomain", NULL,
                                     true, NULL);
diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h
index 953a0050a3..c1ec7c73e3 100644
--- a/xen/include/public/io/xs_wire.h
+++ b/xen/include/public/io/xs_wire.h
@@ -141,7 +141,7 @@ struct xenstore_domain_interface {
 
 /* Valid values for the connection field */
 #define XENSTORE_CONNECTED 0 /* the steady-state */
-#define XENSTORE_RECONNECT 1 /* guest has initiated a reconnect */
+#define XENSTORE_RECONNECT 1 /* reconnect in progress */
 
 /* Valid values for the error field */
 #define XENSTORE_ERROR_NONE    0 /* No error */
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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