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


Groups > linux.kernel > #1432076 > unrolled thread

[PATCH 2/2] x86: vdso: use __pvclock_read_cycles

Started byPaolo Bonzini <pbonzini@redhat.com>
First post2016-06-27 16:30 +0200
Last post2016-07-06 15:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] x86: vdso: use __pvclock_read_cycles Paolo Bonzini <pbonzini@redhat.com> - 2016-06-27 16:30 +0200
    Re: [PATCH 2/2] x86: vdso: use __pvclock_read_cycles Andy Lutomirski <luto@amacapital.net> - 2016-07-06 15:40 +0200

#1432076 — [PATCH 2/2] x86: vdso: use __pvclock_read_cycles

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-06-27 16:30 +0200
Subject[PATCH 2/2] x86: vdso: use __pvclock_read_cycles
Message-ID<rOFHX-1ok-1@gated-at.bofh.it>
The new simplified __pvclock_read_cycles does the same computation
as vread_pvclock, except that (because it takes the pvclock_vcpu_time_info
pointer) it has to be moved inside the loop.  Since the loop is expected to
never roll, this makes no difference.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/entry/vdso/vclock_gettime.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/arch/x86/entry/vdso/vclock_gettime.c b/arch/x86/entry/vdso/vclock_gettime.c
index db1e3b4c3693..94d54d0defa7 100644
--- a/arch/x86/entry/vdso/vclock_gettime.c
+++ b/arch/x86/entry/vdso/vclock_gettime.c
@@ -96,9 +96,8 @@ static notrace cycle_t vread_pvclock(int *mode)
 {
 	const struct pvclock_vcpu_time_info *pvti = &get_pvti0()->pvti;
 	cycle_t ret;
-	u64 tsc, pvti_tsc;
-	u64 last, delta, pvti_system_time;
-	u32 version, pvti_tsc_to_system_mul, pvti_tsc_shift;
+	u64 last;
+	u32 version;
 
 	/*
 	 * Note: The kernel and hypervisor must guarantee that cpu ID
@@ -130,18 +129,9 @@ static notrace cycle_t vread_pvclock(int *mode)
 			return 0;
 		}
 
-		tsc = rdtsc_ordered();
-		pvti_tsc_to_system_mul = pvti->tsc_to_system_mul;
-		pvti_tsc_shift = pvti->tsc_shift;
-		pvti_system_time = pvti->system_time;
-		pvti_tsc = pvti->tsc_timestamp;
+		ret = __pvclock_read_cycles(pvti);
 	} while (pvclock_read_retry(pvti, version));
 
-	delta = tsc - pvti_tsc;
-	ret = pvti_system_time +
-		pvclock_scale_delta(delta, pvti_tsc_to_system_mul,
-				    pvti_tsc_shift);
-
 	/* refer to vread_tsc() comment for rationale */
 	last = gtod->cycle_last;
 
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1437725

FromAndy Lutomirski <luto@amacapital.net>
Date2016-07-06 15:40 +0200
Message-ID<rRVdv-1mu-1@gated-at.bofh.it>
In reply to#1432076
On Mon, Jun 27, 2016 at 7:19 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> The new simplified __pvclock_read_cycles does the same computation
> as vread_pvclock, except that (because it takes the pvclock_vcpu_time_info
> pointer) it has to be moved inside the loop.  Since the loop is expected to
> never roll, this makes no difference.

Acked-by: Andy Lutomirski <luto@kernel.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web