From nobody Fri Apr 19 03:34:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1581493374305288.0231451153239; Tue, 11 Feb 2020 23:42:54 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j1mer-00010v-Lm; Wed, 12 Feb 2020 07:42:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j1meq-00010o-Af for xen-devel@lists.xenproject.org; Wed, 12 Feb 2020 07:42:04 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 25b49bf4-4d6b-11ea-ade5-bc764e2007e4; Wed, 12 Feb 2020 07:41:58 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 30C21AF62; Wed, 12 Feb 2020 07:41:57 +0000 (UTC) X-Inumbo-ID: 25b49bf4-4d6b-11ea-ade5-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 12 Feb 2020 08:41:52 +0100 Message-Id: <20200212074154.23755-2-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200212074154.23755-1-jgross@suse.com> References: <20200212074154.23755-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v2 1/3] xenstore: setup xenstore stubdom console interface properly X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Ian Jackson , Wei Liu MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In order to be able to get access to the console of Xenstore stubdom we need an appropriate granttab entry. So call xc_dom_gnttab_init() when constructing the domain and preset some information needed for that function in the dom structure. We need to create the event channel for the console, too. Do that and store all necessary data locally. Signed-off-by: Juergen Gross Acked-by: Wei Liu --- tools/helpers/init-xenstore-domain.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xens= tore-domain.c index adb8408b63..3a8ca64741 100644 --- a/tools/helpers/init-xenstore-domain.c +++ b/tools/helpers/init-xenstore-domain.c @@ -24,6 +24,7 @@ static char *param; static char *name =3D "Xenstore"; static int memory; static int maxmem; +static xc_evtchn_port_or_error_t console_evtchn; =20 static struct option options[] =3D { { "kernel", 1, NULL, 'k' }, @@ -113,6 +114,12 @@ static int build(xc_interface *xch) fprintf(stderr, "xc_domain_setmaxmem failed\n"); goto err; } + console_evtchn =3D xc_evtchn_alloc_unbound(xch, domid, 0); + if ( console_evtchn < 0 ) + { + fprintf(stderr, "xc_evtchn_alloc_unbound failed\n"); + goto err; + } rv =3D xc_domain_set_memmap_limit(xch, domid, limit_kb); if ( rv ) { @@ -133,6 +140,15 @@ static int build(xc_interface *xch) snprintf(cmdline, 512, "--event %d --internal-db", rv); =20 dom =3D xc_dom_allocate(xch, cmdline, NULL); + if ( !dom ) + { + fprintf(stderr, "xc_dom_allocate failed\n"); + goto err; + } + dom->container_type =3D XC_DOM_PV_CONTAINER; + dom->xenstore_domid =3D domid; + dom->console_evtchn =3D console_evtchn; + rv =3D xc_dom_kernel_file(dom, kernel); if ( rv ) { @@ -186,6 +202,12 @@ static int build(xc_interface *xch) fprintf(stderr, "xc_dom_boot_image failed\n"); goto err; } + rv =3D xc_dom_gnttab_init(dom); + if ( rv ) + { + fprintf(stderr, "xc_dom_gnttab_init failed\n"); + goto err; + } =20 rv =3D xc_domain_set_virq_handler(xch, domid, VIRQ_DOM_EXC); if ( rv ) --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 03:34:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1581493374513142.3120653678651; Tue, 11 Feb 2020 23:42:54 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j1mem-00010i-DF; Wed, 12 Feb 2020 07:42:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j1mel-00010d-II for xen-devel@lists.xenproject.org; Wed, 12 Feb 2020 07:41:59 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 25b4e4f6-4d6b-11ea-bc8e-bc764e2007e4; Wed, 12 Feb 2020 07:41:58 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4FA6FAF92; Wed, 12 Feb 2020 07:41:57 +0000 (UTC) X-Inumbo-ID: 25b4e4f6-4d6b-11ea-bc8e-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 12 Feb 2020 08:41:53 +0100 Message-Id: <20200212074154.23755-3-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200212074154.23755-1-jgross@suse.com> References: <20200212074154.23755-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v2 2/3] xenstore: add console xenstore entries for xenstore stubdom X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Ian Jackson , Wei Liu MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In order to be able to connect to the console of Xenstore stubdom we need to create the appropriate entries in Xenstore. For the moment we don't support xenconsoled living in another domain than dom0, as this information isn't available other then via Xenstore which we are just setting up. Signed-off-by: Juergen Gross Acked-by: Andrew Cooper Acked-by: Wei Liu --- tools/helpers/init-xenstore-domain.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xens= tore-domain.c index 3a8ca64741..4ce8299c3c 100644 --- a/tools/helpers/init-xenstore-domain.c +++ b/tools/helpers/init-xenstore-domain.c @@ -12,6 +12,7 @@ #include #include #include +#include =20 #include "init-dom-json.h" #include "_paths.h" @@ -24,6 +25,7 @@ static char *param; static char *name =3D "Xenstore"; static int memory; static int maxmem; +static xen_pfn_t console_mfn; static xc_evtchn_port_or_error_t console_evtchn; =20 static struct option options[] =3D { @@ -223,6 +225,7 @@ static int build(xc_interface *xch) } =20 rv =3D 0; + console_mfn =3D xc_dom_p2m(dom, dom->console_pfn); =20 err: if ( dom ) @@ -321,6 +324,15 @@ static void do_xs_write(struct xs_handle *xsh, char *p= ath, char *val) fprintf(stderr, "writing %s to xenstore failed.\n", path); } =20 +static void do_xs_write_dir_node(struct xs_handle *xsh, char *dir, char *n= ode, + char *val) +{ + char full_path[100]; + + snprintf(full_path, 100, "%s/%s", dir, node); + do_xs_write(xsh, full_path, val); +} + static void do_xs_write_dom(struct xs_handle *xsh, char *path, char *val) { char full_path[64]; @@ -334,7 +346,7 @@ int main(int argc, char** argv) int opt; xc_interface *xch; struct xs_handle *xsh; - char buf[16]; + char buf[16], be_path[64], fe_path[64]; int rv, fd; char *maxmem_str =3D NULL; =20 @@ -423,6 +435,25 @@ int main(int argc, char** argv) if (maxmem) snprintf(buf, 16, "%d", maxmem * 1024); do_xs_write_dom(xsh, "memory/static-max", buf); + snprintf(be_path, 64, "/local/domain/0/backend/console/%d/0", domid); + snprintf(fe_path, 64, "/local/domain/%d/console", domid); + snprintf(buf, 16, "%d", domid); + do_xs_write_dir_node(xsh, be_path, "frontend-id", buf); + do_xs_write_dir_node(xsh, be_path, "frontend", fe_path); + do_xs_write_dir_node(xsh, be_path, "online", "1"); + snprintf(buf, 16, "%d", XenbusStateInitialising); + do_xs_write_dir_node(xsh, be_path, "state", buf); + do_xs_write_dir_node(xsh, be_path, "protocol", "vt100"); + do_xs_write_dir_node(xsh, fe_path, "backend", be_path); + do_xs_write_dir_node(xsh, fe_path, "backend-id", "0"); + do_xs_write_dir_node(xsh, fe_path, "limit", "1048576"); + do_xs_write_dir_node(xsh, fe_path, "type", "xenconsoled"); + do_xs_write_dir_node(xsh, fe_path, "output", "pty"); + do_xs_write_dir_node(xsh, fe_path, "tty", ""); + snprintf(buf, 16, "%d", console_evtchn); + do_xs_write_dir_node(xsh, fe_path, "port", buf); + snprintf(buf, 16, "%ld", console_mfn); + do_xs_write_dir_node(xsh, fe_path, "ring-ref", buf); xs_close(xsh); =20 fd =3D creat(XEN_RUN_DIR "/xenstored.pid", 0666); --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 19 03:34:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1581493374236428.25020381402237; Tue, 11 Feb 2020 23:42:54 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j1mf1-00012j-7j; Wed, 12 Feb 2020 07:42:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j1mf0-00012R-AZ for xen-devel@lists.xenproject.org; Wed, 12 Feb 2020 07:42:14 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 25b4a220-4d6b-11ea-ade5-bc764e2007e4; Wed, 12 Feb 2020 07:41:58 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 76501AF96; Wed, 12 Feb 2020 07:41:57 +0000 (UTC) X-Inumbo-ID: 25b4a220-4d6b-11ea-ade5-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 12 Feb 2020 08:41:54 +0100 Message-Id: <20200212074154.23755-4-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200212074154.23755-1-jgross@suse.com> References: <20200212074154.23755-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v2 3/3] xenstore: remove not applicable control commands in stubdom X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Ian Jackson , Wei Liu MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" When run in a stubdom environment Xenstore can't select a logfile or emit memory statistics to a specific file. So remove or modify those control commands accordingly. Signed-off-by: Juergen Gross Acked-by: Andrew Cooper Acked-by: Wei Liu --- tools/xenstore/xenstored_control.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_= control.c index e4b8aa95ab..8d48ab4820 100644 --- a/tools/xenstore/xenstored_control.c +++ b/tools/xenstore/xenstored_control.c @@ -61,6 +61,19 @@ static int do_control_log(void *ctx, struct connection *= conn, return 0; } =20 +#ifdef __MINIOS__ +static int do_control_memreport(void *ctx, struct connection *conn, + char **vec, int num) +{ + if (num) + return EINVAL; + + talloc_report_full(NULL, stdout); + + send_ack(conn, XS_CONTROL); + return 0; +} +#else static int do_control_logfile(void *ctx, struct connection *conn, char **vec, int num) { @@ -114,6 +127,7 @@ static int do_control_memreport(void *ctx, struct conne= ction *conn, send_ack(conn, XS_CONTROL); return 0; } +#endif =20 static int do_control_print(void *ctx, struct connection *conn, char **vec, int num) @@ -132,8 +146,12 @@ static int do_control_help(void *, struct connection *= , char **, int); static struct cmd_s cmds[] =3D { { "check", do_control_check, "" }, { "log", do_control_log, "on|off" }, +#ifdef __MINIOS__ + { "memreport", do_control_memreport, "" }, +#else { "logfile", do_control_logfile, "" }, { "memreport", do_control_memreport, "[]" }, +#endif { "print", do_control_print, "" }, { "help", do_control_help, "" }, }; --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel