* Re: [PATCH v2] xen/arm: Fix crash if last memory section is bigger than 1gb
@ 2014-10-02 14:39 Frediano Ziglio
2014-10-02 14:50 ` Julien Grall
0 siblings, 1 reply; 2+ messages in thread
From: Frediano Ziglio @ 2014-10-02 14:39 UTC (permalink / raw)
To: Julien Grall; +Cc: Tim Deegan, Stefano Stabellini, Ian Campbell, xen-devel
setup_xenheap_mappings setup head memory on Arm 32 has a limit of 1gb.
On system with large memory is possible that there are no blocks of memory
smaller than 1gb leading xenheap_pages to be more than 1gb.
This cause memory errors trying to access heap after the 1gb limit.
Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
---
xen/arch/arm/setup.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 446de8a..e223d1b 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -509,6 +509,7 @@ static void __init setup_mm(unsigned long
dtb_paddr, size_t dtb_size)
heap_pages = ram_pages;
xenheap_pages = (heap_pages/8 + 0x1fffUL) & ~0x1fffUL;
xenheap_pages = max(xenheap_pages, 128UL<<(20-PAGE_SHIFT));
+ xenheap_pages = min(xenheap_pages, 1UL<<(30-PAGE_SHIFT));
do
{
--
1.9.1
No problems,
Frediano
2014-10-02 15:30 GMT+01:00 Julien Grall <julien.grall@linaro.org>:
> Hi Frediano,
>
> In general, we add in the subject the version of the subject (for
> instance [PATCH v3]).
>
> Sorry to ask you few others changes. The title doesn't seem suitable,
> it's not a workaround (it would mean it's temporary) but an error in the
> code.
>
> On 10/02/2014 03:07 PM, Frediano Ziglio wrote:
>> setup_xenheap_mappings setup head memory on Arm 32 has a limit of 1gb.
>> On system with large memory is possible that there are no blocks of memory
>> smaller than 1gb leading xenheap_pages to be more than 1gb.
>> This cause memory errors trying to access heap after the 1gb limit.
>>
>> Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
>> ---
>> xen/arch/arm/setup.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>> index 446de8a..e223d1b 100644
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -509,6 +509,7 @@ static void __init setup_mm(unsigned long
>> dtb_paddr, size_t dtb_size)
>> heap_pages = ram_pages;
>> xenheap_pages = (heap_pages/8 + 0x1fffUL) & ~0x1fffUL;
>> xenheap_pages = max(xenheap_pages, 128UL<<(20-PAGE_SHIFT));
>> + xenheap_pages = min(xenheap_pages, 1UL<<(30-PAGE_SHIFT));
>
> Can you also update the comment above, saying we are requesting at most 1G?
>
> With this 2 minors changes:
>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>
>
> Regards,
>
> --
> Julien Grall
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] xen/arm: Fix crash if last memory section is bigger than 1gb
2014-10-02 14:39 [PATCH v2] xen/arm: Fix crash if last memory section is bigger than 1gb Frediano Ziglio
@ 2014-10-02 14:50 ` Julien Grall
0 siblings, 0 replies; 2+ messages in thread
From: Julien Grall @ 2014-10-02 14:50 UTC (permalink / raw)
To: Frediano Ziglio; +Cc: Tim Deegan, Stefano Stabellini, Ian Campbell, xen-devel
Hi Frediano,
On 10/02/2014 03:39 PM, Frediano Ziglio wrote:
> setup_xenheap_mappings setup head memory on Arm 32 has a limit of 1gb.
> On system with large memory is possible that there are no blocks of memory
> smaller than 1gb leading xenheap_pages to be more than 1gb.
> This cause memory errors trying to access heap after the 1gb limit.
>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
> ---
> xen/arch/arm/setup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 446de8a..e223d1b 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -509,6 +509,7 @@ static void __init setup_mm(unsigned long
> dtb_paddr, size_t dtb_size)
> heap_pages = ram_pages;
> xenheap_pages = (heap_pages/8 + 0x1fffUL) & ~0x1fffUL;
> xenheap_pages = max(xenheap_pages, 128UL<<(20-PAGE_SHIFT));
> + xenheap_pages = min(xenheap_pages, 1UL<<(30-PAGE_SHIFT));
>
> do
> {
>
You forgot to add my Reviewed-by (gave on the latest version) and
address one thing.
There is a big comment in the code explaining the different constraint
on to find the heap. You have to update it.
I would replace the line "- must be at most 1/8 the total RAM in the
system" by " - must be at most 1GB or 1/8 the total RAM in the system if
less".
Regards,
--
Julien Grall
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-02 14:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-02 14:39 [PATCH v2] xen/arm: Fix crash if last memory section is bigger than 1gb Frediano Ziglio
2014-10-02 14:50 ` Julien Grall
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).