From: Denis Plotnikov <dplotnikov@virtuozzo.com>
To: kvm@vger.kernel.org, rkrcmar@redhat.com
Cc: pbonzini@redhat.com, den@virtuozzo.com, rkagan@virtuozzo.com
Subject: [PATCH v2 06/11] timekeeping: add functions returning cycle stamp counter along with time
Date: Fri, 21 Jul 2017 18:45:13 +0300 [thread overview]
Message-ID: <1500651918-14156-7-git-send-email-dplotnikov@virtuozzo.com> (raw)
In-Reply-To: <1500651918-14156-1-git-send-email-dplotnikov@virtuozzo.com>
Make interface functions providing support of cycle stamp pointer
Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
---
include/linux/timekeeping.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index fc6683b..edffe82 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -178,23 +178,37 @@ extern u32 ktime_get_resolution_ns(void);
/**
* ktime_get_real - get the real (wall-) time in ktime_t format
+ * ktime_get_real_with_cycles - does the same and stores the cycles value
+ * (if any) used for the ktime_ calculation in the pointer given
*/
static inline ktime_t ktime_get_real(void)
{
return ktime_get_with_offset(TK_OFFS_REAL, NULL);
}
+static inline ktime_t ktime_get_real_with_cycles(u64 *cycles_stamp)
+{
+ return ktime_get_with_offset(TK_OFFS_REAL, cycles_stamp);
+}
+
/**
* ktime_get_boottime - Returns monotonic time since boot in ktime_t format
*
* This is similar to CLOCK_MONTONIC/ktime_get, but also includes the
* time spent in suspend.
+ *
+ * ktime_get_boottime_with_cycles - the version of the function storing the
+ * cycles value used for the ktime_ calculationif (any in) the pointer
*/
static inline ktime_t ktime_get_boottime(void)
{
return ktime_get_with_offset(TK_OFFS_BOOT, NULL);
}
+static inline ktime_t ktime_get_boottime_with_cycles(u64 *cycles_stamp)
+{
+ return ktime_get_with_offset(TK_OFFS_BOOT, cycles_stamp);
+}
/**
* ktime_get_clocktai - Returns the TAI time of day in ktime_t format
*/
@@ -221,11 +235,21 @@ static inline u64 ktime_get_real_ns(void)
return ktime_to_ns(ktime_get_real());
}
+static inline u64 ktime_get_real_ns_with_cycles(u64 *cycles_stamp)
+{
+ return ktime_to_ns(ktime_get_real_with_cycles(cycles_stamp));
+}
+
static inline u64 ktime_get_boot_ns(void)
{
return ktime_to_ns(ktime_get_boottime());
}
+static inline u64 ktime_get_boot_ns_with_cycles(u64 *cycles_stamp)
+{
+ return ktime_to_ns(ktime_get_boottime_with_cycles(cycles_stamp));
+}
+
static inline u64 ktime_get_tai_ns(void)
{
return ktime_to_ns(ktime_get_clocktai());
--
2.7.4
next prev parent reply other threads:[~2017-07-21 15:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 15:45 [PATCH v2 00/11] make L2's kvm-clock stable, get rid of pvclock_gtod Denis Plotnikov
2017-07-21 15:45 ` [PATCH v2 01/11] timekeeper: change interface of clocksource reding functions Denis Plotnikov
2017-07-23 4:24 ` kbuild test robot
2017-07-21 15:45 ` [PATCH v2 02/11] pvclock: write cycle stamp value if a pointer given Denis Plotnikov
2017-07-21 15:45 ` [PATCH v2 03/11] kvmclock: pass cycles pointer to the changed pvclock interface Denis Plotnikov
2017-07-21 15:45 ` [PATCH v2 04/11] TSC: write cycles stamp value to input pointer Denis Plotnikov
2017-07-21 15:45 ` [PATCH v2 05/11] timekeeping: change ktime_get_with_offset interface to accept cycles pointer Denis Plotnikov
2017-07-21 15:45 ` Denis Plotnikov [this message]
2017-07-21 15:45 ` [PATCH v2 07/11] timekeeper: add clocksource change notifier Denis Plotnikov
2017-07-21 15:45 ` [PATCH v2 08/11] timekeeper: add a couple of the core timekeeper reading helpers Denis Plotnikov
2017-07-23 4:02 ` kbuild test robot
2017-07-23 4:02 ` kbuild test robot
2017-07-21 15:45 ` [PATCH v2 09/11] KVM: get rid of pv_clock_gtod Denis Plotnikov
2017-07-25 10:37 ` Paolo Bonzini
2017-07-21 15:45 ` [PATCH v2 10/11] pvclock: add clocksource change notification on changing of tsc stable bit Denis Plotnikov
2017-07-21 15:45 ` [PATCH v2 11/11] KVM: add pvclock to a list of stable clocks Denis Plotnikov
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=1500651918-14156-7-git-send-email-dplotnikov@virtuozzo.com \
--to=dplotnikov@virtuozzo.com \
--cc=den@virtuozzo.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkagan@virtuozzo.com \
--cc=rkrcmar@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.