From nobody Thu Oct 30 23:19:48 2025 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=1753193219; cv=none; d=zohomail.com; s=zohoarc; b=l1v9Q0NxlBBoI0wzSUYVrTUcRpbCnnx0nS/lgVJ50LKuhB4tVJ/JkrH5haQAu466OLsJGaFyImc9HInCF7TURDq0X1gUrr6lO15t6jffrs1U9fqjZsyIB4AmX/zvrTGVo1mTGIkv+t2hnZiE/dASnw3Do252XO2ZkfjNM1enKsc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753193219; 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=hwQcdaQXyhmu4Exu8gwLl3uTdn0YZ/pu3cUIggmc++Q=; b=QF+2jqoJzRDdWBbp0AVPcUxXqFd5pINSxRd19X/9mJYNpvHpEKwz/LCccs31IRFpcjGAT85w9wD4kHRV8iF69df4sTmjMr4UF11eeATwtXADmewlFZ9jtqkjSG4fS6rmDR9vUSY5KPmcsG95AA/Kyv+1lDe3z6IrxxNjThn/198= 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 1753193219235449.44981983015623; Tue, 22 Jul 2025 07:06:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1052672.1421410 (Exim 4.92) (envelope-from ) id 1ueDdh-0005CI-7G; Tue, 22 Jul 2025 14:06:41 +0000 Received: by outflank-mailman (output) from mailman id 1052672.1421410; Tue, 22 Jul 2025 14:06:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDdh-0005CB-4P; Tue, 22 Jul 2025 14:06:41 +0000 Received: by outflank-mailman (input) for mailman id 1052672; Tue, 22 Jul 2025 14:06:40 +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 1ueDdg-0005C5-7c for xen-devel@lists.xenproject.org; Tue, 22 Jul 2025 14:06:40 +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 155a89e4-6705-11f0-b894-0df219b8e170; Tue, 22 Jul 2025 16:06:38 +0200 (CEST) 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 AB75A1F7D7; Tue, 22 Jul 2025 14:06:37 +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 82EEB13A32; Tue, 22 Jul 2025 14:06:37 +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 mgNsHu2af2i5IAAAD6G6ig (envelope-from ); Tue, 22 Jul 2025 14:06:37 +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: 155a89e4-6705-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193197; 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=hwQcdaQXyhmu4Exu8gwLl3uTdn0YZ/pu3cUIggmc++Q=; b=FyCpdLbx9XzAC3pneFkfuxAX4pxfzsrpMBDnjScuz/WoSxdV8dgHaBJf5RDtbFaF6yb7vE m37BjeblLil6eOpEn7eADTMBPOexJXwLeIeYwYyhneJTKVJn4au7ZEI/EZKu9mAxpr7uEc rHx5oj2N1JZG2pEqHK+dE3xQ4W9SWWk= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193197; 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=hwQcdaQXyhmu4Exu8gwLl3uTdn0YZ/pu3cUIggmc++Q=; b=FyCpdLbx9XzAC3pneFkfuxAX4pxfzsrpMBDnjScuz/WoSxdV8dgHaBJf5RDtbFaF6yb7vE m37BjeblLil6eOpEn7eADTMBPOexJXwLeIeYwYyhneJTKVJn4au7ZEI/EZKu9mAxpr7uEc rHx5oj2N1JZG2pEqHK+dE3xQ4W9SWWk= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 1/7] tools/libs/store: add get- and set-feature related functions Date: Tue, 22 Jul 2025 16:06:22 +0200 Message-ID: <20250722140628.28947-2-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250722140628.28947-1-jgross@suse.com> References: <20250722140628.28947-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.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)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753193221560116600 Content-Type: text/plain; charset="utf-8" Add functions for getting and setting Xenstore features to libxenstore: xs_get_features_supported(): return the features supported by the running Xenstore implementation as defined in xs_wire.h via the XENSTORE_SERVER_FEATURE_* macros. xs_get_features_domain(): return the features offered for a specific domain. xs_set_features_domain(): set the features available for a specific domain. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/include/xenstore.h | 13 +++++++++ tools/libs/store/Makefile | 2 +- tools/libs/store/libxenstore.map | 6 ++++ tools/libs/store/xs.c | 49 ++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/tools/include/xenstore.h b/tools/include/xenstore.h index a442252849..423422dc50 100644 --- a/tools/include/xenstore.h +++ b/tools/include/xenstore.h @@ -264,6 +264,19 @@ bool xs_path_is_subpath(const char *parent, const char= *child); */ bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid); =20 +/* Get the features supported by Xenstore. + * Returned as a bitmap of XENSTORE_SERVER_FEATURE_* values. + */ +bool xs_get_features_supported(struct xs_handle *h, unsigned int *features= ); + +/* Get the features available for a given domain. */ +bool xs_get_features_domain(struct xs_handle *h, unsigned int domid, + unsigned int *features); + +/* Set the features available for a given domain. */ +bool xs_set_features_domain(struct xs_handle *h, unsigned int domid, + unsigned int features); + char *xs_control_command(struct xs_handle *h, const char *cmd, void *data, unsigned int len); /* Deprecated: use xs_control_command() instead. */ diff --git a/tools/libs/store/Makefile b/tools/libs/store/Makefile index 0649cf8307..fed43b0008 100644 --- a/tools/libs/store/Makefile +++ b/tools/libs/store/Makefile @@ -2,7 +2,7 @@ XEN_ROOT=3D$(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk =20 MAJOR =3D 4 -MINOR =3D 0 +MINOR =3D 1 version-script :=3D libxenstore.map =20 ifeq ($(CONFIG_Linux),y) diff --git a/tools/libs/store/libxenstore.map b/tools/libs/store/libxenstor= e.map index 7e6c7bdd30..cd9df86749 100644 --- a/tools/libs/store/libxenstore.map +++ b/tools/libs/store/libxenstore.map @@ -39,3 +39,9 @@ VERS_4.0 { xs_strings_to_perms; local: *; /* Do not expose anything by default */ }; +VERS_4.1 { + global: + xs_get_features_supported; + xs_get_features_domain; + xs_set_features_domain; +} VERS_4.0; diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c index cf3266807f..8f4b90a3cf 100644 --- a/tools/libs/store/xs.c +++ b/tools/libs/store/xs.c @@ -1407,6 +1407,55 @@ out: return port; } =20 +static bool xs_uint(char *reply, unsigned int *uintval) +{ + if (!reply) + return false; + + *uintval =3D strtoul(reply, NULL, 10); + free(reply); + + return true; +} + +bool xs_get_features_supported(struct xs_handle *h, unsigned int *features) +{ + struct xsd_sockmsg msg =3D { .type =3D XS_GET_FEATURE }; + struct iovec iov[1]; + + iov[0].iov_base =3D &msg; + iov[0].iov_len =3D sizeof(msg); + + return xs_uint(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL), features); +} + +bool xs_get_features_domain(struct xs_handle *h, unsigned int domid, + unsigned int *features) +{ + return xs_uint(single_with_domid(h, XS_GET_FEATURE, domid), features); +} + +bool xs_set_features_domain(struct xs_handle *h, unsigned int domid, + unsigned int features) +{ + struct xsd_sockmsg msg =3D { .type =3D XS_SET_FEATURE }; + char domid_str[MAX_STRLEN(domid)]; + char feat_str[MAX_STRLEN(features)]; + struct iovec iov[3]; + + snprintf(domid_str, sizeof(domid_str), "%u", domid); + snprintf(feat_str, sizeof(feat_str), "%u", features); + + iov[0].iov_base =3D &msg; + iov[0].iov_len =3D sizeof(msg); + iov[1].iov_base =3D domid_str; + iov[1].iov_len =3D strlen(domid_str) + 1; + iov[2].iov_base =3D feat_str; + iov[2].iov_len =3D strlen(feat_str) + 1; + + return xs_bool(xs_talkv(h, iov, ARRAY_SIZE(iov), NULL)); +} + char *xs_control_command(struct xs_handle *h, const char *cmd, void *data, unsigned int len) { --=20 2.43.0 From nobody Thu Oct 30 23:19:48 2025 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=1753193223; cv=none; d=zohomail.com; s=zohoarc; b=T0YBN2FTs/xJAnoOytfraqCajUqJ367ij9/4j2det86e1PflYwK/C35dGEtW3XqbPMlv30opRA5HeYjCzuA/rSULC5ydAgjWW/Nxz8/B9obWPLk73a/3h+ei6LqXuwe5kN2R0BqtqRqofXHy8NmukZrJsY2YH8kkAQcbwXW3B3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753193223; 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=5S7Qg1LGvq/pUj1Ya9/F/1uS3SdxtLh457+cNjBlml8=; b=f+BkxqrhKJZSobS4bQw1lRX7C7xvTui6tKvPkx/edmhaQpYzD9NrHfZfwupYmXX0TNCSGRd/eEh8XEFo04lXl5cKwKayzSfz/nSrGmzNdzLjOxe21cYdfaiMbUnLruSnceiU5U/j5coUa8dol3eEQlnOZPP7T86vVNa78b70TVo= 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 1753193223411624.5672894824852; Tue, 22 Jul 2025 07:07:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1052675.1421431 (Exim 4.92) (envelope-from ) id 1ueDdo-0005gk-L3; Tue, 22 Jul 2025 14:06:48 +0000 Received: by outflank-mailman (output) from mailman id 1052675.1421431; Tue, 22 Jul 2025 14:06:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDdo-0005gb-I8; Tue, 22 Jul 2025 14:06:48 +0000 Received: by outflank-mailman (input) for mailman id 1052675; Tue, 22 Jul 2025 14:06:46 +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 1ueDdm-0005C5-P9 for xen-devel@lists.xenproject.org; Tue, 22 Jul 2025 14:06:46 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 199eca69-6705-11f0-b894-0df219b8e170; Tue, 22 Jul 2025 16:06:45 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out1.suse.de (Postfix) with ESMTPS id 4565C21229; Tue, 22 Jul 2025 14:06:43 +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 1B9FF13A32; Tue, 22 Jul 2025 14:06:43 +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 k20sBfOaf2jDIAAAD6G6ig (envelope-from ); Tue, 22 Jul 2025 14:06:43 +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: 199eca69-6705-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193203; 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=5S7Qg1LGvq/pUj1Ya9/F/1uS3SdxtLh457+cNjBlml8=; b=gx6dGARC0d9w92mQ20qLwpsJZInLbE9yuB6akh8MccTr18aQxGdgBwIR5okQCO+LKMssU+ FLXzFR29P8sY76fEgCqRbHS6/RAfBIu4S3HCo4QH9H8Udjm04wXbetcR+A5aRwn1i+8b3p z8p+bBbIImkiwmtfcuOqzqpKhJh+Oog= Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=gx6dGARC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193203; 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=5S7Qg1LGvq/pUj1Ya9/F/1uS3SdxtLh457+cNjBlml8=; b=gx6dGARC0d9w92mQ20qLwpsJZInLbE9yuB6akh8MccTr18aQxGdgBwIR5okQCO+LKMssU+ FLXzFR29P8sY76fEgCqRbHS6/RAfBIu4S3HCo4QH9H8Udjm04wXbetcR+A5aRwn1i+8b3p z8p+bBbIImkiwmtfcuOqzqpKhJh+Oog= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 2/7] tools/xenstored: support specification of migration stream version Date: Tue, 22 Jul 2025 16:06:23 +0200 Message-ID: <20250722140628.28947-3-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250722140628.28947-1-jgross@suse.com> References: <20250722140628.28947-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Queue-Id: 4565C21229 X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.com:+] X-Spam-Score: -3.01 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753193224789116600 Content-Type: text/plain; charset="utf-8" In order to prepare xenstored supporting migration stream versions other than 1, add a parameter to the live update command allowing to specify the version of the migration stream. This will allow going back from xenstored using version 2 per default to a xenstored only accepting version 1. For now only version 1 is supported. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/control.c | 6 ++--- tools/xenstored/lu.c | 21 ++++++++++----- tools/xenstored/lu.h | 1 + tools/xs-clients/xenstore_control.c | 41 ++++++++++++++++++++++------- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/tools/xenstored/control.c b/tools/xenstored/control.c index 9561289179..953c01b735 100644 --- a/tools/xenstored/control.c +++ b/tools/xenstored/control.c @@ -289,7 +289,7 @@ static struct cmd_s cmds[] =3D { * Mini-OS: -b * -d (multiple of those) * 2. New command-line (optional): -c - * 3. Start of update: -s [-F] [-t ] + * 3. Start of update: -s [-F] [-t ] [-v ] * Any sub-operation needs to respond with the string "OK" in case * of success, any other response indicates failure. * A started live-update sequence can be aborted via "-a" (not @@ -297,8 +297,8 @@ static struct cmd_s cmds[] =3D { * sub-operation). */ { "live-update", do_control_lu, - "[-c ] [-F] [-t ] \n" - " Default timeout is 60 seconds.", 5 }, + "[-c ] [-F] [-t ] [-v ] \n" + " Default timeout is 60 seconds, default version is 1.", 7 }, #endif { "logfile", do_control_logfile, "" }, { "memreport", do_control_memreport, "[]" }, diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c index 4fccbbc195..330820a8a2 100644 --- a/tools/xenstored/lu.c +++ b/tools/xenstored/lu.c @@ -283,7 +283,7 @@ static const char *lu_dump_state(const void *ctx, struc= t connection *conn) return "Dump state open error"; =20 memcpy(pre.ident, XS_STATE_IDENT, sizeof(pre.ident)); - pre.version =3D htobe32(XS_STATE_VERSION); + pre.version =3D htobe32(lu_status->version); pre.flags =3D XS_STATE_FLAGS; if (fwrite(&pre, sizeof(pre), 1, fp) !=3D 1) { ret =3D "Dump write error"; @@ -412,13 +412,16 @@ static bool do_lu_start(struct delayed_request *req) } =20 static const char *lu_start(const void *ctx, struct connection *conn, - bool force, unsigned int to) + bool force, unsigned int to, unsigned int vers) { syslog(LOG_INFO, "live-update: start, force=3D%d, to=3D%u\n", force, to); =20 if (!lu_status || lu_status->conn !=3D conn) return "Not in live-update session."; =20 + if (!vers || vers > XS_STATE_VERSION) + return "Migration stream version not supported."; + #ifdef __MINIOS__ if (lu_status->kernel_size !=3D lu_status->kernel_off) return "Kernel not complete."; @@ -426,6 +429,7 @@ static const char *lu_start(const void *ctx, struct con= nection *conn, =20 lu_status->force =3D force; lu_status->timeout =3D to; + lu_status->version =3D vers; lu_status->started_at =3D time(NULL); lu_status->in =3D conn->in; =20 @@ -441,6 +445,7 @@ int do_control_lu(const void *ctx, struct connection *c= onn, const char **vec, unsigned int i; bool force =3D false; unsigned int to =3D 0; + unsigned int vers =3D XS_STATE_VERSION; =20 if (num < 1) return EINVAL; @@ -457,15 +462,19 @@ int do_control_lu(const void *ctx, struct connection = *conn, const char **vec, return EINVAL; } else if (!strcmp(vec[0], "-s")) { for (i =3D 1; i < num; i++) { - if (!strcmp(vec[i], "-F")) + if (!strcmp(vec[i], "-F")) { force =3D true; - else if (!strcmp(vec[i], "-t") && i < num - 1) { + } else if (!strcmp(vec[i], "-t") && i < num - 1) { i++; to =3D atoi(vec[i]); - } else + } else if (!strcmp(vec[i], "-v") && i < num - 1) { + i++; + vers =3D atoi(vec[i]); + } else { return EINVAL; + } } - ret =3D lu_start(ctx, conn, force, to); + ret =3D lu_start(ctx, conn, force, to, vers); if (!ret) return errno; } else { diff --git a/tools/xenstored/lu.h b/tools/xenstored/lu.h index dacc9b6e42..512b8a6db2 100644 --- a/tools/xenstored/lu.h +++ b/tools/xenstored/lu.h @@ -26,6 +26,7 @@ struct live_update { /* Start parameters. */ bool force; unsigned int timeout; + unsigned int version; time_t started_at; }; =20 diff --git a/tools/xs-clients/xenstore_control.c b/tools/xs-clients/xenstor= e_control.c index 548363ee70..4b523931ce 100644 --- a/tools/xs-clients/xenstore_control.c +++ b/tools/xs-clients/xenstore_control.c @@ -26,7 +26,8 @@ static int add_to_buf(char **buf, const char *val, int le= n) return len + vallen; } =20 -static int live_update_start(struct xs_handle *xsh, bool force, unsigned i= nt to) +static int live_update_start(struct xs_handle *xsh, bool force, unsigned i= nt to, + unsigned int vers) { int len =3D 0; char *buf =3D NULL, *ret; @@ -40,6 +41,15 @@ static int live_update_start(struct xs_handle *xsh, bool= force, unsigned int to) free(ret); if (force) len =3D add_to_buf(&buf, "-F", len); + if (vers) { + if (asprintf(&ret, "%u", vers) < 0) { + free(buf); + return 1; + } + len =3D add_to_buf(&buf, "-v", len); + len =3D add_to_buf(&buf, ret, len); + free(ret); + } if (len < 0) return 1; =20 @@ -197,7 +207,8 @@ static int send_kernel_blob(struct xs_handle *xsh, cons= t char *binary) * 3. start update (includes flags) */ static int live_update_stubdom(struct xs_handle *xsh, const char *binary, - const char *cmdline, bool force, unsigned i= nt to) + const char *cmdline, bool force, unsigned i= nt to, + unsigned int vers) { int rc; =20 @@ -211,7 +222,7 @@ static int live_update_stubdom(struct xs_handle *xsh, c= onst char *binary, goto abort; } =20 - rc =3D live_update_start(xsh, force, to); + rc =3D live_update_start(xsh, force, to, vers); if (rc) goto abort; =20 @@ -231,7 +242,8 @@ static int live_update_stubdom(struct xs_handle *xsh, c= onst char *binary, * 3. start update (includes flags) */ static int live_update_daemon(struct xs_handle *xsh, const char *binary, - const char *cmdline, bool force, unsigned in= t to) + const char *cmdline, bool force, unsigned in= t to, + unsigned int vers) { int len =3D 0, rc; char *buf =3D NULL, *ret; @@ -256,7 +268,7 @@ static int live_update_daemon(struct xs_handle *xsh, co= nst char *binary, goto abort; } =20 - rc =3D live_update_start(xsh, force, to); + rc =3D live_update_start(xsh, force, to, vers); if (rc) goto abort; =20 @@ -270,7 +282,7 @@ static int live_update_daemon(struct xs_handle *xsh, co= nst char *binary, static int live_update(struct xs_handle *xsh, int argc, char **argv) { int rc =3D 0; - unsigned int i, to =3D 60; + unsigned int i, to =3D 60, vers =3D 0; char *binary =3D NULL, *cmdline =3D NULL, *val; bool force =3D false; =20 @@ -291,10 +303,19 @@ static int live_update(struct xs_handle *xsh, int arg= c, char **argv) goto out; } to =3D atoi(argv[i]); - } else if (!strcmp(argv[i], "-F")) + } else if (!strcmp(argv[i], "-F")) { force =3D true; - else + } else if (!strcmp(argv[i], "-v")) { + i++; + if (i =3D=3D argc) { + fprintf(stderr, "Missing version value\n"); + rc =3D 2; + goto out; + } + vers =3D atoi(argv[i]); + } else { binary =3D argv[i]; + } } =20 if (!binary) { @@ -305,9 +326,9 @@ static int live_update(struct xs_handle *xsh, int argc,= char **argv) =20 val =3D xs_read(xsh, XBT_NULL, "/tool/xenstored/domid", &i); if (val) - rc =3D live_update_stubdom(xsh, binary, cmdline, force, to); + rc =3D live_update_stubdom(xsh, binary, cmdline, force, to, vers); else - rc =3D live_update_daemon(xsh, binary, cmdline, force, to); + rc =3D live_update_daemon(xsh, binary, cmdline, force, to, vers); =20 free(val); =20 --=20 2.43.0 From nobody Thu Oct 30 23:19:48 2025 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=1753193229; cv=none; d=zohomail.com; s=zohoarc; b=lh1hJH4Jb2F3UEC+cMCubVsSNBKwKPlF1AEsG+ciH3bKhzmzEf77XpkEsDH1n5lU8325oVFmAJEQZ+ZVtj/qInvLfR1jsc5TE9bu5FxtAlR1adR+8wjYFv6f7l9XZ93SH7yNcdRQ9u8pGswFFj/wx/e/nxNfd8AhaxNHEWFEz78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753193229; 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=cHyKMn6rOLYAADn9LvneZqj8E2CBWyfa2mbQTELxNcU=; b=F5IDtPEeZVxO15bif47m72uUkTOBfQpNtm50JsDJEbZkBtUxl+l/5uK46OTGqve5r2wp7A4h+6lQ/0izbAtsQk/2tnzb7CI1/U9xn3uLNaWK0+2Dk60YjVQ3gaYbo4OxrgA5Z8ovKO8LngEumcbyWGPoNh8xHilqqxk1WG4G+0k= 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 1753193229146353.5831386932206; Tue, 22 Jul 2025 07:07:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1052676.1421442 (Exim 4.92) (envelope-from ) id 1ueDds-0005zd-Uk; Tue, 22 Jul 2025 14:06:52 +0000 Received: by outflank-mailman (output) from mailman id 1052676.1421442; Tue, 22 Jul 2025 14:06:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDds-0005zQ-QF; Tue, 22 Jul 2025 14:06:52 +0000 Received: by outflank-mailman (input) for mailman id 1052676; Tue, 22 Jul 2025 14:06:50 +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 1ueDdq-0005C5-L4 for xen-devel@lists.xenproject.org; Tue, 22 Jul 2025 14:06:50 +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 1bf6ec80-6705-11f0-b894-0df219b8e170; Tue, 22 Jul 2025 16:06:49 +0200 (CEST) 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 D91C61F7D7; Tue, 22 Jul 2025 14:06:48 +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 A464213A32; Tue, 22 Jul 2025 14:06:48 +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 qrjEJviaf2jHIAAAD6G6ig (envelope-from ); Tue, 22 Jul 2025 14:06:48 +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: 1bf6ec80-6705-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193208; 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=cHyKMn6rOLYAADn9LvneZqj8E2CBWyfa2mbQTELxNcU=; b=Dmv3VVzeTB3OE3YQHEHPs6sQ7y67dff0D3hErkj3eOH8LJGbyEj03LlmPP4bSLIqmus+S7 Bw4f0VMQns6JjfJg7paQ2zHEzyp2PjvKPxHb/aBRvkps7hXQSiWQCOWjOiYCm05Z7xd9+v MzzHDy4wd7dG1+G64HLeTy8gdtb69Mw= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193208; 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=cHyKMn6rOLYAADn9LvneZqj8E2CBWyfa2mbQTELxNcU=; b=Dmv3VVzeTB3OE3YQHEHPs6sQ7y67dff0D3hErkj3eOH8LJGbyEj03LlmPP4bSLIqmus+S7 Bw4f0VMQns6JjfJg7paQ2zHEzyp2PjvKPxHb/aBRvkps7hXQSiWQCOWjOiYCm05Z7xd9+v MzzHDy4wd7dG1+G64HLeTy8gdtb69Mw= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 3/7] tools/xenstored: add missing migration record definitions Date: Tue, 22 Jul 2025 16:06:24 +0200 Message-ID: <20250722140628.28947-4-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250722140628.28947-1-jgross@suse.com> References: <20250722140628.28947-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.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)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753193230583116600 Content-Type: text/plain; charset="utf-8" Add all the missing migration record structures and defines to the xenstore_state.h header file. Update the version of the migration stream to "2". In order to allow receiving version 1 streams, change the version check of the header to reject only streams with a version higher than the current known one. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/control.c | 2 +- tools/xenstored/lu.c | 2 +- tools/xenstored/xenstore_state.h | 31 ++++++++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/tools/xenstored/control.c b/tools/xenstored/control.c index 953c01b735..2611a6fade 100644 --- a/tools/xenstored/control.c +++ b/tools/xenstored/control.c @@ -298,7 +298,7 @@ static struct cmd_s cmds[] =3D { */ { "live-update", do_control_lu, "[-c ] [-F] [-t ] [-v ] \n" - " Default timeout is 60 seconds, default version is 1.", 7 }, + " Default timeout is 60 seconds, default version is 2.", 7 }, #endif { "logfile", do_control_logfile, "" }, { "memreport", do_control_memreport, "[]" }, diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c index 330820a8a2..2c6adecb56 100644 --- a/tools/xenstored/lu.c +++ b/tools/xenstored/lu.c @@ -136,7 +136,7 @@ void lu_read_state(void) =20 pre =3D state.buf; if (memcmp(pre->ident, XS_STATE_IDENT, sizeof(pre->ident)) || - pre->version !=3D htobe32(XS_STATE_VERSION) || + !pre->version || be32toh(pre->version) > XS_STATE_VERSION || pre->flags !=3D XS_STATE_FLAGS) barf("Unknown record identifier"); for (head =3D state.buf + sizeof(*pre); diff --git a/tools/xenstored/xenstore_state.h b/tools/xenstored/xenstore_st= ate.h index bad966caf4..3fd97d60d8 100644 --- a/tools/xenstored/xenstore_state.h +++ b/tools/xenstored/xenstore_state.h @@ -27,8 +27,10 @@ #ifndef htobe32 #if __BYTE_ORDER =3D=3D __LITTLE_ENDIAN #define htobe32(x) __builtin_bswap32(x) +#define be32toh(x) __builtin_bswap32(x) #else #define htobe32(x) (x) +#define be32toh(x) (x) #endif #endif =20 @@ -36,7 +38,7 @@ struct xs_state_preamble { char ident[8]; #define XS_STATE_IDENT "xenstore" /* To be used without the NUL byte. = */ uint32_t version; /* Version in big endian format. */ -#define XS_STATE_VERSION 0x00000001 +#define XS_STATE_VERSION 0x00000002 uint32_t flags; /* Endianess. */ #if __BYTE_ORDER =3D=3D __LITTLE_ENDIAN #define XS_STATE_FLAGS 0x00000000 /* Little endian. */ @@ -59,6 +61,9 @@ struct xs_state_record_header { #define XS_STATE_TYPE_WATCH 0x00000003 #define XS_STATE_TYPE_TA 0x00000004 #define XS_STATE_TYPE_NODE 0x00000005 +#define XS_STATE_TYPE_GLB_QUOTA 0x00000006 +#define XS_STATE_TYPE_DOMAIN 0x00000007 +#define XS_STATE_TYPE_WATCH_EXT 0x00000008 uint32_t length; /* Length of record in bytes. */ }; =20 @@ -98,6 +103,15 @@ struct xs_state_watch { uint8_t data[]; /* Path bytes, token bytes, 0-7 pad bytes. */ }; =20 +struct xs_state_watch_ext { + uint32_t conn_id; /* Connection this watch is associated with. */ + uint16_t path_length; /* Number of bytes of path watched (incl. 0). = */ + uint16_t token_length; /* Number of bytes of watch token (incl. 0). */ + uint16_t depth; /* Number of directory levels below watched pa= th */ + /* to consider for a match. */ + uint8_t data[]; /* Path bytes, token bytes, 0-7 pad bytes. */ +}; + /* Transaction: */ struct xs_state_transaction { uint32_t conn_id; /* Connection this TA is associated with. */ @@ -129,4 +143,19 @@ struct xs_state_node { struct xs_state_node_perm perms[]; /* Path and data follows, plus 0-7 pad bytes. */ }; + +/* Global quota data: */ +struct xs_state_glb_quota { + uint16_t n_dom_quota; /* Number of quota values applying to domains.= */ + uint16_t n_glob_quota; /* Number of quota values applying globally on= ly. */ + uint32_t quota_val[]; /* Array of quota values (domain ones first). = */ +}; + +/* Domain data: */ +struct xs_state_domain { + uint16_t domain_id; /* Domain-id identifying the domain. */ + uint16_t n_quota; /* Number of quota values. */ + uint32_t features; /* Server features available to the domain. */ + uint32_t quota_val[]; /* Array of quota values. */ +}; #endif /* XENSTORE_STATE_H */ --=20 2.43.0 From nobody Thu Oct 30 23:19:48 2025 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=1753193229; cv=none; d=zohomail.com; s=zohoarc; b=nzcp6rFQQIkumGQfiu8t4kg5hrp9qMt75TcBZM2qFvXdpwvJ69O/qJLYgmt5oEYHYwDn/kRCgDvmGUR+yrd16C9WGMh/Rh1rVKsSJqfvI3KtD5bv8I10zw7lJepWkEMU+rxLdIOpSRAC/xrcPKi9VigBfHvN47IHp1l4N2VktFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753193229; 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=B+pnubiHLokeHTW3xbY/TG9p1Ppm+ryNYXGgRmriBO8=; b=a9h0tWeCNIqVB5D7AncJITQPfBNjYmdAwE34RC9OP5Kmgo9kmp1VUQujEIalKn9ia4UAAPuz7SHfIW0d7wTD3WkI0iTH3nE9DsItVBifT5ok3/bAwEDp6eCXV5BySs1c/EG8Dmcw9UL2bRAxKm3E/HMTxD00hlPZNEVDu+/36A4= 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 1753193229915203.11828272378182; Tue, 22 Jul 2025 07:07:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1052679.1421451 (Exim 4.92) (envelope-from ) id 1ueDdw-0006K3-A5; Tue, 22 Jul 2025 14:06:56 +0000 Received: by outflank-mailman (output) from mailman id 1052679.1421451; Tue, 22 Jul 2025 14:06:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDdw-0006Ju-6N; Tue, 22 Jul 2025 14:06:56 +0000 Received: by outflank-mailman (input) for mailman id 1052679; Tue, 22 Jul 2025 14:06:55 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDdv-0005Q3-Jl for xen-devel@lists.xenproject.org; Tue, 22 Jul 2025 14:06:55 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [2a07:de40:b251:101:10:150:64:2]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1f57ea69-6705-11f0-a31d-13f23c93f187; Tue, 22 Jul 2025 16:06:54 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 664861F7D7; Tue, 22 Jul 2025 14:06:54 +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 3B7F213A32; Tue, 22 Jul 2025 14:06:54 +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 ssoIDf6af2jOIAAAD6G6ig (envelope-from ); Tue, 22 Jul 2025 14:06:54 +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: 1f57ea69-6705-11f0-a31d-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193214; 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=B+pnubiHLokeHTW3xbY/TG9p1Ppm+ryNYXGgRmriBO8=; b=cZovKy+Bg7L53o5DrER1doBiTrv9qHbR2BCaV2HiQgxjD8a+Pq0Y7zAHRO4mPrA+dhI3Im yj+uIonIXgMPGUmZZKGgkGB4iJ1AdXAFsQxSsRs5pQRrd6oT/Pwy8ZT27uGk1lEDsmhFIU vGrKv305mZqiXcYFhcZAg2tF84bcc3Y= Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=cZovKy+B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193214; 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=B+pnubiHLokeHTW3xbY/TG9p1Ppm+ryNYXGgRmriBO8=; b=cZovKy+Bg7L53o5DrER1doBiTrv9qHbR2BCaV2HiQgxjD8a+Pq0Y7zAHRO4mPrA+dhI3Im yj+uIonIXgMPGUmZZKGgkGB4iJ1AdXAFsQxSsRs5pQRrd6oT/Pwy8ZT27uGk1lEDsmhFIU vGrKv305mZqiXcYFhcZAg2tF84bcc3Y= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 4/7] tools/xenstored: add server feature support Date: Tue, 22 Jul 2025 16:06:25 +0200 Message-ID: <20250722140628.28947-5-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250722140628.28947-1-jgross@suse.com> References: <20250722140628.28947-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.com:+] X-Spam-Flag: NO X-Spam-Level: X-Rspamd-Queue-Id: 664861F7D7 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753193230752116600 Content-Type: text/plain; charset="utf-8" Add per domain server features, which are initialized by the supported features at domain introduction, or by live update from the migration stream. This requires to add the DOMAIN_DATA record to the migration stream, but for now it will only contain the feature word. Advertise the Xenstore features to guests by setting the appropriate bits in the ring page. Signed-off-by: Juergen Gross --- tools/xenstored/domain.c | 71 ++++++++++++++++++++++++++++++++++++---- tools/xenstored/domain.h | 3 ++ tools/xenstored/lu.c | 14 ++++++-- tools/xenstored/lu.h | 2 +- 4 files changed, 80 insertions(+), 10 deletions(-) diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c index e1d5e8d614..f6d24bc13a 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -32,6 +32,7 @@ #include "transaction.h" #include "watch.h" #include "control.h" +#include "lu.h" =20 #include #include @@ -42,6 +43,8 @@ #include #endif =20 +#define XENSTORE_FEATURES XENSTORE_SERVER_FEATURE_ERROR + static xenmanage_handle *xm_handle; xengnttab_handle **xgt_handle; static evtchn_port_t virq_port; @@ -115,6 +118,9 @@ struct domain /* Event channel port */ evtchn_port_t port; =20 + /* Server features supported for this domain. */ + unsigned int features; + /* Domain path in store. */ char *path; =20 @@ -799,6 +805,7 @@ static struct domain *alloc_domain(const void *context,= unsigned int domid, domain->unique_id =3D unique_id; domain->generation =3D generation; domain->introduced =3D false; + domain->features =3D XENSTORE_FEATURES; =20 if (hashtable_add(domhash, &domain->domid, domain)) { talloc_free(domain); @@ -992,7 +999,8 @@ void ignore_connection(struct connection *conn, unsigne= d int err) { trace("CONN %p ignored, reason %u\n", conn, err); =20 - if (conn->domain && conn->domain->interface) + if (conn->domain && conn->domain->interface && + (conn->domain->features & XENSTORE_SERVER_FEATURE_ERROR)) conn->domain->interface->error =3D err; =20 conn->is_ignored =3D true; @@ -1078,11 +1086,14 @@ int do_introduce(const void *ctx, struct connection= *conn, =20 domain_conn_reset(domain); =20 - if (domain->interface !=3D NULL && - domain->interface->connection =3D=3D XENSTORE_RECONNECT) { - /* Notify the domain that xenstore is available */ - domain->interface->connection =3D XENSTORE_CONNECTED; - xenevtchn_notify(xce_handle, domain->port); + if (domain->interface !=3D NULL) { + domain->interface->server_features =3D domain->features; + + if (domain->interface->connection =3D=3D XENSTORE_RECONNECT) { + /* Notify the domain that xenstore is available */ + domain->interface->connection =3D XENSTORE_CONNECTED; + xenevtchn_notify(xce_handle, domain->port); + } } =20 send_ack(conn, XS_INTRODUCE); @@ -1849,6 +1860,54 @@ void read_state_connection(const void *ctx, const vo= id *state) } } =20 +static int dump_state_domain(const void *k, void *v, void *arg) +{ + struct domain *domain =3D v; + FILE *fp =3D arg; + struct xs_state_domain sd; + struct xs_state_record_header head; + + head.type =3D XS_STATE_TYPE_DOMAIN; + head.length =3D sizeof(sd); + memset(&sd, 0, sizeof(sd)); + sd.domain_id =3D domain->domid; + + if (lu_status->version > 1) + sd.features =3D domain->features; + + if (fwrite(&head, sizeof(head), 1, fp) !=3D 1) + return 1; + if (fwrite(&sd, sizeof(sd), 1, fp) !=3D 1) + return 1; + if (dump_state_align(fp)) + return 1; + + return 0; +} + +const char *dump_state_domains(FILE *fp) +{ + const char *ret =3D NULL; + + if (hashtable_iterate(domhash, dump_state_domain, fp)) + ret =3D "Dump domain error"; + + return ret; +} + +void read_state_domain(const void *ctx, const void *state, unsigned int ve= rsion) +{ + const struct xs_state_domain *sd =3D state; + struct domain *domain; + + domain =3D find_domain_struct(sd->domain_id); + if (!domain) + barf("referenced domain not found"); + + if (version > 1) + domain->features =3D sd->features; +} + struct domain_acc { unsigned int domid; int nodes; diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h index 844ac11510..8bfaca8f90 100644 --- a/tools/xenstored/domain.h +++ b/tools/xenstored/domain.h @@ -162,8 +162,11 @@ void wrl_apply_debit_direct(struct connection *conn); void wrl_apply_debit_trans_commit(struct connection *conn); =20 const char *dump_state_connections(FILE *fp); +const char *dump_state_domains(FILE *fp); =20 void read_state_connection(const void *ctx, const void *state); +void read_state_domain(const void *ctx, const void *state, + unsigned int version); =20 struct hashtable *domain_check_acc_init(void); void domain_check_acc_add(const struct node *node, struct hashtable *domai= ns); diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c index 2c6adecb56..77e0d377c5 100644 --- a/tools/xenstored/lu.c +++ b/tools/xenstored/lu.c @@ -21,6 +21,8 @@ #include "lu.h" #include "watch.h" =20 +struct live_update *lu_status; + #ifndef NO_LIVE_UPDATE =20 struct lu_dump_state { @@ -30,8 +32,6 @@ struct lu_dump_state { char *filename; }; =20 -struct live_update *lu_status; - static int lu_destroy(void *data) { lu_status =3D NULL; @@ -128,6 +128,7 @@ void lu_read_state(void) struct xs_state_record_header *head; void *ctx =3D talloc_new(NULL); /* Work context for subfunctions. */ struct xs_state_preamble *pre; + unsigned int version; =20 syslog(LOG_INFO, "live-update: read state\n"); lu_get_dump_state(&state); @@ -135,8 +136,9 @@ void lu_read_state(void) barf_perror("No state found after live-update"); =20 pre =3D state.buf; + version =3D be32toh(pre->version); if (memcmp(pre->ident, XS_STATE_IDENT, sizeof(pre->ident)) || - !pre->version || be32toh(pre->version) > XS_STATE_VERSION || + !version || version > XS_STATE_VERSION || pre->flags !=3D XS_STATE_FLAGS) barf("Unknown record identifier"); for (head =3D state.buf + sizeof(*pre); @@ -159,6 +161,9 @@ void lu_read_state(void) case XS_STATE_TYPE_NODE: read_state_node(ctx, head + 1); break; + case XS_STATE_TYPE_DOMAIN: + read_state_domain(ctx, head + 1, version); + break; default: xprintf("live-update: unknown state record %08x\n", head->type); @@ -297,6 +302,9 @@ static const char *lu_dump_state(const void *ctx, struc= t connection *conn) if (ret) goto out; ret =3D dump_state_nodes(fp, ctx); + if (ret) + goto out; + ret =3D dump_state_domains(fp); if (ret) goto out; =20 diff --git a/tools/xenstored/lu.h b/tools/xenstored/lu.h index 512b8a6db2..aff7ab9011 100644 --- a/tools/xenstored/lu.h +++ b/tools/xenstored/lu.h @@ -5,7 +5,6 @@ * Copyright (C) 2022 Juergen Gross, SUSE LLC */ =20 -#ifndef NO_LIVE_UPDATE struct live_update { /* For verification the correct connection is acting. */ struct connection *conn; @@ -32,6 +31,7 @@ struct live_update { =20 extern struct live_update *lu_status; =20 +#ifndef NO_LIVE_UPDATE struct connection *lu_get_connection(void); bool lu_is_pending(void); void lu_read_state(void); --=20 2.43.0 From nobody Thu Oct 30 23:19:48 2025 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=1753193243; cv=none; d=zohomail.com; s=zohoarc; b=Ukwkyi+KIsdu79o0b6HjGVmCpUgIGXAtKN7wRGk/bBYic2RSTfDHRa6Ab82Gt4mLKKdpSTW1+F0McVDBowDGbE8Z3sjp2A9GKlimgddVQgKuBGR3culs16XfbSqZ2bSMQVBEWNsRV3lbkYcztyGuLsVixidRY3ULHg+zoibH7J8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753193243; 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=UEcsRHIDGTA5aOeJJG/B8yR+BciXZq054xn8sSP9ApI=; b=W198nm1zq50S4gSHVyQ22cr8VR2y6tm1ZEC4ukrYbw0VLVwZwAMUz+YG7S1x35+60djDFfl3qI8dGl0ozT8gR/21A4Mubf+d26L2Xe+IGJ9P/hpI0vmSimtaVYWwshpboX4hiOh41wjl3RBa+Wv545x3xARsMkXPBq3vNd+XGN0= 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 1753193243460736.7950955676647; Tue, 22 Jul 2025 07:07:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1052683.1421461 (Exim 4.92) (envelope-from ) id 1ueDe2-0006nF-Jd; Tue, 22 Jul 2025 14:07:02 +0000 Received: by outflank-mailman (output) from mailman id 1052683.1421461; Tue, 22 Jul 2025 14:07:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDe2-0006mz-Ee; Tue, 22 Jul 2025 14:07:02 +0000 Received: by outflank-mailman (input) for mailman id 1052683; Tue, 22 Jul 2025 14:07:01 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDe1-0005Q3-0i for xen-devel@lists.xenproject.org; Tue, 22 Jul 2025 14:07:01 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 22b44331-6705-11f0-a31d-13f23c93f187; Tue, 22 Jul 2025 16:07:00 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out1.suse.de (Postfix) with ESMTPS id F021C211A8; Tue, 22 Jul 2025 14:06:59 +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 C68F013A32; Tue, 22 Jul 2025 14:06:59 +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 ktrtLgObf2jTIAAAD6G6ig (envelope-from ); Tue, 22 Jul 2025 14:06:59 +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: 22b44331-6705-11f0-a31d-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193220; 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=UEcsRHIDGTA5aOeJJG/B8yR+BciXZq054xn8sSP9ApI=; b=e0l5xblAWqYqqgs4NpIozYs553ooN/tLVfq4OpQxZfac/F0yGAVGFVCcLfu39DA0XlUzBQ VABDYnSyUetijL9Jfibv+Mz7+yTZqUjoROE9KNL/xuSd7FusaU8VdUxOF3Q62OzBDpf3G/ 8u5iL1BL67ZqU6nIxBJmrLIXKd5iW3s= Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=gwXXJlJc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193219; 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=UEcsRHIDGTA5aOeJJG/B8yR+BciXZq054xn8sSP9ApI=; b=gwXXJlJcCAkY+2EOyJlF9cS3bQwOOAPoYrjcOjiBFmiX6ImkiF2GQR6OBlpdSwiJml771s 0cqUtS+ORIu+HltNbC8zIDUqh2SkuVUB9qlxlGc3t5FyH5S61KBjwcUAKcDA3VuqqUh4G4 IDJhRzEdIgYq95Z8Gx5M3XFz97Ev+V0= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 5/7] tools/xenstored: support SET/GET_FEATURE commands Date: Tue, 22 Jul 2025 16:06:26 +0200 Message-ID: <20250722140628.28947-6-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250722140628.28947-1-jgross@suse.com> References: <20250722140628.28947-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Queue-Id: F021C211A8 X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[suse.com:+] X-Spam-Score: -3.01 X-ZohoMail-DKIM: pass (identity @suse.com) (identity @suse.com) X-ZM-MESSAGEID: 1753193244675116600 Content-Type: text/plain; charset="utf-8" Add support for XS_SET_FEATURE and XS_GET_FEATURE to xenstored. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/core.c | 4 +++ tools/xenstored/domain.c | 60 ++++++++++++++++++++++++++++++++++++++++ tools/xenstored/domain.h | 8 ++++++ 3 files changed, 72 insertions(+) diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c index 37e4dd5a5b..3022efdce1 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -2031,6 +2031,10 @@ static struct { { "SET_TARGET", do_set_target, XS_FLAG_PRIV }, [XS_RESET_WATCHES] =3D { "RESET_WATCHES", do_reset_watches }, [XS_DIRECTORY_PART] =3D { "DIRECTORY_PART", send_directory_part }, + [XS_GET_FEATURE] =3D + { "GET_FEATURE", do_get_feature, XS_FLAG_PRIV }, + [XS_SET_FEATURE] =3D + { "SET_FEATURE", do_set_feature, XS_FLAG_PRIV }, }; =20 static const char *sockmsg_string(enum xsd_sockmsg_type type) diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c index f6d24bc13a..3969b82967 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -1244,6 +1244,66 @@ int do_reset_watches(const void *ctx, struct connect= ion *conn, return 0; } =20 +int do_get_feature(const void *ctx, struct connection *conn, + struct buffered_data *in) +{ + const char *vec[1]; + unsigned int n_args; + unsigned int domid; + const struct domain *domain; + unsigned int features; + char *result; + + n_args =3D get_strings(in, vec, ARRAY_SIZE(vec)); + if (n_args > 1) + return EINVAL; + + if (n_args =3D=3D 1) { + domid =3D atoi(vec[0]); + domain =3D find_or_alloc_existing_domain(domid); + if (!domain) + return ENOENT; + features =3D domain->features; + } else + features =3D XENSTORE_FEATURES; + + result =3D talloc_asprintf(ctx, "%u", features); + if (!result) + return ENOMEM; + + send_reply(conn, XS_GET_FEATURE, result, strlen(result) + 1); + + return 0; +} + +int do_set_feature(const void *ctx, struct connection *conn, + struct buffered_data *in) +{ + const char *vec[2]; + unsigned int domid; + struct domain *domain; + unsigned int features; + + if (get_strings(in, vec, ARRAY_SIZE(vec)) !=3D ARRAY_SIZE(vec)) + return EINVAL; + + domid =3D atoi(vec[0]); + features =3D atoi(vec[1]); + domain =3D find_or_alloc_existing_domain(domid); + if (!domain) + return ENOENT; + if (domain->introduced) + return EBUSY; + if (features & ~XENSTORE_FEATURES) + return EINVAL; + + domain->features =3D features; + + send_ack(conn, XS_SET_FEATURE); + + return 0; +} + static int close_xgt_handle(void *_handle) { xengnttab_close(*(xengnttab_handle **)_handle); diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h index 8bfaca8f90..94481fdcc0 100644 --- a/tools/xenstored/domain.h +++ b/tools/xenstored/domain.h @@ -82,6 +82,14 @@ int do_get_domain_path(const void *ctx, struct connectio= n *conn, int do_reset_watches(const void *ctx, struct connection *conn, struct buffered_data *in); =20 +/* Get global or per domain server features */ +int do_get_feature(const void *ctx, struct connection *conn, + struct buffered_data *in); + +/* Set per domain server features */ +int do_set_feature(const void *ctx, struct connection *conn, + struct buffered_data *in); + void domain_early_init(void); void domain_init(int evtfd); void dom0_init(void); --=20 2.43.0 From nobody Thu Oct 30 23:19:48 2025 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=1753193244; cv=none; d=zohomail.com; s=zohoarc; b=PQ/4oj+4HD/rFvk7TCnRNqUEIIra438ot6CMLr00V/n9alMd4YTSwQYbRoymib9huFQqBGmJRHn4RQDRO4KMjpyBd4W60f9kmmcHWWgDzbvGMsoET1BZW58C8DAFZOcPYiNAY8eAY8GDh0+ixt7YclDbfZrtoOJatE6KeLNAJn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753193244; 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=B/NT+YN68uwOUl+K5/b8we042VJRh3wevpQYOAyTi78=; b=fc0juiEh7Av35/1rvsWhVdK7M0en9HdhHwd5n0OLb/3W7+ix1eG/xe6xUE4j+GqKI6AoPProoCI1m6pqhZwfGQLMALvnCztkz3ShF4BTg8UMRnYQ7qAgbN+N6gp0K34gkHhQKrlK73teNGudxNdQb5vLALbU4X1iKKWnVYzyHFE= 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 1753193244217341.06826454201234; Tue, 22 Jul 2025 07:07:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1052686.1421471 (Exim 4.92) (envelope-from ) id 1ueDe8-0007GV-SE; Tue, 22 Jul 2025 14:07:08 +0000 Received: by outflank-mailman (output) from mailman id 1052686.1421471; Tue, 22 Jul 2025 14:07:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDe8-0007Fn-Nt; Tue, 22 Jul 2025 14:07:08 +0000 Received: by outflank-mailman (input) for mailman id 1052686; Tue, 22 Jul 2025 14:07:07 +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 1ueDe7-0005C5-8Z for xen-devel@lists.xenproject.org; Tue, 22 Jul 2025 14:07:07 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 25e30816-6705-11f0-b894-0df219b8e170; Tue, 22 Jul 2025 16:07:05 +0200 (CEST) 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-out1.suse.de (Postfix) with ESMTPS id 7D78D2118F; Tue, 22 Jul 2025 14:07:05 +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 5AD5013A32; Tue, 22 Jul 2025 14:07:05 +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 m1/BFAmbf2jfIAAAD6G6ig (envelope-from ); Tue, 22 Jul 2025 14:07:05 +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: 25e30816-6705-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193225; 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=B/NT+YN68uwOUl+K5/b8we042VJRh3wevpQYOAyTi78=; b=tj2XCSCoF7iSlRdt76kuJWytEbWZVdCrDW+9EXKCExlNlhg0NyFYnZiw2qbSDUn6TztS54 4gRcs2ouBD8zeiXgkod27DfDU1vq49dXg07bgpQHzd9nbWr02exM6l3E0SrPZ22du/775q GTdmpEUHiu6FXfhRpTsWf67UjTU274k= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193225; 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=B/NT+YN68uwOUl+K5/b8we042VJRh3wevpQYOAyTi78=; b=tj2XCSCoF7iSlRdt76kuJWytEbWZVdCrDW+9EXKCExlNlhg0NyFYnZiw2qbSDUn6TztS54 4gRcs2ouBD8zeiXgkod27DfDU1vq49dXg07bgpQHzd9nbWr02exM6l3E0SrPZ22du/775q GTdmpEUHiu6FXfhRpTsWf67UjTU274k= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Anthony PERARD Subject: [PATCH 6/7] tools/xl: add available Xenstore features to xl info output Date: Tue, 22 Jul 2025 16:06:27 +0200 Message-ID: <20250722140628.28947-7-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250722140628.28947-1-jgross@suse.com> References: <20250722140628.28947-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_THREE(0.00)[3]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Level: X-Spam-Score: -2.80 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753193244666116600 Content-Type: text/plain; charset="utf-8" Add the Xenstore feature value to the output of "xl info" in order to prepare for a future capability to limit Xenstore features visible by a guest. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xl/Makefile | 3 ++- tools/xl/xl_info.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/xl/Makefile b/tools/xl/Makefile index d742e96a5b..ad577cdd70 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -13,6 +13,7 @@ LDFLAGS +=3D $(PTHREAD_LDFLAGS) =20 CFLAGS_XL +=3D $(CFLAGS_libxenlight) CFLAGS_XL +=3D $(CFLAGS_libxenutil) +CFLAGS_XL +=3D $(CFLAGS_libxenstore) CFLAGS_XL +=3D -Wshadow =20 XL_OBJS-$(CONFIG_X86) =3D xl_psr.o @@ -32,7 +33,7 @@ $(XL_OBJS): CFLAGS +=3D -include $(XEN_ROOT)/tools/config= .h # libxl_json.h needs i all: xl =20 xl: $(XL_OBJS) - $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) $(LDLIBS_libxenutil) $(LDLIBS_libxenlig= ht) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS) + $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) $(LDLIBS_libxenutil) $(LDLIBS_libxenlig= ht) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) -lyajl $(APPEND_LDFLAGS) =20 .PHONY: install install: all diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c index 72e87eac46..eb019e3ee9 100644 --- a/tools/xl/xl_info.c +++ b/tools/xl/xl_info.c @@ -28,6 +28,7 @@ #include #include #include +#include =20 #include "xl.h" #include "xl_utils.h" @@ -333,6 +334,25 @@ static void output_topologyinfo(void) return; } =20 +static void output_xenstore_info(void) +{ + struct xs_handle *xsh; + unsigned int features =3D 0; + + xsh =3D xs_open(0); + if (!xsh) { + fprintf(stderr, "xs_open failed.\n"); + return; + } + + /* Ignore error, default to "0" for features. */ + xs_get_features_supported(xsh, &features); + + maybe_printf("xenstore_features : 0x%08x\n", features); + + xs_close(xsh); +} + static void print_info(int numa) { output_nodeinfo(); @@ -345,6 +365,8 @@ static void print_info(int numa) } output_xeninfo(); =20 + output_xenstore_info(); + maybe_printf("xend_config_format : 4\n"); =20 return; --=20 2.43.0 From nobody Thu Oct 30 23:19:48 2025 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=1753193468; cv=none; d=zohomail.com; s=zohoarc; b=Il1XeYtqPFlNIGmG3PF3hAkE66AQbTxamG40BjONBYGyYlF7z3Mn8aUJfLOB5fJ4JIOMxX9YjXcrykvZW4ESe7qdPd82T7j0aSDGsnM53dw8Yfwk4lYoGXXD+pTU6+YeDsaNK6n7XW+WexhaWI3mu8f5P5dl1TJTlPkonh1Hndg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753193468; 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=hwZcuS9kfvPxfgGT0GO7X9E2v0ACjv8kF+BUFgQs7nA=; b=VpQ8G31cizF7wvUz4um5vLNA/RYBHHjlVCIVSlafoa1aU+Ea2UhxEvJqeiEkOCX7s/YGNf6qUvKKKrjrfaBw9z0/cjdAwHlFZMsFXs4R5n8KqrF+t3l0G79VR/jtrZH8AQCZGQHotIlk4+cqnx8DwY3TXlipoEhoBq01vd4IQjA= 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 1753193468371585.7892121446177; Tue, 22 Jul 2025 07:11:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1052719.1421481 (Exim 4.92) (envelope-from ) id 1ueDho-0001lA-CO; Tue, 22 Jul 2025 14:10:56 +0000 Received: by outflank-mailman (output) from mailman id 1052719.1421481; Tue, 22 Jul 2025 14:10:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ueDho-0001jy-6z; Tue, 22 Jul 2025 14:10:56 +0000 Received: by outflank-mailman (input) for mailman id 1052719; Tue, 22 Jul 2025 14:10:54 +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 1ueDeD-0005C5-2A for xen-devel@lists.xenproject.org; Tue, 22 Jul 2025 14:07:13 +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 294e2f95-6705-11f0-b894-0df219b8e170; Tue, 22 Jul 2025 16:07:11 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 1AB681F7D7; Tue, 22 Jul 2025 14:07:11 +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 DF92A13A32; Tue, 22 Jul 2025 14:07:10 +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 HkIaNQ6bf2jjIAAAD6G6ig (envelope-from ); Tue, 22 Jul 2025 14:07:10 +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: 294e2f95-6705-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193231; 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=hwZcuS9kfvPxfgGT0GO7X9E2v0ACjv8kF+BUFgQs7nA=; b=jckq0S8UkGr180XzDPsgAE86gJUUTGVrICvv2V7OeUy6N4ZBVCBIQt8eNQA/FnSNS/jsuj 6QnXisRp3tgzgEfkEIksuBPP0MEOCXHNw3555y9uNCKApZBDG90fTDAUmg2+pDlSkUdypM 2uDk/p8T+IY4n/6mZhSeMHRVMHIs3PE= Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=jckq0S8U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753193231; 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=hwZcuS9kfvPxfgGT0GO7X9E2v0ACjv8kF+BUFgQs7nA=; b=jckq0S8UkGr180XzDPsgAE86gJUUTGVrICvv2V7OeUy6N4ZBVCBIQt8eNQA/FnSNS/jsuj 6QnXisRp3tgzgEfkEIksuBPP0MEOCXHNw3555y9uNCKApZBDG90fTDAUmg2+pDlSkUdypM 2uDk/p8T+IY4n/6mZhSeMHRVMHIs3PE= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Anthony PERARD , Nick Rosbrook , George Dunlap Subject: [PATCH 7/7] tools: allow to limit xenstore features via guest config Date: Tue, 22 Jul 2025 16:06:28 +0200 Message-ID: <20250722140628.28947-8-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250722140628.28947-1-jgross@suse.com> References: <20250722140628.28947-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.com:+] X-Spam-Flag: NO X-Spam-Level: X-Rspamd-Queue-Id: 1AB681F7D7 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753193469994116600 Content-Type: text/plain; charset="utf-8" Add a guest config parameter "xenstore_feature_mask" allowing to limit the Xenstore features the guest can see and use. This can be needed in order to allow migrating a guest to a host running a Xenstore version providing less features than the source host. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- docs/man/xl.cfg.5.pod.in | 36 ++++++++++++++++++++++++++++ tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go | 1 + tools/include/libxl.h | 6 +++++ tools/libs/light/libxl_dom.c | 12 ++++++++++ tools/libs/light/libxl_types.idl | 1 + tools/xl/xl_parse.c | 3 +++ 7 files changed, 61 insertions(+) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 1d122982c6..506f6a3161 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -714,6 +714,42 @@ If this option is not specified then it will default t= o B. =20 =3Dback =20 +=3Dhead3 Xenstore related settings + +=3Dover 4 + +=3Ditem B + +Specify which Xenstore features are visible for the guest. + +This might be needed when a guest should be able to be migrated to a host +running a Xenstore implementation with less features than the one the guest +is created on. + +The visible features are specified via a binary or of the following +values: + +=3Dover 4 + +=3Ditem B<0x00000001> + +Xenstore is capable to reconnect to a guest. + +=3Ditem B<0x00000002> + +Xenstore will present an error value in case it disconnects due to an error +condition. + +=3Dback + +The features supported by the running Xenstore instance can be retireved +via the B command in dom0. + +The default value is B<0xffffffff>, meaning that all possible Xenstore +features are visible by the guest. + +=3Dback + =3Dhead2 Devices =20 The following options define the paravirtual, emulated and physical diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/h= elpers.gen.go index c45df1005f..429aee3950 100644 --- a/tools/golang/xenlight/helpers.gen.go +++ b/tools/golang/xenlight/helpers.gen.go @@ -1174,6 +1174,7 @@ return fmt.Errorf("converting field Vpmu: %v", err) if err :=3D x.TrapUnmappedAccesses.fromC(&xc.trap_unmapped_accesses);err != =3D nil { return fmt.Errorf("converting field TrapUnmappedAccesses: %v", err) } +x.XenstoreFeatureMask =3D uint32(xc.xenstore_feature_mask) =20 return nil} =20 @@ -1708,6 +1709,7 @@ return fmt.Errorf("converting field Vpmu: %v", err) if err :=3D x.TrapUnmappedAccesses.toC(&xc.trap_unmapped_accesses); err != =3D nil { return fmt.Errorf("converting field TrapUnmappedAccesses: %v", err) } +xc.xenstore_feature_mask =3D C.uint32_t(x.XenstoreFeatureMask) =20 return nil } diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/typ= es.gen.go index 61e322f20a..c9ba4d2844 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -607,6 +607,7 @@ Altp2M Altp2MMode VmtraceBufKb int Vpmu Defbool TrapUnmappedAccesses Defbool +XenstoreFeatureMask uint32 } =20 type DomainBuildInfoTypeUnion interface { diff --git a/tools/include/libxl.h b/tools/include/libxl.h index a8704e0268..1d4510506c 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -654,6 +654,12 @@ */ #define LIBXL_HAVE_DT_OVERLAY_DOMAIN 1 =20 +/* + * LIBXL_HAVE_XENSTORE_FEATURE_MASK indicates the presence of + * xenstore_feature_mask in struct libxl_domain_build_info. + */ +#define LIBXL_HAVE_XENSTORE_FEATURE_MASK 1 + /* * libxl memory management * diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c index a61085ca3b..2a7923533f 100644 --- a/tools/libs/light/libxl_dom.c +++ b/tools/libs/light/libxl_dom.c @@ -494,6 +494,18 @@ retry_transaction: if (!xs_transaction_end(ctx->xsh, t, 0)) if (errno =3D=3D EAGAIN) goto retry_transaction; + + if (info->xenstore_feature_mask !=3D ~0U) { + unsigned int features; + + if (xs_get_features_supported(ctx->xsh, &features) && + !xs_set_features_domain(ctx->xsh, domid, + features & info->xenstore_feature_mask= )) { + LOG(ERROR, "Failed to set Xenstore features"); + return ERROR_FAIL; + } + } + xs_introduce_domain(ctx->xsh, domid, state->store_mfn, state->store_po= rt); free(vm_path); return 0; diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index a3a79d12b2..99ab2c3ebb 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -738,6 +738,7 @@ libxl_domain_build_info =3D Struct("domain_build_info",[ =20 ("vpmu", libxl_defbool), ("trap_unmapped_accesses", libxl_defbool), + ("xenstore_feature_mask", uint32, {'init_val': '~0U'}), =20 ], dir=3DDIR_IN, copy_deprecated_fn=3D"libxl__domain_build_info_copy_deprecated", diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 7e11c62ba0..aaeace1840 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1409,6 +1409,9 @@ void parse_config_data(const char *config_source, if (!xlu_cfg_get_string (config, "pool", &buf, 0)) xlu_cfg_replace_string(config, "pool", &c_info->pool_name, 0); =20 + if (!xlu_cfg_get_long (config, "xenstore_feature_mask", &l, 0)) + b_info->xenstore_feature_mask =3D l; + libxl_domain_build_info_init_type(b_info, c_info->type); =20 if (b_info->type =3D=3D LIBXL_DOMAIN_TYPE_PVH) { --=20 2.43.0