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

[Xen-changelog] [xen-unstable] entrace: Remove assertions to avoid system crashes on debug build xen.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1191577132 -3600
# Node ID 1d120f6807bacf4b77faafae8efa42f0eb535e2c
# Parent  b629d7a2bcc71370b104a89e585e7f850c9cd224
entrace: Remove assertions to avoid system crashes on debug build xen.
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>
---
 xen/common/trace.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)

diff -r b629d7a2bcc7 -r 1d120f6807ba xen/common/trace.c
--- a/xen/common/trace.c        Fri Oct 05 10:31:25 2007 +0100
+++ b/xen/common/trace.c        Fri Oct 05 10:38:52 2007 +0100
@@ -360,21 +360,15 @@ void __trace_var(u32 event, int cycles, 
     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, 
 
     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,12 +429,10 @@ void __trace_var(u32 event, int cycles, 
         {
             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 )
     {
@@ -484,8 +476,6 @@ void __trace_var(u32 event, int cycles, 
         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);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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