From nobody Thu Oct 30 19:06:32 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=1753449594; cv=none; d=zohomail.com; s=zohoarc; b=TsT2F2JEzji5XsFBg47VtAOJdzJ9bo3TSQLIPCansXEgN6Yaf9cqslGCsqpds3Qo53P5f+9ruPBQ5zN88ZjPe9o7SYzO8zDtXTN9dNSl7zD1mdshALOLvMM/Noby+2+vqA3PHBZO1BMsw/jabCz/imcgFe6GFT04Ej1MjNtA634= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753449594; 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=z/rhJqj1Rq5FR9jY2WqwJfa3ZKn4d5Db8TqETdaGs2I=; b=O2cQ+gjuzWxBn925FxBtNvxajjAEN50XG7Lf8XPaja8pOUdO+5DJluPryhtWScu5f/aFWKsYoTyMYbjcnCBC7+ffaOV00bMGy5U+Z8zzHCSMtMc+ggeMJ36GeRas5xFdC/FiNvXkTRIdRapeugp2/ZZjmRjaxUUvpmLXg3YdGqc= 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 1753449594021482.874172980598; Fri, 25 Jul 2025 06:19:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1057790.1425491 (Exim 4.92) (envelope-from ) id 1ufIKo-0006u2-Tk; Fri, 25 Jul 2025 13:19:38 +0000 Received: by outflank-mailman (output) from mailman id 1057790.1425491; Fri, 25 Jul 2025 13:19:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ufIKo-0006tt-R1; Fri, 25 Jul 2025 13:19:38 +0000 Received: by outflank-mailman (input) for mailman id 1057790; Fri, 25 Jul 2025 13:19:37 +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 1ufIKn-0006ft-TZ for xen-devel@lists.xenproject.org; Fri, 25 Jul 2025 13:19:37 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 032de031-695a-11f0-a31e-13f23c93f187; Fri, 25 Jul 2025 15:19:37 +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 B9FC91F7A0; Fri, 25 Jul 2025 13:19:36 +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 8A617134E8; Fri, 25 Jul 2025 13:19:36 +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 r5VKIGiEg2jSPAAAD6G6ig (envelope-from ); Fri, 25 Jul 2025 13:19:36 +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: 032de031-695a-11f0-a31e-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449576; 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=z/rhJqj1Rq5FR9jY2WqwJfa3ZKn4d5Db8TqETdaGs2I=; b=MjXlZAhb9OxJGnEf8g1JwMdOgy6izUIzlgflENKaRuVZITtKlTle9yWSS84uDpwVTqhqIV TEZVFrUWfLCLaqDAD9itv+gh2U6VxVWMHiDk+iBSTyr1yEsEKVxl2jlqOj7SkI11epi5cN +7fFabyAHVQRU7JWPoTLRNeXyBkGnZw= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449576; 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=z/rhJqj1Rq5FR9jY2WqwJfa3ZKn4d5Db8TqETdaGs2I=; b=MjXlZAhb9OxJGnEf8g1JwMdOgy6izUIzlgflENKaRuVZITtKlTle9yWSS84uDpwVTqhqIV TEZVFrUWfLCLaqDAD9itv+gh2U6VxVWMHiDk+iBSTyr1yEsEKVxl2jlqOj7SkI11epi5cN +7fFabyAHVQRU7JWPoTLRNeXyBkGnZw= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD , Jason Andryuk Subject: [PATCH v2 1/7] tools/libs/store: add get- and set-feature related functions Date: Fri, 25 Jul 2025 15:19:22 +0200 Message-ID: <20250725131928.19286-2-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250725131928.19286-1-jgross@suse.com> References: <20250725131928.19286-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,suse.com:email,suse.com:mid]; 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_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753449595355116600 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 19:06:32 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=1753449597; cv=none; d=zohomail.com; s=zohoarc; b=kpJSlXkojOKCAeacysIBdxlVFWK465wgGlb8WBr3eoMarFbpSjPr9jaQLEtfGnFpBVom1+pI9bZxLE9D8Onq+OoJvqkbXPGCi0JsLYYI8AHzKZP4PTRsiswpSKJHfa71rbmHOs3BZooT0UXJI7ShedxGyAgnuWh9e/TQXx/HNQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753449597; 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=BjaK3DHae0L+tvH83IKYZFxcoyYS5iwSjWvHNKFN12w=; b=OayRfrAFQRPWKEzr7HQ9YH1+RBHkk+xXeMRPlH7UtPBvXaENcO3jy4xDSl8xRDAaNBN7l+vf3F7iUzlWREiVp15jRtzgzEGFNxR8wDju2NraYmwgUytAG1Xp+RE1h8k+CR5Pe4AoCJrzO5b9gdH5R09p4uRgmCdV4DTsEQGvcC0= 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 1753449597242965.2289019130476; Fri, 25 Jul 2025 06:19:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1057791.1425502 (Exim 4.92) (envelope-from ) id 1ufIKw-0007C3-3s; Fri, 25 Jul 2025 13:19:46 +0000 Received: by outflank-mailman (output) from mailman id 1057791.1425502; Fri, 25 Jul 2025 13:19:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ufIKw-0007Bu-1G; Fri, 25 Jul 2025 13:19:46 +0000 Received: by outflank-mailman (input) for mailman id 1057791; Fri, 25 Jul 2025 13:19:45 +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 1ufIKu-0007Aq-VV for xen-devel@lists.xenproject.org; Fri, 25 Jul 2025 13:19:44 +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 068493ed-695a-11f0-b895-0df219b8e170; Fri, 25 Jul 2025 15:19:42 +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 561D92170E; Fri, 25 Jul 2025 13:19:42 +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 275E2134E8; Fri, 25 Jul 2025 13:19:42 +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 HVQ2CG6Eg2jYPAAAD6G6ig (envelope-from ); Fri, 25 Jul 2025 13:19:42 +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: 068493ed-695a-11f0-b895-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449582; 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=BjaK3DHae0L+tvH83IKYZFxcoyYS5iwSjWvHNKFN12w=; b=u63xHcK9oTeHakB3sAW52n2jzfehuPFKbkUx6X/FEavtXOSfFOyOh0XJgVCMdlOhp9LEo1 JBFooOCjpDfOn7sZF3zMgIVR8zc8Zt3fp2OOOSQf+hXhJkTasUcfHP2+79ocwFXkoBWBT4 zl3YtdGrhZajsDtFEaFFL4bHxDUmJlg= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449582; 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=BjaK3DHae0L+tvH83IKYZFxcoyYS5iwSjWvHNKFN12w=; b=u63xHcK9oTeHakB3sAW52n2jzfehuPFKbkUx6X/FEavtXOSfFOyOh0XJgVCMdlOhp9LEo1 JBFooOCjpDfOn7sZF3zMgIVR8zc8Zt3fp2OOOSQf+hXhJkTasUcfHP2+79ocwFXkoBWBT4 zl3YtdGrhZajsDtFEaFFL4bHxDUmJlg= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD , Jason Andryuk Subject: [PATCH v2 2/7] tools/xenstored: support specification of migration stream version Date: Fri, 25 Jul 2025 15:19:23 +0200 Message-ID: <20250725131928.19286-3-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250725131928.19286-1-jgross@suse.com> References: <20250725131928.19286-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)[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)[suse.com:mid,suse.com:email,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_FIVE(0.00)[5]; 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: 1753449599469116600 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 19:06:32 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=1753449601; cv=none; d=zohomail.com; s=zohoarc; b=HdNB/vKm+mSRk+dWdY/oQe6iincfCdaJEUkYUU3Wvo/WX/sLvfK2bbLYukY4uPh0rLOyWbD+x3cvPuWzE00GtMCgL5cXyj2ESWHHlRk4Fw8gyrWt6IFRDRHQ9iSRahxE/gXcNVOX751eb5LEnkSjuNkL70CXvuMcb6AangAWAo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753449601; 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=yb7PraGRfp4jOfNUeV5ucZ1QqsNlsA8+/YfJexfVTTw=; b=ZMGOgbgE1/oeCyQwOlxgaCI8hzasQUUHgYBggrBIPxmo6rlTSJ2xUZqACOxh4Gc/ojwi8/5XPHkRE0hpRN2BWR/Gtf9U0vdtegor+6+qNNRVd4DHiNwwzmJy1FyzliLD6vxF7kn+fLEgEhxaOaKb0l3veuujN4ls7hmO8v81rAI= 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 1753449601219465.79196477182325; Fri, 25 Jul 2025 06:20:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1057794.1425511 (Exim 4.92) (envelope-from ) id 1ufIL0-0007Uv-Es; Fri, 25 Jul 2025 13:19:50 +0000 Received: by outflank-mailman (output) from mailman id 1057794.1425511; Fri, 25 Jul 2025 13:19:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ufIL0-0007Uk-C6; Fri, 25 Jul 2025 13:19:50 +0000 Received: by outflank-mailman (input) for mailman id 1057794; Fri, 25 Jul 2025 13:19:49 +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 1ufIKz-0007Aq-RK for xen-devel@lists.xenproject.org; Fri, 25 Jul 2025 13:19:49 +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 09d9fe66-695a-11f0-b895-0df219b8e170; Fri, 25 Jul 2025 15:19:48 +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 F3F232128E; Fri, 25 Jul 2025 13:19:47 +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 BF2C6134E8; Fri, 25 Jul 2025 13:19:47 +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 W2URLXOEg2jfPAAAD6G6ig (envelope-from ); Fri, 25 Jul 2025 13:19:47 +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: 09d9fe66-695a-11f0-b895-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449588; 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=yb7PraGRfp4jOfNUeV5ucZ1QqsNlsA8+/YfJexfVTTw=; b=gi6fg0Gcvd/rKw5jdaGGmJTR7cBBEFuVTV7iJP5SuRA+tiBLJ9Tqca55JiVLc/1R9kWgS+ le/Fwjszc6V+Z+njDdHkuqUN29AAPCKTC0RHI443BnN+7qmBYdMimKbTpR4YGjpyFEun7L CwfS1+w359YaJTf/So+T3HVGElaGNz4= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449588; 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=yb7PraGRfp4jOfNUeV5ucZ1QqsNlsA8+/YfJexfVTTw=; b=gi6fg0Gcvd/rKw5jdaGGmJTR7cBBEFuVTV7iJP5SuRA+tiBLJ9Tqca55JiVLc/1R9kWgS+ le/Fwjszc6V+Z+njDdHkuqUN29AAPCKTC0RHI443BnN+7qmBYdMimKbTpR4YGjpyFEun7L CwfS1+w359YaJTf/So+T3HVGElaGNz4= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD , Jason Andryuk Subject: [PATCH v2 3/7] tools/xenstored: add missing migration record definitions Date: Fri, 25 Jul 2025 15:19:24 +0200 Message-ID: <20250725131928.19286-4-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250725131928.19286-1-jgross@suse.com> References: <20250725131928.19286-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,suse.com:email,suse.com:mid]; 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_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753449603539116600 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 19:06:32 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=1753449612; cv=none; d=zohomail.com; s=zohoarc; b=Gem+mrqwxxG/Z96u8kkRnsca5U7eN+g+ZorGpR0Y6T+1wIxLEp48XVBKd7gbIkYkTaf+gqtZz4bTcbmyy/UOx9seY5ZddTUb+c4HGOIDSpKfAK97oaJqeE4Ys4USSysa1AIrkdr7sVUPY/9zvZ4Wt5WxtgFSd7Co+KF78B9CVgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753449612; 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=0L+m609nB8jubdx18B8IaRi3KvDezEsn/+/gJVTBJ6Y=; b=cE3SgKZafU5TmwHWNRfx8E15FhowkAvxbAch8VCPCV/8D6HjXsExssITDOxXxAm4bQ4nOIKu9sgcuOcH4YJqifTxw7OqNbNzDd9ObfD/+Syb3UxR3AdKmRPKTSKog4D7KVgbnlH/xte/T6ooUfBbUM+2Y4aU0GhhnEdcM4cpLIA= 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 1753449612201299.19477581271144; Fri, 25 Jul 2025 06:20:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1057795.1425522 (Exim 4.92) (envelope-from ) id 1ufIL5-0007qK-No; Fri, 25 Jul 2025 13:19:55 +0000 Received: by outflank-mailman (output) from mailman id 1057795.1425522; Fri, 25 Jul 2025 13:19:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ufIL5-0007qA-KA; Fri, 25 Jul 2025 13:19:55 +0000 Received: by outflank-mailman (input) for mailman id 1057795; Fri, 25 Jul 2025 13:19:54 +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 1ufIL4-0006ft-KN for xen-devel@lists.xenproject.org; Fri, 25 Jul 2025 13:19:54 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0d258ee1-695a-11f0-a31e-13f23c93f187; Fri, 25 Jul 2025 15:19:53 +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 92CA21F79E; Fri, 25 Jul 2025 13:19:53 +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 68359134E8; Fri, 25 Jul 2025 13:19:53 +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 nfACGHmEg2jkPAAAD6G6ig (envelope-from ); Fri, 25 Jul 2025 13:19:53 +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: 0d258ee1-695a-11f0-a31e-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449593; 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=0L+m609nB8jubdx18B8IaRi3KvDezEsn/+/gJVTBJ6Y=; b=XSC+RNNXGZFg0IW2C1QTC4RvcBFXdsF77s/uBLacMB7VBHvK9W5dC7gRcCblkGuszmCvi+ kvBY7BzJKITdFr0mr32Y7I4qLZRezW2vSDxwQts/hgNyTbw9HtJAI1BDSNP9eaFZN/LSHK 3yOU2pJh5StcwA8GBxc0DVPQCQH4Edg= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449593; 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=0L+m609nB8jubdx18B8IaRi3KvDezEsn/+/gJVTBJ6Y=; b=XSC+RNNXGZFg0IW2C1QTC4RvcBFXdsF77s/uBLacMB7VBHvK9W5dC7gRcCblkGuszmCvi+ kvBY7BzJKITdFr0mr32Y7I4qLZRezW2vSDxwQts/hgNyTbw9HtJAI1BDSNP9eaFZN/LSHK 3yOU2pJh5StcwA8GBxc0DVPQCQH4Edg= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH v2 4/7] tools/xenstored: add server feature support Date: Fri, 25 Jul 2025 15:19:25 +0200 Message-ID: <20250725131928.19286-5-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250725131928.19286-1-jgross@suse.com> References: <20250725131928.19286-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)[suse.com:email,suse.com:mid,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: 1753449613684116600 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 Reviewed-by: Jason Andryuk --- V2: - move setting interface->server_features to introduce_domain() --- tools/xenstored/domain.c | 60 +++++++++++++++++++++++++++++++++++++++- tools/xenstored/domain.h | 3 ++ tools/xenstored/lu.c | 14 ++++++++-- tools/xenstored/lu.h | 2 +- 4 files changed, 74 insertions(+), 5 deletions(-) diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c index e1d5e8d614..24ee99cbc6 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; @@ -1032,6 +1040,8 @@ static struct domain *introduce_domain(const void *ct= x, return NULL; } domain->interface =3D interface; + if (!restore) + interface->server_features =3D domain->features; =20 if (is_master_domain) setup_structure(restore); @@ -1849,6 +1859,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 19:06:32 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=1753449611; cv=none; d=zohomail.com; s=zohoarc; b=Q10HwFpagJ4QXSzVovA8TE48DEbnpqhrfRLS+V4OdoMw5Th2DTFCrrE+QuDfiinV1l7a9NrjunC+LOZMALyY+xTNLs+TpuDqqc+P0vn/81JnMi84DFrN42RA8hCWQcAnIQssTZNgX5P1tkvDzMoIiicsDvcM4L8MTk4LXmR9S2w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753449611; 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=IhT3MMF1W91hB+KCaP9wYp31IAPZIGuXwTH5M+yqdlw=; b=ehikv/eZI9clqM9vVEq8fWR2V2cOpezVMEMeDQkHb1AMsgzjShKyWqF+17q0aLGtwgBnwC/ME3Jt5FvzGjOQFrQEFrOmHAfQcux8rmQ+5ZudEcCWn4K8+V3q8uMFhr2GjvRdRPCU3wxSjWHoPKUEKMrsrOl1fEoGPQwlGHYi3Og= 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 1753449611371754.8850865603978; Fri, 25 Jul 2025 06:20:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1057800.1425532 (Exim 4.92) (envelope-from ) id 1ufILC-0008Qd-0Q; Fri, 25 Jul 2025 13:20:02 +0000 Received: by outflank-mailman (output) from mailman id 1057800.1425532; Fri, 25 Jul 2025 13:20:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ufILB-0008QC-T6; Fri, 25 Jul 2025 13:20:01 +0000 Received: by outflank-mailman (input) for mailman id 1057800; Fri, 25 Jul 2025 13:20:01 +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 1ufILB-0007Aq-1l for xen-devel@lists.xenproject.org; Fri, 25 Jul 2025 13:20:01 +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 1091a018-695a-11f0-b895-0df219b8e170; Fri, 25 Jul 2025 15:19:59 +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 3648E1F747; Fri, 25 Jul 2025 13:19: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 06E34134E8; Fri, 25 Jul 2025 13:19:58 +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 hSt8On6Eg2jtPAAAD6G6ig (envelope-from ); Fri, 25 Jul 2025 13:19:58 +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: 1091a018-695a-11f0-b895-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449599; 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=IhT3MMF1W91hB+KCaP9wYp31IAPZIGuXwTH5M+yqdlw=; b=QTwR1YaRTqqTLVrpB37qFF0qkT5y4MhhgVR80//WIdGEO8fpH40XyAF7Tf+mZWAOwNDJnF AzFIDnNo9PeimWpZ73+G+jzxx2Rx0wUviCj67z5a9Qi4vzf9i19LUGKWGDVQsPHNrVHaHR FI8U4bwESeHJilGlzdsWyqLJLv52yds= Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=QTwR1YaR DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449599; 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=IhT3MMF1W91hB+KCaP9wYp31IAPZIGuXwTH5M+yqdlw=; b=QTwR1YaRTqqTLVrpB37qFF0qkT5y4MhhgVR80//WIdGEO8fpH40XyAF7Tf+mZWAOwNDJnF AzFIDnNo9PeimWpZ73+G+jzxx2Rx0wUviCj67z5a9Qi4vzf9i19LUGKWGDVQsPHNrVHaHR FI8U4bwESeHJilGlzdsWyqLJLv52yds= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD , Jason Andryuk Subject: [PATCH v2 5/7] tools/xenstored: support SET/GET_FEATURE commands Date: Fri, 25 Jul 2025 15:19:26 +0200 Message-ID: <20250725131928.19286-6-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250725131928.19286-1-jgross@suse.com> References: <20250725131928.19286-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Queue-Id: 3648E1F747 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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.com:dkim,suse.com:mid,suse.com:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.com:+] X-Spam-Score: -3.01 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753449613556116600 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 24ee99cbc6..2362216a7a 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -1243,6 +1243,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 19:06:32 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=1753449622; cv=none; d=zohomail.com; s=zohoarc; b=hHzwmjiowMeZfp60a5NIpLMcClHuSvflM6n+gkH0d6GtQNQ9JD0yT3lhdGSHNs4KAZwYn1G9vpj4I/wvSh0sk4UouC2D3+/3AN7dD06RXU51cRPspqmOEO9q9BhPfw6XjVon+kMl4WkhDdIgVJFPis8zHR9GbElyShodEQxTInM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753449622; 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=J971eGRb4I4rLoEKD9TcIoDmDuQYwQE2ZFSGXoKtYBA=; b=W5ir85Ur6WGl9OawLQlCp32tLxvI5X7iDrFAWC1dU1ofifl+QQkFLytpVIdIkemZLyd2hjQcoeX9mv4ZhaTj93JChMgGvACJNMdNAlc+FHQ0WbFQG7YidHz3f493+RSX68Q7n/6mYcdTedrwWDDx/mZlEzgL4XFKhc0WkKm5J8o= 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 1753449622336173.0269435085678; Fri, 25 Jul 2025 06:20:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1057806.1425542 (Exim 4.92) (envelope-from ) id 1ufILI-0001GH-7N; Fri, 25 Jul 2025 13:20:08 +0000 Received: by outflank-mailman (output) from mailman id 1057806.1425542; Fri, 25 Jul 2025 13:20: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 1ufILI-0001Fp-4O; Fri, 25 Jul 2025 13:20:08 +0000 Received: by outflank-mailman (input) for mailman id 1057806; Fri, 25 Jul 2025 13:20:07 +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 1ufILH-0006ft-1p for xen-devel@lists.xenproject.org; Fri, 25 Jul 2025 13:20:07 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 146d4de8-695a-11f0-a31e-13f23c93f187; Fri, 25 Jul 2025 15:20:06 +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 B6DE31F7A7; Fri, 25 Jul 2025 13:20:04 +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 8DB53134E8; Fri, 25 Jul 2025 13:20:04 +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 BZJGIYSEg2j+PAAAD6G6ig (envelope-from ); Fri, 25 Jul 2025 13:20:04 +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: 146d4de8-695a-11f0-a31e-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449605; 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=J971eGRb4I4rLoEKD9TcIoDmDuQYwQE2ZFSGXoKtYBA=; b=S/zCZl7AokZWdEfG+1vVoW8ytE4KSyI7DprVityHer4+bVeDKyyK4cll+kaUQYpI0VmH6o f0Ldaf0xFz7b80KxusJ9xL0fK21e0JJQ5Ex/zP89o0K9In2OSM1KtWYSb+njHRdpJ1oOcP HkiiNQ14uPa8xDSoTd99BOGOccz/i4I= Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=RDmEy3q2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449604; 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=J971eGRb4I4rLoEKD9TcIoDmDuQYwQE2ZFSGXoKtYBA=; b=RDmEy3q2XqOyT5/EARf1S7TZlSfx+hFW6nVPzH5hNV+aOT4dkaSCFedl9XJtACVDbjX80b 3QImRnn563sh0gWy+Y6Arinmnwt+0WAb1962M/vHFNj31xbEeUHg3BedgtGrpRmdfhpxeU IGblDPk1ZQ/RjX2zYo5ptPYA9VSv9Xs= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Anthony PERARD , Jason Andryuk Subject: [PATCH v2 6/7] tools/xl: add available Xenstore features to xl info output Date: Fri, 25 Jul 2025 15:19:27 +0200 Message-ID: <20250725131928.19286-7-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250725131928.19286-1-jgross@suse.com> References: <20250725131928.19286-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Queue-Id: B6DE31F7A7 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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[suse.com:dkim,suse.com:mid,suse.com:email,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)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; 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: 1753449623560116600 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 Acked-by: Anthony PERARD --- 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 19:06:32 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=1753449623; cv=none; d=zohomail.com; s=zohoarc; b=jUUdhKPrZOPyUzYDk/V9PDFRK3l8BLk78qP4Efez3oNLHio0QCbmPW99nBXIibNPhVLKN2qwwGHaR7Hdt3mjFMRR/AN/bRoSoirW3JX/O/RFBSFR0DC4d6vWtL7EhVEKER3YMhbgGpDTrM2B+yMclMC/O5QqpRuALUW2WfTT3OY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753449623; 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=iV66UlCLpM6BgnOhEb2Yl2KD4ZAo551/i+60LtyfZio=; b=EMI1p29N7XCNr9Dr/a0aW8eNvvX/zBrgCBHt965ekvDM/hRDphpVD4lhKRYQwaETyyDQPuqHsutxZOA24E5JB7ReJeJqRvhx6zl8n/Rvssbu6RGL0mubWx5aM9Yiyy2XUthJi3eVNQbyVrEyF/0BIqQnUN5lmA14D1Xs3qUNlkk= 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 1753449623268556.9909366886429; Fri, 25 Jul 2025 06:20:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1057810.1425552 (Exim 4.92) (envelope-from ) id 1ufILM-0001q7-Kt; Fri, 25 Jul 2025 13:20:12 +0000 Received: by outflank-mailman (output) from mailman id 1057810.1425552; Fri, 25 Jul 2025 13:20:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ufILM-0001pI-HK; Fri, 25 Jul 2025 13:20:12 +0000 Received: by outflank-mailman (input) for mailman id 1057810; Fri, 25 Jul 2025 13:20:11 +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 1ufILL-0006ft-Bq for xen-devel@lists.xenproject.org; Fri, 25 Jul 2025 13:20:11 +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 17215e0b-695a-11f0-a31e-13f23c93f187; Fri, 25 Jul 2025 15:20:10 +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 5643E216E2; Fri, 25 Jul 2025 13:20:10 +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 21B88134E8; Fri, 25 Jul 2025 13:20: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 aLC7BoqEg2gJPQAAD6G6ig (envelope-from ); Fri, 25 Jul 2025 13:20: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: 17215e0b-695a-11f0-a31e-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449610; 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=iV66UlCLpM6BgnOhEb2Yl2KD4ZAo551/i+60LtyfZio=; b=tf0VvVyhu/2DeZp4Edckj3lXfvhmZA30TGTBek83ZsfgBAA0SPchi8wXt9sCh30cfv1KNq JOYTaeYAg/iJrPNIMAdiIKzb02nnnOw8JUebg8dEbpBRJA8MtuMhibU8lwdfW3UzFrUD/K b5prkLc5oVtdplxqGxDiK1M8DKrf4XU= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753449610; 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=iV66UlCLpM6BgnOhEb2Yl2KD4ZAo551/i+60LtyfZio=; b=tf0VvVyhu/2DeZp4Edckj3lXfvhmZA30TGTBek83ZsfgBAA0SPchi8wXt9sCh30cfv1KNq JOYTaeYAg/iJrPNIMAdiIKzb02nnnOw8JUebg8dEbpBRJA8MtuMhibU8lwdfW3UzFrUD/K b5prkLc5oVtdplxqGxDiK1M8DKrf4XU= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Anthony PERARD , Nick Rosbrook , George Dunlap , Jason Andryuk Subject: [PATCH v2 7/7] tools: allow to limit xenstore features via guest config Date: Fri, 25 Jul 2025 15:19:28 +0200 Message-ID: <20250725131928.19286-8-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250725131928.19286-1-jgross@suse.com> References: <20250725131928.19286-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)[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,suse.com:mid,suse.com:email]; 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_FIVE(0.00)[6]; 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: 1753449625861116600 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 Acked-by: Nick Rosbrook --- V2: - fix typo (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..4efe680960 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 retrieved +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