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

Re: [Xen-devel] [PATCH] x86/cpuid: Untangle Invariant TSC handling



On 06.03.2020 18:48, Andrew Cooper wrote:
> On 05/03/2020 08:20, Jan Beulich wrote:
>> On 04.03.2020 19:40, Andrew Cooper wrote:
>>> On 04/03/2020 10:25, Jan Beulich wrote:
>>>> Actually looking
>>>> at the change to libxl__cpuid_legacy() I wonder whether you don't instead
>>>> mean "requests vTSC" here.
>>> I don't see how you come to that conclusion.  It is two separate cases
>>> where the toolstack can reasonably expect the guest-observed frequency
>>> not to differ.
>> Looking at this hunk
> 
> Ok.  There are ...
> 
>>
>> @@ -432,7 +433,22 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
>>      if (info->type == LIBXL_DOMAIN_TYPE_HVM)
>>          pae = libxl_defbool_val(info->u.hvm.pae);
>>  
>> -    xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae);
>> +    /*
>> +     * Advertising Invariant TSC to a guest means that the TSC frequency 
>> won't
>> +     * change at any point in the future.
>> +     *
>> +     * We do not have enough information about potential migration
>> +     * destinations to know whether advertising ITSC is safe, but if the 
>> guest
>> +     * isn't going to migrate, then the current hardware is all that 
>> matters.
> 
> ... 1, or ...
> 
>> +     *
>> +     * Alternatively, an internal property of vTSC is that the values read 
>> are
>> +     * invariant.  Advertise ITSC when we know the domain will have emualted
>> +     * TSC everywhere it goes.
> 
> ... 2 orthogonal cases described, where xl/libxl in its current form can
> determine that ITSC is safe to advertise.
> 
>> +     */
>> +    itsc = (libxl_defbool_val(info->disable_migrate) ||
>> +            info->tsc_mode == LIBXL_TSC_MODE_ALWAYS_EMULATE);
>> +
>> +    xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae, itsc);
>>
>> I see the check of ->tsc_mode, which aiui is a request to enable
>> vTSC unconditionally.
> 
> vTSC in Xen is not !!tsc_mode.
> 
> In particular, libxl cannot (currently) determine whether
> TSC_MODE_NATIVE will result in suitable invariant properties inside the
> guest, because amongst other things, it depends on where the VM might
> migrate to in the future.

And I didn't say anything like this. What I did say is that
TSC_MODE_ALWAYS_EMULATE is a request to enable vTSC. I didn't
exclude there being other cases where vTSC would get enabled
even if the tool stack didn't explicitly as for it.

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®.