From patchwork Tue Jul 9 15:28:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11037159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24BF813A4 for ; Tue, 9 Jul 2019 15:30:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 125B726246 for ; Tue, 9 Jul 2019 15:30:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06AF727FA8; Tue, 9 Jul 2019 15:30:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9F68326246 for ; Tue, 9 Jul 2019 15:30:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hks39-0003gf-RF; Tue, 09 Jul 2019 15:28:59 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hks38-0003gU-LC for xen-devel@lists.xenproject.org; Tue, 09 Jul 2019 15:28:58 +0000 X-Inumbo-ID: 43a55166-a25e-11e9-b546-637a9a85595a Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 43a55166-a25e-11e9-b546-637a9a85595a; Tue, 09 Jul 2019 15:28:55 +0000 (UTC) Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 8QVR43kiQrVwW5qxCQzor9FRCUgeBrh8LOiTgZ+Mo5egKylf8mQrYYWXuzXpNWEo6lOS2dx4fg +xiQjAdxbzaIl8d7fnaa9MI2/pWvhfObyrxhYpATQR4kq/AJzBTVv6i980+LC6lLjU5Gq/Nxim PRtsuzfGZz3tJ9CN1so7Tz9lpnYl6Xsst8Tm37DpkyEA9PPHEJMh7BF5HXobgoYbYTpP7O6e0u 8S090zoCE9f9hOUnVhAaMOdGJdfLP7RY6kWK+2gg0gWXk3XYG1Fx0rBi4MZsk1QG7CIUHtnc9j o/k= X-SBRS: 2.7 X-MesageID: 2812809 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,470,1557201600"; d="scan'208";a="2812809" From: Andrew Cooper To: Xen-devel Date: Tue, 9 Jul 2019 16:28:44 +0100 Message-ID: <20190709152845.18217-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190709152845.18217-1-andrew.cooper3@citrix.com> References: <20190709152845.18217-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/2] tools/xenstored: Make gnttab interface mandatory 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 , Andrew Cooper , Wei Liu , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP xenstored currently requires an libxc and evtchn interface, but leaves the gnttab interface as optional. gnttab is ubiquitous these days, and in practice mandatory in all cases where xenstored isn't running as root in dom0 (due to the inability to foreign map by MFN). The toolstack has unconditionally set up grant details for many years now, and longterm it would be good to phase out the use of libxc. This requires that xenstored map the store ring by grant map, rather than foreign map. No practical change. Signed-off-by: Andrew Cooper Reviewed-by: Juergen Gross --- CC: Ian Jackson CC: Wei Liu CC: Juergen Gross --- tools/xenstore/xenstored_domain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index fa6655033a..463ebba643 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -641,9 +641,9 @@ void domain_init(void) *xgt_handle = xengnttab_open(NULL, 0); if (*xgt_handle == NULL) - xprintf("WARNING: Failed to open connection to gnttab\n"); - else - talloc_set_destructor(xgt_handle, close_xgt_handle); + barf_perror("Failed to open connection to gnttab"); + + talloc_set_destructor(xgt_handle, close_xgt_handle); xce_handle = xenevtchn_open(NULL, 0); From patchwork Tue Jul 9 15:28:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11037155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE3B613A4 for ; Tue, 9 Jul 2019 15:30:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC3F026246 for ; Tue, 9 Jul 2019 15:30:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FBA6287AB; Tue, 9 Jul 2019 15:30:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 00FB726246 for ; Tue, 9 Jul 2019 15:30:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hks37-0003g1-HV; Tue, 09 Jul 2019 15:28:57 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hks36-0003fw-DQ for xen-devel@lists.xenproject.org; Tue, 09 Jul 2019 15:28:56 +0000 X-Inumbo-ID: 4163b1f4-a25e-11e9-bcc5-2f39246d5fa5 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4163b1f4-a25e-11e9-bcc5-2f39246d5fa5; Tue, 09 Jul 2019 15:28:52 +0000 (UTC) Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: X9PVLOT/nknk00784RoO81mAL54xyeGww4xKJVQ5ldU1NMTWoRpSQE5FrTcFYgt8t25ybsgiTC lAVUymh9OydxWLHAo0LccrvJYNKFo3i+Ueb1YEpcq3OqSqHf4WD55vApLXS2pMgrwvzs8eKYl1 miouuI1l60CXF68fgXhrAp0E19J4ywNU5vMNE0jH8XsqgmtufhVBhgTCIIJAostynqLXiVdsMu fpTBB/jnzfFPh14hNAAQ4HgSOGYcC3tymytISkSciyw8MwghXHUXJ0t1X1ejgP0RaMUwH+MNfH 4A8= X-SBRS: 2.7 X-MesageID: 2812807 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,470,1557201600"; d="scan'208";a="2812807" From: Andrew Cooper To: Xen-devel Date: Tue, 9 Jul 2019 16:28:45 +0100 Message-ID: <20190709152845.18217-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190709152845.18217-1-andrew.cooper3@citrix.com> References: <20190709152845.18217-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/2] tools/xenstored: Drop mapping of the ring via foreign map 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 , Andrew Cooper , Wei Liu , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is a vestigial remnent of the pre xenstored stub domain days. Foreign mapping via MFN is a privileged operation which is not necessary, because grant details are unconditionally set up during domain construction. In practice, this means xenstored never uses its ability to foreign map the ring. Drop the ability completely, which removes the penultimate use of the unstable libxc interface. Signed-off-by: Andrew Cooper Reviewed-by: Juergen Gross --- CC: Ian Jackson CC: Wei Liu CC: Juergen Gross --- tools/xenstore/xenstored_domain.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index 463ebba643..c793543bb4 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -171,24 +171,16 @@ static int readchn(struct connection *conn, void *data, unsigned int len) return len; } -static void *map_interface(domid_t domid, unsigned long mfn) -{ - if (*xgt_handle != NULL) { - /* this is the preferred method */ - return xengnttab_map_grant_ref(*xgt_handle, domid, - GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE); - } else { - return xc_map_foreign_range(*xc_handle, domid, - XC_PAGE_SIZE, PROT_READ|PROT_WRITE, mfn); - } +static void *map_interface(domid_t domid) +{ + return xengnttab_map_grant_ref(*xgt_handle, domid, + GNTTAB_RESERVED_XENSTORE, + PROT_READ|PROT_WRITE); } static void unmap_interface(void *interface) { - if (*xgt_handle != NULL) - xengnttab_unmap(*xgt_handle, interface, 1); - else - munmap(interface, XC_PAGE_SIZE); + xengnttab_unmap(*xgt_handle, interface, 1); } static int destroy_domain(void *_domain) @@ -396,7 +388,7 @@ int do_introduce(struct connection *conn, struct buffered_data *in) domain = find_domain_by_domid(domid); if (domain == NULL) { - interface = map_interface(domid, mfn); + interface = map_interface(domid); if (!interface) return errno; /* Hang domain off "in" until we're finished. */