Skip to content
Snippets Groups Projects
Commit 4078ffa5 authored by Avi Kivity's avatar Avi Kivity
Browse files

kvmclock: drop unneeded memory barriers

kvmclock changes always come from the same cpu, so a real memory barrier
is not needed.

Replace with a compiler barrier.
parent 0e70982b
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
#include "mmu.hh"
#include "string.h"
#include "cpuid.hh"
#include "barrier.hh"
class kvmclock : public clock {
private:
......@@ -56,9 +57,9 @@ u64 kvmclock::wall_clock_boot()
u64 w;
do {
v1 = _wall->version;
__sync_synchronize();
barrier();
w = u64(_wall->sec) * 1000000000 + _wall->nsec;
__sync_synchronize();
barrier();
v2 = _wall->version;
} while (v1 != v2);
return w;
......@@ -70,7 +71,7 @@ u64 kvmclock::system_time()
u64 time;
do {
v1 = _sys->version;
__sync_synchronize();
barrier();
time = processor::rdtsc() - _sys->tsc_timestamp;
if (_sys->tsc_shift >= 0) {
time <<= _sys->tsc_shift;
......@@ -82,7 +83,7 @@ u64 kvmclock::system_time()
: "rm"(u64(_sys->tsc_to_system_mul))
: "rdx");
time += _sys->system_time;
__sync_synchronize();
barrier();
v2 = _sys->version;
} while (v1 != v2);
return time;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment