Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BE0FC83002 for ; Thu, 30 Apr 2020 05:39:23 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E4622082E for ; Thu, 30 Apr 2020 05:39:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E4622082E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jU1uL-0003nc-Gf; Thu, 30 Apr 2020 05:38:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jU1uJ-0003nX-He for xen-devel@lists.xenproject.org; Thu, 30 Apr 2020 05:38:47 +0000 X-Inumbo-ID: dbfe6f7c-8aa4-11ea-9887-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id dbfe6f7c-8aa4-11ea-9887-bc764e2007e4; Thu, 30 Apr 2020 05:38:46 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6276BAF17; Thu, 30 Apr 2020 05:38:44 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Subject: [PATCH v3] tools/xenstore: don't store domU's mfn of ring page in xenstored Date: Thu, 30 Apr 2020 07:38:42 +0200 Message-Id: <20200430053842.4376-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The XS_INTRODUCE command has two parameters: the mfn (or better: gfn) of the domain's xenstore ring page and the event channel of the domain for communicating with Xenstore. The gfn is not really needed. It is stored in the per-domain struct in xenstored and in case of another XS_INTRODUCE for the domain it is tested to match the original value. If it doesn't match the command is aborted via EINVAL, otherwise the event channel to the domain is recreated. As XS_INTRODUCE is limited to dom0 and there is no real downside of recreating the event channel just omit the test for the gfn to match and don't return EINVAL for multiple XS_INTRODUCE calls. Signed-off-by: Juergen Gross --- V2: - remove mfn from struct domain (Julien Grall) - replace mfn by gfn in comments (Julien Grall) V3: - allow multiple XS_INTRODUCE calls (Igor Druzhinin) --- tools/xenstore/xenstored_domain.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index 5858185211..06359503f0 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -55,10 +55,6 @@ struct domain repeated domain introductions. */ evtchn_port_t remote_port; - /* The mfn associated with the event channel, used only to validate - repeated domain introductions. */ - unsigned long mfn; - /* Domain path in store. */ char *path; @@ -363,13 +359,12 @@ static void domain_conn_reset(struct domain *domain) domain->interface->rsp_cons = domain->interface->rsp_prod = 0; } -/* domid, mfn, evtchn, path */ +/* domid, gfn, evtchn, path */ int do_introduce(struct connection *conn, struct buffered_data *in) { struct domain *domain; char *vec[3]; unsigned int domid; - unsigned long mfn; evtchn_port_t port; int rc; struct xenstore_domain_interface *interface; @@ -381,7 +376,7 @@ int do_introduce(struct connection *conn, struct buffered_data *in) return EACCES; domid = atoi(vec[0]); - mfn = atol(vec[1]); + /* Ignore the gfn, we don't need it. */ port = atoi(vec[2]); /* Sanity check args. */ @@ -402,21 +397,19 @@ int do_introduce(struct connection *conn, struct buffered_data *in) return rc; } domain->interface = interface; - domain->mfn = mfn; /* Now domain belongs to its connection. */ talloc_steal(domain->conn, domain); fire_watches(NULL, in, "@introduceDomain", false); - } else if ((domain->mfn == mfn) && (domain->conn != conn)) { + } else { /* Use XS_INTRODUCE for recreating the xenbus event-channel. */ if (domain->port) xenevtchn_unbind(xce_handle, domain->port); rc = xenevtchn_bind_interdomain(xce_handle, domid, port); domain->port = (rc == -1) ? 0 : rc; domain->remote_port = port; - } else - return EINVAL; + } domain_conn_reset(domain); -- 2.16.4