All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <Julien.Grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <stefanos@xilinx.com>, nd <nd@arm.com>,
	"206497@studenti.unimore.it" <206497@studenti.unimore.it>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>
Subject: Re: [PATCH] xen/arm: skip first page when RAM starts at 0x0
Date: Thu, 25 Apr 2019 21:27:52 +0000	[thread overview]
Message-ID: <981e7b3f-464b-d37c-e03e-22408ae65f85@arm.com> (raw)
In-Reply-To: <1556214715-22030-1-git-send-email-sstabellini@kernel.org>

Hi Stefano,

On 25/04/2019 18:51, Stefano Stabellini wrote:
> Xen assumes that RAM starts at addresses greater than 0x0 in a few
> places. The PDX code is one of them but there are more.

A bit more context in the commit message would have been useful. Imagine 
if we have to look at the commit message it in 2 years time.

> 
> For now, skip the first page in memory when the start addess is 0x0.
> 
> Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
> ---
>   xen/arch/arm/bootfdt.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> index 891b4b6..2ae4238 100644
> --- a/xen/arch/arm/bootfdt.c
> +++ b/xen/arch/arm/bootfdt.c
> @@ -157,6 +157,13 @@ static void __init process_memory_node(const void *fdt, int node,
>           device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
>           if ( !size )
>               continue;
> +
> +        /*
> +         * Xen cannot deal with memory starting at 0x0. Burn the first
> +         * page.
> +         */
> +        if ( start == 0 )
> +            start += PAGE_SIZE;

I am afraid this is not enough. This does not cover the case where Xen 
is booting using UEFI (either DT or ACPI). The banks will be created 
from the UEFI memory map (see efi_process_memory_map_bootinfo()).

I also want to avoid mixing populating bootinfo.mem.bank and trying to 
workaround Xen allocator/PDX.

For a first we need to gather feedback from contributors that know a bit 
more of the code that may be affected. AFAICT, there are only two pieces 
where we hand over memory to common code:
     - PDX: The problem is passing 0 to pdx_init_mask() will result to a 
~0 mask defeating the compression later on.
     - Buddy allocator: Jan has been suggesting to stick a check in 
init_xenheap_pages(). This would go the other ugliness existing to deal 
with the buddy allocator.

If we fix in those two places, then I think we cover all the issues in 
common code and make easier to port Xen to a new arch.

Cheers,

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

WARNING: multiple messages have this Message-ID (diff)
From: Julien Grall <Julien.Grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <stefanos@xilinx.com>, nd <nd@arm.com>,
	"206497@studenti.unimore.it" <206497@studenti.unimore.it>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>
Subject: Re: [Xen-devel] [PATCH] xen/arm: skip first page when RAM starts at 0x0
Date: Thu, 25 Apr 2019 21:27:52 +0000	[thread overview]
Message-ID: <981e7b3f-464b-d37c-e03e-22408ae65f85@arm.com> (raw)
Message-ID: <20190425212752.tATTCQCehzLKkzfFKkQcTHitNnjmrP1VEDiU9Ode_c0@z> (raw)
In-Reply-To: <1556214715-22030-1-git-send-email-sstabellini@kernel.org>

Hi Stefano,

On 25/04/2019 18:51, Stefano Stabellini wrote:
> Xen assumes that RAM starts at addresses greater than 0x0 in a few
> places. The PDX code is one of them but there are more.

A bit more context in the commit message would have been useful. Imagine 
if we have to look at the commit message it in 2 years time.

> 
> For now, skip the first page in memory when the start addess is 0x0.
> 
> Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
> ---
>   xen/arch/arm/bootfdt.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> index 891b4b6..2ae4238 100644
> --- a/xen/arch/arm/bootfdt.c
> +++ b/xen/arch/arm/bootfdt.c
> @@ -157,6 +157,13 @@ static void __init process_memory_node(const void *fdt, int node,
>           device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
>           if ( !size )
>               continue;
> +
> +        /*
> +         * Xen cannot deal with memory starting at 0x0. Burn the first
> +         * page.
> +         */
> +        if ( start == 0 )
> +            start += PAGE_SIZE;

I am afraid this is not enough. This does not cover the case where Xen 
is booting using UEFI (either DT or ACPI). The banks will be created 
from the UEFI memory map (see efi_process_memory_map_bootinfo()).

I also want to avoid mixing populating bootinfo.mem.bank and trying to 
workaround Xen allocator/PDX.

For a first we need to gather feedback from contributors that know a bit 
more of the code that may be affected. AFAICT, there are only two pieces 
where we hand over memory to common code:
     - PDX: The problem is passing 0 to pdx_init_mask() will result to a 
~0 mask defeating the compression later on.
     - Buddy allocator: Jan has been suggesting to stick a check in 
init_xenheap_pages(). This would go the other ugliness existing to deal 
with the buddy allocator.

If we fix in those two places, then I think we cover all the issues in 
common code and make easier to port Xen to a new arch.

Cheers,

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

  reply	other threads:[~2019-04-25 21:27 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25 17:51 [PATCH] xen/arm: skip first page when RAM starts at 0x0 Stefano Stabellini
2019-04-25 17:51 ` [Xen-devel] " Stefano Stabellini
2019-04-25 21:27 ` Julien Grall [this message]
2019-04-25 21:27   ` Julien Grall
2019-04-26  9:12   ` Jan Beulich
2019-04-26  9:12     ` [Xen-devel] " Jan Beulich
2019-04-26  9:19     ` Julien Grall
2019-04-26  9:19       ` [Xen-devel] " Julien Grall
2019-04-26  9:42       ` Jan Beulich
2019-04-26  9:42         ` [Xen-devel] " Jan Beulich
2019-04-26 15:38         ` Julien Grall
2019-04-26 15:38           ` [Xen-devel] " Julien Grall
2019-04-26 15:48           ` Jan Beulich
2019-04-26 15:48             ` [Xen-devel] " Jan Beulich
2019-04-26 21:31             ` Julien Grall
2019-04-26 21:31               ` [Xen-devel] " Julien Grall
2019-04-26 23:47               ` Stefano Stabellini
2019-04-26 23:47                 ` [Xen-devel] " Stefano Stabellini
2019-04-27 19:43                 ` Julien Grall
2019-04-27 19:43                   ` [Xen-devel] " Julien Grall
2019-04-29  7:15                 ` Jan Beulich
2019-04-29  7:15                   ` [Xen-devel] " Jan Beulich
2019-04-29 15:54                   ` Julien Grall
2019-04-29 15:54                     ` [Xen-devel] " Julien Grall
2019-04-29 16:07                     ` Jan Beulich
2019-04-29 16:07                       ` [Xen-devel] " Jan Beulich
2019-04-29 17:51                       ` Stefano Stabellini
2019-04-29 17:51                         ` [Xen-devel] " Stefano Stabellini
2019-05-01 22:44                         ` Stefano Stabellini
2019-05-01 22:44                           ` [Xen-devel] " Stefano Stabellini
2019-05-02  7:30                           ` Jan Beulich
2019-05-02  7:30                             ` [Xen-devel] " Jan Beulich
2019-05-02  9:02                             ` Julien Grall
2019-05-02  9:02                               ` [Xen-devel] " Julien Grall
2019-05-02  9:20                               ` Jan Beulich
2019-05-02  9:20                                 ` [Xen-devel] " Jan Beulich
2019-05-02 22:25                                 ` Stefano Stabellini
2019-05-02 22:25                                   ` [Xen-devel] " Stefano Stabellini
2019-05-03  7:26                                   ` Jan Beulich
2019-05-03  7:26                                     ` [Xen-devel] " Jan Beulich
2019-05-03 20:16                                     ` Stefano Stabellini
2019-05-03 20:16                                       ` [Xen-devel] " Stefano Stabellini
2019-04-29  7:07               ` Jan Beulich
2019-04-29  7:07                 ` [Xen-devel] " Jan Beulich

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=981e7b3f-464b-d37c-e03e-22408ae65f85@arm.com \
    --to=julien.grall@arm.com \
    --cc=206497@studenti.unimore.it \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=nd@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=stefanos@xilinx.com \
    --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.