All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] console: avoid printing no or null time stamps
@ 2018-07-05 13:51 Jan Beulich
  2018-07-05 15:29 ` Wei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jan Beulich @ 2018-07-05 13:51 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, Julien Grall

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@suse.com>
---
v2: Mention ARM cycle_t change in description. Keep sprintf()-s
    separate.
---
ARM side build-tested only.

--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -413,7 +413,7 @@ only available when used together with `
 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 shoul
     * `[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.
--- 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(cons
         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 c
         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:
--- 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 */
--- 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




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] console: avoid printing no or null time stamps
  2018-07-05 13:51 [PATCH v2] console: avoid printing no or null time stamps Jan Beulich
@ 2018-07-05 15:29 ` Wei Liu
  2018-07-05 17:31 ` Andrew Cooper
  2018-07-16  7:33 ` Ping: " Jan Beulich
  2 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2018-07-05 15:29 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, Julien Grall, xen-devel

On Thu, Jul 05, 2018 at 07:51:09AM -0600, Jan Beulich wrote:
> 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@suse.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] console: avoid printing no or null time stamps
  2018-07-05 13:51 [PATCH v2] console: avoid printing no or null time stamps Jan Beulich
  2018-07-05 15:29 ` Wei Liu
@ 2018-07-05 17:31 ` Andrew Cooper
  2018-07-16  7:33 ` Ping: " Jan Beulich
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-07-05 17:31 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Tim Deegan,
	Ian Jackson, Julien Grall

On 05/07/18 14:51, Jan Beulich wrote:
> 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@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Ping: [PATCH v2] console: avoid printing no or null time stamps
  2018-07-05 13:51 [PATCH v2] console: avoid printing no or null time stamps Jan Beulich
  2018-07-05 15:29 ` Wei Liu
  2018-07-05 17:31 ` Andrew Cooper
@ 2018-07-16  7:33 ` Jan Beulich
  2018-07-16 10:05   ` Julien Grall
  2 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2018-07-16  7:33 UTC (permalink / raw)
  To: Julien Grall, Stefano Stabellini
  Cc: Wei Liu, George Dunlap, Andrew Cooper, Tim Deegan, xen-devel,
	Ian Jackson

>>> On 05.07.18 at 15:51, <JBeulich@suse.com> wrote:
> 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@suse.com>

May I ask for an ARM side ack (or otherwise) for this:

> --- 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 */

Thanks, Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ping: [PATCH v2] console: avoid printing no or null time stamps
  2018-07-16  7:33 ` Ping: " Jan Beulich
@ 2018-07-16 10:05   ` Julien Grall
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Grall @ 2018-07-16 10:05 UTC (permalink / raw)
  To: Jan Beulich, Stefano Stabellini
  Cc: Wei Liu, George Dunlap, Andrew Cooper, Tim Deegan, xen-devel,
	Ian Jackson

Hi Jan,

Sorry for the late answer.

On 16/07/18 08:33, Jan Beulich wrote:
>>>> On 05.07.18 at 15:51, <JBeulich@suse.com> wrote:
>> 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@suse.com>
> 
> May I ask for an ARM side ack (or otherwise) for this:

Acked-by: Julien GralL <julien.grall@arm.com>

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-16 10:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-05 13:51 [PATCH v2] console: avoid printing no or null time stamps Jan Beulich
2018-07-05 15:29 ` Wei Liu
2018-07-05 17:31 ` Andrew Cooper
2018-07-16  7:33 ` Ping: " Jan Beulich
2018-07-16 10:05   ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.