* [PATCH V3] xen: Check if the range is valid in init_domheap_pages
@ 2013-11-13 13:37 Julien Grall
2013-11-13 14:58 ` Keir Fraser
2013-11-20 16:09 ` Julien Grall
0 siblings, 2 replies; 4+ messages in thread
From: Julien Grall @ 2013-11-13 13:37 UTC (permalink / raw)
To: xen-devel
Cc: Keir Fraser, ian.campbell, stefano.stabellini, Julien Grall, tim,
Jan Beulich, patches
On ARM, when an initrd is given to xen by U-boot, it will reserve the memory in
the device tree.
In this case, when xen decides to free unused memory, dt_unreserved_regions
will call init_domheap_pages with the start and the end of range equals. But
the latter assumes that (start > end), if not Xen will hang because the
number of pages is equals to (unsigned)-1.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
---
Changes in v3:
- Invert the check
Changes in v2:
- Change commit title
- Move the check in init_domheap_pages
---
xen/common/page_alloc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 4c17fbd..0701333 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1429,6 +1429,9 @@ void init_domheap_pages(paddr_t ps, paddr_t pe)
smfn = round_pgup(ps) >> PAGE_SHIFT;
emfn = round_pgdown(pe) >> PAGE_SHIFT;
+ if ( emfn <= smfn )
+ return;
+
init_heap_pages(mfn_to_page(smfn), emfn - smfn);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V3] xen: Check if the range is valid in init_domheap_pages
2013-11-13 13:37 [PATCH V3] xen: Check if the range is valid in init_domheap_pages Julien Grall
@ 2013-11-13 14:58 ` Keir Fraser
2013-11-20 16:09 ` Julien Grall
1 sibling, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2013-11-13 14:58 UTC (permalink / raw)
To: Julien Grall, xen-devel
Cc: patches, tim, ian.campbell, Jan Beulich, stefano.stabellini
On 13/11/2013 13:37, "Julien Grall" <julien.grall@linaro.org> wrote:
> On ARM, when an initrd is given to xen by U-boot, it will reserve the memory
> in
> the device tree.
> In this case, when xen decides to free unused memory, dt_unreserved_regions
> will call init_domheap_pages with the start and the end of range equals. But
> the latter assumes that (start > end), if not Xen will hang because the
> number of pages is equals to (unsigned)-1.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <jbeulich@suse.com>
I understand Jan's reservations, but I think just being more liberal here is
fine really.
Acked-by: Keir Fraser <keir@xen.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3] xen: Check if the range is valid in init_domheap_pages
2013-11-13 13:37 [PATCH V3] xen: Check if the range is valid in init_domheap_pages Julien Grall
2013-11-13 14:58 ` Keir Fraser
@ 2013-11-20 16:09 ` Julien Grall
2013-11-20 21:12 ` Keir Fraser
1 sibling, 1 reply; 4+ messages in thread
From: Julien Grall @ 2013-11-20 16:09 UTC (permalink / raw)
To: Julien Grall
Cc: Keir Fraser, ian.campbell, stefano.stabellini, patches, tim,
Jan Beulich, xen-devel
On 11/13/2013 01:37 PM, Julien Grall wrote:
> On ARM, when an initrd is given to xen by U-boot, it will reserve the memory in
> the device tree.
> In this case, when xen decides to free unused memory, dt_unreserved_regions
> will call init_domheap_pages with the start and the end of range equals. But
> the latter assumes that (start > end), if not Xen will hang because the
> number of pages is equals to (unsigned)-1.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <jbeulich@suse.com>
Ping ? Without this commit, the user is unable to pass initrd to dom0 on
ARM.
--
Julien Grall
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3] xen: Check if the range is valid in init_domheap_pages
2013-11-20 16:09 ` Julien Grall
@ 2013-11-20 21:12 ` Keir Fraser
0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2013-11-20 21:12 UTC (permalink / raw)
To: Julien Grall, Julien Grall
Cc: ian.campbell, patches, stefano.stabellini, tim, Jan Beulich, xen-devel
On 20/11/2013 08:09, "Julien Grall" <julien.grall@citrix.com> wrote:
> On 11/13/2013 01:37 PM, Julien Grall wrote:
>> On ARM, when an initrd is given to xen by U-boot, it will reserve the memory
>> in
>> the device tree.
>> In this case, when xen decides to free unused memory, dt_unreserved_regions
>> will call init_domheap_pages with the start and the end of range equals. But
>> the latter assumes that (start > end), if not Xen will hang because the
>> number of pages is equals to (unsigned)-1.
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> CC: Keir Fraser <keir@xen.org>
>> CC: Jan Beulich <jbeulich@suse.com>
>
> Ping ? Without this commit, the user is unable to pass initrd to dom0 on
> ARM.
It was fine with me.
Acked-by: Keir Fraser <keir@xen.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-20 21:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-13 13:37 [PATCH V3] xen: Check if the range is valid in init_domheap_pages Julien Grall
2013-11-13 14:58 ` Keir Fraser
2013-11-20 16:09 ` Julien Grall
2013-11-20 21:12 ` Keir Fraser
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.