xen/arm: Handle empty grant table region in find_unallocated_memory()
PATCH 1/1 xen/arm: Handle empty grant table region in find_unallocated_memory()
When creating dom0 with grant table support disabled in Xen and no IOMMU, the following assert is triggered (debug build):
"Assertion 's <= e' failed at common/rangeset.c:189"
This is because find_unallocated_memory() (used to find memory holes for extended regions) calls rangeset_remove_range() for an empty grant table region. Fix it by checking if the size of region is not 0.
--- xen/arch/arm/domain_build.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
xen/arch/arm/domain_build.c +11 -7
@@ -1633,14 +1633,18 @@ static int __init find_unallocated_memory(const struct kernel_info *kinfo, }/* Remove grant table region */ - start = kinfo->gnttab_start; - end = kinfo->gnttab_start + kinfo->gnttab_size; - res =rangeset_remove_range (unalloc_mem,PFN_DOWN (start),PFN_DOWN (end -1 )); -if ( res ) +if ( kinfo->gnttab_size ) { -printk (XENLOG_ERR "Failed to remove: %#" PRIpaddr"->%#" PRIpaddr"\n" , - start, end); - goto out; + start = kinfo->gnttab_start; + end = kinfo->gnttab_start + kinfo->gnttab_size; + res =rangeset_remove_range (unalloc_mem,PFN_DOWN (start), +PFN_DOWN (end -1 )); +if ( res ) + { +printk (XENLOG_ERR "Failed to remove: %#" PRIpaddr"->%#" PRIpaddr"\n" , + start, end); + goto out; + } } start =0 ;
Signature · 1 line
2.25.1
Hi,
Quoted 3 lines · Michal Orzel
When creating dom0 with grant table support disabled in Xen and no IOMMU, the following assert is triggered (debug build):
"Assertion 's <= e' failed atcommon/rangeset.c:189"
A partial stack trace would have been handy. This help the reader to understand how you came to the conclusion that the issue was in find_unallocated_memory().
Quoted 6 lines
This is because
find_unallocated_memory()(used to find memory holes for extended regions) callsrangeset_remove_range()for an empty grant table region. Fix it by checking if the size of region is not 0.Signed-off-by Michal Orzel <[email protected]>
The change itself looks fine. So with the stack trace add:
Quoted 24 lines
--- xen/arch/arm/domain_build.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)xen/arch/arm/domain_build.c +4
-7@@ -1633,14 +1633,18 @@ static int __init find_unallocated_memory(const struct kernel_info *kinfo, }/* Remove grant table region */ - start = kinfo->gnttab_start; - end = kinfo->gnttab_start + kinfo->gnttab_size; - res =rangeset_remove_range (unalloc_mem,PFN_DOWN (start),PFN_DOWN (end -1 )); -if ( res ) +if ( kinfo->gnttab_size ) { -printk (XENLOG_ERR "Failed to remove: %#" PRIpaddr"->%#" PRIpaddr"\n" , - start, end); - goto out; + start = kinfo->gnttab_start; + end = kinfo->gnttab_start + kinfo->gnttab_size; + res = rangeset_remove_range(unalloc_mem, PFN_DOWN(start),
xen/arch/arm/domain_build.c static int __init find_unallocated_memory(const struct kernel_info *kinfo, · line 1650
Quoted 10 lines
xen/arch/arm/domain_build.c +7
-0+ PFN_DOWN(end - 1)); +if ( res ) + { +printk (XENLOG_ERR "Failed to remove: %#" PRIpaddr"->%#" PRIpaddr"\n" , + start, end); + goto out; + } } start =0 ;
Cheers,
Signature · 1 line
Julien Grall
Hi Julien,
Quoted 4 lines · Julien Grall
Hi,
Quoted 8 lines
Quoted 3 lines · Michal Orzel
When creating dom0 with grant table support disabled in Xen and no IOMMU, the following assert is triggered (debug build):
"Assertion 's <= e' failed atcommon/rangeset.c:189"A partial stack trace would have been handy. This help the reader to understand how you came to the conclusion that the issue was in
find_unallocated_memory().
Here you go:
(XEN) Xen call trace:
(XEN) [<0000020000218568>] rangeset_remove_range+0xbc/0x2cc (PC) (XEN) [<00000200002c76bc>] domain_build.c#make_hypervisor_node+0x294/0x7c4 (LR) (XEN) [<00000200002ca240>] domain_build.c#handle_node+0x7ec/0x924 (XEN) [<00000200002ca7ac>] domain_build.c#construct_dom0+0x434/0x4d8
Can you append this to the commit msg while committing or do you want a respin?
~Michal
Quoted 9 lines · Michal Orzel
Quoted 8 lines · Julien Grall
Quoted 3 lines · Michal Orzel
When creating dom0 with grant table support disabled in Xen and no IOMMU, the following assert is triggered (debug build):
"Assertion 's <= e' failed atcommon/rangeset.c:189"A partial stack trace would have been handy. This help the reader to understand how you came to the conclusion that the issue was in
find_unallocated_memory().
Quoted 8 lines
Here you go:
(XEN) Xen call trace:(XEN) [<0000020000218568>] rangeset_remove_range+0xbc/0x2cc (PC) (XEN) [<00000200002c76bc>] domain_build.c#make_hypervisor_node+0x294/0x7c4 (LR) (XEN) [<00000200002ca240>] domain_build.c#handle_node+0x7ec/0x924 (XEN) [<00000200002ca7ac>] domain_build.c#construct_dom0+0x434/0x4d8Can you append this to the commit msg while committing or do you want a respin?
Thanks. It can be done on commit.
Cheers,
Signature · 1 line
Julien Grall
Quoted 19 lines · Julien Grall
Quoted 16 lines · Michal Orzel
Quoted 8 lines · Julien Grall
Quoted 3 lines · Michal Orzel
When creating dom0 with grant table support disabled in Xen and no IOMMU, the following assert is triggered (debug build):
"Assertion 's <= e' failed atcommon/rangeset.c:189"A partial stack trace would have been handy. This help the reader to understand how you came to the conclusion that the issue was in
find_unallocated_memory().Here you go:
(XEN) Xen call trace:
(XEN) [<0000020000218568>]rangeset_remove_range+0xbc/0x2cc(PC) (XEN) [<00000200002c76bc>] domain_build.c#make_hypervisor_node+0x294/0x7c4 (LR) (XEN) [<00000200002ca240>] domain_build.c#handle_node+0x7ec/0x924 (XEN) [<00000200002ca7ac>] domain_build.c#construct_dom0+0x434/0x4d8
Quoted 3 lines
Quoted 1 line
Can you append this to the commit msg while committing or do you want a respin?
Thanks. It can be done on commit.
I have now committed the patch. Sorry for the delay.
Cheers,
Signature · 1 line
Julien Grall