[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6 5/5] xen: add debugtrace entry when entry count is wrapping



On 09.09.19 10:19, Jan Beulich wrote:
On 09.09.2019 09:35, Juergen Gross wrote:
@@ -173,10 +177,23 @@ void debugtrace_printk(const char *fmt, ...)
      nr = vsnprintf(buf, sizeof(buf), fmt, args);
      va_end(args);
+ if ( count == DEBUGTRACE_COUNT_WRAP )
+    {
+        count = 0;
+        wrap_cnt++;
+    }
+
      if ( debugtrace_send_to_console )
      {
-        unsigned int n = scnprintf(cntbuf, sizeof(cntbuf), "%u ", ++count);
+        unsigned int n;
+
+        if ( count == 0 )
+        {
+            n = scnprintf(cntbuf, sizeof(cntbuf), "wrap: %lu\n", wrap_cnt);
+            console_serial_puts(cntbuf, n);
+        }
+ n = scnprintf(cntbuf, sizeof(cntbuf), "%u ", ++count);
          console_serial_puts(cntbuf, n);
          console_serial_puts(buf, nr);
      }

Just one minor remark: In this case you issue a "wrap" message at
start of day, ...

@@ -184,8 +201,16 @@ void debugtrace_printk(const char *fmt, ...)
      {
          unsigned int cpu = debugtrace_per_cpu ? smp_processor_id() : 0;
- if ( debugtrace_buf_empty || strcmp(buf, last_buf) )
+        if ( debugtrace_buf_empty || wrap_cnt != data->wrap_cnt ||
+             strcmp(buf, last_buf) )
          {
+            if ( wrap_cnt != data->wrap_cnt )
+            {
+                snprintf(cntbuf, sizeof(cntbuf), "wrap: %lu->%lu\n",
+                         data->wrap_cnt, wrap_cnt);
+                debugtrace_add_to_buf(cntbuf);
+                data->wrap_cnt = wrap_cnt;
+            }
              debugtrace_buf_empty = false;
              last_prd = data->prd;
              last_count = ++count;

... whereas here one gets issued (as I'd expect it) only after the
first wrapping of "count".

Yes, I know. The reason I have done it this way was the possibility to
support debugtrace via console even in case of a zero-sized buffer in
future. I can point that out in the commit message.


Juergen

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.