xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] xen/arm: domain_build: Don't continue if unable to allocate all dom0 banks
@ 2019-08-21 22:12 Julien Grall
  2019-10-02  1:12 ` Stefano Stabellini
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Grall @ 2019-08-21 22:12 UTC (permalink / raw)
  To: xen-devel
  Cc: Julien Grall, Stefano Stabellini, Volodymyr Babchuk, Bertrand.Marquis

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.

Signed-off-by: Julien Grall <julien.grall@arm.com>

---

Cc: Bertrand.Marquis@arm.com

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(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 1a3dcb1bcd..72e14746cd 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -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++ )
     {
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Xen-devel] [PATCH] xen/arm: domain_build: Don't continue if unable to allocate all dom0 banks
  2019-08-21 22:12 [Xen-devel] [PATCH] xen/arm: domain_build: Don't continue if unable to allocate all dom0 banks Julien Grall
@ 2019-10-02  1:12 ` Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2019-10-02  1:12 UTC (permalink / raw)
  To: Julien Grall
  Cc: xen-devel, Stefano Stabellini, Volodymyr Babchuk, Bertrand.Marquis

On Wed, 21 Aug 2019, Julien Grall wrote:
> Xen will only print a warning if there are memory unallocated when using
                                         ^ is


> 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

 
> 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.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> 
> Cc: Bertrand.Marquis@arm.com
> 
> 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(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 1a3dcb1bcd..72e14746cd 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -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++ )
>      {
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-02  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-21 22:12 [Xen-devel] [PATCH] xen/arm: domain_build: Don't continue if unable to allocate all dom0 banks Julien Grall
2019-10-02  1:12 ` Stefano Stabellini

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).