All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: JBeulich@suse.com
Cc: Stefano Stabellini <stefanos@xilinx.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	206497@studenti.unimore.it,
	xen-devel <xen-devel@lists.xenproject.org>,
	nd@arm.com
Subject: Re: [PATCH] xen/arm: skip first page when RAM starts at 0x0
Date: Wed, 1 May 2019 15:44:57 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1905011536510.23881@sstabellini-ThinkPad-X260> (raw)
In-Reply-To: <alpine.DEB.2.10.1904291008070.27577@sstabellini-ThinkPad-X260>

On Mon, 29 Apr 2019, Stefano Stabellini wrote:
> On Mon, 29 Apr 2019, Jan Beulich wrote:
> > >>> On 29.04.19 at 17:54, <julien.grall@arm.com> wrote:
> > > Anyway, I also tested the change suggested by Stefano. This will substantially 
> > > increase the size of the frametable on platform where the RAM does not start 
> > > at 0.
> > > 
> > > For instance, on Foundation Model the RAM starts at 2GB. As we don't compress 
> > > any of the first 31 bits, the frametable will now be 28MB bigger than we 
> > > currently have (112MB up from 84MB).
> > > 
> > > So I think what we want is:
> > > 
> > > nr_pdxs = pfn_to_pdx(end - 1) - pfn_to_pdx(start) + 1;
> > > frame_table_base_pdx = pfn_to_pdx(start);
> > 
> > Yes, if there's only a single memory range at 2Gb, then subtracting
> > the base address will of course yield better results. But if there are
> > multiple regions, things really depend on the placement of all of
> > them.
> 
> If we do not compress any RAM addresses below 4G, then we cannot
> compensate for any holes in that range. However, at least we can safely
> skip the first [0-start] like Julien suggested in the calculation of
> nr_pdxs.


Hi Jan, I have a question on the PDX code.

The PDX initialization is a bit different between x86 and ARM, but it
follows roughly the same pattern, look at
xen/arch/x86/srat.c:srat_parse_regions (I take that is where things
happen on x86) and xen/arch/arm/setup.c:init_pdx.

Mask is initialized calling pdx_init_mask on a start address, then a
loop fills in the rest of the mask calling pdx_region_mask, based on the
memory regions present.

I wrote a small unit test of the ARM PDX initialization and while I was
playing with addresses and values I noticed that actually if I simply
skip pdx_init_mask and just initialize the mask to 0 (mask = 0) in
init_pdx, the rest of the function always calculates the right mask.

In fact, there are cases where initializing the mask to a value causes
the rest of the code to miss some potential compressions. While
initializing the mask to 0 leads to more optimizations. I can provide
specific examples if you are curious.

Before I make any changes to that code, I would like to understand a bit
better why things are done that way today. Do you know why the mask is
initialized to pdx_init_mask(start-of-ram)?

_______________________________________________
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: Stefano Stabellini <sstabellini@kernel.org>
To: JBeulich@suse.com
Cc: Stefano Stabellini <stefanos@xilinx.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	206497@studenti.unimore.it,
	xen-devel <xen-devel@lists.xenproject.org>,
	nd@arm.com
Subject: Re: [Xen-devel] [PATCH] xen/arm: skip first page when RAM starts at 0x0
Date: Wed, 1 May 2019 15:44:57 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1905011536510.23881@sstabellini-ThinkPad-X260> (raw)
Message-ID: <20190501224457.gzqg25nJvTm6Z-2ex1qAoA1nrMZhlEMzr-jYjFjaCl8@z> (raw)
In-Reply-To: <alpine.DEB.2.10.1904291008070.27577@sstabellini-ThinkPad-X260>

On Mon, 29 Apr 2019, Stefano Stabellini wrote:
> On Mon, 29 Apr 2019, Jan Beulich wrote:
> > >>> On 29.04.19 at 17:54, <julien.grall@arm.com> wrote:
> > > Anyway, I also tested the change suggested by Stefano. This will substantially 
> > > increase the size of the frametable on platform where the RAM does not start 
> > > at 0.
> > > 
> > > For instance, on Foundation Model the RAM starts at 2GB. As we don't compress 
> > > any of the first 31 bits, the frametable will now be 28MB bigger than we 
> > > currently have (112MB up from 84MB).
> > > 
> > > So I think what we want is:
> > > 
> > > nr_pdxs = pfn_to_pdx(end - 1) - pfn_to_pdx(start) + 1;
> > > frame_table_base_pdx = pfn_to_pdx(start);
> > 
> > Yes, if there's only a single memory range at 2Gb, then subtracting
> > the base address will of course yield better results. But if there are
> > multiple regions, things really depend on the placement of all of
> > them.
> 
> If we do not compress any RAM addresses below 4G, then we cannot
> compensate for any holes in that range. However, at least we can safely
> skip the first [0-start] like Julien suggested in the calculation of
> nr_pdxs.


Hi Jan, I have a question on the PDX code.

The PDX initialization is a bit different between x86 and ARM, but it
follows roughly the same pattern, look at
xen/arch/x86/srat.c:srat_parse_regions (I take that is where things
happen on x86) and xen/arch/arm/setup.c:init_pdx.

Mask is initialized calling pdx_init_mask on a start address, then a
loop fills in the rest of the mask calling pdx_region_mask, based on the
memory regions present.

I wrote a small unit test of the ARM PDX initialization and while I was
playing with addresses and values I noticed that actually if I simply
skip pdx_init_mask and just initialize the mask to 0 (mask = 0) in
init_pdx, the rest of the function always calculates the right mask.

In fact, there are cases where initializing the mask to a value causes
the rest of the code to miss some potential compressions. While
initializing the mask to 0 leads to more optimizations. I can provide
specific examples if you are curious.

Before I make any changes to that code, I would like to understand a bit
better why things are done that way today. Do you know why the mask is
initialized to pdx_init_mask(start-of-ram)?

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

  reply	other threads:[~2019-05-01 22:45 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
2019-04-25 21:27   ` [Xen-devel] " 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 [this message]
2019-05-01 22:44                           ` 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=alpine.DEB.2.10.1905011536510.23881@sstabellini-ThinkPad-X260 \
    --to=sstabellini@kernel.org \
    --cc=206497@studenti.unimore.it \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=nd@arm.com \
    --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.