On Tue, Jul 24, 2007 at 01:20:27PM +0400, Dajie Tan wrote: > This patch adds support for profiling Loongson 2E. It's been tested on > FuLong mini PC(loongson2e inside). First of all, your patch has been garbled when mailing. [.. Lots of arch/mips code deleted ...] No complaints upto this point. But: > diff -urN b/drivers/oprofile/cpu_buffer.c a/drivers/oprofile/cpu_buffer.c > --- b/drivers/oprofile/cpu_buffer.c 2007-07-24 13:00:54.000000000 +0800 > +++ a/drivers/oprofile/cpu_buffer.c 2007-07-19 08:22:15.000000000 +0800 > @@ -148,6 +148,10 @@ > unsigned long pc, unsigned long event) > { > struct op_sample * entry = &cpu_buf->buffer[cpu_buf->head_pos]; > + > + if(!entry) > + return; > + > entry->eip = pc; > entry->event = event; > increment_head(cpu_buf); Why do you need this change? It almost looks as if you're papering over a bug where add_sample should not be called at all. Ralf