From nobody Fri May 3 16:04:57 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1588225168; cv=none; d=zohomail.com; s=zohoarc; b=Q5wLEHoCWnK06WPYyePrNtrB2t6ZD0S9NjtF+qLbvWllvblmzCojeqzQ57cTYun0oTyJxsCjVv+/KiLaPgQharfEwAgklBzLBL/ns4BrreTVBnRNu9IpNB3xcBEh9Z7lmLXalpbn4jdsM2HYzBX6rUWR3YA/B+DMLTtD111mYaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588225168; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=UJoQfcQFfgu4NyM0cW/sRzIizrsNmaRGkWgi5sSvNh4=; b=JQe3n6bAnFJ8cOIZ3a1l6x/fghQtIYdd5NtpNvDD7wQ9qPvh1YjoKoyTWlT0JZluSOhHo8YZPEw1vOpWLibtcf4dvWib74j3xgMrLk1AcTWe+iiXWMJBv0idzsPte/Aqc9AeOXhCYykJkSuskYvfS1ySzV4y22D+0Z73zkGn390= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1588225168223376.2520339971127; Wed, 29 Apr 2020 22:39:28 -0700 (PDT) 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 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) 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) X-Inumbo-ID: dbfe6f7c-8aa4-11ea-9887-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Acked-by: Wei Liu Reviewed-by: Julien Grall --- 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_d= omain.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; =20 - /* The mfn associated with the event channel, used only to validate - repeated domain introductions. */ - unsigned long mfn; - /* Domain path in store. */ char *path; =20 @@ -363,13 +359,12 @@ static void domain_conn_reset(struct domain *domain) domain->interface->rsp_cons =3D domain->interface->rsp_prod =3D 0; } =20 -/* 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 buffer= ed_data *in) return EACCES; =20 domid =3D atoi(vec[0]); - mfn =3D atol(vec[1]); + /* Ignore the gfn, we don't need it. */ port =3D atoi(vec[2]); =20 /* Sanity check args. */ @@ -402,21 +397,19 @@ int do_introduce(struct connection *conn, struct buff= ered_data *in) return rc; } domain->interface =3D interface; - domain->mfn =3D mfn; =20 /* Now domain belongs to its connection. */ talloc_steal(domain->conn, domain); =20 fire_watches(NULL, in, "@introduceDomain", false); - } else if ((domain->mfn =3D=3D mfn) && (domain->conn !=3D conn)) { + } else { /* Use XS_INTRODUCE for recreating the xenbus event-channel. */ if (domain->port) xenevtchn_unbind(xce_handle, domain->port); rc =3D xenevtchn_bind_interdomain(xce_handle, domid, port); domain->port =3D (rc =3D=3D -1) ? 0 : rc; domain->remote_port =3D port; - } else - return EINVAL; + } =20 domain_conn_reset(domain); =20 --=20 2.16.4