[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] console: avoid printing no or null time stamps
commit da3d55ae67225798c2ad8f42af2f432f6f2b2214 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Jul 16 15:12:19 2018 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Jul 16 15:12:19 2018 +0200 console: avoid printing no or null time stamps During early boot timestamps aren't very useful, as they're all zero (in "boot" mode) or absent altogether (in "date" and "datems" modes). Log "boot" format timestamps when the date formats aren't available yet, and log raw timestamps when boot ones are still all zero. Also add a "raw" mode. For the ARM side get_cycles() to produce a meaningful value, ARM's cycle_t gets changed to uint64_t. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Julien Grall <julien.grall@xxxxxxx> --- docs/misc/xen-command-line.markdown | 4 +++- xen/drivers/char/console.c | 30 ++++++++++++++++++++++-------- xen/include/asm-arm/time.h | 4 ++-- xen/include/asm-x86/time.h | 2 +- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index 875c331d9a..d33bd5a683 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -413,7 +413,7 @@ only available when used together with `pv-in-pvh`. makes sense on its own. ### console\_timestamps -> `= none | date | datems | boot` +> `= none | date | datems | boot | raw` > Default: `none` @@ -428,6 +428,8 @@ Specify which timestamp format Xen should use for each console line. * `[YYYY-MM-DD HH:MM:SS.mmm]` * `boot`: Seconds and microseconds since boot * `[SSSSSS.uuuuuu]` ++ `raw`: Raw platform ticks, architecture and implementation dependent + * `[XXXXXXXXXXXXXXXX]` For compatibility with the older boolean parameter, specifying `console_timestamps` alone will enable the `date` option. diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 0f0536930b..a911958108 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -68,7 +68,8 @@ enum con_timestamp_mode TSM_NONE, /* No timestamps */ TSM_DATE, /* [YYYY-MM-DD HH:MM:SS] */ TSM_DATE_MS, /* [YYYY-MM-DD HH:MM:SS.mmm] */ - TSM_BOOT /* [SSSSSS.uuuuuu] */ + TSM_BOOT, /* [SSSSSS.uuuuuu] */ + TSM_RAW, /* [XXXXXXXXXXXXXXXX] */ }; static enum con_timestamp_mode __read_mostly opt_con_timestamp_mode = TSM_NONE; @@ -676,6 +677,8 @@ static int parse_console_timestamps(const char *s) opt_con_timestamp_mode = TSM_DATE_MS; else if ( !strcmp(s, "boot") ) opt_con_timestamp_mode = TSM_BOOT; + else if ( !strcmp(s, "raw") ) + opt_con_timestamp_mode = TSM_RAW; else if ( !strcmp(s, "none") ) opt_con_timestamp_mode = TSM_NONE; else @@ -699,25 +702,36 @@ static void printk_start_of_line(const char *prefix) tm = wallclock_time(&nsec); if ( tm.tm_mday == 0 ) - return; - - if ( opt_con_timestamp_mode == TSM_DATE ) + /* nothing */; + else if ( opt_con_timestamp_mode == TSM_DATE ) + { snprintf(tstr, sizeof(tstr), "[%04u-%02u-%02u %02u:%02u:%02u] ", 1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + break; + } else + { snprintf(tstr, sizeof(tstr), "[%04u-%02u-%02u %02u:%02u:%02u.%03"PRIu64"] ", 1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, nsec / 1000000); - break; - + break; + } + /* fall through */ case TSM_BOOT: sec = NOW(); nsec = do_div(sec, 1000000000); - snprintf(tstr, sizeof(tstr), "[%5"PRIu64".%06"PRIu64"] ", - sec, nsec / 1000); + if ( sec | nsec ) + { + snprintf(tstr, sizeof(tstr), "[%5"PRIu64".%06"PRIu64"] ", + sec, nsec / 1000); + break; + } + /* fall through */ + case TSM_RAW: + snprintf(tstr, sizeof(tstr), "[%016"PRIx64"] ", get_cycles()); break; case TSM_NONE: diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h index 5b9a31de91..19a4515e72 100644 --- a/xen/include/asm-arm/time.h +++ b/xen/include/asm-arm/time.h @@ -5,11 +5,11 @@ DT_MATCH_COMPATIBLE("arm,armv7-timer"), \ DT_MATCH_COMPATIBLE("arm,armv8-timer") -typedef unsigned long cycles_t; +typedef uint64_t cycles_t; static inline cycles_t get_cycles (void) { - return 0; + return READ_SYSREG64(CNTPCT_EL0); } /* List of timer's IRQ */ diff --git a/xen/include/asm-x86/time.h b/xen/include/asm-x86/time.h index b3ae832df4..ce96ec9778 100644 --- a/xen/include/asm-x86/time.h +++ b/xen/include/asm-x86/time.h @@ -28,7 +28,7 @@ extern bool disable_tsc_sync; static inline cycles_t get_cycles(void) { - return rdtsc(); + return rdtsc_ordered(); } unsigned long -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |