diff mbox

[v2,04/11] TSC: write cycles stamp value to input pointer

Message ID 1500651918-14156-5-git-send-email-dplotnikov@virtuozzo.com (mailing list archive)
State New, archived
Headers show

Commit Message

Denis Plotnikov July 21, 2017, 3:45 p.m. UTC
This allows to get cycles stamp used for time calculation when
clocksource is tsc

Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
---
 arch/x86/kernel/tsc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index b475f6c..5411b18 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1112,7 +1112,11 @@  static void tsc_resume(struct clocksource *cs)
  */
 static u64 read_tsc(struct clocksource *cs, u64 *cycles_stamp)
 {
-	return (u64)rdtsc_ordered();
+	u64 tsc = rdtsc_ordered();
+
+	if (cycles_stamp)
+		*cycles_stamp = tsc;
+	return tsc;
 }
 
 static void tsc_cs_mark_unstable(struct clocksource *cs)