Skip to content

Commit

Permalink
[LibOS] Correct RDTSC instruction drift with system clock more often
Browse files Browse the repository at this point in the history
Signed-off-by: aneessahib <anees.a.sahib@intel.com>
  • Loading branch information
aneessahib authored and mkow committed Sep 6, 2021
1 parent a7e7713 commit 487969c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Pal/src/host/Linux-SGX/db_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
#include "spinlock.h"
#include "toml.h"

#define TSC_REFINE_INIT_TIMEOUT_USECS 10000000
/* The timeout of 50ms was found to be a safe TSC drift correction periodicity based on results
* from multiple systems. Any higher or lower could pose risks of negative time drift or
* performance hit respectively.
*/
#define TSC_REFINE_INIT_TIMEOUT_USECS 50000

uint64_t g_tsc_hz = 0; /* TSC frequency for fast and accurate time ("invariant TSC" HW feature) */
static uint64_t g_start_tsc = 0;
Expand Down

0 comments on commit 487969c

Please sign in to comment.