From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xen.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Julien Grall <julien.grall@arm.com>,
Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 06/15] xen/x86: p2m-pod: Clean-up use of typesafe MFN
Date: Wed, 13 Sep 2017 18:59:44 +0100 [thread overview]
Message-ID: <20170913175953.16942-7-julien.grall@arm.com> (raw)
In-Reply-To: <20170913175953.16942-1-julien.grall@arm.com>
Some unboxing/boxing can be avoided by using mfn_add(...) instead.
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
xen/arch/x86/mm/p2m-pod.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index bcc87aee03..34f5239b6d 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -101,7 +101,7 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
* promise to provide zero pages. So we scrub pages before using.
*/
for ( i = 0; i < (1UL << order); i++ )
- clear_domain_page(_mfn(mfn_x(page_to_mfn(page)) + i));
+ clear_domain_page(mfn_add(page_to_mfn(page), i));
/* First, take all pages off the domain list */
lock_page_alloc(p2m);
@@ -743,7 +743,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, unsigned long gfn)
mfn0 = mfn;
type0 = type;
}
- else if ( type != type0 || mfn_x(mfn) != (mfn_x(mfn0) + i) )
+ else if ( type != type0 || !mfn_eq(mfn, mfn_add(mfn0, i)) )
goto out;
n = 1UL << min(cur_order, SUPERPAGE_ORDER + 0U);
@@ -758,7 +758,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, unsigned long gfn)
for ( i = 0; i < SUPERPAGE_PAGES; i++ )
{
/* Quick zero-check */
- map = map_domain_page(_mfn(mfn_x(mfn0) + i));
+ map = map_domain_page(mfn_add(mfn0, i));
for ( j = 0; j < 16; j++ )
if ( *(map + j) != 0 )
@@ -783,7 +783,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, unsigned long gfn)
*/
for ( i = 0; i < SUPERPAGE_PAGES; i++ )
{
- mfn = _mfn(mfn_x(mfn0) + i);
+ mfn = mfn_add(mfn0, i);
if ( (mfn_to_page(mfn)->count_info & PGC_count_mask) > 1 )
{
reset = 1;
@@ -794,7 +794,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, unsigned long gfn)
/* Finally, do a full zero-check */
for ( i = 0; i < SUPERPAGE_PAGES; i++ )
{
- map = map_domain_page(_mfn(mfn_x(mfn0) + i));
+ map = map_domain_page(mfn_add(mfn0, i));
for ( j = 0; j < (PAGE_SIZE / sizeof(*map)); j++ )
if ( *(map+j) != 0 )
--
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-09-13 17:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-13 17:59 [PATCH 00/15] xen/x86: Clean-up the PoD code Julien Grall
2017-09-13 17:59 ` [PATCH 01/15] xen/x86: p2m-pod: Clean-up includes Julien Grall
2017-09-13 17:59 ` [PATCH 02/15] xen/x86: p2m-pod: Remove trailing whitespaces Julien Grall
2017-09-13 17:59 ` [PATCH 03/15] xen/x86: p2m-pod: Fix coding style for comments Julien Grall
2017-09-13 17:59 ` [PATCH 04/15] xen/x86: p2m-pod: Fix coding style Julien Grall
2017-09-13 17:59 ` [PATCH 05/15] xen/x86: p2m-pod: Avoid redundant assignments in p2m_pod_demand_populate Julien Grall
2017-09-13 17:59 ` Julien Grall [this message]
2017-09-13 17:59 ` [PATCH 07/15] xen/x86: p2m-pod: Use typesafe gfn in p2m_pod_decrease_reservation Julien Grall
2017-09-13 17:59 ` [PATCH 08/15] xen/x86: p2m: Use typesafe gfn for the P2M callbacks get_entry and set_entry Julien Grall
2017-09-13 18:22 ` Andrew Cooper
2017-09-13 18:27 ` Julien Grall
2017-09-13 19:10 ` Razvan Cojocaru
2017-09-13 19:08 ` Razvan Cojocaru
2017-09-13 19:32 ` Julien Grall
2017-09-20 6:57 ` Tian, Kevin
2017-09-13 17:59 ` [PATCH 09/15] xen/x86: p2m: Use typesafe GFN in p2m_set_entry Julien Grall
2017-09-13 20:16 ` Tamas K Lengyel
2017-09-13 17:59 ` [PATCH 10/15] xen/x86: p2m-pod: Use typesafe GFN in pod_eager_record Julien Grall
2017-09-13 17:59 ` [PATCH 11/15] xen/x86: p2m-pod: Clean-up p2m_pod_zero_check Julien Grall
2017-09-13 17:59 ` [PATCH 12/15] xen/x86: p2m-pod: Use typesafe gfn in p2m_pod_zero_check Julien Grall
2017-09-13 17:59 ` [PATCH 13/15] xen/x86: p2m-pod: Use typesafe gfn in p2m_pod_demand_populate Julien Grall
2017-09-13 17:59 ` [PATCH 14/15] xen/x86: p2m-pod: Use typesafe gfn for the fields reclaim_single and max_guest Julien Grall
2017-09-13 17:59 ` [PATCH 15/15] xen/x86: p2m-pod: Rework prototype of p2m_pod_demand_populate Julien Grall
2017-09-13 18:30 ` [PATCH 00/15] xen/x86: Clean-up the PoD code Andrew Cooper
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=20170913175953.16942-7-julien.grall@arm.com \
--to=julien.grall@arm.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=jbeulich@suse.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).