From: "tip-bot2 for Yubo Xie" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Yubo Xie <yuboxie@microsoft.com>,
Tianyu Lan <Tianyu.Lan@microsoft.com>,
Thomas Gleixner <tglx@linutronix.de>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
stable@vger.kernel.org, x86 <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [tip: timers/urgent] clocksource/drivers/hyper-v: Make sched clock return nanoseconds correctly
Date: Fri, 27 Mar 2020 11:30:58 -0000 [thread overview]
Message-ID: <158530865882.28353.581776728371427215.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200327021159.31429-1-Tianyu.Lan@microsoft.com>
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 749da8ca978f19710aba496208c480ad42d37f79
Gitweb: https://git.kernel.org/tip/749da8ca978f19710aba496208c480ad42d37f79
Author: Yubo Xie <yuboxie@microsoft.com>
AuthorDate: Thu, 26 Mar 2020 19:11:59 -07:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 27 Mar 2020 12:27:45 +01:00
clocksource/drivers/hyper-v: Make sched clock return nanoseconds correctly
The sched clock read functions return the HV clock (100ns granularity)
without converting it to nanoseconds.
Add the missing conversion.
Fixes: bd00cd52d5be ("clocksource/drivers/hyperv: Add Hyper-V specific sched clock function")
Signed-off-by: Yubo Xie <yuboxie@microsoft.com>
Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20200327021159.31429-1-Tianyu.Lan@microsoft.com
---
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 9d808d5..eb0ba78 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 = {
prev parent reply other threads:[~2020-03-27 11:31 UTC|newest]
Thread overview: 5+ 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
2020-03-30 10:22 ` Wei Liu
2020-03-27 11:30 ` tip-bot2 for Yubo Xie [this message]
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=158530865882.28353.581776728371427215.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=Tianyu.Lan@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
--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).