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

Re: [Xen-devel] [PATCH for-4.12 v2 2/2] xen/arm: Stop relocating Xen


On 17/12/2018 15:55, Andrii Anisov wrote:

On 17.12.18 15:38, Julien Grall wrote:
So technically allocating the RAM using a 2MB alignment should be enough.

For 64-bit and, maybe, raw 32-bit Linux kernel images.
For 32-bit compressed Linux kernel - still 128MB aligned first bank is required.
It can be changed on kernel side by setting ZRELADDR, but we can't designate that from XEN runtime.

I also don't think this would be a good approach as we still want to keep the kernel as much as possible position independent.

I suppose you get me wrong.
I'm saying that 128MB alignment requirement for RAM start might be relaxed by kernel itself, if it has set ZRELADDR. But we, from XEN side, can not rely on that, nor detect that.
So we must follow RAM start alignment for compressed Linux kernel images (32 

I didn't get you wrong. We are saying the same things :).

Yet we need to make sure the first bank is at least 128MB.

Well, I'm not sure the ARM64 documentation [33] or implementation mention the size of the first bank. Except it should be enough to hold the kernel image [44]. Also I would not treat [55] as a strict requirement to have 128MB in the first bank. But we can stick at that to make things easier.

The size of the first bank is implicit on arm32. If you look at the Documentation/arm32/Booting.txt, the DTB/initramfs should be loaded just above 128MB to avoid the decompressor to avoid overwrite them.

It is rather a recommendation. A good way to choose the place for initramfs and dtb. Because decompressor is pretty dumb and limited by 128MB addresses range.
And on XEN side we follow this recommendation whenever it is possible.

So technically, we should allow more than 128MB for the first bank

Although, it is not said that DTB or initramfs should reside in the first RAM bank ;)

The documentation suggest to load the DTB and initramfs just above 128MB. I am not entirely how the kernel would behave if you put it in a separate bank far after.

Similarly, some version on Linux (i.e prior to 4.2) requires the DTB to within 512MB from the kernel.

At the moment, the algorithm to load 64-bit and 32-bit Image are the same. Hence why I said we need at least 128MB in the first bank. I am open for using different algorithm if Dom0 should be smaller.

The algorithm is the same, but it is buggy right now for smaller Dom0 sizes. The lines

     const unsigned int min_low_order =
         get_order_from_bytes(min_t(paddr_t, dom0_mem, MB(128)));

in `allocate_memory_11()` prone to end up with a wrong RAM start alignment.

Patches are welcomed.


Julien Grall

Xen-devel mailing list



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