From patchwork Mon Aug 19 18:45:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Druzhinin X-Patchwork-Id: 11101661 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 489C71813 for ; Mon, 19 Aug 2019 18:47:44 +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 26D5B206C1 for ; Mon, 19 Aug 2019 18:47:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="ZVrg4Qpb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26D5B206C1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none 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.89) (envelope-from ) id 1hzmf3-0006MX-K1; Mon, 19 Aug 2019 18:45:45 +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 1hzmf2-0006MS-Rl for xen-devel@lists.xenproject.org; Mon, 19 Aug 2019 18:45:44 +0000 X-Inumbo-ID: 8c845936-c2b1-11e9-8bf0-12813bfff9fa Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8c845936-c2b1-11e9-8bf0-12813bfff9fa; Mon, 19 Aug 2019 18:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1566240344; h=from:to:cc:subject:date:message-id:mime-version; bh=X82PK+6p+WT1kSQdG3xzVeRwHWQSEY2ohWqF+fhkyuc=; b=ZVrg4QpbbyyehbnuWyhQA6bA18TCtKeJ2LlxEPL2Xjak4a2BL2btR19c OGjXHNmMwYEpBmTP1VID2Z/EHw+ud17+CqgcXs16YnHHRRsL/5kQYppua 2CI2Hisjt10sv+Rkr5LmhKCSb+p8wSJKt9Zir2mebDX36KLiETRf3DXQl o=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=igor.druzhinin@citrix.com; spf=Pass smtp.mailfrom=igor.druzhinin@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of igor.druzhinin@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of igor.druzhinin@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: +S8ssrNtJ/IYwt6LSG9DGexCqoowxdkpcfRxrRsFP9zDk6V/Uqz2XU08zaVbPVMzEvVGf1E03C KaKyAp3/07Lq/08fexTXBDvFGmYTeSeet5vkQc4xREEeN4rlBEuKqfiCV35SSrE0Yw3anFgr/Y 9Yp0qc2ooSsoTfZMxqWxZJaQHpat0S505ggtQ/TPB9rIuDeUBPUaFsI/Iv6xbrcspB6PZ4+5Yw RlzgAMLny9LL06xDxU45IUzRAEpFKalknLac8abh63FnT+cgybp9+l+h5uT258c+niT7o1H2m8 SQQ= X-SBRS: 2.7 X-MesageID: 4484969 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,405,1559534400"; d="scan'208";a="4484969" From: Igor Druzhinin To: Date: Mon, 19 Aug 2019 19:45:35 +0100 Message-ID: <1566240335-6614-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] tools/oxenstored: port XS_INTRODUCE evtchn rebind function from cxenstored 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: Igor Druzhinin , ian.jackson@eu.citrix.com, christian.lindig@citrix.com, wl@xen.org, dave@recoil.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" C version of xenstored had this ability since 61aaed0d5 ("Allow XS_INTRODUCE to be used for rebinding the xenstore evtchn.") from 2007. Copy it as is to Ocaml version. Signed-off-by: Igor Druzhinin Acked-by: Christian Lindig --- tools/ocaml/xenstored/domain.ml | 6 +++++- tools/ocaml/xenstored/process.ml | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml index b0a01b0..aeb185f 100644 --- a/tools/ocaml/xenstored/domain.ml +++ b/tools/ocaml/xenstored/domain.ml @@ -23,9 +23,9 @@ type t = { id: Xenctrl.domid; mfn: nativeint; - remote_port: int; interface: Xenmmap.mmap_interface; eventchn: Event.t; + mutable remote_port: int; mutable port: Xeneventchn.t option; mutable bad_client: bool; mutable io_credit: int; (* the rounds of ring process left to do, default is 0, @@ -71,6 +71,10 @@ let notify dom = match dom.port with Event.notify dom.eventchn port let bind_interdomain dom = + begin match dom.port with + | None -> () + | Some port -> Event.unbind dom.eventchn port + end; dom.port <- Some (Event.bind_interdomain dom.eventchn dom.id dom.remote_port); debug "bound domain %d remote port %d to local port %s" dom.id dom.remote_port (string_of_port dom.port) diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml index 8a7e538..ff5c948 100644 --- a/tools/ocaml/xenstored/process.ml +++ b/tools/ocaml/xenstored/process.ml @@ -408,7 +408,13 @@ let do_introduce con _t domains cons data = in let dom = if Domains.exist domains domid then - Domains.find domains domid + let edom = Domains.find domains domid in + if (Domain.get_mfn edom) = mfn && (Connections.find_domain cons domid) != con then begin + (* Use XS_INTRODUCE for recreating the xenbus event-channel. *) + edom.remote_port <- port; + Domain.bind_interdomain edom; + end; + edom else try let ndom = Domains.create domains domid mfn port in Connections.add_domain cons ndom;