diff options
author | jhb <jhb@FreeBSD.org> | 2008-01-17 18:59:38 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-01-17 18:59:38 +0000 |
commit | a114208c341bc5a712d49fcc016cf27f4651f212 (patch) | |
tree | 3c99a002d20f9c0c3ae39a1f03e4eb826f36bb6e | |
parent | 7f5a9c7a3602de0c7b5c5157690e605889c07dac (diff) | |
download | FreeBSD-src-a114208c341bc5a712d49fcc016cf27f4651f212.zip FreeBSD-src-a114208c341bc5a712d49fcc016cf27f4651f212.tar.gz |
Use cpu_spinwait() (i.e., "pause") when spinning on rdtsc during DELAY().
MFC after: 1 week
-rw-r--r-- | sys/amd64/isa/clock.c | 1 | ||||
-rw-r--r-- | sys/i386/isa/clock.c | 1 | ||||
-rw-r--r-- | sys/isa/atrtc.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 2809828..3275267 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -286,6 +286,7 @@ DELAY(int n) start = rdtsc(); end = start + (tsc_freq * n) / 1000000; do { + cpu_spinwait(); now = rdtsc(); } while (now < end || (now > start && end < start)); sched_unpin(); diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index a67db31..f31c7ea 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -291,6 +291,7 @@ DELAY(int n) start = rdtsc(); end = start + (tsc_freq * n) / 1000000; do { + cpu_spinwait(); now = rdtsc(); } while (now < end || (now > start && end < start)); sched_unpin(); diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index a67db31..f31c7ea 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -291,6 +291,7 @@ DELAY(int n) start = rdtsc(); end = start + (tsc_freq * n) / 1000000; do { + cpu_spinwait(); now = rdtsc(); } while (now < end || (now > start && end < start)); sched_unpin(); |