From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH 0/6] trace: miscellaneous fixes Date: Tue, 29 Jun 2010 16:37:12 +0100 Message-ID: <4C2A2F480200007800008A8C@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part25084E38.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: George Dunlap Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part25084E38.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline After getting a report of 3.2.3's xenmon crashing Xen (as it turned out this was because c/s 17000 was backported to that tree without also applying c/s 17515), I figured that the hypervisor shouldn't rely on any specific state of the actual trace buffer (as it is shared writable with Dom0) I chose to use 'volatile' qualifiers rather than sprinkling around barriers - this can certainly be changed if considered unacceptable. To make clear what purpose specific variables have and/or where they got loaded from, the patch also changes the type of some of them to be explicitly u32/s32, and removes pointless assertions (like checking an unsigned variable to be >=3D 0). I also took the prototype adjustment of __trace_var() as an opportunity to simplify the TRACE_xD() macros. Similar simplification could be done on the (quite numerous) direct callers of the function. Signed-off-by: Jan Beulich --- 2010-06-15.orig/xen/common/trace.c 2010-06-29 17:04:45.000000000 = +0200 +++ 2010-06-15/xen/common/trace.c 2010-06-29 17:05:09.000000000 = +0200 @@ -52,14 +52,14 @@ static struct t_info *t_info; #define T_INFO_SIZE ((T_INFO_PAGES)*(PAGE_SIZE)) /* t_info.tbuf_size + list of mfn offsets + 1 to round up / sizeof = uint32_t */ #define T_INFO_FIRST_OFFSET (((2 + NR_CPUS) * sizeof(uint16_t)) / = sizeof(uint32_t)) -static DEFINE_PER_CPU_READ_MOSTLY(struct t_buf *, t_bufs); +static DEFINE_PER_CPU_READ_MOSTLY(volatile struct t_buf *, t_bufs); static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, t_data); static DEFINE_PER_CPU_READ_MOSTLY(spinlock_t, t_lock); -static int data_size; +static u32 data_size; =20 /* High water mark for trace buffers; */ /* Send virtual interrupt when buffer level reaches this point */ -static int t_buf_highwater; +static u32 t_buf_highwater; =20 /* Number of records lost due to per-CPU trace buffer being full. */ static DEFINE_PER_CPU(unsigned long, lost_records); @@ -145,7 +145,7 @@ static int alloc_trace_bufs(void) =20 spin_lock_irqsave(&per_cpu(t_lock, cpu), flags); =20 - buf =3D per_cpu(t_bufs, cpu) =3D (struct t_buf *)rawbuf; + per_cpu(t_bufs, cpu) =3D buf =3D (struct t_buf *)rawbuf; buf->cons =3D buf->prod =3D 0; per_cpu(t_data, cpu) =3D (unsigned char *)(buf + 1); =20 @@ -196,6 +196,7 @@ out_dealloc: spin_lock_irqsave(&per_cpu(t_lock, cpu), flags); if ( (rawbuf =3D (char *)per_cpu(t_bufs, cpu)) ) { + per_cpu(t_bufs, cpu) =3D NULL; ASSERT(!(virt_to_page(rawbuf)->count_info & PGC_allocated)); free_xenheap_pages(rawbuf, order); } @@ -410,19 +411,37 @@ int tb_control(xen_sysctl_tbuf_op_t *tbc return rc; } =20 -static inline int calc_rec_size(int cycles, int extra)=20 +static inline unsigned int calc_rec_size(bool_t cycles, unsigned int = extra) { - int rec_size; - rec_size =3D 4; + unsigned int rec_size =3D 4; + if ( cycles ) rec_size +=3D 8; rec_size +=3D extra; return rec_size; } =20 -static inline int calc_unconsumed_bytes(struct t_buf *buf) +static inline bool_t bogus(u32 prod, u32 cons) +{ + if ( unlikely(prod & 3) || unlikely(prod >=3D 2 * data_size) || + unlikely(cons & 3) || unlikely(cons >=3D 2 * data_size) ) + { + tb_init_done =3D 0; + printk(XENLOG_WARNING "trc#%u: bogus prod (%08x) and/or cons = (%08x)\n", + smp_processor_id(), prod, cons); + return 1; + } + return 0; +} + +static inline u32 calc_unconsumed_bytes(const volatile struct t_buf *buf) { - int x =3D buf->prod - buf->cons; + u32 prod =3D buf->prod, cons =3D buf->cons; + s32 x =3D prod - cons; + + if ( bogus(prod, cons) ) + return data_size; + if ( x < 0 ) x +=3D 2*data_size; =20 @@ -432,9 +451,14 @@ static inline int calc_unconsumed_bytes( return x; } =20 -static inline int calc_bytes_to_wrap(struct t_buf *buf) +static inline u32 calc_bytes_to_wrap(const volatile struct t_buf *buf) { - int x =3D data_size - buf->prod; + u32 prod =3D buf->prod; + s32 x =3D data_size - prod; + + if ( bogus(prod, buf->cons) ) + return 0; + if ( x <=3D 0 ) x +=3D data_size; =20 @@ -444,35 +468,37 @@ static inline int calc_bytes_to_wrap(str return x; } =20 -static inline int calc_bytes_avail(struct t_buf *buf) +static inline u32 calc_bytes_avail(const volatile struct t_buf *buf) { return data_size - calc_unconsumed_bytes(buf); } =20 -static inline struct t_rec * -next_record(struct t_buf *buf) +static inline struct t_rec *next_record(const volatile struct t_buf *buf) { - int x =3D buf->prod; + u32 x =3D buf->prod; + + if ( !tb_init_done || bogus(x, buf->cons) ) + return NULL; + if ( x >=3D data_size ) x -=3D data_size; =20 - ASSERT(x >=3D 0); ASSERT(x < data_size); =20 return (struct t_rec *)&this_cpu(t_data)[x]; } =20 -static inline int __insert_record(struct t_buf *buf, - unsigned long event, - int extra, - int cycles, - int rec_size, - unsigned char *extra_data) +static inline void __insert_record(volatile struct t_buf *buf, + unsigned long event, + unsigned int extra, + bool_t cycles, + unsigned int rec_size, + const void *extra_data) { struct t_rec *rec; unsigned char *dst; - unsigned long extra_word =3D extra/sizeof(u32); - int local_rec_size =3D calc_rec_size(cycles, extra); + unsigned int extra_word =3D extra / sizeof(u32); + unsigned int local_rec_size =3D calc_rec_size(cycles, extra); uint32_t next; =20 BUG_ON(local_rec_size !=3D rec_size); @@ -488,11 +514,13 @@ static inline int __insert_record(struct printk(XENLOG_WARNING "%s: avail=3D%u (size=3D%08x prod=3D%08x cons=3D%08x) = rec=3D%u\n", __func__, next, data_size, buf->prod, buf->cons, = rec_size); - return 0; + return; } rmb(); =20 rec =3D next_record(buf); + if ( !rec ) + return; rec->event =3D event; rec->extra_u32 =3D extra_word; dst =3D (unsigned char *)rec->u.nocycles.extra_u32; @@ -509,21 +537,22 @@ static inline int __insert_record(struct =20 wmb(); =20 - next =3D buf->prod + rec_size; + next =3D buf->prod; + if ( bogus(next, buf->cons) ) + return; + next +=3D rec_size; if ( next >=3D 2*data_size ) next -=3D 2*data_size; - ASSERT(next >=3D 0); ASSERT(next < 2*data_size); buf->prod =3D next; - - return rec_size; } =20 -static inline int insert_wrap_record(struct t_buf *buf, int size) +static inline void insert_wrap_record(volatile struct t_buf *buf, + unsigned int size) { - int space_left =3D calc_bytes_to_wrap(buf); - unsigned long extra_space =3D space_left - sizeof(u32); - int cycles =3D 0; + u32 space_left =3D calc_bytes_to_wrap(buf); + unsigned int extra_space =3D space_left - sizeof(u32); + bool_t cycles =3D 0; =20 BUG_ON(space_left > size); =20 @@ -535,17 +564,13 @@ static inline int insert_wrap_record(str ASSERT((extra_space/sizeof(u32)) <=3D TRACE_EXTRA_MAX); } =20 - return __insert_record(buf, - TRC_TRACE_WRAP_BUFFER, - extra_space, - cycles, - space_left, - NULL); + __insert_record(buf, TRC_TRACE_WRAP_BUFFER, extra_space, cycles, + space_left, NULL); } =20 #define LOST_REC_SIZE (4 + 8 + 16) /* header + tsc + sizeof(struct ed) */ =20 -static inline int insert_lost_records(struct t_buf *buf) +static inline void insert_lost_records(volatile struct t_buf *buf) { struct { u32 lost_records; @@ -560,12 +585,8 @@ static inline int insert_lost_records(st =20 this_cpu(lost_records) =3D 0; =20 - return __insert_record(buf, - TRC_LOST_RECORDS, - sizeof(ed), - 1 /* cycles */, - LOST_REC_SIZE, - (unsigned char *)&ed); + __insert_record(buf, TRC_LOST_RECORDS, sizeof(ed), 1 /* cycles */, + LOST_REC_SIZE, &ed); } =20 /* @@ -587,13 +608,15 @@ static DECLARE_TASKLET(trace_notify_dom0 * failure, otherwise 0. Failure occurs only if the trace buffers are = not yet * initialised. */ -void __trace_var(u32 event, int cycles, int extra, unsigned char = *extra_data) +void __trace_var(u32 event, bool_t cycles, unsigned int extra, + const void *extra_data) { - struct t_buf *buf; - unsigned long flags, bytes_to_tail, bytes_to_wrap; - int rec_size, total_size; - int extra_word; - int started_below_highwater =3D 0; + volatile struct t_buf *buf; + unsigned long flags; + u32 bytes_to_tail, bytes_to_wrap; + unsigned int rec_size, total_size; + unsigned int extra_word; + bool_t started_below_highwater; =20 if( !tb_init_done ) return; @@ -626,13 +649,11 @@ void __trace_var(u32 event, int cycles,=20 =20 /* Read tb_init_done /before/ t_bufs. */ rmb(); - - spin_lock_irqsave(&this_cpu(t_lock), flags); - buf =3D this_cpu(t_bufs); - if ( unlikely(!buf) ) - goto unlock; + return; + + spin_lock_irqsave(&this_cpu(t_lock), flags); =20 started_below_highwater =3D (calc_unconsumed_bytes(buf) < t_buf_highwa= ter); =20 --- 2010-06-15.orig/xen/include/xen/trace.h 2010-06-29 16:53:25.0000000= 00 +0200 +++ 2010-06-15/xen/include/xen/trace.h 2010-06-25 12:08:36.000000000 = +0200 @@ -36,7 +36,7 @@ int tb_control(struct xen_sysctl_tbuf_op =20 int trace_will_trace_event(u32 event); =20 -void __trace_var(u32 event, int cycles, int extra, unsigned char = *extra_data); +void __trace_var(u32 event, bool_t cycles, unsigned int extra, const void = *); =20 static inline void trace_var(u32 event, int cycles, int extra, unsigned char *extra_data) @@ -57,7 +57,7 @@ static inline void trace_var(u32 event,=20 { \ u32 _d[1]; \ _d[0] =3D d1; \ - __trace_var(_e, 1, sizeof(*_d), (unsigned char *)_d); \ + __trace_var(_e, 1, sizeof(_d), _d); \ } \ } while ( 0 ) =20 @@ -68,7 +68,7 @@ static inline void trace_var(u32 event,=20 u32 _d[2]; \ _d[0] =3D d1; \ _d[1] =3D d2; \ - __trace_var(_e, 1, sizeof(*_d)*2, (unsigned char *)_d); \ + __trace_var(_e, 1, sizeof(_d), _d); \ } \ } while ( 0 ) =20 @@ -80,7 +80,7 @@ static inline void trace_var(u32 event,=20 _d[0] =3D d1; \ _d[1] =3D d2; \ _d[2] =3D d3; \ - __trace_var(_e, 1, sizeof(*_d)*3, (unsigned char *)_d); \ + __trace_var(_e, 1, sizeof(_d), _d); \ } \ } while ( 0 ) =20 @@ -93,7 +93,7 @@ static inline void trace_var(u32 event,=20 _d[1] =3D d2; \ _d[2] =3D d3; \ _d[3] =3D d4; \ - __trace_var(_e, 1, sizeof(*_d)*4, (unsigned char *)_d); \ + __trace_var(_e, 1, sizeof(_d), _d); \ } \ } while ( 0 ) =20 @@ -107,7 +107,7 @@ static inline void trace_var(u32 event,=20 _d[2] =3D d3; \ _d[3] =3D d4; \ _d[4] =3D d5; \ - __trace_var(_e, 1, sizeof(*_d)*5, (unsigned char *)_d); \ + __trace_var(_e, 1, sizeof(_d), _d); \ } \ } while ( 0 ) =20 @@ -122,7 +122,7 @@ static inline void trace_var(u32 event,=20 _d[3] =3D d4; \ _d[4] =3D d5; \ _d[5] =3D d6; \ - __trace_var(_e, 1, sizeof(*_d)*6, (unsigned char *)_d); \ + __trace_var(_e, 1, sizeof(_d), _d); \ } \ } while ( 0 ) =20 --=__Part25084E38.0__= Content-Type: text/plain; name="trace-security.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="trace-security.patch" After getting a report of 3.2.3's xenmon crashing Xen (as it turned = out=0Athis was because c/s 17000 was backported to that tree without = also=0Aapplying c/s 17515), I figured that the hypervisor shouldn't rely = on any=0Aspecific state of the actual trace buffer (as it is shared = writable with=0ADom0)=0A=0AI chose to use 'volatile' qualifiers rather = than sprinkling around=0Abarriers - this can certainly be changed if = considered unacceptable.=0A=0ATo make clear what purpose specific = variables have and/or where they=0Agot loaded from, the patch also changes = the type of some of them to=0Abe explicitly u32/s32, and removes pointless = assertions (like checking=0Aan unsigned variable to be >=3D 0).=0A=0AI = also took the prototype adjustment of __trace_var() as an opportunity=0Ato = simplify the TRACE_xD() macros. Similar simplification could be done=0Aon = the (quite numerous) direct callers of the function.=0A=0ASigned-off-by: = Jan Beulich =0A=0A--- 2010-06-15.orig/xen/common/trace= .c 2010-06-29 17:04:45.000000000 +0200=0A+++ 2010-06-15/xen/common/tra= ce.c 2010-06-29 17:05:09.000000000 +0200=0A@@ -52,14 +52,14 @@ static = struct t_info *t_info;=0A #define T_INFO_SIZE ((T_INFO_PAGES)*(PAGE_SIZE))= =0A /* t_info.tbuf_size + list of mfn offsets + 1 to round up / sizeof = uint32_t */=0A #define T_INFO_FIRST_OFFSET (((2 + NR_CPUS) * sizeof(uint16_= t)) / sizeof(uint32_t))=0A-static DEFINE_PER_CPU_READ_MOSTLY(struct t_buf = *, t_bufs);=0A+static DEFINE_PER_CPU_READ_MOSTLY(volatile struct t_buf *, = t_bufs);=0A static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, t_data);=0A = static DEFINE_PER_CPU_READ_MOSTLY(spinlock_t, t_lock);=0A-static int = data_size;=0A+static u32 data_size;=0A =0A /* High water mark for trace = buffers; */=0A /* Send virtual interrupt when buffer level reaches this = point */=0A-static int t_buf_highwater;=0A+static u32 t_buf_highwater;=0A = =0A /* Number of records lost due to per-CPU trace buffer being full. = */=0A static DEFINE_PER_CPU(unsigned long, lost_records);=0A@@ -145,7 = +145,7 @@ static int alloc_trace_bufs(void)=0A =0A spin_lock_irqsav= e(&per_cpu(t_lock, cpu), flags);=0A =0A- buf =3D per_cpu(t_bufs, = cpu) =3D (struct t_buf *)rawbuf;=0A+ per_cpu(t_bufs, cpu) =3D buf = =3D (struct t_buf *)rawbuf;=0A buf->cons =3D buf->prod =3D 0;=0A = per_cpu(t_data, cpu) =3D (unsigned char *)(buf + 1);=0A =0A@@ -196,6 = +196,7 @@ out_dealloc:=0A spin_lock_irqsave(&per_cpu(t_lock, cpu), = flags);=0A if ( (rawbuf =3D (char *)per_cpu(t_bufs, cpu)) )=0A = {=0A+ per_cpu(t_bufs, cpu) =3D NULL;=0A = ASSERT(!(virt_to_page(rawbuf)->count_info & PGC_allocated));=0A = free_xenheap_pages(rawbuf, order);=0A }=0A@@ -410,19 +411,37 @@ = int tb_control(xen_sysctl_tbuf_op_t *tbc=0A return rc;=0A }=0A = =0A-static inline int calc_rec_size(int cycles, int extra) =0A+static = inline unsigned int calc_rec_size(bool_t cycles, unsigned int extra)=0A = {=0A- int rec_size;=0A- rec_size =3D 4;=0A+ unsigned int rec_size = =3D 4;=0A+=0A if ( cycles )=0A rec_size +=3D 8;=0A = rec_size +=3D extra;=0A return rec_size;=0A }=0A =0A-static inline int = calc_unconsumed_bytes(struct t_buf *buf)=0A+static inline bool_t bogus(u32 = prod, u32 cons)=0A+{=0A+ if ( unlikely(prod & 3) || unlikely(prod >=3D = 2 * data_size) ||=0A+ unlikely(cons & 3) || unlikely(cons >=3D 2 * = data_size) )=0A+ {=0A+ tb_init_done =3D 0;=0A+ printk(XENL= OG_WARNING "trc#%u: bogus prod (%08x) and/or cons (%08x)\n",=0A+ = smp_processor_id(), prod, cons);=0A+ return 1;=0A+ }=0A+ = return 0;=0A+}=0A+=0A+static inline u32 calc_unconsumed_bytes(const = volatile struct t_buf *buf)=0A {=0A- int x =3D buf->prod - buf->cons;=0A= + u32 prod =3D buf->prod, cons =3D buf->cons;=0A+ s32 x =3D prod - = cons;=0A+=0A+ if ( bogus(prod, cons) )=0A+ return data_size;=0A+= =0A if ( x < 0 )=0A x +=3D 2*data_size;=0A =0A@@ -432,9 = +451,14 @@ static inline int calc_unconsumed_bytes(=0A return x;=0A = }=0A =0A-static inline int calc_bytes_to_wrap(struct t_buf *buf)=0A+static = inline u32 calc_bytes_to_wrap(const volatile struct t_buf *buf)=0A {=0A- = int x =3D data_size - buf->prod;=0A+ u32 prod =3D buf->prod;=0A+ = s32 x =3D data_size - prod;=0A+=0A+ if ( bogus(prod, buf->cons) )=0A+ = return 0;=0A+=0A if ( x <=3D 0 )=0A x +=3D data_size;=0A = =0A@@ -444,35 +468,37 @@ static inline int calc_bytes_to_wrap(str=0A = return x;=0A }=0A =0A-static inline int calc_bytes_avail(struct t_buf = *buf)=0A+static inline u32 calc_bytes_avail(const volatile struct t_buf = *buf)=0A {=0A return data_size - calc_unconsumed_bytes(buf);=0A }=0A = =0A-static inline struct t_rec *=0A-next_record(struct t_buf *buf)=0A+stati= c inline struct t_rec *next_record(const volatile struct t_buf *buf)=0A = {=0A- int x =3D buf->prod;=0A+ u32 x =3D buf->prod;=0A+=0A+ if ( = !tb_init_done || bogus(x, buf->cons) )=0A+ return NULL;=0A+=0A = if ( x >=3D data_size )=0A x -=3D data_size;=0A =0A- ASSERT(x = >=3D 0);=0A ASSERT(x < data_size);=0A =0A return (struct t_rec = *)&this_cpu(t_data)[x];=0A }=0A =0A-static inline int __insert_record(struc= t t_buf *buf,=0A- unsigned long event,=0A-= int extra,=0A- = int cycles,=0A- int rec_size,=0A- = unsigned char *extra_data)=0A+static = inline void __insert_record(volatile struct t_buf *buf,=0A+ = unsigned long event,=0A+ = unsigned int extra,=0A+ bool_t = cycles,=0A+ unsigned int rec_size,=0A+ = const void *extra_data)=0A {=0A struct = t_rec *rec;=0A unsigned char *dst;=0A- unsigned long extra_word =3D = extra/sizeof(u32);=0A- int local_rec_size =3D calc_rec_size(cycles, = extra);=0A+ unsigned int extra_word =3D extra / sizeof(u32);=0A+ = unsigned int local_rec_size =3D calc_rec_size(cycles, extra);=0A = uint32_t next;=0A =0A BUG_ON(local_rec_size !=3D rec_size);=0A@@ = -488,11 +514,13 @@ static inline int __insert_record(struct=0A = printk(XENLOG_WARNING=0A "%s: avail=3D%u (size=3D%08x = prod=3D%08x cons=3D%08x) rec=3D%u\n",=0A __func__, = next, data_size, buf->prod, buf->cons, rec_size);=0A- return 0;=0A+ = return;=0A }=0A rmb();=0A =0A rec =3D next_record(buf);= =0A+ if ( !rec )=0A+ return;=0A rec->event =3D event;=0A = rec->extra_u32 =3D extra_word;=0A dst =3D (unsigned char *)rec->u.nocyc= les.extra_u32;=0A@@ -509,21 +537,22 @@ static inline int __insert_record(st= ruct=0A =0A wmb();=0A =0A- next =3D buf->prod + rec_size;=0A+ = next =3D buf->prod;=0A+ if ( bogus(next, buf->cons) )=0A+ = return;=0A+ next +=3D rec_size;=0A if ( next >=3D 2*data_size )=0A = next -=3D 2*data_size;=0A- ASSERT(next >=3D 0);=0A ASSERT(nex= t < 2*data_size);=0A buf->prod =3D next;=0A-=0A- return rec_size;=0A= }=0A =0A-static inline int insert_wrap_record(struct t_buf *buf, int = size)=0A+static inline void insert_wrap_record(volatile struct t_buf = *buf,=0A+ unsigned int size)=0A {=0A- = int space_left =3D calc_bytes_to_wrap(buf);=0A- unsigned long = extra_space =3D space_left - sizeof(u32);=0A- int cycles =3D 0;=0A+ = u32 space_left =3D calc_bytes_to_wrap(buf);=0A+ unsigned int extra_space= =3D space_left - sizeof(u32);=0A+ bool_t cycles =3D 0;=0A =0A = BUG_ON(space_left > size);=0A =0A@@ -535,17 +564,13 @@ static inline int = insert_wrap_record(str=0A ASSERT((extra_space/sizeof(u32)) <=3D = TRACE_EXTRA_MAX);=0A }=0A =0A- return __insert_record(buf,=0A- = TRC_TRACE_WRAP_BUFFER,=0A- extra_space,=0A= - cycles,=0A- space_left,=0A- = NULL);=0A+ __insert_record(buf, TRC_TRACE_WRAP_BUFFER, = extra_space, cycles,=0A+ space_left, NULL);=0A }=0A =0A = #define LOST_REC_SIZE (4 + 8 + 16) /* header + tsc + sizeof(struct ed) = */=0A =0A-static inline int insert_lost_records(struct t_buf *buf)=0A+stati= c inline void insert_lost_records(volatile struct t_buf *buf)=0A {=0A = struct {=0A u32 lost_records;=0A@@ -560,12 +585,8 @@ static inline = int insert_lost_records(st=0A =0A this_cpu(lost_records) =3D 0;=0A = =0A- return __insert_record(buf,=0A- = TRC_LOST_RECORDS,=0A- sizeof(ed),=0A- = 1 /* cycles */,=0A- LOST_REC_SIZE,= =0A- (unsigned char *)&ed);=0A+ __insert_recor= d(buf, TRC_LOST_RECORDS, sizeof(ed), 1 /* cycles */,=0A+ = LOST_REC_SIZE, &ed);=0A }=0A =0A /*=0A@@ -587,13 +608,15 @@ static = DECLARE_TASKLET(trace_notify_dom0=0A * failure, otherwise 0. Failure = occurs only if the trace buffers are not yet=0A * initialised.=0A = */=0A-void __trace_var(u32 event, int cycles, int extra, unsigned char = *extra_data)=0A+void __trace_var(u32 event, bool_t cycles, unsigned int = extra,=0A+ const void *extra_data)=0A {=0A- struct = t_buf *buf;=0A- unsigned long flags, bytes_to_tail, bytes_to_wrap;=0A- = int rec_size, total_size;=0A- int extra_word;=0A- int started_below= _highwater =3D 0;=0A+ volatile struct t_buf *buf;=0A+ unsigned long = flags;=0A+ u32 bytes_to_tail, bytes_to_wrap;=0A+ unsigned int = rec_size, total_size;=0A+ unsigned int extra_word;=0A+ bool_t = started_below_highwater;=0A =0A if( !tb_init_done )=0A = return;=0A@@ -626,13 +649,11 @@ void __trace_var(u32 event, int cycles, = =0A =0A /* Read tb_init_done /before/ t_bufs. */=0A rmb();=0A-=0A- = spin_lock_irqsave(&this_cpu(t_lock), flags);=0A-=0A buf =3D = this_cpu(t_bufs);=0A-=0A if ( unlikely(!buf) )=0A- goto = unlock;=0A+ return;=0A+=0A+ spin_lock_irqsave(&this_cpu(t_lock), = flags);=0A =0A started_below_highwater =3D (calc_unconsumed_bytes(buf) = < t_buf_highwater);=0A =0A--- 2010-06-15.orig/xen/include/xen/trace.h = 2010-06-29 16:53:25.000000000 +0200=0A+++ 2010-06-15/xen/include/xen/trace.= h 2010-06-25 12:08:36.000000000 +0200=0A@@ -36,7 +36,7 @@ int = tb_control(struct xen_sysctl_tbuf_op=0A =0A int trace_will_trace_event(u32 = event);=0A =0A-void __trace_var(u32 event, int cycles, int extra, unsigned = char *extra_data);=0A+void __trace_var(u32 event, bool_t cycles, unsigned = int extra, const void *);=0A =0A static inline void trace_var(u32 event, = int cycles, int extra,=0A unsigned char = *extra_data)=0A@@ -57,7 +57,7 @@ static inline void trace_var(u32 event, = =0A { \=0A = u32 _d[1]; \=0A = _d[0] =3D d1; \=0A- = __trace_var(_e, 1, sizeof(*_d), (unsigned char *)_d); \=0A+ = __trace_var(_e, 1, sizeof(_d), _d); \=0A } = \=0A } while ( 0 )=0A = =0A@@ -68,7 +68,7 @@ static inline void trace_var(u32 event, =0A = u32 _d[2]; \=0A = _d[0] =3D d1; \=0A = _d[1] =3D d2; \=0A- = __trace_var(_e, 1, sizeof(*_d)*2, (unsigned char *)_d); \=0A+ = __trace_var(_e, 1, sizeof(_d), _d); \=0A } = \=0A } while ( 0 )=0A = =0A@@ -80,7 +80,7 @@ static inline void trace_var(u32 event, =0A = _d[0] =3D d1; \=0A = _d[1] =3D d2; \=0A = _d[2] =3D d3; \=0A- = __trace_var(_e, 1, sizeof(*_d)*3, (unsigned char *)_d); \=0A+ = __trace_var(_e, 1, sizeof(_d), _d); \=0A } = \=0A } while ( 0 )=0A = =0A@@ -93,7 +93,7 @@ static inline void trace_var(u32 event, =0A = _d[1] =3D d2; \=0A = _d[2] =3D d3; \=0A = _d[3] =3D d4; \=0A- = __trace_var(_e, 1, sizeof(*_d)*4, (unsigned char *)_d); \=0A+ = __trace_var(_e, 1, sizeof(_d), _d); \=0A } = \=0A } while ( 0 )=0A = =0A@@ -107,7 +107,7 @@ static inline void trace_var(u32 event, =0A = _d[2] =3D d3; \=0A = _d[3] =3D d4; \=0A = _d[4] =3D d5; \=0A- = __trace_var(_e, 1, sizeof(*_d)*5, (unsigned char *)_d); \=0A+ = __trace_var(_e, 1, sizeof(_d), _d); \=0A } = \=0A } while ( 0 )=0A = =0A@@ -122,7 +122,7 @@ static inline void trace_var(u32 event, =0A = _d[3] =3D d4; \=0A = _d[4] =3D d5; \=0A = _d[5] =3D d6; \=0A- = __trace_var(_e, 1, sizeof(*_d)*6, (unsigned char *)_d); \=0A+ = __trace_var(_e, 1, sizeof(_d), _d); \=0A } = \=0A } while ( 0 )=0A =0A --=__Part25084E38.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part25084E38.0__=--