diff options
Diffstat (limited to 'core/timebase.c')
-rw-r--r-- | core/timebase.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/timebase.c b/core/timebase.c index b1d8196..4fcfae5 100644 --- a/core/timebase.c +++ b/core/timebase.c @@ -25,6 +25,11 @@ static void time_wait_poll(unsigned long duration) unsigned long end = mftb() + duration; unsigned long period = msecs_to_tb(5); + if (this_cpu()->tb_invalid) { + cpu_relax(); + return; + } + while (tb_compare(mftb(), end) != TB_AAFTERB) { /* Call pollers periodically but not continually to avoid * bouncing cachelines due to lock contention. */ @@ -57,6 +62,11 @@ void time_wait_nopoll(unsigned long duration) { unsigned long end = mftb() + duration; + if (this_cpu()->tb_invalid) { + cpu_relax(); + return; + } + while(tb_compare(mftb(), end) != TB_AAFTERB) cpu_relax(); } |