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

Re: [Xen-devel] [PATCH] x86/shadow: adjust minimum allocation calculations



>>> On 06.02.19 at 13:00, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 06/02/2019 10:56, Jan Beulich wrote:
>> @@ -1373,9 +1377,15 @@ static unsigned int sh_min_allocation(co
>>  {
>>      /*
>>       * Don't allocate less than the minimum acceptable, plus one page per
>> -     * megabyte of RAM (for the p2m table).
>> +     * megabyte of RAM (for the p2m table, minimally enough for HVM's 
>> setting
>> +     * up of slot zero and VMX's setting up of the LAPIC page), plus one for
>> +     * HVM's 1-to-1 pagetable.
> 
> What is in slot 0?  Nothing comes to mind.

I can only refer you to p2m_alloc_table(), which has

    /* Initialise physmap tables for slot zero. Other code assumes this. */
    p2m->defer_nested_flush = 1;
    rc = p2m_set_entry(p2m, _gfn(0), INVALID_MFN, PAGE_ORDER_4K,
                       p2m_invalid, p2m->default_access);
    p2m->defer_nested_flush = 0;

>>       */
>> -    return shadow_min_acceptable_pages(d) + (d->tot_pages / 256);
>> +    return shadow_min_acceptable_pages(d) +
>> +           max(d->tot_pages / 256,
>> +               is_hvm_domain(d) ? CONFIG_PAGING_LEVELS + !!cpu_has_vmx * 2
>> +                                : 0U) +
> 
> I'm not sure cpu_has_vmx is the right check here.  For one, there is a
> series posted adding similar support for AMD, so this is going to be
> stale shortly.
> 
> I'd err on the side of making it unconditional, but if you do want to be
> as tight as possible, then cpu_has_vmx_apic_reg_virt is the correct
> check for now.

Well, if anything then the qualifier vmx_alloc_vlapic_mapping() uses,
which is cpu_has_vmx_virtualize_apic_accesses (unless you tell me
that needs changing too). But if SVM is going to have a similar
requirement going forward, then making it unconditional is fine with
me.

Jan



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

 


Rackspace

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