Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1408462

[PATCH 3/3 V2] pvclock: Get rid of __pvclock_read_cycles in function pvclock_read_flags

From Minfei Huang <mnghuan@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 3/3 V2] pvclock: Get rid of __pvclock_read_cycles in function pvclock_read_flags
Date 2016-05-28 14:30 +0200
Message-ID <rDLxn-rd-1@gated-at.bofh.it> (permalink)
References <rDjhL-8fO-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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, get this variable
flags directly in function.

Signed-off-by: Minfei Huang <mnghuan@gmail.com>
---
v1:
- Get rid of __pvclock_read_cycles according to Andy's suggestion
---
 arch/x86/kernel/pvclock.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index 7f82fe0..06c58ce 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -61,11 +61,14 @@ 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 = src->version;
+		/* Make the latest version visible */
+		smp_rmb();
+
+		flags = src->flags;
 		/* Make sure that the version double-check is last. */
 		smp_rmb();
 	} while ((src->version & 1) || version != src->version);
-- 
2.6.3

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] pvclock: Add a new wrapper function to only get variable flags Minfei Huang <mnghuan@gmail.com> - 2016-05-27 08:20 +0200
  Re: [PATCH 3/3] pvclock: Add a new wrapper function to only get  variable flags Andy Lutomirski <luto@amacapital.net> - 2016-05-27 17:50 +0200
    Re: [PATCH 3/3] pvclock: Add a new wrapper function to only get  variable flags Paolo Bonzini <pbonzini@redhat.com> - 2016-05-27 18:10 +0200
      Re: [PATCH 3/3] pvclock: Add a new wrapper function to only get  variable flags Minfei Huang <mnghuan@gmail.com> - 2016-05-28 14:10 +0200
  [PATCH 3/3 V2] pvclock: Get rid of __pvclock_read_cycles in function pvclock_read_flags Minfei Huang <mnghuan@gmail.com> - 2016-05-28 14:30 +0200

csiph-web