mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
time: add "NOW() good" indicator
printk_start_of_line() checks for a value of 0 right now. In order to be able to have NOW() return at least monotonically increasing values, that needs replacing by an explicit indicator. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> Acked-by: Roger Pau Monné <roger@xenproject.org> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
669f8c502a
commit
6e3102caac
6 files changed
+18
-4
No files matched your search
@@ -145,6 +145,8 @@ void __init preinit_xen_time(void)
|
||||
panic("Timer: Cannot initialize platform timer\n");
|
||||
|
||||
boot_count = get_cycles();
|
||||
smp_wmb();
|
||||
NOW_good = true;
|
||||
}
|
||||
|
||||
static void __init init_dt_xen_time(void)
|
||||
|
||||
@@ -87,6 +87,8 @@ void __init preinit_xen_time(void)
|
||||
panic("%s: ACPI isn't supported\n", __func__);
|
||||
|
||||
boot_clock_cycles = get_cycles();
|
||||
smp_wmb();
|
||||
NOW_good = true;
|
||||
|
||||
/* set_xen_timer must have been set by sbi_init() already */
|
||||
ASSERT(set_xen_timer);
|
||||
|
||||
@@ -2660,6 +2660,8 @@ void __init early_time_init(void)
|
||||
|
||||
set_time_scale(&t->tsc_scale, tmp);
|
||||
t->stamp.local_tsc = boot_tsc_stamp;
|
||||
barrier();
|
||||
NOW_good = true;
|
||||
|
||||
init_percpu_time();
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <asm/div64.h>
|
||||
#include <asm/domain.h>
|
||||
|
||||
bool __ro_after_init NOW_good;
|
||||
|
||||
/* Nonzero if YEAR is a leap year (every 4 years,
|
||||
except every 100th isn't, and every 400th is). */
|
||||
#define __isleap(year) \
|
||||
|
||||
@@ -987,11 +987,11 @@ static void printk_start_of_line(const char *prefix)
|
||||
}
|
||||
/* fall through */
|
||||
case TSM_BOOT:
|
||||
sec = NOW();
|
||||
nsec = do_div(sec, 1000000000);
|
||||
|
||||
if ( sec | nsec )
|
||||
if ( NOW_good )
|
||||
{
|
||||
smp_rmb();
|
||||
sec = NOW();
|
||||
nsec = do_div(sec, 1000000000);
|
||||
snprintf(tstr, sizeof(tstr), "[%5"PRIu64".%06"PRIu64"] ",
|
||||
sec, nsec / 1000);
|
||||
break;
|
||||
|
||||
@@ -62,6 +62,12 @@ struct tm wallclock_time(uint64_t *ns);
|
||||
/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
|
||||
#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ULL>>2))
|
||||
|
||||
/*
|
||||
* Indicator that the value returned by NOW() is good (earlier invocations may
|
||||
* return zero or very small, merely monotonically increasing values).
|
||||
*/
|
||||
extern bool NOW_good;
|
||||
|
||||
/* Explicitly OR with 1 just in case version number gets out of sync. */
|
||||
#define version_update_begin(v) (((v) + 1) | 1)
|
||||
#define version_update_end(v) ((v) + 1)
|
||||
|
||||