stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Tianyu Lan <ltykernel@gmail.com>,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Yubo Xie <yuboxie@microsoft.com>,
	kys@microsoft.com, haiyangz@microsoft.com,
	sthemmin@microsoft.com, liuwe@microsoft.com,
	daniel.lezcano@linaro.org, tglx@linutronix.de,
	michael.h.kelley@microsoft.com, Wei Liu <wei.liu@kernel.org>
Subject: Re: [PATCH V2] x86/Hyper-V: Fix hv sched clock function return wrong time unit
Date: Mon, 30 Mar 2020 11:05:02 +0100	[thread overview]
Message-ID: <20200330100502.hh2yygyxctsmwd6o@debian> (raw)
In-Reply-To: <87k13641rg.fsf@vitty.brq.redhat.com>

On Fri, Mar 27, 2020 at 09:53:39AM +0100, Vitaly Kuznetsov wrote:
> Tianyu Lan <ltykernel@gmail.com> writes:
> 
> > From: Yubo Xie <yuboxie@microsoft.com>
> >
> > sched clock callback should return time with nano second as unit
> > but current hv callback returns time with 100ns. Fix it.
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Yubo Xie <yuboxie@microsoft.com>
> > Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
> > Fixes: bd00cd52d5be ("clocksource/drivers/hyperv: Add Hyper-V specific sched clock function")
> > ---
> > Change since v1:
> > 	Update fix commit number in change log. 
> > ---
> >  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);
> >  }
> >  
> >  static struct clocksource hyperv_cs_msr = {
> 
> Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

Queued for hyperv-fixes. Thank you both.

Wei.

  reply	other threads:[~2020-03-30 10:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27  2:11 [PATCH V2] x86/Hyper-V: Fix hv sched clock function return wrong time unit Tianyu Lan
2020-03-27  8:53 ` Vitaly Kuznetsov
2020-03-30 10:05   ` Wei Liu [this message]
2020-03-30 10:22     ` Wei Liu
2020-03-27 11:30 ` [tip: timers/urgent] clocksource/drivers/hyper-v: Make sched clock return nanoseconds correctly tip-bot2 for Yubo Xie
2020-03-27 15:03 ` [PATCH V2] x86/Hyper-V: Fix hv sched clock function return wrong time unit Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200330100502.hh2yygyxctsmwd6o@debian \
    --to=wei.liu@kernel.org \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuwe@microsoft.com \
    --cc=ltykernel@gmail.com \
    --cc=michael.h.kelley@microsoft.com \
    --cc=stable@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=yuboxie@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).