From patchwork Thu Oct 5 17:42:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114957 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp848289qgn; Thu, 5 Oct 2017 10:44:42 -0700 (PDT) X-Received: by 10.107.200.198 with SMTP id y189mr1100701iof.157.1507225482256; Thu, 05 Oct 2017 10:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507225482; cv=none; d=google.com; s=arc-20160816; b=yFbPllL9WC32LGtXlkk1hGPlQsmv/0gOSH8yA1MxYeT/FzwH6qUffn2xaN8+VYZt5F 0/4kl2Qxex8tYhY46j44PbqaNUVNwpVSV0aR6cCdxsB2GLgi4/wTpd2bBwV0nHy6B8ZU yNrH0uWTbZF3QyTnRVRfRXCCiS9YL+BqxjN8tpHh2QLpU55OMnJmJ1X0yr+JLM4/LgTU /GHu4awScziBwGtasmUAYI4Gq5znxN3lD2oJykpzlWGKzZB9K66a8xPKmgXkTgukwV1e TNPVdnnrZuyz3reUrrWMT/j9G4JY4XIPwxdLJ8cYrNcPpWxtsCQfl4urWBEZmhKKYqvE 6YXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=KKV7XEDAhhHRco2kpMr5Dr9WGZG1jj4xQ/CaI/WAuKM=; b=pfMN2NL8DmdF2gbb2xVaWpqf2pC1t9oknqGWEbkqipeVM40exHhapQ5aRlepuzkVzJ F/bUX8S7O/wI9rbv6ni9YyUQkRb6L+FmCT29m1i4jApJ+IQsF63xJhJeKr190jjZe116 C2meo74eMttaL8im5u3X6fUTgr2TBpEBlg40BCDhqrqgGzA1yJbTqqBU+Lt1H0YqNUFH MTaBotYvVEN2F+joL8r6tv5T+fTayiWvOAU/X1IpvAryvoSmkXkHrPHd0ym8IFAy2ahV IpXWqv95brBEo/XdCCqWwO6nZuEz8t98qzywcqlXIoj/Mbgaa2OfxwdnLyz5jKhHZCl1 1fsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SumVyzOA; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e18si15153286ioe.39.2017.10.05.10.44.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2017 10:44:42 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SumVyzOA; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0AAO-0000yT-Gx; Thu, 05 Oct 2017 17:42:36 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0AAN-0000y6-Bp for xen-devel@lists.xen.org; Thu, 05 Oct 2017 17:42:35 +0000 Received: from [85.158.143.35] by server-6.bemta-6.messagelabs.com id 3B/F8-03409-A0F66D95; Thu, 05 Oct 2017 17:42:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVyMfTOBl3O/Gu RBq+vWVks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmbFy9jLZjCU7Ht4Ea2BsZpXF2MnBxCAhMZ JX68E+xi5OJgEZjHLPFq7XZ2EEdCoJ9VYvfRJSwgVRICeRLzd71khrDTJL6f2sgGYddIfFoxF 8jmAJqkJrHmTRRIr5BAH5PEtcdTGEHibAI6Eutm1IKUiwhIS1z7fJkRpIZZ4BzQ4u5esPnCAg kSuw/0gs1kEVCVeDy5lQnE5hWwkfi27gXULnmJXW0XWUFsTgFbifU9d9ghPrCRWL7iLPMERsE FjAyrGDWKU4vKUot0DS30kooy0zNKchMzc3QNDcz0clOLixPTU3MSk4r1kvNzNzECA44BCHYw 3twYcIhRkoNJSZTXK+tapBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3su5QDnBotT01Iq0zBxg6 MOkJTh4lER4n4KkeYsLEnOLM9MhUqcYLTku3Ln0h4njwJ5bQLLj5t0/TEIsefl5qVLivHtAGg RAGjJK8+DGweLzEqOslDAvI9CBQjwFqUW5mSWo8q8YxTkYlYR5D4JM4cnMK4Hb+groICagg+Y 0XQE5qCQRISXVwFhQfczvsOLVxjy5/qrLMpvL/QzKtzNuW/bo74s3Vss3pqXZ1MxSln7qI7ai e+q7lAc7A54Jv26Pun+/pcp/5pq6mVPvtP2dJFm12Cvk/mTB9HdaW+penCr4O++WedvbTof9N j9dlf5J/nyaIi1ypCSaxyGp9lK63i45Hr75ez5tF48PiD0a36vEUpyRaKjFXFScCABU6keiyg IAAA== X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-12.tower-21.messagelabs.com!1507225353!76540053!1 X-Originating-IP: [209.85.220.176] 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 30200 invoked from network); 5 Oct 2017 17:42:33 -0000 Received: from mail-qk0-f176.google.com (HELO mail-qk0-f176.google.com) (209.85.220.176) by server-12.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 5 Oct 2017 17:42:33 -0000 Received: by mail-qk0-f176.google.com with SMTP id 17so15471511qkq.8 for ; Thu, 05 Oct 2017 10:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8XPw/nu3bqb0DtxAxapOeASD38s/mBNX5UBXFAHb0S4=; b=SumVyzOAsAv0X0iIaPM3cl/mIBOS6D8FhEWn518Voa6JtEaLl/vWflYNYGvx123T9/ tRm9YcWKFgkgSYiEVwO398u6Hg/7iXT6UnjXWnZQftXAURxXptAJ1cMjg2N+mv/lnWnN PEtJOch1fzXV9HnkFDBQxiXaBf80YPvNIP+14= 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:in-reply-to :references; bh=8XPw/nu3bqb0DtxAxapOeASD38s/mBNX5UBXFAHb0S4=; b=lHssqzRKqJC13a+Pvj3v/A7i2qUp8dlgTksovIeMI+j7xNrhXNHqPG9Sqz8pmEZ8Hd 51xwEF3RhBYjdgYEK9ISKqVs6CBSWoil+5MX5FFEUsSYfKQGe0zBpun9PpNoU5Tvt0vg ppQlNbBHAViNeLsE8hB324fFJpcOPheEGnqJlBrVYV8zP6D8YygX+wJENQ8R7xhfwrFM hGZI2EFQAEJ5ea05VSJ2ElRS1j4/QXKJsbzYql9jpnoT4nHg4b26nnpmYusLjnuZMoSt FNd1J9b0QVFQ++3RU+qKyikTYs1TtrFfQk+AKg68jPH+DqskWpd+8PiQQ5NpDj/NQvLt WIVw== X-Gm-Message-State: AMCzsaXbQueOcVYw3/BpSQERyTt3qqbOYjltoUdr/uZTkO/j9pxXvKgP X9vap/fQmAXDeYfLxgzidn50bTqGKWE= X-Google-Smtp-Source: AOwi7QAJuUWoAKFWVRxXs+WR7OxBcBwL2Cjj8UA8m+AonWU2n5ki+68Hy4LHg93EIgiQRt/b0FLYuA== X-Received: by 10.55.156.141 with SMTP id f135mr22093387qke.309.1507225352859; Thu, 05 Oct 2017 10:42:32 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id y63sm11815084qky.75.2017.10.05.10.42.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2017 10:42:32 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 5 Oct 2017 18:42:16 +0100 Message-Id: <20171005174222.29161-4-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171005174222.29161-1-julien.grall@linaro.org> References: <20171005174222.29161-1-julien.grall@linaro.org> Cc: George Dunlap , Andrew Cooper , Julien Grall , Tamas K Lengyel , Jan Beulich Subject: [Xen-devel] [PATCH v2 3/9] xen/x86: mem_sharing: Use copy_domain_page in __mem_sharing_unshare_page 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" The function __mem_sharing_unshare_page contains an open-code version of copy_domain_page. Use the function to simplify a bit the code. At the same time replace _mfn(__page_to_mfn(...)) by page_to_mfn(...) given that the file given already provides a typesafe version of page_to_mfn. Signed-off-by: Julien Grall Reviewed-by: Andrew Cooper Acked-by: Tamas K Lengyel --- Cc: Tamas K Lengyel Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Changes in v2: - New patch --- xen/arch/x86/mm/mem_sharing.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index b856028c02..6f4be95515 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -1106,7 +1106,6 @@ int __mem_sharing_unshare_page(struct domain *d, p2m_type_t p2mt; mfn_t mfn; struct page_info *page, *old_page; - void *s, *t; int last_gfn; gfn_info_t *gfn_info = NULL; @@ -1185,11 +1184,7 @@ int __mem_sharing_unshare_page(struct domain *d, return -ENOMEM; } - s = map_domain_page(_mfn(__page_to_mfn(old_page))); - t = map_domain_page(_mfn(__page_to_mfn(page))); - memcpy(t, s, PAGE_SIZE); - unmap_domain_page(s); - unmap_domain_page(t); + copy_domain_page(page_to_mfn(page), page_to_mfn(old_page)); BUG_ON(set_shared_p2m_entry(d, gfn, page_to_mfn(page))); mem_sharing_gfn_destroy(old_page, d, gfn_info);