From nobody Mon Mar 23 21:43:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773388138; cv=none; d=zohomail.com; s=zohoarc; b=lljphT+R50XUJ2ke8Te2J1Lu2DEViNsV1epLQKko4CrvrUDolMbhCxxehm39mJiakfnXAjcDRL1BNNZFdDKqjM600ALsmaQHRUM+wG5RWq+WUGQnO+CDXIXzG4DSagWXAHPwvv/nyZzH40pzetxztMB1p/5BbsHmnlfNvkzYY0s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773388138; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Wtc5vtg54h365QFdm8hm6MolP6XIgjTyDkWMll2qEbc=; b=D41EulaqWa59A0UG+K+w2OYzCK6G4WroX5Cbr9Yuqx1x6FKJxAmnDSmC/bvgumjtEvhd+UkD5twLqYJv3jjrV7jRsWNxlnUM4+KgfZKXiy0ivoW/ZUpHan6QNNFUIaLEv5/QgeROC13sITdoq6EDe2DFuw/d9NXazk/nx7MjRqM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773388138661204.79808104914503; Fri, 13 Mar 2026 00:48:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1253379.1549676 (Exim 4.92) (envelope-from ) id 1w0xG7-000675-B4; Fri, 13 Mar 2026 07:48:35 +0000 Received: by outflank-mailman (output) from mailman id 1253379.1549676; Fri, 13 Mar 2026 07:48:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0xG7-00066v-7A; Fri, 13 Mar 2026 07:48:35 +0000 Received: by outflank-mailman (input) for mailman id 1253379; Fri, 13 Mar 2026 07:48:33 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0xG5-0003h2-Mc for xen-devel@lists.xenproject.org; Fri, 13 Mar 2026 07:48:33 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 081c0d37-1eb1-11f1-9ccf-f158ae23cfc8; Fri, 13 Mar 2026 08:48:32 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C46755CF3A; Fri, 13 Mar 2026 07:48:31 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A3F84403F6; Fri, 13 Mar 2026 07:48:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id jozfJk/Bs2nxGAAAD6G6ig (envelope-from ); Fri, 13 Mar 2026 07:48:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 081c0d37-1eb1-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1773388111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wtc5vtg54h365QFdm8hm6MolP6XIgjTyDkWMll2qEbc=; b=IFXiqIDBBFWrVLnDa2TDp0llCHTngEsRKlAA6/8Goi95/zxhfJW0wSvjmYPXIp5XYeH4ya 6IF+YyI2lywmpGm/crQt+24oJBhu4IaP6cNtClfIKibfr/XbV7ohmzD+BsywkdEGjPZWfL uCcRGjbycsgRz9o9i/CSmI+ae4yUhII= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1773388111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wtc5vtg54h365QFdm8hm6MolP6XIgjTyDkWMll2qEbc=; b=IFXiqIDBBFWrVLnDa2TDp0llCHTngEsRKlAA6/8Goi95/zxhfJW0wSvjmYPXIp5XYeH4ya 6IF+YyI2lywmpGm/crQt+24oJBhu4IaP6cNtClfIKibfr/XbV7ohmzD+BsywkdEGjPZWfL uCcRGjbycsgRz9o9i/CSmI+ae4yUhII= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 7/8] tools/xenstored: expand special watch handling with depth feature Date: Fri, 13 Mar 2026 08:47:50 +0100 Message-ID: <20260313074751.2904215-8-jgross@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260313074751.2904215-1-jgross@suse.com> References: <20260313074751.2904215-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[4]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid,suse.com:email,imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -6.80 X-Spam-Level: X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773388140780158500 Content-Type: text/plain; charset="utf-8" With XENSTORE_SERVER_FEATURE_WATCHDEPTH available, special watch handling needs to be extended: - when a special watch is set with depth =3D 1, the domid is added to the watch event - it is possible to watch for @releaseDomain/ Signed-off-by: Juergen Gross --- tools/xenstored/domain.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c index 866c0aa908..1fe8abbea9 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -613,7 +613,12 @@ static void domain_tree_remove(struct domain *domain) walk_node_tree(domain, NULL, "@introduceDomain", &walkfuncs, domain); } =20 -static void fire_special_watches(const char *name) +#define WATCH_NODOM 1 /* Fire watches without extension. */ +#define WATCH_DOM 2 /* Fire watches with extension. */ +#define WATCH_BOTH (WATCH_NODOM | WATCH_DOM) + +static void fire_special_watches(const char *name, unsigned int domid, + unsigned int watchdom_flag) { void *ctx =3D talloc_new(NULL); const struct node *node; @@ -623,9 +628,19 @@ static void fire_special_watches(const char *name) =20 node =3D read_node_const(NULL, ctx, name); =20 - if (node) - fire_watches(NULL, ctx, name, node, true, NULL); - else + if (node) { + if (watchdom_flag & WATCH_NODOM) + fire_watches(NULL, ctx, name, node, MATCH_NODEPTH, + NULL); + if (watchdom_flag & WATCH_DOM) { + char name_dom[24]; /* max. "@introduceDomain/domid" */ + + snprintf(name_dom, sizeof(name_dom), + "%s/%u", name, domid); + fire_watches(NULL, ctx, name_dom, node, MATCH_DEPTH, + NULL); + } + } else log("special node %s not found\n", name); =20 talloc_free(ctx); @@ -650,7 +665,7 @@ static int destroy_domain(void *_domain) if (domain->interface) unmap_interface(domain->domid, domain->interface); =20 - fire_special_watches("@releaseDomain"); + fire_special_watches("@releaseDomain", domain->domid, WATCH_BOTH); =20 wrl_domain_destroy(domain); =20 @@ -678,10 +693,13 @@ static int do_check_domain(struct domain *domain, boo= l *notify, if ((state & XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN) && !domain->shutdown) { domain->shutdown =3D true; + fire_special_watches("@releaseDomain", domain->domid, + WATCH_DOM); *notify =3D true; } - if (!(state & XENMANAGE_GETDOMSTATE_STATE_DEAD)) + if (!(state & XENMANAGE_GETDOMSTATE_STATE_DEAD)) { return 0; + } } if (domain->conn) { /* domain is a talloc child of domain->conn. */ @@ -720,7 +738,7 @@ void check_domains(void) ; =20 if (notify) - fire_special_watches("@releaseDomain"); + fire_special_watches("@releaseDomain", 0, WATCH_NODOM); } =20 static struct domain *find_domain_struct(unsigned int domid) @@ -744,7 +762,7 @@ static void do_check_domains(void) } =20 if (notify) - fire_special_watches("@releaseDomain"); + fire_special_watches("@releaseDomain", 0, WATCH_NODOM); } =20 /* We scan all domains rather than use the information given here. */ @@ -1097,7 +1115,8 @@ static struct domain *introduce_domain(const void *ct= x, talloc_steal(domain->conn, domain); =20 if (!is_priv_domain && !restore) - fire_special_watches("@introduceDomain"); + fire_special_watches("@introduceDomain", domid, + WATCH_BOTH); } else { /* Use XS_INTRODUCE for recreating the xenbus event-channel. */ if (domain->port) --=20 2.53.0