Skip to contentSkip to conversation

xen/arm: domain_build: Don't continue if unable to allocate all dom0 banks

PATCH In review Julien Grall 2 participants 2 messages Aug 21, 2019 – Oct 2, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: domain_build: Don't continue if unable to allocate all dom0 banks

Xen will only print a warning if there are memory unallocated when using 1:1 mapping (only used by dom0). This also includes the case where no memory has been allocated.

It will bring to all sort of issues that can be hard to diagnostic for users (the warning can be difficult to spot or disregard).

If the users request 1GB of memory, then most likely they want the exact amount and not 512MB. So panic if all the memory has not been allocated.

After this change, the behavior is the same as for non-1:1 memory allocation (used by domU).

At the same time, reflow the message to have the format on a single line.

---

It took me sometimes this morning to spot the warning in the log. If we don't honor the size, it feels it is better to crash and request the user to request less memory (or re-order the binary).

This is inline on how domU memory allocation is handled.

---
 xen/arch/arm/domain_build.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +3 -4
index 1a3dcb1bcd..72e14746cd 100644
@@ -358,10 +358,9 @@ static void __init allocate_memory_11(struct domain *d,
     }
 
     if ( kinfo->unassigned_mem )
-        printk("WARNING: Failed to allocate requested dom0 memory."
-               /* Don't want format this as PRIpaddr (16 digit hex) */
-               " %ldMB unallocated\n",
-               (unsigned long)kinfo->unassigned_mem >> 20);
+        /* Don't want format this as PRIpaddr (16 digit hex) */
+        panic("Failed to allocate requested dom0 memory. %ldMB unallocated\n",
+              (unsigned long)kinfo->unassigned_mem >> 20);
 
     for( i = 0; i < kinfo->mem.nr_banks; i++ )
     {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Julien Grall

Xen will only print a warning if there are memory unallocated when using

^ is

Quoted 5 lines

1:1 mapping (only used by dom0). This also includes the case where no memory has been allocated.

It will bring to all sort of issues that can be hard to diagnostic for users (the warning can be difficult to spot or disregard).

^ disregarded

Quoted 10 lines

If the users request 1GB of memory, then most likely they want the exact amount and not 512MB. So panic if all the memory has not been allocated.

After this change, the behavior is the same as for non-1:1 memory allocation (used by domU).

At the same time, reflow the message to have the format on a single line.

Quoted 34 lines

---

It took me sometimes this morning to spot the warning in the log. If we don't honor the size, it feels it is better to crash and request the user to request less memory (or re-order the binary).

This is inline on how domU memory allocation is handled.

---
 xen/arch/arm/domain_build.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +3 -4
index 1a3dcb1bcd..72e14746cd 100644
@@ -358,10 +358,9 @@ static void __init allocate_memory_11(struct domain *d,
     }
 
     if ( kinfo->unassigned_mem )
-        printk("WARNING: Failed to allocate requested dom0 memory."
-               /* Don't want format this as PRIpaddr (16 digit hex) */
-               " %ldMB unallocated\n",
-               (unsigned long)kinfo->unassigned_mem >> 20);
+        /* Don't want format this as PRIpaddr (16 digit hex) */
+        panic("Failed to allocate requested dom0 memory. %ldMB unallocated\n",
+              (unsigned long)kinfo->unassigned_mem >> 20);
 
     for( i = 0; i < kinfo->mem.nr_banks; i++ )
     {
Signature · 1 line
2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel