From: "Sverdlin, Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@nokia.com>
To: "x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Sverdlin,
Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@nokia.com>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Jason Vas Dias <jason.vas.dias@gmail.com>,
Andy Lutomirski <luto@kernel.org>
Subject: [PATCH v3 2/2] x86/vdso: implement clock_gettime(CLOCK_MONOTONIC_RAW, ...)
Date: Wed, 5 Jun 2019 14:41:45 +0000 [thread overview]
Message-ID: <20190605144116.28553-3-alexander.sverdlin@nokia.com> (raw)
In-Reply-To: <20190605144116.28553-1-alexander.sverdlin@nokia.com>
From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Add CLOCK_MONOTONIC_RAW to the existing clock_gettime() vDSO
implementation. This is based on the ideas of Jason Vas Dias and comments
of Thomas Gleixner.
Test program from the previous patch shows the following improvement:
Clock Before After Diff
----- ------ ----- ----
CLOCK_MONOTONIC_RAW 44.9M 359.6M +700%
Link: https://lore.kernel.org/patchwork/patch/933583/
Link: https://bugzilla.kernel.org/show_bug.cgi?id=198961
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Vas Dias <jason.vas.dias@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
arch/x86/entry/vsyscall/vsyscall_gtod.c | 6 ++++++
arch/x86/include/asm/vgtod.h | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/x86/entry/vsyscall/vsyscall_gtod.c b/arch/x86/entry/vsyscall/vsyscall_gtod.c
index 64b1e7c..402c3b3 100644
--- a/arch/x86/entry/vsyscall/vsyscall_gtod.c
+++ b/arch/x86/entry/vsyscall/vsyscall_gtod.c
@@ -69,6 +69,12 @@ void update_vsyscall(struct timekeeper *tk)
base->mult = tk->tkr_mono.mult;
base->shift = tk->tkr_mono.shift;
+ base = &vdata->basetime[CLOCK_MONOTONIC_RAW];
+ base->sec = tk->raw_sec;
+ base->nsec = tk->tkr_raw.xtime_nsec;
+ base->mult = tk->tkr_raw.mult;
+ base->shift = tk->tkr_raw.shift;
+
base = &vdata->basetime[CLOCK_REALTIME_COARSE];
base->sec = tk->xtime_sec;
base->nsec = tk->tkr_mono.xtime_nsec >> tk->tkr_mono.shift;
diff --git a/arch/x86/include/asm/vgtod.h b/arch/x86/include/asm/vgtod.h
index b1f6df3..1fb7048 100644
--- a/arch/x86/include/asm/vgtod.h
+++ b/arch/x86/include/asm/vgtod.h
@@ -30,7 +30,8 @@ struct vgtod_ts {
};
#define VGTOD_BASES (CLOCK_TAI + 1)
-#define VGTOD_HRES (BIT(CLOCK_REALTIME) | BIT(CLOCK_MONOTONIC) | BIT(CLOCK_TAI))
+#define VGTOD_HRES (BIT(CLOCK_REALTIME) | BIT(CLOCK_MONOTONIC) | \
+ BIT(CLOCK_MONOTONIC_RAW) | BIT(CLOCK_TAI))
#define VGTOD_COARSE (BIT(CLOCK_REALTIME_COARSE) | BIT(CLOCK_MONOTONIC_COARSE))
/*
--
2.4.6
prev parent reply other threads:[~2019-06-05 14:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 8:01 [PATCH] x86/vdso: implement clock_gettime(CLOCK_MONOTONIC_RAW, ...) Sverdlin, Alexander (Nokia - DE/Ulm)
2019-05-28 18:01 ` Thomas Gleixner
2019-06-04 16:42 ` [PATCH v2] " Sverdlin, Alexander (Nokia - DE/Ulm)
2019-06-04 17:39 ` Andy Lutomirski
2019-06-05 14:41 ` [PATCH v3 0/2] x86/vdso: CLOCK_MONOTONIC_RAW implementation Sverdlin, Alexander (Nokia - DE/Ulm)
2019-06-05 14:41 ` [PATCH v3 1/2] x86/vdso: Move mult and shift into struct vgtod_ts Sverdlin, Alexander (Nokia - DE/Ulm)
2019-06-23 10:18 ` Thomas Gleixner
2019-06-24 9:16 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-06-24 9:40 ` Thomas Gleixner
2019-06-27 12:00 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-06-27 12:07 ` Thomas Gleixner
2019-06-27 12:15 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-06-27 12:21 ` Thomas Gleixner
2019-06-05 14:41 ` Sverdlin, Alexander (Nokia - DE/Ulm) [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=20190605144116.28553-3-alexander.sverdlin@nokia.com \
--to=alexander.sverdlin@nokia.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jason.vas.dias@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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).