All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall.oss@gmail.com>
To: Brian Woods <brian.woods@xilinx.com>
Cc: xen-devel@lists.xenproject.org,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [Xen-devel] [PATCH v2] xen/arm: add warning if memory modules overlap
Date: Thu, 17 Oct 2019 21:34:51 +0100	[thread overview]
Message-ID: <CAJ=z9a2TxLmtE2nrwYQNVvh3K8upSszYke-PZ8BeaAs2wc0qjQ@mail.gmail.com> (raw)
In-Reply-To: <1571342860-15838-1-git-send-email-brian.woods@xilinx.com>

Hi,

On Thu, 17 Oct 2019 at 21:08, Brian Woods <brian.woods@xilinx.com> wrote:
>
> It's possible for a misconfigured device tree to cause Xen to crash when
> there are overlapping addresses in the memory modules.  Add a warning
> when printing the addresses to let the user know there's a possible
> issue.
>
> Signed-off-by: Brian Woods <brian.woods@xilinx.com>
> ---
> v1 -> v2
>         - removed nested loop and placed check in add_boot_module()
>
> Sample output:
> ...
> (XEN) MODULE[0]: 0000000001400000 - 0000000001542121 Xen
> (XEN) MODULE[1]: 0000000003846000 - 0000000003850080 Device Tree
> (XEN) MODULE[2]: 0000000003853000 - 0000000007fff676 Ramdisk
> (XEN) MODULE[3]: 0000000000080000 - 0000000003180000 Kernel
> (XEN)  RESVD[0]: 0000000003846000 - 0000000003850000
> (XEN)  RESVD[1]: 0000000003853000 - 0000000007fff676
> (XEN)
> (XEN) WARNING: overlap detected in the memory module addresses
> (XEN)
> (XEN) Command line: console=dtuart dtuart=serial0 dom0_mem=1G bootscrub=0 maxcpus=1 timer_slop=0
> ...
>
>  xen/arch/arm/bootfdt.c      | 4 ++++
>  xen/arch/arm/setup.c        | 6 ++++++
>  xen/include/asm-arm/setup.h | 1 +
>  3 files changed, 11 insertions(+)
>
> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> index 08fb59f..f8b34d4 100644
> --- a/xen/arch/arm/bootfdt.c
> +++ b/xen/arch/arm/bootfdt.c
> @@ -387,6 +387,10 @@ static void __init early_print_info(void)
>                 mem_resv->bank[j].start + mem_resv->bank[j].size - 1);
>      }
>      printk("\n");
> +
> +    if ( mem_module_overlap )
> +        printk("WARNING: overlap detected in the memory module addresses.\n");

As a user such message would likely put me off. You tell me there are
an overlap, but you don't provide more information even if you likely
have the information in place. However...

> +
>      for ( i = 0 ; i < cmds->nr_mods; i++ )
>          printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start,
>                 cmds->cmdline[i].dt_name,
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 705a917..315a131 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -69,6 +69,8 @@ integer_param("xenheap_megabytes", opt_xenheap_megabytes);
>
>  domid_t __read_mostly max_init_domid;
>
> +bool __initdata mem_module_overlap;
> +
>  static __used void init_done(void)
>  {
>      /* Must be done past setting system_state. */
> @@ -254,6 +256,10 @@ struct bootmodule __init *add_boot_module(bootmodule_kind kind,
>                  mod->domU = false;
>              return mod;
>          }
> +
> +        if ( ((mod->start >= start) && (mod->start < start + size)) ||
> +             ((start >= mod->start) && (start < mod->start + mod->size)) )
> +            mem_module_overlap = true;

... What's wrong with just dumping the information here directly?

Cheers,

-- 
Julien Grall

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

  reply	other threads:[~2019-10-17 20:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 19:47 [Xen-devel] [PATCH] xen/arm: add warning if memory modules overlap Brian Woods
2019-10-10 15:39 ` Julien Grall
2019-10-11 16:43   ` Brian Woods
2019-10-11 16:58     ` Julien Grall
2019-10-11 18:06       ` Brian Woods
2019-10-11 18:17         ` Julien Grall
2019-10-11 19:07           ` Brian Woods
2019-10-17  9:20             ` Julien Grall
2019-10-17 19:48               ` Brian Woods
2019-10-17 20:23                 ` Julien Grall
2019-10-17 20:07 ` [Xen-devel] [PATCH v2] " Brian Woods
2019-10-17 20:34   ` Julien Grall [this message]
2019-10-17 21:20     ` Brian Woods
2019-10-17 21:49       ` Julien Grall
2019-10-17 22:34         ` Brian Woods
2019-10-18 15:41           ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ=z9a2TxLmtE2nrwYQNVvh3K8upSszYke-PZ8BeaAs2wc0qjQ@mail.gmail.com' \
    --to=julien.grall.oss@gmail.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=brian.woods@xilinx.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.