From nobody Wed May 22 03:24:01 2024 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=1699616112; cv=none; d=zohomail.com; s=zohoarc; b=bkRBkjPfMzC/NPni7DJ91J2y/nzUHs1vkTrVAviroSHGPhWCFMPQoAL6jWJ3hYHNJDrEOZVf77h4G2oBSk+txZuPKFDtllkojGJ4jIKDnsyKcZmWUy/iobxh/cNz6e/JD75xZ3XwohS+K+pq0MY5Hxq6Jg2x2teXentFgF3FPpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699616112; 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=3t0G5pmc2tLtGKnSz0jnViu11fvXLpv0iet8qXj51Qc=; b=ZUt+mF9C4MNJFqEIfFMH1Dgto2EUY34bfL27roLdx2FMBEkLQT0Jea5ljjrfUfS/ARXPdKPLQAlMV18T7Ses6zFneWvicad9nGRx9/2nQqWvtjYlqIz6rTVxVAXFljtfJFYyYkeexvuqHZlCC5k/3QbXca0Pl5CrFpgzZ7tHjs0= 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 169961611213946.89446168315499; Fri, 10 Nov 2023 03:35:12 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.630211.982902 (Exim 4.92) (envelope-from ) id 1r1Pmg-000812-Ss; Fri, 10 Nov 2023 11:34:46 +0000 Received: by outflank-mailman (output) from mailman id 630211.982902; Fri, 10 Nov 2023 11:34: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 1r1Pmg-00080d-O1; Fri, 10 Nov 2023 11:34:46 +0000 Received: by outflank-mailman (input) for mailman id 630211; Fri, 10 Nov 2023 11:34:45 +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 1r1Pmf-0007vX-U0 for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:34:45 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 24c674ba-7fbd-11ee-98da-6d05b1d4d9a1; Fri, 10 Nov 2023 12:34:44 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A98A61F8BA; Fri, 10 Nov 2023 11:34:43 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 77EDA13398; Fri, 10 Nov 2023 11:34:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hFVPGlMVTmXfAwAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:34:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 24c674ba-7fbd-11ee-98da-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616083; 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=3t0G5pmc2tLtGKnSz0jnViu11fvXLpv0iet8qXj51Qc=; b=RT77VAcD/8qmhPqKRYDJFsLU3i+kRf25gQ+WUCfhbSILqpLleXo659ePRYndl3bYxroFEZ BUsSK/BTrxaxdf0SadYaaO0cEjubUiFpVcDGV9uGzCxRhTsvczddDGWi4lGqzFd/6z1kAh iWOoU3lVzzkQoSJhdspcoGrV6mrFW8M= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross , Jason Andryuk Subject: [PATCH v2 1/5] Mini-OS: make xenstore_buf externally visible Date: Fri, 10 Nov 2023 12:34:31 +0100 Message-Id: <20231110113435.22609-2-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1699616114155100004 Content-Type: text/plain; charset="utf-8" For support of the 9pfs frontend in Xenstore-stubdom xenstore_buf needs to be externally visible. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- include/xenbus.h | 2 ++ xenbus.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/xenbus.h b/include/xenbus.h index c0fc0ac5..542ee456 100644 --- a/include/xenbus.h +++ b/include/xenbus.h @@ -8,12 +8,14 @@ typedef unsigned long xenbus_transaction_t; =20 #ifdef CONFIG_XENBUS extern uint32_t xenbus_evtchn; +extern struct xenstore_domain_interface *xenstore_buf; =20 /* Initialize the XenBus system. */ void init_xenbus(void); void get_xenbus(void *p); #else #define xenbus_evtchn ~0 +#define xenstore_buf NULL =20 static inline void init_xenbus(void) { diff --git a/xenbus.c b/xenbus.c index 923e8181..8bfd5bd4 100644 --- a/xenbus.c +++ b/xenbus.c @@ -44,7 +44,7 @@ #define DEBUG(_f, _a...) ((void)0) #endif =20 -static struct xenstore_domain_interface *xenstore_buf; +struct xenstore_domain_interface *xenstore_buf; static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); DECLARE_WAIT_QUEUE_HEAD(xenbus_watch_queue); static __DECLARE_SEMAPHORE_GENERIC(xb_write_sem, 1); --=20 2.35.3 From nobody Wed May 22 03:24:01 2024 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=1699616113; cv=none; d=zohomail.com; s=zohoarc; b=Vxxc1XFUYx+Awl7N44CmEBuwzW43ARye+sJpNYBwlvctHxzXtm05FAZO/xGdHv52/9a+q+fUZrH4zURaRKKz5S7xkppN0t6wfq1EOtIQfrTXh40SDdzabzA4jsx9SlCOSlWq7Qagr+aqLPca4HbZJUum1O33BL/KB2jMvsPTDC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699616113; 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=oEkaTvWrd2nXatjBd0EXJy9ZObp+JBhOQHMFm6gHKW4=; b=W6+sWK6gH9Q+vY0zaWH9O1plbDn24ek9sJlcbgBaGWJt/QSUdCsA3TeZVbOOriQY6Ff3ziZC56uDAic7BfpMHgm4baUkkojUcoZBUi9hIeFkaQ1XzQ5JWNlfRNGcxwtSuYVtcwDg2hWK+bkf7yq8vDjMuL10oFVATEbDuTm0AaQ= 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 1699616113078334.2333949927347; Fri, 10 Nov 2023 03:35:13 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.630212.982911 (Exim 4.92) (envelope-from ) id 1r1Pmn-0008MP-1s; Fri, 10 Nov 2023 11:34:53 +0000 Received: by outflank-mailman (output) from mailman id 630212.982911; Fri, 10 Nov 2023 11:34:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pmm-0008MI-VY; Fri, 10 Nov 2023 11:34:52 +0000 Received: by outflank-mailman (input) for mailman id 630212; Fri, 10 Nov 2023 11:34:52 +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 1r1Pmm-0007he-4H for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:34:52 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2819436e-7fbd-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 12:34:49 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4191C1F8BA; Fri, 10 Nov 2023 11:34:49 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 153EA13398; Fri, 10 Nov 2023 11:34:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Pte9A1kVTmXsAwAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:34:49 +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: 2819436e-7fbd-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616089; 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=oEkaTvWrd2nXatjBd0EXJy9ZObp+JBhOQHMFm6gHKW4=; b=s9UoIFSj79bmGo8WgY7yrK18Ld9fC6vQctHhLCTBqkGMmsjBmbVM1gDtyGugGGBjAj0Qlz tADXA2DapRZ48BJzdZWkqnuM3OO/grtYiQPXRQRi9CeGacPQAj9eVUd5axRdrZU09BDte6 VtrGrER+gGEF/hmdiIKl0QHRxHg8J3I= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross Subject: [PATCH v2 2/5] Mini-OS: get own domid Date: Fri, 10 Nov 2023 12:34:32 +0100 Message-Id: <20231110113435.22609-3-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1699616114063100001 Content-Type: text/plain; charset="utf-8" Get the own domid via creation of a temporary event channel. There is no "official" way to read the own domid in PV guests, so use the event channel interface to get it: - allocate an unbound event channel specifying DOMID_SELF for the other end - read the event channel status which will contain the own domid in unbound.dom - close the event channel Signed-off-by: Juergen Gross --- events.c | 32 ++++++++++++++++++++++++++++++++ include/events.h | 2 ++ 2 files changed, 34 insertions(+) diff --git a/events.c b/events.c index cdae90f4..af9f9f9e 100644 --- a/events.c +++ b/events.c @@ -261,6 +261,38 @@ int evtchn_get_peercontext(evtchn_port_t local_port, c= har *ctx, int size) return rc; } =20 +domid_t evtchn_get_domid(void) +{ + int rc; + domid_t domid =3D DOMID_INVALID; + evtchn_alloc_unbound_t op; + struct evtchn_status status; + struct evtchn_close close; + + op.dom =3D DOMID_SELF; + op.remote_dom =3D DOMID_SELF; + rc =3D HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &op); + if ( rc ) + { + printk("ERROR: alloc_unbound failed with rc=3D%d", rc); + return domid; + } + + status.dom =3D DOMID_SELF; + status.port =3D op.port; + rc =3D HYPERVISOR_event_channel_op(EVTCHNOP_status, &status); + if ( rc ) + printk("ERROR: EVTCHNOP_status failed with rc=3D%d", rc); + else + domid =3D status.u.unbound.dom; + + close.port =3D op.port; + rc =3D HYPERVISOR_event_channel_op(EVTCHNOP_close, &close); + if ( rc ) + printk("WARN: close_port %d failed rc=3D%d. ignored\n", close.port= , rc); + + return domid; +} =20 /* * Local variables: diff --git a/include/events.h b/include/events.h index 705ad93a..87311481 100644 --- a/include/events.h +++ b/include/events.h @@ -57,4 +57,6 @@ static inline int notify_remote_via_evtchn(evtchn_port_t = port) void fini_events(void); void suspend_events(void); =20 +domid_t evtchn_get_domid(void); + #endif /* _EVENTS_H_ */ --=20 2.35.3 From nobody Wed May 22 03:24:01 2024 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=1699616122; cv=none; d=zohomail.com; s=zohoarc; b=ScJ5Nv2yg2c9wkpB6hDZtBaiJN1wqxDUaajoxjZ0FE3iMnuIq5MLHG/yq7rL3YT315C/FrCk00bVwOatNP1ZcrODT/httbcTFImmAYyDclyhxH9FEDPkj2WC0NVRHWQ+FER7GXvv+Ka2nmJqy9BkJfbZbzt0C5dPllVHz93KUUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699616122; 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=UMM1Ggz+vBiGVJdcd2QMUJ1ZGIfkpwMwpm/gMVXFLeQ=; b=FdEGh6sRvWJhNgKex88IWa+FJMykD2xQTXDRYgDK/7izHQfnPNNh5hnUd4HExwYu104XDYcVGDHKV79LA05JhI9uH0aTODAesycIyg0AZLsubQt/HYw9MPxETEHWAboOLQybfgJ05PKEYUL0S8NXWqDB4ty0jseB1HpyOiXprRg= 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 1699616122052776.6822487920916; Fri, 10 Nov 2023 03:35:22 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.630215.982930 (Exim 4.92) (envelope-from ) id 1r1Pmu-0000PE-GH; Fri, 10 Nov 2023 11:35:00 +0000 Received: by outflank-mailman (output) from mailman id 630215.982930; Fri, 10 Nov 2023 11:35:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pmu-0000Oy-Cs; Fri, 10 Nov 2023 11:35:00 +0000 Received: by outflank-mailman (input) for mailman id 630215; Fri, 10 Nov 2023 11:34:58 +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 1r1Pms-0007he-NU for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:34:58 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2b71cb8c-7fbd-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 12:34:55 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D74AB1F8BA; Fri, 10 Nov 2023 11:34:54 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A717613398; Fri, 10 Nov 2023 11:34:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mZB6J14VTmUABAAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:34:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2b71cb8c-7fbd-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616094; 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=UMM1Ggz+vBiGVJdcd2QMUJ1ZGIfkpwMwpm/gMVXFLeQ=; b=hZooTPeThVheEzRapoEd6UFJiQa3WN3RnkHWOV0CJVv/fy91v0n9hCFLqDjphzDoFl8Ocj M/UUI9z1zxlzsSupMF80JwZRdnLSJiyKbHXUZZlMLPNEcEi6OrOe3fO2GUCPLlWrRukScl OZmwN4JSkTsHU1iD8eiNiwBvJryxXrM= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross , Jason Andryuk Subject: [PATCH v2 3/5] Mini-OS: don't crash if no shutdown node is available Date: Fri, 10 Nov 2023 12:34:33 +0100 Message-Id: <20231110113435.22609-4-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1699616123977100001 Content-Type: text/plain; charset="utf-8" It might be perfectly fine not to have a control/shutdown Xenstore node. If this is the case, don't crash, but just terminate the shutdown thread after issuing a message that shutdown isn't available. In fini_shutdown() clearing the watch can result in an error now, in case the early exit above was taken. Just ignore this error now. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- shutdown.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/shutdown.c b/shutdown.c index bb2c6f11..ded6b64d 100644 --- a/shutdown.c +++ b/shutdown.c @@ -75,7 +75,9 @@ static void shutdown_thread(void *p) xenbus_wait_for_watch(&events); if ((err =3D xenbus_read(XBT_NIL, path, &shutdown))) { free(err); - do_exit(); + free(xenbus_unwatch_path_token(XBT_NIL, path, token)); + printk("Shutdown Xenstore node not available.\n"); + return; } =20 if (end_shutdown_thread) @@ -117,15 +119,9 @@ void init_shutdown(void) =20 void fini_shutdown(void) { - char *err; - end_shutdown_thread =3D 1; xenbus_release_wait_for_watch(&events); - err =3D xenbus_unwatch_path_token(XBT_NIL, path, token); - if (err) { - free(err); - do_exit(); - } + free(xenbus_unwatch_path_token(XBT_NIL, path, token)); } #endif =20 --=20 2.35.3 From nobody Wed May 22 03:24:01 2024 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=1699616127; cv=none; d=zohomail.com; s=zohoarc; b=M+hqgFDhgSwgt0pKY+rymIXKExzycpRPfmSzwXcDGoolS+0a4EY8o68UG15HpRGGh1bg0Ju/r+ebaShNL09EU2XjwcjqcpIDqahQcmS6GODzGfD1SgR8iI6vQkcai5fwMG/bH10MSPuzGwJFmehsnp232JwDmiTo1tpNnoR8M5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699616127; 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=iyiJvbdzxfjlxXumjIe2Le5NJ94QuV7U0Z18Or31ob0=; b=hoz9p8i9XhLCWIRdCGDdNBL47NdWNUqEfyFy765QjTTABfuNPHy8ZYebHwlP6Z2DAej/dqYwzh44SDw8HNgvOij/ufFNLwY7kfrQok/8DxUE/AT1KMrKUHKFET5Ex2aBz24jtIeCpBp+zcW8VrZwBRhibIOSx8pXZVKX9PdAfAs= 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 1699616127120107.53146541607362; Fri, 10 Nov 2023 03:35:27 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.630218.982944 (Exim 4.92) (envelope-from ) id 1r1Pmz-0000u4-QT; Fri, 10 Nov 2023 11:35:05 +0000 Received: by outflank-mailman (output) from mailman id 630218.982944; Fri, 10 Nov 2023 11:35:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pmz-0000ts-N6; Fri, 10 Nov 2023 11:35:05 +0000 Received: by outflank-mailman (input) for mailman id 630218; Fri, 10 Nov 2023 11:35:04 +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 1r1Pmy-0007he-DA for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:35:04 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2ed45b4b-7fbd-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 12:35:00 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7FB3A1F8BB; Fri, 10 Nov 2023 11:35:00 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 454E613398; Fri, 10 Nov 2023 11:35:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aoa7D2QVTmUJBAAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:35:00 +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: 2ed45b4b-7fbd-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616100; 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=iyiJvbdzxfjlxXumjIe2Le5NJ94QuV7U0Z18Or31ob0=; b=lXQ/tq5ePTKElZQM2cBlSIKbW004yTsXKydCqgdKUBQFJrzrswpHjd9+7NaTI0I9do4B4f pKop2gWJifnXuPOvU98XvCwT0+UJ2pyelDL5f4UjaB6yfibWJQBmzcgOuQH+xtZZOtPqoE BcdJmeRTcmFuPCQuQ5cmoYOjDNJBZSk= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross , Jason Andryuk Subject: [PATCH v2 4/5] Mini-OS: fix 9pfs stat receive format Date: Fri, 10 Nov 2023 12:34:34 +0100 Message-Id: <20231110113435.22609-5-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1699616127962100001 Content-Type: text/plain; charset="utf-8" The format string of the received data for the 9pfs stat command is missing the initial 2 byte total length specifier. Add it. Fixes: 2d1dfccd3aa3 ("Mini-OS: add read and write support to 9pfsfront") Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- 9pfront.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/9pfront.c b/9pfront.c index 5da8a365..43c7409f 100644 --- a/9pfront.c +++ b/9pfront.c @@ -711,6 +711,7 @@ static int p9_create(struct dev_9pfs *dev, uint32_t fid= , char *path, static int p9_stat(struct dev_9pfs *dev, uint32_t fid, struct p9_stat *sta= t) { struct req *req =3D get_free_req(dev); + uint16_t total; int ret; =20 if ( !req ) @@ -719,10 +720,10 @@ static int p9_stat(struct dev_9pfs *dev, uint32_t fid= , struct p9_stat *stat) memset(stat, 0, sizeof(*stat)); req->cmd =3D P9_CMD_STAT; send_9p(dev, req, "U", fid); - rcv_9p(dev, req, "uuUQUUULSSSSSUUU", &stat->size, &stat->type, &stat->= dev, - stat->qid, &stat->mode, &stat->atime, &stat->mtime, &stat->leng= th, - &stat->name, &stat->uid, &stat->gid, &stat->muid, &stat->extens= ion, - &stat->n_uid, &stat->n_gid, &stat->n_muid); + rcv_9p(dev, req, "uuuUQUUULSSSSSUUU", &total, &stat->size, &stat->type, + &stat->dev, stat->qid, &stat->mode, &stat->atime, &stat->mtime, + &stat->length, &stat->name, &stat->uid, &stat->gid, &stat->muid, + &stat->extension, &stat->n_uid, &stat->n_gid, &stat->n_muid); =20 ret =3D req->result; =20 --=20 2.35.3 From nobody Wed May 22 03:24:01 2024 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=1699618424; cv=none; d=zohomail.com; s=zohoarc; b=SDeTYZVIXXSblX9hWXimOXTZwcphsSJV0UMRW2bllQG2pI/WoqpGUNmXtO45LkPVSWlZcKGZPXFdUAp/yWsJNAOiiuhZq7RQB8HjQ8Z17HMItjDFQgFyvBUWv1kA0jUhU0JCud+asJk3JGaaL6B/IUUoHJ5Fnzgnb5O9SuWef64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699618424; 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=pEEtaKVN/DMgZvS8wiA2rruIly8+jtG6pBEpyWM89Hs=; b=Wt3qNkJIwKaO2Hh6dLcVEmHwhVBDWaP5px5A3fXFUrt3a6IwWndqOsIlbacdj4j/9sszbYIXsb8EbPOr4PO3NxknujALlLaaL97TDGYq449ns2nD5leTbzg5CLFDV03YUx/O/a7vN2KHPJ/o2DUvblTFgspbldGyI5s8z0tYvyo= 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 1699618424505707.5475593998216; Fri, 10 Nov 2023 04:13:44 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.630248.982958 (Exim 4.92) (envelope-from ) id 1r1Pws-0005XR-Ql; Fri, 10 Nov 2023 11:45:18 +0000 Received: by outflank-mailman (output) from mailman id 630248.982958; Fri, 10 Nov 2023 11:45:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pws-0005XI-Nv; Fri, 10 Nov 2023 11:45:18 +0000 Received: by outflank-mailman (input) for mailman id 630248; Fri, 10 Nov 2023 11:45:17 +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 1r1Pn3-0007he-Do for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:35:09 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 32192935-7fbd-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 12:35:06 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0A2CD1F8BA; Fri, 10 Nov 2023 11:35:06 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D240B13398; Fri, 10 Nov 2023 11:35:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JNYFMmkVTmUYBAAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:35:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 32192935-7fbd-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616106; 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=pEEtaKVN/DMgZvS8wiA2rruIly8+jtG6pBEpyWM89Hs=; b=iTkromXprVW3/nlojohrUMSkRDHKNbAXjPRqSQgXtZNtgoDrr9+z3Vs3FUuCmFlWEaWOxD NIKEOvNlJcgV421yMkbkpRvLV02NEins8CCiI+/mkuCA+fEg1h722mm7/EcdQlYiTcqKCH if+Qv8+FJKIqYgYb903VLkCAZFzBrk8= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross Subject: [PATCH v2 5/5] Mini-OS: fix 9pfs response receiving Date: Fri, 10 Nov 2023 12:34:35 +0100 Message-Id: <20231110113435.22609-6-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1699618426475100001 Content-Type: text/plain; charset="utf-8" When copying a 9pfs response chunk from the ring buffer across the ring end, the local ring pointer and length field are not updated correctly. Fix that. Fixes: 0924fec1de58 ("Mini-OS: add 9pfs transport layer") Signed-off-by: Juergen Gross --- V2: - new patch --- 9pfront.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/9pfront.c b/9pfront.c index 43c7409f..35c5552b 100644 --- a/9pfront.c +++ b/9pfront.c @@ -386,7 +386,9 @@ static void copy_bufs(unsigned char **buf1, unsigned ch= ar **buf2, printk("9pfs: short copy (dropping %u bytes)\n", len - *len1); len =3D *len1; } - memcpy(target, *buf1, *len1); + memcpy(target, *buf1, len); + *buf1 +=3D len; + *len1 -=3D len; } } =20 --=20 2.35.3