[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <039e126f-f00d-d7e1-aa92-c049c9e3333b@gmail.com>
Date: Wed, 25 Mar 2020 21:57:52 +0800
From: Tianyu Lan <ltykernel@...il.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: Yubo Xie <yuboxie@...rosoft.com>, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Tianyu Lan <Tianyu.Lan@...rosoft.com>, kys@...rosoft.com,
haiyangz@...rosoft.com, sthemmin@...rosoft.com,
liuwe@...rosoft.com, daniel.lezcano@...aro.org, tglx@...utronix.de,
michael.h.kelley@...rosoft.com
Subject: Re: [PATCH] x86/Hyper-V: Fix hv sched clock function return wrong
time unit
Hi Vitaly:
Thanks for your review.
On 3/24/2020 11:49 PM, Vitaly Kuznetsov wrote:
> Yubo Xie <ltykernel@...il.com> writes:
>
>> sched clock callback should return time with nano second as unit
>> but current hv callback returns time with 100ns. Fix it.
>>
>> Cc: stable@...r.kernel.org
>> Signed-off-by: Yubo Xie <yuboxie@...rosoft.com>
>> Signed-off-by: Tianyu Lan <Tianyu.Lan@...rosoft.com>
>> Fixes: adb87ff4f96c ("clocksource/drivers/hyperv: Allocate Hyper-V TSC page statically")
>
> I don't think this is the right commit to reference,
>
> commit bd00cd52d5be655a2f217e2ed74b91a71cb2b14f
> Author: Tianyu Lan <Tianyu.Lan@...rosoft.com>
> Date: Wed Aug 14 20:32:16 2019 +0800
>
> clocksource/drivers/hyperv: Add Hyper-V specific sched clock function
>
> looks like the one.
Sorry. You are right. Will update in the next version.
>
>> ---
>> drivers/clocksource/hyperv_timer.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c
>> index 9d808d595ca8..662ed978fa24 100644
>> --- a/drivers/clocksource/hyperv_timer.c
>> +++ b/drivers/clocksource/hyperv_timer.c
>> @@ -343,7 +343,8 @@ static u64 notrace read_hv_clock_tsc_cs(struct clocksource *arg)
>>
>> static u64 read_hv_sched_clock_tsc(void)
>> {
>> - return read_hv_clock_tsc() - hv_sched_clock_offset;
>> + return (read_hv_clock_tsc() - hv_sched_clock_offset)
>> + * (NSEC_PER_SEC / HV_CLOCK_HZ);
>> }
>>
>> static void suspend_hv_clock_tsc(struct clocksource *arg)
>> @@ -398,7 +399,8 @@ static u64 notrace read_hv_clock_msr_cs(struct clocksource *arg)
>>
>> static u64 read_hv_sched_clock_msr(void)
>> {
>> - return read_hv_clock_msr() - hv_sched_clock_offset;
>> + return (read_hv_clock_msr() - hv_sched_clock_offset)
>> + * (NSEC_PER_SEC / HV_CLOCK_HZ);
>> }
>
> kvmclock seems to have the same (pre-patch) code ...
kvm sched clock gets time from pvclock_clocksource_read() and
the time unit is nanosecond. So there is such issue in KVM code.
>
>>
>> static struct clocksource hyperv_cs_msr = {
>
Powered by blists - more mailing lists