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

Re: [Xen-devel] Question about patch "svm: fix incorrect TSC scaling"



>>> On 29.05.18 at 12:31, <dongli.zhang@xxxxxxxxxx> wrote:

> 
> On 05/29/2018 06:23 PM, Dongli Zhang wrote:
>> 
>> 
>> On 05/29/2018 05:56 PM, Jan Beulich wrote:
>>>>>> On 28.05.18 at 14:25, <dongli.zhang@xxxxxxxxxx> wrote:
>>>> I am writing to ask about below patch as I am not familiar with AMD tsc
>>>> scaling:
>>>>
>>>>  commit 11eeca65126e51f03a883907751d5ccbe4f35aa3
>>>>  Author: Haozhong Zhang <haozhong.zhang@xxxxxxxxx>
>>>>  Date:   Tue Dec 8 09:46:12 2015 +0100
>>>>
>>>>      svm: fix incorrect TSC scaling
>>>>  
>>>>      SVM TSC ratio is incorrectly used in the current
>>>>      svm_get_tsc_offset(). This patch replaces the scaling logic in
>>>>      svm_get_tsc_offset() with a correct implementation.
>>>>  
>>>>      Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx>
>>>>      Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
>>>>
>>>>
>>>> The below equation is used in the above patch:
>>>>
>>>> -------------------------
>>>> host_tsc * ratio * 2^-32.
>>>> -------------------------
> 
> Indeed, I have an extra question that why 2^-32 is involved here?
> 
> Is it because we would like to ignore the frag part and only consider the
> leading integer part? Why not just use "host_tsc * ratio"?

Quoting the PM: "The TSC Ratio MSR specifies the TSCRatio value as a
fixed-point binary number in 8.32 format, ..." IOW this is to convert
ratio from its presentation (uint64_t) to its purpose (a fixed point value
with 8 [really 32] bits representing the integer part and 32 bits of
fraction). We very certainly don't want to ignore the fractional part.

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