[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/arm: skip first page when RAM starts at 0x0

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@xxxxxxx> 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



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.