From patchwork Sat Aug 19 10:11:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sky Liu X-Patchwork-Id: 9910423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F0C0D60382 for ; Sat, 19 Aug 2017 10:14:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9CF928D5A for ; Sat, 19 Aug 2017 10:14:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB95728D97; Sat, 19 Aug 2017 10:14:42 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A48128D5A for ; Sat, 19 Aug 2017 10:14:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dj0jc-0000Mg-VD; Sat, 19 Aug 2017 10:12:04 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dj0jb-0000Ma-3P for xen-devel@lists.xen.org; Sat, 19 Aug 2017 10:12:03 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 94/18-03406-2FE08995; Sat, 19 Aug 2017 10:12:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRWlGSWpSXmKPExsVyMfTAYd2PfDM iDe4u0LZY8nExiwOjx9Hdv5kCGKNYM/OS8isSWDM6Vh5lK+gXqti2k7eBcTdvFyMnh5BAP6PE 9DXFXYxcHCwCl1gk7jbsZwRxJATesUj0PTjPBFIlIRAn8W/TeiCbA8iukvi4zQmiWVli+sof7 CD1QgJNTBLzJt5gBUmwCWhIrJ1ykA3EFhGQlrj2+TLYUGaBI4wSJ/Y/BCsSFoiXeLHrGCPIUB YBVYlze51BwrwCFhKTv1xihNgrL9G/YznTBEa+BYwMqxg1ilOLylKLdA0N9JKKMtMzSnITM3O APDO93NTi4sT01JzEpGK95PzcTYzAMGEAgh2Mx9/HHWKU5GBSEuX9PWtKpBBfUn5KZUZicUZ8 UWlOavEhRhkODiUJ3rW8MyKFBItS01Mr0jJzgAELk5bg4FES4fUDSfMWFyTmFmemQ6ROMVpyX Lmy7gsTx4bV64HklAPbvzAJseTl56VKifN2gDQIgDRklObBjYNF1SVGWSlhXkagA4V4ClKLcj NLUOVfMYpzMCoJ80aDTOHJzCuB2/oK6CAmoIMMW6eBHFSSiJCSamA0/1upVnTyJvuq8LWtU9+ daq63vJ31MezLbl4+07y/j8IN1y46OP27IyfHn09rjh7fp7DrpMf3xV8Z/Z4c9TcJvX1Af0vG 7n8b5qcIrFPfvm1iFONizup19v8Xrbw5hc9/y/lwhoQDsr1yTn517mnWYRqL+UKv3hc4cdmec U6/snJ60cdXUhNnKLEUZyQaajEXFScCAAdoULulAgAA X-Env-Sender: blackskygg@gmail.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1503137520!64691989!1 X-Originating-IP: [209.85.192.195] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60573 invoked from network); 19 Aug 2017 10:12:01 -0000 Received: from mail-pf0-f195.google.com (HELO mail-pf0-f195.google.com) (209.85.192.195) by server-2.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 19 Aug 2017 10:12:01 -0000 Received: by mail-pf0-f195.google.com with SMTP id z3so773385pfk.0 for ; Sat, 19 Aug 2017 03:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2OkfY6ATab2O08wiV9o2/nTIg9OzEalGoEZbLUxRizU=; b=nmV2R5669fVn7VQrvnSrza2bE/c6xUYf2zNxp3ect39GfvjjUBQYm+gxCYKIQM4+1P B5dFTS+s47WuJz933SqSl93S52U0ruNbZR9iMhhpaiab8C3hdGOiyhvFGqDc/lqQKkIL LPBsv6GEYGPx9dNmkcgkYPmVLoFYslZ8sAY306cQ+0htJXruXusJCSrrYcK20T7pxukN p2zqSfaDnTrVItVEALQbVSObwdpb3sqbdMBo7lIvDVjY+ZYkG020KY/Ljngv93+FAFHB GthZf9ZyetRclu9wMe1zKQiOG5ewGUteRo2pxmMHllomksQBRwe4dFrXFQPgFNZM6y/T yEIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2OkfY6ATab2O08wiV9o2/nTIg9OzEalGoEZbLUxRizU=; b=TWIz9eyRHBYInZb8Euj+VsTwMpWQuFlLbxhSZ3UYB4y1k06bBkJfAXPbbENmCBN5Dn psx2rmpty9kz03TujdqHxjDTZBuVelDwUaqZW+TAMkLgzGOLrVM5b8aQ2kEL+31bI8DO ofCrLdA0UAbNWsIArMwHvFe+b+diEjzKglayrWB7DfNCJF94c7L08XUTo1AT72MbgjKB ksmMX+iLQa0IOQh32htjCVC41CQ19b06Hacr7EyONmXupSJel1Wqe8+FBt/jKvVWxJ0p kbaiuZ6NW9bMOM1QgHstKrcSIG6m6MLPYdEem0tFQytAd/zEazeIjaOuWm8vTYh6we10 7YKA== X-Gm-Message-State: AHYfb5hJS9EwFycbwn0rvpeA+OGyGEDLwT6UP+ZwW5CJEw//6XVfDUvT sMSnHmgRtY5xqzSV X-Received: by 10.84.218.136 with SMTP id r8mr12477111pli.111.1503137519397; Sat, 19 Aug 2017 03:11:59 -0700 (PDT) Received: from sky-arch.localdomain ([120.239.101.221]) by smtp.gmail.com with ESMTPSA id i187sm16189890pfe.67.2017.08.19.03.11.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Aug 2017 03:11:58 -0700 (PDT) From: Zhongze Liu To: xen-devel@lists.xen.org Date: Sat, 19 Aug 2017 18:11:37 +0800 Message-Id: <20170819101137.4101-1-blackskygg@gmail.com> X-Mailer: git-send-email 2.14.0 Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson , Zhongze Liu Subject: [Xen-devel] [PATCH v2] libxc: add xc_domain_remove_from_physmap to wrap XENMEM_remove_from_physmap X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is for the proposal "Allow setting up shared memory areas between VMs from xl config file". See: https://lists.xenproject.org/archives/html/xen-devel/2017-07/msg03047.html Then plan is to use XENMEM_add_to_physmap_batch to map the shared pages from one domU to another and use XENMEM_remove_from_physmap to cancel the sharing. A wrapper to XENMEM_add_to_physmap_batch was added in the following commit: commit 20e725e9364cff4a29945f66986ecd88cca8743d Now add the wrapper to XENMEM_remove_from_physmap. Signed-off-by: Zhongze Liu Cc: Ian Jackson Cc: Wei Liu Cc: Stefano Stabellini Cc: Julien Grall Cc: xen-devel@lists.xen.org Reviewed-by: Stefano Stabellini --- v2: add the signed-off message --- tools/libxc/include/xenctrl.h | 4 ++++ tools/libxc/xc_domain.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index c7710b8f36..0ff15a9255 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1381,6 +1381,10 @@ int xc_domain_add_to_physmap_batch(xc_interface *xch, xen_pfn_t *gfpns, int *errs); +int xc_domain_remove_from_physmap(xc_interface *xch, + domid_t domid, + xen_pfn_t gpfn); + int xc_domain_populate_physmap(xc_interface *xch, uint32_t domid, unsigned long nr_extents, diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 3bab4e8bab..e6b32792c0 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -1077,6 +1077,17 @@ out: return rc; } +int xc_domain_remove_from_physmap(xc_interface *xch, + domid_t domid, + xen_pfn_t gpfn) +{ + struct xen_remove_from_physmap xrfp = { + .domid = domid, + .gpfn = gpfn, + }; + return do_memory_op(xch, XENMEM_remove_from_physmap, &xrfp, sizeof(xrfp)); +} + int xc_domain_claim_pages(xc_interface *xch, uint32_t domid, unsigned long nr_pages)