* [PATCH V2] xen/arm: mm: fix nr_second calculation in setup_frametable_mappings
@ 2016-05-12 13:03 Peng Fan
2016-05-16 9:36 ` Julien Grall
0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan @ 2016-05-12 13:03 UTC (permalink / raw)
To: xen-devel, julien.grall, sstabellini; +Cc: van.freenix
On ARM64, "frametable_size >> SECOND_SHIFT" computes the number
of second level entries, not the number of second level pages.
"ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT" which computes
the number of the first level entries (the number of second level pages),
is the correct one that should be used.
Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>
---
V2:
Take Julien's suggestion in http://lists.xen.org/archives/html/xen-devel/2016-05/msg01145.html.
Refine commit log.
xen/arch/arm/mm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 0a4f845..5f60aa4 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -767,7 +767,8 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12));
#ifdef CONFIG_ARM_64
- nr_second = frametable_size >> SECOND_SHIFT;
+ /* Compute the number of second level pages. */
+ nr_second = ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT;
second_base = alloc_boot_pages(nr_second, 1);
second = mfn_to_virt(second_base);
for ( i = 0; i < nr_second; i++ )
--
2.6.2
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] xen/arm: mm: fix nr_second calculation in setup_frametable_mappings
2016-05-12 13:03 [PATCH V2] xen/arm: mm: fix nr_second calculation in setup_frametable_mappings Peng Fan
@ 2016-05-16 9:36 ` Julien Grall
2016-05-16 9:39 ` Wei Liu
0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2016-05-16 9:36 UTC (permalink / raw)
To: Peng Fan, Xen Devel, sstabellini; +Cc: Wei Liu
(CC Wei for Xen 4.7)
Hi,
On 12/05/16 14:03, Peng Fan wrote:
> On ARM64, "frametable_size >> SECOND_SHIFT" computes the number
> of second level entries, not the number of second level pages.
>
> "ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT" which computes
> the number of the first level entries (the number of second level pages),
> is the correct one that should be used.
>
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Julien Grall <julien.grall@arm.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
This is a bug fix for Xen 4.7 and should be backported up to Xen 4.4.
Wei, could we get a release-ack for this patch?
The computation of the number of page to allocation was wrong. This
could result to overrun xen_first on platform with big amount of memory.
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] xen/arm: mm: fix nr_second calculation in setup_frametable_mappings
2016-05-16 9:36 ` Julien Grall
@ 2016-05-16 9:39 ` Wei Liu
0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2016-05-16 9:39 UTC (permalink / raw)
To: Julien Grall; +Cc: Peng Fan, sstabellini, Wei Liu, Xen Devel
On Mon, May 16, 2016 at 10:36:11AM +0100, Julien Grall wrote:
> (CC Wei for Xen 4.7)
>
> Hi,
>
> On 12/05/16 14:03, Peng Fan wrote:
> >On ARM64, "frametable_size >> SECOND_SHIFT" computes the number
> >of second level entries, not the number of second level pages.
> >
> >"ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT" which computes
> >the number of the first level entries (the number of second level pages),
> >is the correct one that should be used.
> >
> >Signed-off-by: Peng Fan <van.freenix@gmail.com>
> >Cc: Stefano Stabellini <sstabellini@kernel.org>
> >Cc: Julien Grall <julien.grall@arm.com>
>
> Reviewed-by: Julien Grall <julien.grall@arm.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-16 9:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-12 13:03 [PATCH V2] xen/arm: mm: fix nr_second calculation in setup_frametable_mappings Peng Fan
2016-05-16 9:36 ` Julien Grall
2016-05-16 9:39 ` Wei Liu
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).