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

Re: [PATCH 11/15] x86/PVH: try to map initrd directly into Dom0


  • To: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 16 Oct 2026 10:52:08 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Marek Marczykowski <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 16 Oct 2026 08:52:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.10.2026 18:32, Roger Pau Monné wrote:
> On Mon, Oct 12, 2026 at 10:25:11AM +0200, Jan Beulich wrote:
>> Our present handling of initrd is problematic in particular when the
>> initrd is huge, and when at the same time "dom0_mem=" isn't in use to
>> significantly shrink Dom0's memory (from the default). In that case,
>> insufficient memory may exist for pvh_populate_p2m() to succeed (because
>> initrd memory can be freed only after copying).
>>
>> Make an attempt to map the blob (including headroom) into Dom0 instead,
> 
> I would use "dom0 p2m" instead of plain p2m, it's clearer IMO.

Can do, sure.

>> thus also saving the copying operation. With __start_xen() having arranged
>> for a larger than necessary blob, that mapping can typically be done with
>> superpage mappings.
>>
>> Reported-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> Is there a need to prune (scrub) the headroom space?
> 
> We already populate the p2m with memory allocated with MEMF_no_scrub,
> so there's no reason to scrub the headroom unless we also remove the
> MEMF_no_scrub for p2m population.

Oh, I hadn't noticed that. Away goes the remark.

>> Why does find_memory() go upwards, while find_kernel_memory() goes
>> downwards? And why do we use the lowest part of the region found by
>> find_memory() rather than the highest part?
> 
> find_memory() should probably start downwards from 4G.

I've added a todo item; maybe I can get this done in another patch in v2.

(Further remarks will be addressed separately.)

>> +    /*
>> +     * As we promise to place below 4G whatever fits there, make a first 
>> pass
>> +     * limiting permitted addresses.  If we can't fit it there, fall back to
>> +     * placing above 4G.
>> +     */
>> +    for ( paddr_t limit = GB(4); ; )
>> +    {
>> +        paddr_t start;
>> +
>> +        *blob_start = find_initrd_memory(d, elf, &try, align, limit);
>> +        if ( *blob_start != INVALID_PADDR )
>> +            break;
>> +
>> +        if ( align == PAGE_SIZE )
>> +        {
>> +            if ( !(limit + 1) )
>> +                return;
>> +
>> +            limit = -1;
>> +            align = 1UL << L3_PAGETABLE_SHIFT;
> 
> Aren't you possibly asking for an alignment better than what's
> required by the actual initrd memory?  Maybe it's using 2M pages yet
> you request 1G alignment here.

Yes and no: I may request too much here, but the very first condition in
find_initrd_memory() deals with that. When trying different variants of
coding this up, doing it this way seemed like the best way.

Jan



 


Rackspace

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