From: Keir Fraser Date: Fri, 5 Oct 2007 09:38:52 +0000 (+0100) Subject: entrace: Remove assertions to avoid system crashes on debug build xen. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14908 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c4698a7d71652c686f9006a32865a4fc9d20ff2d;p=xen.git entrace: Remove assertions to avoid system crashes on debug build xen. Signed-off-by: Yosuke Iwamatsu --- diff --git a/xen/common/trace.c b/xen/common/trace.c index 9e76f26605..bf1d1fe7fa 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -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);