From nobody Thu Oct 30 22:39:36 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=1753878242; cv=none; d=zohomail.com; s=zohoarc; b=drPaiqCW9MSmrJgldn7SOCig0aCRbSFbq/J+pByGXLrB9TQCfo17w8+JWC+FgIbQqjMOsQOybP/tNNNZYhoRz66DbBu6jTFw/TDnfVwC8JjxzSB5XFAI/hEO5SqaqW3WS2PlTyfuiAXMYLXeBYSLYm20x3qg30QZz8TKQDUD3w4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753878242; 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=EEBwah7qk2nax0TCJi1E0NRt+EjeWrtG5skr59O3zrk=; b=nj+GuCWAO5Kgkv8PFaQ2qznzkb0mlR03nAjCRe06GoIOwF8o8FBARbAqjA2V1YHIuQms5DuS0BwzcqOitKvjoh9n5Ko4jwEEMKMUotKQd0PaenJnEdcpI02ESkZMS2Wk7jC3/d6KQFFKHrlD3ZNt5djw3Gmq8PvwVRAvSjM4JzE= 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 1753878242297122.69999490260398; Wed, 30 Jul 2025 05:24:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1063900.1429661 (Exim 4.92) (envelope-from ) id 1uh5qY-0007Ex-Ns; Wed, 30 Jul 2025 12:23:50 +0000 Received: by outflank-mailman (output) from mailman id 1063900.1429661; Wed, 30 Jul 2025 12:23: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 1uh5qY-0007Eo-Ky; Wed, 30 Jul 2025 12:23:50 +0000 Received: by outflank-mailman (input) for mailman id 1063900; Wed, 30 Jul 2025 12:23:49 +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 1uh5qX-0004Wg-NH for xen-devel@lists.xenproject.org; Wed, 30 Jul 2025 12:23:49 +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 0ad215d8-6d40-11f0-a320-13f23c93f187; Wed, 30 Jul 2025 14:23: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 5555C21AB3; Wed, 30 Jul 2025 12:23: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 223DC1388B; Wed, 30 Jul 2025 12:23: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 iIn0BtMOimjMJAAAD6G6ig (envelope-from ); Wed, 30 Jul 2025 12:23: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: 0ad215d8-6d40-11f0-a320-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753878227; 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=EEBwah7qk2nax0TCJi1E0NRt+EjeWrtG5skr59O3zrk=; b=QMWUHD7/BeWXk9NigmovZa2+P5cGFcp7h2xN2vQocuPPEzLwEBrPZqp5hYIMUq4qdH7OGM vVy+o3y5dO/5wr3zd5h8WjNU53vMdiL5QqjObAaqXmKUpO0iGpzTP56QCtlwJp0G2SSdYA e+LhNpS+VdVlHT0JnUYKn0zZj/4QYXI= Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b="QMWUHD7/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1753878227; 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=EEBwah7qk2nax0TCJi1E0NRt+EjeWrtG5skr59O3zrk=; b=QMWUHD7/BeWXk9NigmovZa2+P5cGFcp7h2xN2vQocuPPEzLwEBrPZqp5hYIMUq4qdH7OGM vVy+o3y5dO/5wr3zd5h8WjNU53vMdiL5QqjObAaqXmKUpO0iGpzTP56QCtlwJp0G2SSdYA e+LhNpS+VdVlHT0JnUYKn0zZj/4QYXI= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Julien Grall , Anthony PERARD , Jason Andryuk Subject: [PATCH v3 7/9] tools/xenstored: make stubdom_init() live update aware Date: Wed, 30 Jul 2025 14:23:03 +0200 Message-ID: <20250730122305.4050-8-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250730122305.4050-1-jgross@suse.com> References: <20250730122305.4050-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Queue-Id: 5555C21AB3 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)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[suse.com:+]; 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] X-Spam-Score: -3.01 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1753878243785116600 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 e3e8607592..5377d72f54 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -2774,14 +2774,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 7a6ce5b91b..57ca98ee5b 100644 --- a/tools/xenstored/domain.c +++ b/tools/xenstored/domain.c @@ -1337,7 +1337,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; @@ -1345,13 +1345,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 94481fdcc0..3ca702f56d 100644 --- a/tools/xenstored/domain.h +++ b/tools/xenstored/domain.h @@ -93,7 +93,7 @@ int do_set_feature(const void *ctx, struct connection *co= nn, 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