[PATCH v5 5/7] xenstored: send an evtchn notification on introduce_domain

Stefano Stabellini posted 7 patches 2 years, 7 months ago
There is a newer version of this series
[PATCH v5 5/7] xenstored: send an evtchn notification on introduce_domain
Posted by Stefano Stabellini 2 years, 7 months ago
From: Luca Miccio <lucmiccio@gmail.com>

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 XS_CONNECTION_STATE_RECONNECTING.

The extra notification is harmless for domains that don't require it.

Signed-off-by: Luca Miccio <lucmiccio@gmail.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
CC: Juergen Gross <jgross@suse.com>
CC: Julien Grall <julien@xen.org>
---
I dropped the Reviewed-by tags due to the connect = 0 change. Julien
also suggested it would be a good idea to add a clarification statement
about the usage of XS_CONNECTION_STATE_RECONNECTING in the header files
but I wasn't sure what to write. Please advise and I am happy to include
a statement in the next version.

Changes in v5:
- reset XS_CONNECTION_STATE_RECONNECTING before notifying the domU

Changes in v2:
- drop the new late_init parameter
---
 tools/xenstore/xenstored_domain.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index ae065fcbee..7bb8c64d33 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 = 0x0;
+		xenevtchn_notify(xce_handle, domain->port);
+
 		if (!is_master_domain && !restore)
 			fire_watches(NULL, ctx, "@introduceDomain", NULL,
 				     false, NULL);
-- 
2.25.1
Re: [PATCH v5 5/7] xenstored: send an evtchn notification on introduce_domain
Posted by Juergen Gross 2 years, 7 months ago
On 29.04.22 22:57, Stefano Stabellini wrote:
> From: Luca Miccio <lucmiccio@gmail.com>
> 
> 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 XS_CONNECTION_STATE_RECONNECTING.
> 
> The extra notification is harmless for domains that don't require it.
> 
> Signed-off-by: Luca Miccio <lucmiccio@gmail.com>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
> CC: Juergen Gross <jgross@suse.com>
> CC: Julien Grall <julien@xen.org>
> ---
> I dropped the Reviewed-by tags due to the connect = 0 change. Julien
> also suggested it would be a good idea to add a clarification statement
> about the usage of XS_CONNECTION_STATE_RECONNECTING in the header files
> but I wasn't sure what to write. Please advise and I am happy to include
> a statement in the next version.
> 
> Changes in v5:
> - reset XS_CONNECTION_STATE_RECONNECTING before notifying the domU
> 
> Changes in v2:
> - drop the new late_init parameter
> ---
>   tools/xenstore/xenstored_domain.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
> index ae065fcbee..7bb8c64d33 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 = 0x0;

Please use XENSTORE_CONNECTED instead of 0x0.

> +		xenevtchn_notify(xce_handle, domain->port);
> +
>   		if (!is_master_domain && !restore)
>   			fire_watches(NULL, ctx, "@introduceDomain", NULL,
>   				     false, NULL);


Juergen