]> xenbits.xensource.com Git - xen.git/commitdiff
entrace: Remove assertions to avoid system crashes on debug build xen.
authorKeir Fraser <keir@xensource.com>
Fri, 5 Oct 2007 09:38:52 +0000 (10:38 +0100)
committerKeir Fraser <keir@xensource.com>
Fri, 5 Oct 2007 09:38:52 +0000 (10:38 +0100)
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
xen/common/trace.c

index 9e76f26605bad886b7db0647f622d6058c5b2941..bf1d1fe7faa06bd2f325117f1d0a8e4f3b53fff6 100644 (file)
@@ -360,21 +360,15 @@ void __trace_var(u32 event, int cycles, int extra, unsigned char *extra_data)
     int extra_word;
     int started_below_highwater;
 
-    if(!tb_init_done)
-        return;
+    ASSERT(tb_init_done);
 
     /* Convert byte count into word count, rounding up */
     extra_word = (extra / sizeof(u32));
-    if((extra % sizeof(u32)) != 0)
+    if ( (extra % sizeof(u32)) != 0 )
         extra_word++;
     
-#if !NDEBUG
-    ASSERT(extra_word<=TRACE_EXTRA_MAX);
-#else
-    /* Not worth crashing a production system over */
-    if(extra_word > TRACE_EXTRA_MAX)
-        extra_word = TRACE_EXTRA_MAX;
-#endif
+    ASSERT(extra_word <= TRACE_EXTRA_MAX);
+    extra_word = min_t(int, extra_word, TRACE_EXTRA_MAX);
 
     /* Round size up to nearest word */
     extra = extra_word * sizeof(u32);
@@ -401,7 +395,7 @@ void __trace_var(u32 event, int cycles, int extra, unsigned char *extra_data)
 
     local_irq_save(flags);
 
-    started_below_highwater = ( (buf->prod - buf->cons) < t_buf_highwater );
+    started_below_highwater = ((buf->prod - buf->cons) < t_buf_highwater);
 
     /* Calculate the record size */
     rec_size = calc_rec_size(cycles, extra);
@@ -435,13 +429,11 @@ void __trace_var(u32 event, int cycles, int extra, unsigned char *extra_data)
         {
             bytes_to_wrap -= LOST_REC_SIZE;
             if ( bytes_to_wrap == 0 )
-                bytes_to_wrap == data_size;
+                bytes_to_wrap = data_size;
         }
         total_size += LOST_REC_SIZE;
     }
 
-    ASSERT(bytes_to_wrap == calc_bytes_to_wrap(buf));
-
     if ( rec_size > bytes_to_wrap )
     {
         total_size += bytes_to_wrap;
@@ -484,8 +476,6 @@ void __trace_var(u32 event, int cycles, int extra, unsigned char *extra_data)
         insert_lost_records(buf);
     }
 
-    ASSERT(bytes_to_wrap == calc_bytes_to_wrap(buf));
-
     if ( rec_size > bytes_to_wrap )
         insert_wrap_record(buf, rec_size);