From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xen.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Julien Grall <julien.grall@linaro.org>,
Tamas K Lengyel <tamas@tklengyel.com>,
Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v2 3/9] xen/x86: mem_sharing: Use copy_domain_page in __mem_sharing_unshare_page
Date: Thu, 5 Oct 2017 18:42:16 +0100 [thread overview]
Message-ID: <20171005174222.29161-4-julien.grall@linaro.org> (raw)
In-Reply-To: <20171005174222.29161-1-julien.grall@linaro.org>
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 <julien.grall@linaro.org>
---
Cc: Tamas K Lengyel <tamas@tklengyel.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
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);
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-10-05 17:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-05 17:42 [PATCH v2 0/9] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN Julien Grall
2017-10-05 17:42 ` [PATCH v2 1/9] xen/arm: domain_build: Clean-up insert_11_bank Julien Grall
2017-10-05 17:42 ` [PATCH v2 2/9] xen/arm32: mm: Rework is_xen_heap_page to avoid nameclash Julien Grall
2017-10-05 17:42 ` Julien Grall [this message]
2017-10-05 17:49 ` [PATCH v2 3/9] xen/x86: mem_sharing: Use copy_domain_page in __mem_sharing_unshare_page Andrew Cooper
2017-10-05 17:52 ` Tamas K Lengyel
2017-10-05 17:42 ` [PATCH v2 4/9] xen/x86: Use maddr_to_page and maddr_to_mfn to avoid open-coded >> PAGE_SHIFT Julien Grall
2017-10-05 17:42 ` [PATCH v2 5/9] xen/kimage: Remove defined but unused variables Julien Grall
2017-10-05 17:42 ` [PATCH v2 6/9] xen/kexec, kimage: Convert kexec and kimage to use typesafe mfn_t Julien Grall
2017-10-05 17:51 ` Andrew Cooper
2017-10-05 17:42 ` [PATCH v2 7/9] xen/xenoprof: Convert the file to use typesafe MFN Julien Grall
2017-10-05 17:42 ` [PATCH v2 8/9] xen/tmem: Convert the file common/tmem_xen.c " Julien Grall
2017-10-05 17:42 ` [PATCH v2 9/9] xen: Convert __page_to_mfn and __mfn_to_page " Julien Grall
2017-10-05 17:59 ` Andrew Cooper
2017-10-05 18:31 ` Razvan Cojocaru
2017-10-06 9:11 ` Paul Durrant
2017-10-06 10:49 ` Julien Grall
2017-10-06 10:55 ` Paul Durrant
2017-10-06 11:00 ` Julien Grall
2017-10-06 11:44 ` Paul Durrant
2017-10-06 13:02 ` Boris Ostrovsky
2017-10-09 11:42 ` Jan Beulich
2017-10-09 12:20 ` Julien Grall
2017-10-09 13:40 ` Jan Beulich
2017-10-09 13:48 ` Julien Grall
2017-10-09 14:07 ` Jan Beulich
2017-10-10 5:18 ` Tian, Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171005174222.29161-4-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=tamas@tklengyel.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).