-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 251982 b: refs/heads/master c: 44259b1 h: refs/heads/master v: v3
- Loading branch information
Andy Lutomirski
authored and
Thomas Gleixner
committed
May 24, 2011
1 parent
5187cd6
commit 4f27554
Showing
5 changed files
with
46 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 0f51f2852ccf0fe38a02d340d0ba625e8e32a863 | ||
refs/heads/master: 44259b1abfaa8bb819d25d41d71e8e33e25dd36a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* This code runs in userspace. */ | ||
|
||
#define DISABLE_BRANCH_PROFILING | ||
#include <asm/vgtod.h> | ||
|
||
notrace cycle_t __vsyscall_fn vread_tsc(void) | ||
{ | ||
cycle_t ret; | ||
u64 last; | ||
|
||
/* | ||
* Empirically, a fence (of type that depends on the CPU) | ||
* before rdtsc is enough to ensure that rdtsc is ordered | ||
* with respect to loads. The various CPU manuals are unclear | ||
* as to whether rdtsc can be reordered with later loads, | ||
* but no one has ever seen it happen. | ||
*/ | ||
rdtsc_barrier(); | ||
ret = (cycle_t)vget_cycles(); | ||
|
||
last = VVAR(vsyscall_gtod_data).clock.cycle_last; | ||
|
||
if (likely(ret >= last)) | ||
return ret; | ||
|
||
/* | ||
* GCC likes to generate cmov here, but this branch is extremely | ||
* predictable (it's just a funciton of time and the likely is | ||
* very likely) and there's a data dependence, so force GCC | ||
* to generate a branch instead. I don't barrier() because | ||
* we don't actually need a barrier, and if this function | ||
* ever gets inlined it will generate worse code. | ||
*/ | ||
asm volatile (""); | ||
return last; | ||
} |