From nobody Thu Oct 30 23:12:12 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; 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=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751444015572570.9328748576174; Wed, 2 Jul 2025 01:13:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030391.1404074 (Exim 4.92) (envelope-from ) id 1uWsao-0001Is-64; Wed, 02 Jul 2025 08:13:22 +0000 Received: by outflank-mailman (output) from mailman id 1030391.1404074; Wed, 02 Jul 2025 08:13:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWsao-0001Hz-14; Wed, 02 Jul 2025 08:13:22 +0000 Received: by outflank-mailman (input) for mailman id 1030391; Wed, 02 Jul 2025 08:13:21 +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 1uWsan-00082X-1t for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:13:21 +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 69bb5852-571c-11f0-b894-0df219b8e170; Wed, 02 Jul 2025 10:13:19 +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 3C2881F452; Wed, 2 Jul 2025 08:13:19 +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 07EDC13A24; Wed, 2 Jul 2025 08:13:19 +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 r99lAB/qZGgISQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:13:19 +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: 69bb5852-571c-11f0-b894-0df219b8e170 Authentication-Results: smtp-out2.suse.de; none From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Samuel Thibault , Julien Grall , Anthony PERARD Subject: [PATCH 1/9] stubdom: configure kexec for PVH Xenstore stubdom Date: Wed, 2 Jul 2025 10:12:57 +0200 Message-ID: <20250702081305.14440-2-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Queue-Id: 3C2881F452 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.00 X-ZM-MESSAGEID: 1751444016266116600 Content-Type: text/plain; charset="utf-8" Add the required configuration settings to enable kexec in the PVH variant of xenstore-stubdom. This is required to support live update. Set the number of kexec module pages to 18 in order to support using the kexec module memory for the stubdom's 9pfs granted pages. In Xenstore code test the CONFIG_KEXEC setting in order to determine whether stubdom live update is supported (PV xenstore-stubdom doesn't have live update support, as it lacks kexec). Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- stubdom/xenstorepvh-minios.cfg | 2 ++ tools/xenstored/core.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/stubdom/xenstorepvh-minios.cfg b/stubdom/xenstorepvh-minios.cfg index 62a228f33d..ed2461d7fa 100644 --- a/stubdom/xenstorepvh-minios.cfg +++ b/stubdom/xenstorepvh-minios.cfg @@ -8,4 +8,6 @@ CONFIG_CONSFRONT=3Dn CONFIG_LWIP=3Dn CONFIG_9PFRONT=3Dy CONFIG_BALLOON=3Dy +CONFIG_KEXEC=3Dy +CONFIG_KEXEC_MODULE_PAGES=3D18 XEN_INTERFACE_VERSION=3D__XEN_LATEST_INTERFACE_VERSION__ diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h index 632886cecf..1ba9592d16 100644 --- a/tools/xenstored/core.h +++ b/tools/xenstored/core.h @@ -45,6 +45,11 @@ #endif #endif =20 +/* Live update in stubdom case needs kexec support. */ +#if defined(__MINIOS__) && !defined(CONFIG_KEXEC) +#define NO_LIVE_UPDATE +#endif + /* DEFAULT_BUFFER_SIZE should be large enough for each errno string. */ #define DEFAULT_BUFFER_SIZE 16 =20 --=20 2.43.0 From nobody Thu Oct 30 23:12:12 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=1751444470; cv=none; d=zohomail.com; s=zohoarc; b=OQnL2a3ekkoa+xCcY8kcXemuMqbZ3ngBq2z3/kR8OxMBl1dKwWL1yAnfm/DqWrM7PtOERc/sGbOqfWsoRJoQfCKRYAcRYHyVuqvs4ytVLXl1gL5l5oEiH9OFDYeTI847oKSjNUKknt2NtCJ4Fo6VeDu+kx6qFlT9k3W0P6fnzbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751444470; 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=5VnYHbx1b6eDsCfttQs09iHQOMBpidE1KzK0WuvNpBs=; b=LyJayo5z7Hp6Wsrls3EOpMhsNXu4opUzSNYPIP49Ao9pRnq3eVG/wOk0xplOFLPuyrIXppY7XLzhMzGOJ8DebOGT94fvMm6mv5qP8A49Q3wC9/y1AVGdOC18sV7Y63EnGHstGHwobtlusAyF0UyRgorA/Iusshur5kZb7jNEwRM= 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 1751444470808196.3215370054137; Wed, 2 Jul 2025 01:21:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030447.1404171 (Exim 4.92) (envelope-from ) id 1uWsi3-0005kp-Em; Wed, 02 Jul 2025 08:20:51 +0000 Received: by outflank-mailman (output) from mailman id 1030447.1404171; Wed, 02 Jul 2025 08:20:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWsi2-0005ix-TF; Wed, 02 Jul 2025 08:20:50 +0000 Received: by outflank-mailman (input) for mailman id 1030447; Wed, 02 Jul 2025 08:20: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 1uWsas-00082X-Kv for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:13:26 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [2a07:de40:b251:101:10:150:64:2]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6d1a0bc4-571c-11f0-b894-0df219b8e170; Wed, 02 Jul 2025 10:13:25 +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 C56B71F454; Wed, 2 Jul 2025 08:13:24 +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 9C03113A24; Wed, 2 Jul 2025 08:13:24 +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 JdiDJCTqZGgUSQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:13:24 +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: 6d1a0bc4-571c-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1751444004; 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=5VnYHbx1b6eDsCfttQs09iHQOMBpidE1KzK0WuvNpBs=; b=vL3SEcPq59eEcqZuqsFbJBUOR5FdYogFa5pKE5Q3JhCLZT6VYIOVWy2XzUwcj5+h0hp7gJ L0aVBwHLe4I7kyICD42dTKnl8fJHxO1nUgIB07+XPsnMHlMgfVdvhtIVjMOPLXeg6T3l+E AZVGYxfTux4fGdvcAC8saU/udBlJL6Y= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1751444004; 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=5VnYHbx1b6eDsCfttQs09iHQOMBpidE1KzK0WuvNpBs=; b=vL3SEcPq59eEcqZuqsFbJBUOR5FdYogFa5pKE5Q3JhCLZT6VYIOVWy2XzUwcj5+h0hp7gJ L0aVBwHLe4I7kyICD42dTKnl8fJHxO1nUgIB07+XPsnMHlMgfVdvhtIVjMOPLXeg6T3l+E AZVGYxfTux4fGdvcAC8saU/udBlJL6Y= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 2/9] tools/xenstore: perform kexec for stubdom live update Date: Wed, 2 Jul 2025 10:12:58 +0200 Message-ID: <20250702081305.14440-3-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Flag: NO X-Spam-Score: -6.80 X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:mid,suse.com:email] X-Spam-Level: X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1751444472780116600 Content-Type: text/plain; charset="utf-8" For the final step of live-update in stubdom, call kexec(). Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/lu_minios.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/xenstored/lu_minios.c b/tools/xenstored/lu_minios.c index b14a0b29d5..b8ca631610 100644 --- a/tools/xenstored/lu_minios.c +++ b/tools/xenstored/lu_minios.c @@ -8,13 +8,44 @@ #include #include =20 +#include + #include "talloc.h" #include "lu.h" +#include "core.h" =20 #ifndef NO_LIVE_UPDATE char *lu_exec(const void *ctx, int argc, char **argv) { - return "NYI"; + int i; + int ret; + char *errbuf; + char *cmdline; + + if (!lu_status->kernel) + return "No new kernel"; + + cmdline =3D talloc_strdup(ctx, ""); + if (!cmdline) + return "Allocation failure"; + for (i =3D 1; argv[i]; i++) { + if (i > 1) { + cmdline =3D talloc_append_string(ctx, cmdline, " "); + if (!cmdline) + return "Allocation failure"; + } + cmdline =3D talloc_append_string(ctx, cmdline, argv[i]); + if (!cmdline) + return "Allocation failure"; + } + + ret =3D kexec(lu_status->kernel, lu_status->kernel_size, cmdline); + + errbuf =3D talloc_asprintf(ctx, "kexec() returned %d", ret); + if (!errbuf) + errbuf =3D "kexec() returned"; + + return errbuf; } =20 static const char *lu_binary_alloc(const void *ctx, struct connection *con= n, --=20 2.43.0 From nobody Thu Oct 30 23:12:12 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; 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=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751444510364544.0282766423979; Wed, 2 Jul 2025 01:21:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030563.1404311 (Exim 4.92) (envelope-from ) id 1uWsik-0003yc-Cs; Wed, 02 Jul 2025 08:21:34 +0000 Received: by outflank-mailman (output) from mailman id 1030563.1404311; Wed, 02 Jul 2025 08:21:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWsik-0003wK-5O; Wed, 02 Jul 2025 08:21:34 +0000 Received: by outflank-mailman (input) for mailman id 1030563; Wed, 02 Jul 2025 08:21:32 +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 1uWsb0-00082X-PW for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:13:34 +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 720692c1-571c-11f0-b894-0df219b8e170; Wed, 02 Jul 2025 10:13:33 +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 56A701F452; Wed, 2 Jul 2025 08:13:30 +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 337A913A24; Wed, 2 Jul 2025 08:13:30 +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 onwjCyrqZGgbSQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:13:30 +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: 720692c1-571c-11f0-b894-0df219b8e170 Authentication-Results: smtp-out2.suse.de; none From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Anthony PERARD Subject: [PATCH 3/9] libevtchn: add O_CLOEXEC support for Mini-OS Date: Wed, 2 Jul 2025 10:12:59 +0200 Message-ID: <20250702081305.14440-4-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Queue-Id: 56A701F452 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.00 X-ZM-MESSAGEID: 1751444511299116600 Content-Type: text/plain; charset="utf-8" With Mini-OS now supporting O_CLOEXEC for the kexec case, no longer ignore the XENEVTCHN_NO_CLOEXEC flag in minios.c. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/libs/evtchn/minios.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c index 046cd28d37..0d2a201438 100644 --- a/tools/libs/evtchn/minios.c +++ b/tools/libs/evtchn/minios.c @@ -114,10 +114,6 @@ static void evtchn_initialize(void) ftype_evtchn =3D alloc_file_type(&evtchn_ops); } =20 -/* - * XENEVTCHN_NO_CLOEXEC is being ignored, as there is no exec() call suppo= rted - * in Mini-OS. - */ int osdep_evtchn_open(xenevtchn_handle *xce, unsigned int flags) { int fd; @@ -137,6 +133,8 @@ int osdep_evtchn_open(xenevtchn_handle *xce, unsigned i= nt flags) return -1; } =20 + if ( !(flags & XENEVTCHN_NO_CLOEXEC) ) + file->cloexec =3D true; file->dev =3D ports; XEN_LIST_INIT(&ports->list); xce->fd =3D fd; --=20 2.43.0 From nobody Thu Oct 30 23:12:12 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=1751444464; cv=none; d=zohomail.com; s=zohoarc; b=TdiYeS0duZhEvIbzXKE3/19JTeYTv3TJEnOWusXMdCeWEkAfnKk895mGvP5k/c7Z7OYts6qx+1aI3m027GnIul5Y8cWwS5z/+lXIg7dgpNAiwhCRUzvG3VvaORt1aDly4rG8UVI+pLKJVnq2RXtbqqjFN7zhjOWEpV1CEq5eiso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751444464; 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=wEXVr7vNx+ZD3Vi9tkKFmxXn75/3BjiD+2cTf/nfsPU=; b=IscOg5UgLsciC5xelhxI/Ks1eDeiUbics5Q/uavVNP6usZI2qrF5mbk2ufLFZmqOXZPAt2eTqaeAmJhU+ggxqMA/nEGwT8Iy2t9lThh4Ni4GTa1f6czA8hWuVM0NhJ/ChK0XBxy6duapXSrA/Yf0EKT0NLGyRJLAHkf2KictdXQ= 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 1751444464865225.35719253602406; Wed, 2 Jul 2025 01:21:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030442.1404153 (Exim 4.92) (envelope-from ) id 1uWsi1-0005Zk-TU; Wed, 02 Jul 2025 08:20:49 +0000 Received: by outflank-mailman (output) from mailman id 1030442.1404153; Wed, 02 Jul 2025 08:20:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWsi1-0005ZX-Oi; Wed, 02 Jul 2025 08:20:49 +0000 Received: by outflank-mailman (input) for mailman id 1030442; Wed, 02 Jul 2025 08:20:48 +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 1uWsb6-00082X-5G for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:13: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 748514af-571c-11f0-b894-0df219b8e170; Wed, 02 Jul 2025 10:13: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 DD8FF1F455; Wed, 2 Jul 2025 08:13:35 +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 B2B1C13A24; Wed, 2 Jul 2025 08:13:35 +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 Pw4yKi/qZGgsSQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:13:35 +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: 748514af-571c-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1751444015; 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=wEXVr7vNx+ZD3Vi9tkKFmxXn75/3BjiD+2cTf/nfsPU=; b=DRmgtjhVTWWoTjcAfdrtBYBnCh/qJnjjXQjEivWo5tYvJlVtid2a8AcbthfIH88xh7N6M4 +XBK80SwRIp+v0zq/WUNSoBhKFtce8p/mOd2HxSRkfDs24o022EYEBIK4K5Qx/LEcEJrBW 49LN+zTB0TqWYSTHAabEoJLqRM9ti+0= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1751444015; 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=wEXVr7vNx+ZD3Vi9tkKFmxXn75/3BjiD+2cTf/nfsPU=; b=DRmgtjhVTWWoTjcAfdrtBYBnCh/qJnjjXQjEivWo5tYvJlVtid2a8AcbthfIH88xh7N6M4 +XBK80SwRIp+v0zq/WUNSoBhKFtce8p/mOd2HxSRkfDs24o022EYEBIK4K5Qx/LEcEJrBW 49LN+zTB0TqWYSTHAabEoJLqRM9ti+0= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Anthony PERARD Subject: [PATCH 4/9] libxengnttab: set the cloexec flag on Mini-OS Date: Wed, 2 Jul 2025 10:13:00 +0200 Message-ID: <20250702081305.14440-5-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Flag: NO X-Spam-Score: -6.80 X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.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]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:mid,suse.com:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1751444466657116600 Content-Type: text/plain; charset="utf-8" With Mini-OS now supporting the O_CLOEXEC flag for the kexec case, set the related cloexec flag in minios.c. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/libs/gnttab/minios.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/libs/gnttab/minios.c b/tools/libs/gnttab/minios.c index cac89f0ba6..63bbdc7719 100644 --- a/tools/libs/gnttab/minios.c +++ b/tools/libs/gnttab/minios.c @@ -74,6 +74,7 @@ int osdep_gnttab_open(xengnttab_handle *xgt) } =20 file->dev =3D gntmap; + file->cloexec =3D true; gntmap_init(gntmap); xgt->fd =3D fd; return 0; --=20 2.43.0 From nobody Thu Oct 30 23:12:12 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=1751444495; cv=none; d=zohomail.com; s=zohoarc; b=KaQjNu2KgDXENxvVuBvUpOFkb33DtPgNGymGjAV6g6Rf5tF0PwQn7Ka53wgdqtYhClLxE0sqKsUMy+spM3X3a4T4qkNMzeLUW9aowlnoi+llSFUrf9pnsiK4xHMGsFbcHZQ2QcJPCYZrJdBlEvdQC4eWmpWSuUf/sCTTbeeMc/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751444495; 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=n3xdHTHhnqc+GZbIRwTftFXYxJ+xtVKpvXphY7KAzMI=; b=BGRFcTsGBeNYzytVZTJ86uRc+XW3yCzrGE27kbVjFotpBFoyjkWAtZR//XqkFfqzMgsR6AyKDwOcNcqjJmE3+0ZW7ubWk25/Aygx6uuSPKu8bHKUyqTNwB7oSxJxs9XOgsNgT9NvcpaKMiQsCChAlgIpxDYGD3vMWq+xArLwbqs= 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 1751444495536677.3836213168539; Wed, 2 Jul 2025 01:21:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030534.1404262 (Exim 4.92) (envelope-from ) id 1uWsiY-0002KW-Ek; Wed, 02 Jul 2025 08:21:22 +0000 Received: by outflank-mailman (output) from mailman id 1030534.1404262; Wed, 02 Jul 2025 08:21:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWsiY-0002KJ-Ap; Wed, 02 Jul 2025 08:21:22 +0000 Received: by outflank-mailman (input) for mailman id 1030534; Wed, 02 Jul 2025 08:21:21 +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 1uWsb9-00082X-81 for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:13:43 +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 7706b6b8-571c-11f0-b894-0df219b8e170; Wed, 02 Jul 2025 10:13:41 +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 73B531F452; Wed, 2 Jul 2025 08:13:41 +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 49AC213A24; Wed, 2 Jul 2025 08:13:41 +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 l8M6EDXqZGg+SQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:13:41 +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: 7706b6b8-571c-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1751444021; 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=n3xdHTHhnqc+GZbIRwTftFXYxJ+xtVKpvXphY7KAzMI=; b=a4vz/B8wffipetAwuW46AvoaCLwJGo5KRt+wIm8THWF+WdzdYq3cQmubanWFNX/KUlK3Ou n5HTRmezd0pmVb+0N8vD52XCLiLRnjgbdGBBNdwePdIzTffJKRx/mmKtxcoNGZQrXtppA2 a6SsRtNPN5YJ0Hi2zTTSAw2Yp5A8Wm8= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1751444021; 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=n3xdHTHhnqc+GZbIRwTftFXYxJ+xtVKpvXphY7KAzMI=; b=a4vz/B8wffipetAwuW46AvoaCLwJGo5KRt+wIm8THWF+WdzdYq3cQmubanWFNX/KUlK3Ou n5HTRmezd0pmVb+0N8vD52XCLiLRnjgbdGBBNdwePdIzTffJKRx/mmKtxcoNGZQrXtppA2 a6SsRtNPN5YJ0Hi2zTTSAw2Yp5A8Wm8= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 5/9] xenstored: use fread() instead of mmap() for reading live update state Date: Wed, 2 Jul 2025 10:13:01 +0200 Message-ID: <20250702081305.14440-6-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.com:mid,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -6.80 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1751444497233116600 Content-Type: text/plain; charset="utf-8" Mini-OS doesn't support using mmap() for accessing a file. In order to support reading the live update state from a 9pfs based file, use fread() instead of mmap(). Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/lu.c | 93 +++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 35 deletions(-) diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c index 4fccbbc195..029c4fab72 100644 --- a/tools/xenstored/lu.c +++ b/tools/xenstored/lu.c @@ -25,9 +25,11 @@ =20 struct lu_dump_state { void *buf; + unsigned int buf_size; unsigned int size; - int fd; + unsigned int offset; char *filename; + FILE *fp; }; =20 struct live_update *lu_status; @@ -80,9 +82,10 @@ bool lu_is_pending(void) return lu_status !=3D NULL; } =20 -static void lu_get_dump_state(struct lu_dump_state *state) +static void lu_get_dump_state(void *ctx, struct lu_dump_state *state) { struct stat statbuf; + int fd; =20 state->size =3D 0; =20 @@ -91,77 +94,102 @@ static void lu_get_dump_state(struct lu_dump_state *st= ate) if (!state->filename) barf("Allocation failure"); =20 - state->fd =3D open(state->filename, O_RDONLY); - if (state->fd < 0) - return; - if (fstat(state->fd, &statbuf) !=3D 0) - goto out_close; + fd =3D open(state->filename, O_RDONLY); + if (fd < 0) + barf("No state file found"); + if (fstat(fd, &statbuf) !=3D 0) + barf("Could not fstat state file"); state->size =3D statbuf.st_size; =20 - state->buf =3D mmap(NULL, state->size, PROT_READ, MAP_PRIVATE, - state->fd, 0); - if (state->buf =3D=3D MAP_FAILED) { - state->size =3D 0; - goto out_close; - } + /* Start with a 4k buffer. If needed we'll reallocate a larger one. */ + state->buf_size =3D 4096; + state->buf =3D talloc_size(ctx, state->buf_size); + if (!state->buf) + barf("Allocation failure"); =20 - return; + state->fp =3D fdopen(fd, "r"); +} =20 - out_close: - close(state->fd); +static void lu_dump_close(FILE *fp) +{ + fclose(fp); } =20 static void lu_close_dump_state(struct lu_dump_state *state) { assert(state->filename !=3D NULL); =20 - munmap(state->buf, state->size); - close(state->fd); + lu_dump_close(state->fp); =20 unlink(state->filename); talloc_free(state->filename); + talloc_free(state->buf); +} + +static void lu_read_data(void *ctx, struct lu_dump_state *state, + unsigned int size) +{ + if (state->offset + size > state->size) + barf("Inconsistent state data"); + + if (size > state->buf_size) { + state->buf =3D talloc_realloc_size(ctx, state->buf, size); + if (!state->buf) + barf("Allocation failure"); + state->buf_size =3D size; + } + + if (fread(state->buf, size, 1, state->fp) !=3D 1) + barf("State read error"); + + state->offset +=3D size; } =20 void lu_read_state(void) { struct lu_dump_state state =3D {}; - struct xs_state_record_header *head; + struct xs_state_record_header head; void *ctx =3D talloc_new(NULL); /* Work context for subfunctions. */ struct xs_state_preamble *pre; =20 syslog(LOG_INFO, "live-update: read state\n"); - lu_get_dump_state(&state); + lu_get_dump_state(ctx, &state); if (state.size =3D=3D 0) barf_perror("No state found after live-update"); =20 + lu_read_data(ctx, &state, sizeof(*pre)); pre =3D state.buf; if (memcmp(pre->ident, XS_STATE_IDENT, sizeof(pre->ident)) || pre->version !=3D htobe32(XS_STATE_VERSION) || pre->flags !=3D XS_STATE_FLAGS) barf("Unknown record identifier"); - for (head =3D state.buf + sizeof(*pre); - head->type !=3D XS_STATE_TYPE_END && - (void *)head - state.buf < state.size; - head =3D (void *)head + sizeof(*head) + head->length) { - switch (head->type) { + + for (;;) { + lu_read_data(ctx, &state, sizeof(head)); + head =3D *(struct xs_state_record_header *)(state.buf); + if (head.type =3D=3D XS_STATE_TYPE_END) + break; + lu_read_data(ctx, &state, head.length); + + switch (head.type) { case XS_STATE_TYPE_GLOBAL: - read_state_global(ctx, head + 1); + read_state_global(ctx, state.buf); break; case XS_STATE_TYPE_CONN: - read_state_connection(ctx, head + 1); + read_state_connection(ctx, state.buf); break; case XS_STATE_TYPE_WATCH: - read_state_watch(ctx, head + 1); + read_state_watch(ctx, state.buf); break; case XS_STATE_TYPE_TA: xprintf("live-update: ignore transaction record\n"); break; case XS_STATE_TYPE_NODE: - read_state_node(ctx, head + 1); + read_state_node(ctx, state.buf); break; default: xprintf("live-update: unknown state record %08x\n", - head->type); + head.type); break; } } @@ -266,11 +294,6 @@ static FILE *lu_dump_open(const void *ctx) return fdopen(fd, "w"); } =20 -static void lu_dump_close(FILE *fp) -{ - fclose(fp); -} - static const char *lu_dump_state(const void *ctx, struct connection *conn) { FILE *fp; --=20 2.43.0 From nobody Thu Oct 30 23:12:12 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; 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=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 175144446287649.81377187762962; Wed, 2 Jul 2025 01:21:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030437.1404123 (Exim 4.92) (envelope-from ) id 1uWshw-0004XG-GI; Wed, 02 Jul 2025 08:20:44 +0000 Received: by outflank-mailman (output) from mailman id 1030437.1404123; Wed, 02 Jul 2025 08:20:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWshw-0004Vh-1c; Wed, 02 Jul 2025 08:20:44 +0000 Received: by outflank-mailman (input) for mailman id 1030437; Wed, 02 Jul 2025 08:20:43 +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 1uWsbG-00082X-OB for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:13:50 +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 7a51eb2c-571c-11f0-b894-0df219b8e170; Wed, 02 Jul 2025 10:13:47 +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 130932117F; Wed, 2 Jul 2025 08:13: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 D892813A54; Wed, 2 Jul 2025 08:13:46 +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 PcglMzrqZGhGSQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:13:46 +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: 7a51eb2c-571c-11f0-b894-0df219b8e170 Authentication-Results: smtp-out1.suse.de; none From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 6/9] xenstored: don't use xenevtchn_fdopen() in stubdom Date: Wed, 2 Jul 2025 10:13:02 +0200 Message-ID: <20250702081305.14440-7-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Queue-Id: 130932117F X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.00 X-ZM-MESSAGEID: 1751444464806116600 Content-Type: text/plain; charset="utf-8" When running in a stubdom environment xenevtchn_fdopen() won't work, as any file descriptor state is lost across kexec(). Use a wrapper to replace the call of xenevtchn_fdopen() with the really needed xenevtchn_open() when running on top of Mini-OS. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/core.h | 3 +++ tools/xenstored/domain.c | 2 +- tools/xenstored/minios.c | 5 +++++ tools/xenstored/posix.c | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h index 1ba9592d16..bef24a688c 100644 --- a/tools/xenstored/core.h +++ b/tools/xenstored/core.h @@ -29,6 +29,7 @@ #include #include #include +#include =20 #include "xenstore_lib.h" #include "xenstore_state.h" @@ -405,6 +406,8 @@ void handle_special_fds(void); int get_socket_fd(void); void set_socket_fd(int fd); =20 +xenevtchn_handle *evtchn_fdopen(int fd); + #ifdef __MINIOS__ void mount_9pfs(void); #endif diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c index e1d5e8d614..e0c2342edb 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -1326,7 +1326,7 @@ void domain_init(int evtfd) if (evtfd < 0) xce_handle =3D xenevtchn_open(NULL, XENEVTCHN_NO_CLOEXEC); else - xce_handle =3D xenevtchn_fdopen(NULL, evtfd, 0); + xce_handle =3D evtchn_fdopen(evtfd); =20 if (xce_handle =3D=3D NULL) barf_perror("Failed to open evtchn device"); diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c index a229954cf4..aa1f03fd6b 100644 --- a/tools/xenstored/minios.c +++ b/tools/xenstored/minios.c @@ -85,6 +85,11 @@ void set_socket_fd(int fd) { } =20 +xenevtchn_handle *evtchn_fdopen(int fd) +{ + return xenevtchn_open(NULL, XENEVTCHN_NO_CLOEXEC); +} + static void mount_thread(void *p) { xenbus_event_queue events =3D NULL; diff --git a/tools/xenstored/posix.c b/tools/xenstored/posix.c index 6037d739d0..ebdec82215 100644 --- a/tools/xenstored/posix.c +++ b/tools/xenstored/posix.c @@ -408,6 +408,11 @@ void set_socket_fd(int fd) sock =3D fd; } =20 +xenevtchn_handle *evtchn_fdopen(int fd) +{ + return xenevtchn_fdopen(NULL, fd, 0); +} + const char *xenstore_rundir(void) { return xenstore_daemon_rundir(); --=20 2.43.0 From nobody Thu Oct 30 23:12:12 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=1751444493; cv=none; d=zohomail.com; s=zohoarc; b=CkrcIeUvDXTFy/Gt7b5vuzvdiwKbbUPK4TrAxNoUKpX5aiVfhNEto2u1LSI8klHalC6t+B8mYPEjncTCbSNyvha5Pt3O3pwQ1oLVkWyfgpdRmTSS92QRZrNBi9xKCOX3EpotpGzRg4u7XgbDjUSwogtG4ASlDILK8VXVQ/fLFgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751444493; 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=QyZcNcUWYXlMK58GDg4vsd2KFsd/E7h4zy2FrD+iwSU=; b=bnlvdyiJzK2xwVxn1IHCX3cfW0CB2CupMXFjrwd7vF5vNtxOGBRDNo/x+kJ0tjCZ80zf1oLBO3y//xBQitpKAiRhHX7rxiyyEIF3siWeUqca2jz+YlMyQr7l9JRqeT12tDqK8Y/bTmBzyejjPYL9l4WXlR9YMVDnteoCmMBFZss= 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 1751444493236922.2272552663876; Wed, 2 Jul 2025 01:21:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030517.1404248 (Exim 4.92) (envelope-from ) id 1uWsiQ-0001No-2G; Wed, 02 Jul 2025 08:21:14 +0000 Received: by outflank-mailman (output) from mailman id 1030517.1404248; Wed, 02 Jul 2025 08:21:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWsiP-0001N9-VU; Wed, 02 Jul 2025 08:21:13 +0000 Received: by outflank-mailman (input) for mailman id 1030517; Wed, 02 Jul 2025 08:21:12 +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 1uWsbP-00082X-BN for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:13:59 +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 80a00a17-571c-11f0-b894-0df219b8e170; Wed, 02 Jul 2025 10:13:57 +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 95C2721175; Wed, 2 Jul 2025 08:13:52 +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 726A713A24; Wed, 2 Jul 2025 08:13:52 +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 HyC2GUDqZGhPSQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:13:52 +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: 80a00a17-571c-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1751444032; 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=QyZcNcUWYXlMK58GDg4vsd2KFsd/E7h4zy2FrD+iwSU=; b=jKGhsSm554iOqRnNksc6r0G0n7ed9Ttt2b5N2VrWl1Y3EH7/Xf0AdHXM7FkJF4hTTcYvXa qyY1WJBkBXpzSdxYpDPPPrDzI0pcRBXVK5ebWJdLq+tJc5GXMkCZgADuljJ0q7dwBizw8z spnOnrehY/RRzh+v4bSHMIR4qBrlj9g= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1751444032; 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=QyZcNcUWYXlMK58GDg4vsd2KFsd/E7h4zy2FrD+iwSU=; b=jKGhsSm554iOqRnNksc6r0G0n7ed9Ttt2b5N2VrWl1Y3EH7/Xf0AdHXM7FkJF4hTTcYvXa qyY1WJBkBXpzSdxYpDPPPrDzI0pcRBXVK5ebWJdLq+tJc5GXMkCZgADuljJ0q7dwBizw8z spnOnrehY/RRzh+v4bSHMIR4qBrlj9g= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Anthony PERARD Subject: [PATCH 7/9] tools/libxenevtchn: add xenevtchn_bind() under Mini-OS Date: Wed, 2 Jul 2025 10:13:03 +0200 Message-ID: <20250702081305.14440-8-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[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]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:email,suse.com:mid]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -6.80 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1751444495152116600 Content-Type: text/plain; charset="utf-8" In order to reactivate an event channel after kexec() of Mini-OS, libxenevtchn needs to allocate the port data for the event channel and set the handler again. Add a new interface xenevtchn_bind() for that purpose, available under Mini-OS only. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/include/xenevtchn.h | 11 +++++++++++ tools/libs/evtchn/minios.c | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tools/include/xenevtchn.h b/tools/include/xenevtchn.h index 1255c85178..113a718d67 100644 --- a/tools/include/xenevtchn.h +++ b/tools/include/xenevtchn.h @@ -173,6 +173,17 @@ int xenevtchn_unmask(xenevtchn_handle *xce, evtchn_por= t_t port); */ int xenevtchn_restrict(xenevtchn_handle *xce, domid_t domid); =20 +/** + * Bind an event channel under Mini-OS. + * + * Bind an event channel specified by its known port after a kexec() of + * Mini-OS. This function is available under Mini-OS only! + * + * @parm xce handle to the open evtchn interface + * @parm port the event channel to bind again + * @return 0 on success, -1 on failure with errno set appropriately. + */ +int xenevtchn_bind(xenevtchn_handle *xce, evtchn_port_t port); #endif =20 /* diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c index 0d2a201438..36e4201249 100644 --- a/tools/libs/evtchn/minios.c +++ b/tools/libs/evtchn/minios.c @@ -259,6 +259,23 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(x= enevtchn_handle *xce, return local_port; } =20 +int xenevtchn_bind(xenevtchn_handle *xce, evtchn_port_t port) +{ + struct port_info *port_info; + port_info =3D port_alloc(xce); + if ( port_info =3D=3D NULL ) + return -1; + + printf("xenevtchn_bind(%"PRId32")\n", port); + bind_evtchn(port, evtchn_handler, xce); + + port_info->bound =3D true; + port_info->port =3D port; + unmask_evtchn(port); + + return 0; +} + int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port) { int fd =3D xce->fd; --=20 2.43.0 From nobody Thu Oct 30 23:12:12 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; 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=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751444513410989.9298047505548; Wed, 2 Jul 2025 01:21:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030569.1404334 (Exim 4.92) (envelope-from ) id 1uWsim-0004Yf-Fr; Wed, 02 Jul 2025 08:21:36 +0000 Received: by outflank-mailman (output) from mailman id 1030569.1404334; Wed, 02 Jul 2025 08:21:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWsim-0004XH-4w; Wed, 02 Jul 2025 08:21:36 +0000 Received: by outflank-mailman (input) for mailman id 1030569; Wed, 02 Jul 2025 08:21:34 +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 1uWsbT-00082Y-87 for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:14:03 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [2a07:de40:b251:101:10:150:64:1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 83898f99-571c-11f0-a313-13f23c93f187; Wed, 02 Jul 2025 10:14:02 +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 227C321196; Wed, 2 Jul 2025 08:13:58 +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 EE15813A24; Wed, 2 Jul 2025 08:13:57 +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 jjiuOEXqZGhZSQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:13:57 +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: 83898f99-571c-11f0-a313-13f23c93f187 Authentication-Results: smtp-out1.suse.de; none From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 8/9] xenstored: rebind event channels after live update in stubdom Date: Wed, 2 Jul 2025 10:13:04 +0200 Message-ID: <20250702081305.14440-9-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spam-Level: X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Flag: NO X-Rspamd-Queue-Id: 227C321196 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Score: -4.00 X-ZM-MESSAGEID: 1751444515443116600 Content-Type: text/plain; charset="utf-8" After performing a live update in stubdom environment some information about inter-domain event channels is lost. In order to set this information again, call xenevtchn_bind() from new_domain() in the restore case. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/core.c | 1 - tools/xenstored/core.h | 3 +++ tools/xenstored/domain.c | 8 ++++++-- tools/xenstored/minios.c | 5 +++++ tools/xenstored/posix.c | 5 +++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c index 37e4dd5a5b..09c838d6e8 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -49,7 +49,6 @@ #include "control.h" #include "lu.h" =20 -extern xenevtchn_handle *xce_handle; /* in domain.c */ static int xce_pollfd_idx =3D -1; struct pollfd *poll_fds; static unsigned int current_array_size; diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h index bef24a688c..3f7426fbe3 100644 --- a/tools/xenstored/core.h +++ b/tools/xenstored/core.h @@ -394,6 +394,8 @@ static inline bool domain_is_unprivileged(const struct = connection *conn) return conn && domid_is_unprivileged(conn->id); } =20 +extern xenevtchn_handle *xce_handle; /* in domain.c */ + /* Return the event channel used by xenbus. */ evtchn_port_t get_xenbus_evtchn(void); void early_init(bool live_update, bool dofork, const char *pidfile); @@ -407,6 +409,7 @@ int get_socket_fd(void); void set_socket_fd(int fd); =20 xenevtchn_handle *evtchn_fdopen(int fd); +int evtchn_rebind(int port); =20 #ifdef __MINIOS__ void mount_9pfs(void); diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c index e0c2342edb..ca0744d6bb 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -855,9 +855,13 @@ static int new_domain(struct domain *domain, int port,= bool restore) =20 wrl_domain_new(domain); =20 - if (restore) + if (restore) { + if (evtchn_rebind(port)) { + errno =3D ENOMEM; + return errno; + } domain->port =3D port; - else { + } else { /* Tell kernel we're interested in this event. */ rc =3D xenevtchn_bind_interdomain(xce_handle, domain->domid, port); diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c index aa1f03fd6b..ec5faebaf3 100644 --- a/tools/xenstored/minios.c +++ b/tools/xenstored/minios.c @@ -90,6 +90,11 @@ xenevtchn_handle *evtchn_fdopen(int fd) return xenevtchn_open(NULL, XENEVTCHN_NO_CLOEXEC); } =20 +int evtchn_rebind(int port) +{ + return xenevtchn_bind(xce_handle, port); +} + static void mount_thread(void *p) { xenbus_event_queue events =3D NULL; diff --git a/tools/xenstored/posix.c b/tools/xenstored/posix.c index ebdec82215..97561701ae 100644 --- a/tools/xenstored/posix.c +++ b/tools/xenstored/posix.c @@ -413,6 +413,11 @@ xenevtchn_handle *evtchn_fdopen(int fd) return xenevtchn_fdopen(NULL, fd, 0); } =20 +int evtchn_rebind(int port) +{ + return 0; +} + const char *xenstore_rundir(void) { return xenstore_daemon_rundir(); --=20 2.43.0 From nobody Thu Oct 30 23:12:12 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; 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=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751444518881893.8649196638511; Wed, 2 Jul 2025 01:21:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1030582.1404350 (Exim 4.92) (envelope-from ) id 1uWsiw-00062Z-Ov; Wed, 02 Jul 2025 08:21:46 +0000 Received: by outflank-mailman (output) from mailman id 1030582.1404350; Wed, 02 Jul 2025 08:21: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 1uWsiw-00062J-Jv; Wed, 02 Jul 2025 08:21:46 +0000 Received: by outflank-mailman (input) for mailman id 1030582; Wed, 02 Jul 2025 08:21: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 1uWsbX-00082X-O3 for xen-devel@lists.xenproject.org; Wed, 02 Jul 2025 08:14: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 85a0e0f8-571c-11f0-b894-0df219b8e170; Wed, 02 Jul 2025 10:14: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-out1.suse.de (Postfix) with ESMTPS id A68C321175; Wed, 2 Jul 2025 08:14:03 +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 7E1C713A24; Wed, 2 Jul 2025 08:14:03 +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 0XJLHUvqZGhfSQAAD6G6ig (envelope-from ); Wed, 02 Jul 2025 08:14:03 +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: 85a0e0f8-571c-11f0-b894-0df219b8e170 Authentication-Results: smtp-out1.suse.de; none From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD Subject: [PATCH 9/9] tools/xenstored: make stubdom_init() live update aware Date: Wed, 2 Jul 2025 10:13:05 +0200 Message-ID: <20250702081305.14440-10-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250702081305.14440-1-jgross@suse.com> References: <20250702081305.14440-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Queue-Id: A68C321175 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.00 X-ZM-MESSAGEID: 1751444519497116600 Content-Type: text/plain; charset="utf-8" Pass the live_update bool to stubdom_init() in order to be able to handle it properly under Mini-OS. As stubdom_init() will (re-)create the 9pfs device needed for reading the saved state, call stubdom_init() before lu_read_state(). Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- tools/xenstored/core.c | 4 ++-- tools/xenstored/core.h | 2 +- tools/xenstored/domain.c | 15 +++++++++------ tools/xenstored/domain.h | 2 +- tools/xenstored/minios.c | 12 +++++++++--- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c index 09c838d6e8..18c5643029 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -2770,14 +2770,14 @@ int main(int argc, char *argv[]) if (tracefile) tracefile =3D absolute_filename(NULL, tracefile); =20 + stubdom_init(live_update); + #ifndef NO_LIVE_UPDATE /* Read state in case of live update. */ if (live_update) lu_read_state(); #endif =20 - stubdom_init(); - check_store(); =20 /* Get ready to listen to the tools. */ diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h index 3f7426fbe3..5071f1dedd 100644 --- a/tools/xenstored/core.h +++ b/tools/xenstored/core.h @@ -412,7 +412,7 @@ xenevtchn_handle *evtchn_fdopen(int fd); int evtchn_rebind(int port); =20 #ifdef __MINIOS__ -void mount_9pfs(void); +void mount_9pfs(bool live_update); #endif =20 const char *xenstore_rundir(void); diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c index ca0744d6bb..877a14e858 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -1267,7 +1267,7 @@ void dom0_init(void) xenevtchn_notify(xce_handle, dom0->port); } =20 -void stubdom_init(void) +void stubdom_init(bool live_update) { #ifdef __MINIOS__ struct domain *stubdom; @@ -1275,13 +1275,16 @@ void stubdom_init(void) if (stub_domid < 0) return; =20 - stubdom =3D introduce_domain(NULL, stub_domid, xenbus_evtchn, false); - if (!stubdom) - barf_perror("Failed to initialize stubdom"); + if (!live_update) { + stubdom =3D introduce_domain(NULL, stub_domid, xenbus_evtchn, + false); + if (!stubdom) + barf_perror("Failed to initialize stubdom"); =20 - xenevtchn_notify(xce_handle, stubdom->port); + xenevtchn_notify(xce_handle, stubdom->port); + } =20 - mount_9pfs(); + mount_9pfs(live_update); #endif } =20 diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h index 844ac11510..02b261ad47 100644 --- a/tools/xenstored/domain.h +++ b/tools/xenstored/domain.h @@ -85,7 +85,7 @@ int do_reset_watches(const void *ctx, struct connection *= conn, void domain_early_init(void); void domain_init(int evtfd); void dom0_init(void); -void stubdom_init(void); +void stubdom_init(bool live_update); void domain_deinit(void); void ignore_connection(struct connection *conn, unsigned int err); =20 diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c index ec5faebaf3..f04423fe09 100644 --- a/tools/xenstored/minios.c +++ b/tools/xenstored/minios.c @@ -131,15 +131,21 @@ static void mount_thread(void *p) free(err); } =20 - p9_device =3D init_9pfront(0, XENSTORE_LIB_DIR); + p9_device =3D init_9pfront2(0, XENSTORE_LIB_DIR, INIT9P_FLAG_KEXEC); =20 /* Start logging if selected. */ reopen_log(); } =20 -void mount_9pfs(void) +void mount_9pfs(bool live_update) { - create_thread("mount-9pfs", mount_thread, NULL); + if (!live_update) + create_thread("mount-9pfs", mount_thread, NULL); + else { + p9_device =3D init_9pfront2(0, XENSTORE_LIB_DIR, + INIT9P_FLAG_REINIT); + reopen_log(); + } } =20 const char *xenstore_rundir(void) --=20 2.43.0