[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1464329832-4638-3-git-send-email-mnghuan@gmail.com>
Date: Fri, 27 May 2016 14:17:12 +0800
From: Minfei Huang <mnghuan@...il.com>
To: bp@...e.de, pbonzini@...hat.com, luto@...nel.org, hpa@...or.com,
mingo@...hat.com, tglx@...utronix.de
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Minfei Huang <mnghuan@...il.com>
Subject: [PATCH 3/3] pvclock: Add a new wrapper function to only get variable flags
There is a generic function __pvclock_read_cycles to be used to get both
flags and cycles. For function pvclock_read_flags, it's useless to get
cycles value. To make this function be more effective, add a new wrapper
function to only get variable flags.
Signed-off-by: Minfei Huang <mnghuan@...il.com>
---
arch/x86/include/asm/pvclock.h | 12 ++++++++++++
arch/x86/kernel/pvclock.c | 3 +--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index 7c1c895..3c4e5b7 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -88,6 +88,18 @@ unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
return version;
}
+static __always_inline unsigned int __pvclock_read_flags(
+ const struct pvclock_vcpu_time_info *src, u8 *flags)
+{
+ unsigned int version;
+
+ version = src->version;
+ /* Make the latest version visible */
+ smp_rmb();
+ *flags = src->flags;
+ return version;
+}
+
struct pvclock_vsyscall_time_info {
struct pvclock_vcpu_time_info pvti;
} __attribute__((__aligned__(SMP_CACHE_BYTES)));
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index 7f82fe0..138772c 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -61,11 +61,10 @@ void pvclock_resume(void)
u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src)
{
unsigned version;
- cycle_t ret;
u8 flags;
do {
- version = __pvclock_read_cycles(src, &ret, &flags);
+ version = __pvclock_read_flags(src, &flags);
/* Make sure that the version double-check is last. */
smp_rmb();
} while ((src->version & 1) || version != src->version);
--
2.6.3
Powered by blists - more mailing lists