Hello,
When trying to boot two zImage using dom0less boot on ARM, we encountered this problem when xen runs gunzip on second guest:
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Out of memory
(XEN) ****************************************
And worked around it with the following patch. We'd like to check to see if this is a known issue and if the work-around looks reasonable. Thank you
diff --git a/xen/common/gunzip.c b/xen/common/gunzip.c
index db4efcd34b..e5bd19ba7f 100644
--- a/xen/common/gunzip.c
+++ b/xen/common/gunzip.c
@@ -113,8 +113,10 @@ __init int perform_gunzip(char *output, char *image, unsigned long image_len)
window = (unsigned char *)output;
+ if (!free_mem_ptr) {
free_mem_ptr = (unsigned long)alloc_xenheap_pages(HEAPORDER, 0);
free_mem_end_ptr = free_mem_ptr + (PAGE_SIZE << HEAPORDER);
+ }
inbuf = (unsigned char *)image;
insize = image_len;
@@ -131,7 +133,12 @@ __init int perform_gunzip(char *output, char *image, unsigned long image_len)
rc = 0;
}
+ if (free_mem_ptr) {
free_xenheap_pages((void *)free_mem_ptr, HEAPORDER);
+ free_mem_ptr = 0;
+ }
+
+ bytes_out = 0;
return rc;
}
diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index f99c985d61..de96002188 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -244,7 +244,7 @@ static void *INIT malloc(int size)
if (size < 0)
error("Malloc error");
- if (!malloc_ptr)
+ if ((!malloc_ptr) || (!malloc_count))
malloc_ptr = free_mem_ptr;
malloc_ptr = (malloc_ptr + 3) & ~3; /* Align */
--
Charles Chiou
NOTE: This email (including attachments) contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.
When trying to boot two zImage using dom0less boot on ARM, we encountered this problem when xen runs gunzip on second guest:
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Out of memory
(XEN) ****************************************
And worked around it with the following patch. We'd like to check to see if this is a known issue and if the work-around looks reasonable. Thank you
diff --git a/xen/common/gunzip.c b/xen/common/gunzip.c
index db4efcd34b..e5bd19ba7f 100644
--- a/xen/common/gunzip.c
+++ b/xen/common/gunzip.c
@@ -113,8 +113,10 @@ __init int perform_gunzip(char *output, char *image, unsigned long image_len)
window = (unsigned char *)output;
+ if (!free_mem_ptr) {
free_mem_ptr = (unsigned long)alloc_xenheap_pages(HEAPORDER, 0);
free_mem_end_ptr = free_mem_ptr + (PAGE_SIZE << HEAPORDER);
+ }
inbuf = (unsigned char *)image;
insize = image_len;
@@ -131,7 +133,12 @@ __init int perform_gunzip(char *output, char *image, unsigned long image_len)
rc = 0;
}
+ if (free_mem_ptr) {
free_xenheap_pages((void *)free_mem_ptr, HEAPORDER);
+ free_mem_ptr = 0;
+ }
+
+ bytes_out = 0;
return rc;
}
diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index f99c985d61..de96002188 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -244,7 +244,7 @@ static void *INIT malloc(int size)
if (size < 0)
error("Malloc error");
- if (!malloc_ptr)
+ if ((!malloc_ptr) || (!malloc_count))
malloc_ptr = free_mem_ptr;
malloc_ptr = (malloc_ptr + 3) & ~3; /* Align */
--
Charles Chiou
NOTE: This email (including attachments) contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.