From: Julien Grall <julien.grall@arm.com>
To: Wei Liu <wei.liu2@citrix.com>, Jan Beulich <JBeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Tim Deegan <tim@xen.org>,
xen-devel@lists.xen.org, Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH v4 08/16] xen/mm: Drop the parameter mfn from populate_pt_range
Date: Sun, 11 Mar 2018 19:30:51 +0000 [thread overview]
Message-ID: <f09b1a1b-5867-d3e7-1aba-0a2ebbb03bc0@arm.com> (raw)
In-Reply-To: <20180309172957.lbzthnrhc4wz4t4s@citrix.com>
Hi Wei,
On 03/09/2018 05:29 PM, Wei Liu wrote:
> On Mon, Mar 05, 2018 at 07:38:36AM -0700, Jan Beulich wrote:
>>>>> On 05.03.18 at 15:11, <julien.grall@arm.com> wrote:
>>> On 05/03/18 14:00, Jan Beulich wrote:
>>>>>>> On 05.03.18 at 14:43, <julien.grall@arm.com> wrote:
>>>>> Anyway, I don't have much knowledge on the x86 to make the modification
>>>>> that you suggested. So I am going to revert to _mfn(0) for x86.
>>>>
>>>> I'd prefer if you didn't, but well, it'll be one of us to clean it up
>>>> then.
>>> I can keep as INVALID_MFN. But then either you or Andrew (or anyone x86
>>> folks) would have to provide the patch to skip incrementing invalid MFN
>>> (if I understood correctly your request).
>>
>> Sigh - this should go together imo. While wrongly incrementing from
>> zero was bad, wrongly wrapping from INVALID_MFN makes things
>> worse.
>>
>
> Try this patch?
I am happy to carry this patch at the beginning of my series if you want.
>
> ---8<---
> From 8f0024c690c736d17adde0fa765cbbf6fa2846dc Mon Sep 17 00:00:00 2001
> From: Wei Liu <wei.liu2@citrix.com>
> Date: Fri, 9 Mar 2018 17:20:14 +0000
> Subject: [PATCH] x86/mm: skip incrementing mfn if it is not a valid mfn
>
> The function is called to fill in page table entries in
> populate_pt_range. Skip incrementing mfn if it is invalid.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> xen/arch/x86/mm.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index 9b559448a7..5f5577c7c2 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -4731,7 +4731,8 @@ int map_pages_to_xen(
> }
>
> virt += 1UL << L3_PAGETABLE_SHIFT;
> - mfn += 1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT);
> + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) )
> + mfn += 1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT);
> nr_mfns -= 1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT);
> continue;
> }
> @@ -4756,7 +4757,8 @@ int map_pages_to_xen(
> if ( i > nr_mfns )
> i = nr_mfns;
> virt += i << PAGE_SHIFT;
> - mfn += i;
> + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) )
> + mfn += i;
> nr_mfns -= i;
> continue;
> }
> @@ -4824,7 +4826,8 @@ int map_pages_to_xen(
> }
>
> virt += 1UL << L2_PAGETABLE_SHIFT;
> - mfn += 1UL << PAGETABLE_ORDER;
> + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) )
> + mfn += 1UL << PAGETABLE_ORDER;
> nr_mfns -= 1UL << PAGETABLE_ORDER;
> }
> else
> @@ -4853,7 +4856,8 @@ int map_pages_to_xen(
> if ( i > nr_mfns )
> i = nr_mfns;
> virt += i << L1_PAGETABLE_SHIFT;
> - mfn += i;
> + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) )
> + mfn += i;
> nr_mfns -= i;
> goto check_l3;
> }
> @@ -4898,7 +4902,8 @@ int map_pages_to_xen(
> }
>
> virt += 1UL << L1_PAGETABLE_SHIFT;
> - mfn += 1UL;
> + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) )
> + mfn += 1UL;
> nr_mfns -= 1UL;
>
> if ( (flags == PAGE_HYPERVISOR) &&
>
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-03-11 19:30 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 14:02 [PATCH v4 00/16] xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN Julien Grall
2018-02-21 14:02 ` [PATCH v4 01/16] xen/tmem: Convert the file common/tmem_xen.c " Julien Grall
2018-02-21 14:02 ` [PATCH v4 02/16] xen/arm: setup: use maddr_to_mfn rather than _mfn(paddr_to_pfn(...)) Julien Grall
2018-02-21 14:02 ` [PATCH v4 03/16] xen/arm: mm: Use gaddr_to_gfn rather than _gfn(paddr_to_pfn(...)) Julien Grall
2018-02-21 14:02 ` [PATCH v4 04/16] xen/arm: mm: Remove unused M2P code Julien Grall
2018-02-21 14:02 ` [PATCH v4 05/16] xen/arm: mm: Remove unused relinquish_shared_pages Julien Grall
2018-02-21 14:02 ` [PATCH v4 06/16] xen/x86: Remove unused override of page_to_mfn/mfn_to_page Julien Grall
2018-03-01 11:20 ` George Dunlap
2018-03-02 14:42 ` Jan Beulich
2018-03-02 14:44 ` Julien Grall
2018-03-02 15:11 ` Jan Beulich
2018-03-05 13:29 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 07/16] xen/x86: mm: Switch x86/mm.c to use typesafe for virt_to_mfn Julien Grall
2018-03-02 14:45 ` Jan Beulich
2018-03-02 14:46 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 08/16] xen/mm: Drop the parameter mfn from populate_pt_range Julien Grall
2018-02-22 16:35 ` Wei Liu
2018-02-22 16:40 ` Julien Grall
2018-02-22 16:51 ` Wei Liu
2018-02-22 16:55 ` Julien Grall
2018-02-22 17:10 ` Wei Liu
2018-03-02 14:55 ` Jan Beulich
2018-03-05 13:43 ` Julien Grall
2018-03-05 14:00 ` Jan Beulich
2018-03-05 14:11 ` Julien Grall
2018-03-05 14:38 ` Jan Beulich
2018-03-09 17:29 ` Wei Liu
2018-03-11 19:30 ` Julien Grall [this message]
2018-03-12 6:36 ` Jan Beulich
2018-03-14 15:22 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 09/16] xen/pdx: Introduce helper to convert MFN <-> PDX Julien Grall
2018-02-22 16:39 ` Wei Liu
2018-02-21 14:02 ` [PATCH v4 10/16] xen/mm: Switch map_pages_to_xen to use MFN typesafe Julien Grall
2018-02-23 4:59 ` Tian, Kevin
2018-02-23 17:21 ` Wei Liu
2018-03-02 15:06 ` Jan Beulich
2018-03-02 15:08 ` Jan Beulich
2018-03-05 14:07 ` Julien Grall
2018-03-05 14:39 ` Jan Beulich
2018-03-05 14:44 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 11/16] xen/mm: Switch page_alloc.c to typesafe MFN Julien Grall
2018-02-23 17:21 ` Wei Liu
2018-03-02 15:18 ` Jan Beulich
2018-03-02 15:57 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 12/16] xen/mm: Switch common/memory.c to use " Julien Grall
2018-02-23 17:26 ` Wei Liu
2018-02-23 17:46 ` Julien Grall
2018-02-23 18:05 ` Wei Liu
2018-02-23 18:06 ` Julien Grall
2018-02-23 18:10 ` Wei Liu
2018-03-02 15:34 ` Jan Beulich
2018-03-05 14:18 ` Julien Grall
2018-03-05 14:41 ` Jan Beulich
2018-03-09 17:33 ` Wei Liu
2018-03-11 19:44 ` Julien Grall
2018-03-12 6:39 ` Jan Beulich
2018-03-14 16:08 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 13/16] xen/grant: Switch {create, replace}_grant_p2m_mapping to " Julien Grall
2018-02-23 17:29 ` Wei Liu
2018-03-02 15:38 ` Jan Beulich
2018-02-21 14:02 ` [PATCH v4 14/16] xen/grant: Switch common/grant_table.c to use " Julien Grall
2018-02-23 17:30 ` Wei Liu
2018-03-02 15:54 ` Jan Beulich
2018-03-02 15:59 ` Julien Grall
2018-03-02 16:12 ` Jan Beulich
2018-02-21 14:02 ` [PATCH v4 15/16] xen/x86: Switch mfn_to_page in x86_64/mm.c " Julien Grall
2018-03-02 15:57 ` Jan Beulich
2018-02-21 14:02 ` [PATCH v4 16/16] xen: Convert page_to_mfn and mfn_to_page " Julien Grall
2018-02-21 14:25 ` Razvan Cojocaru
2018-02-21 14:59 ` Paul Durrant
2018-02-21 23:20 ` Boris Ostrovsky
2018-02-23 4:59 ` Tian, Kevin
2018-02-23 17:31 ` Wei Liu
2018-03-02 16:08 ` Jan Beulich
2018-03-14 17:02 ` Julien Grall
2018-03-15 7:07 ` Jan Beulich
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=f09b1a1b-5867-d3e7-1aba-0a2ebbb03bc0@arm.com \
--to=julien.grall@arm.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.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).