Skip to contentSkip to conversation

add support for profiling loongson2e

PATCH RESEND In review Dajie Tan 2 participants 2 messages Aug 1, 2007 MIPS

lore
Share & tools
lore

Dajie Tan

author
#0 lore raw

PATCH RESEND 1/1 add support for profiling loongson2e

Using mutt resend it. Wish it would be sended ok.

Tan.

---
 arch/mips/lemote/lm2e/irq.c              |    2 +
 arch/mips/oprofile/Makefile              |    1 +
 arch/mips/oprofile/common.c              |    6 +
 arch/mips/oprofile/op_model_loongson2e.c |  170 ++++++++++++++++++++++++++++++
 drivers/oprofile/cpu_buffer.c            |    4 +
 include/asm-mips/mipsregs.h              |   60 +++++++++++
 6 files changed, 243 insertions(+), 0 deletions(-)
arch/mips/lemote/lm2e/irq.c +2 -0
index 3e0b7be..62f6822 100644
@@ -81,6 +81,8 @@ asmlinkage void plat_irq_dispatch(void)
 
 	if (pending & CAUSEF_IP7) {
 		do_IRQ(MIPS_CPU_IRQ_BASE + 7);
+ 	} else if (pending & CAUSEF_IP6) { 	/* performance counter overflowe at IP6 */
+ 		do_IRQ(MIPS_CPU_IRQ_BASE + 6);
 	} else if (pending & CAUSEF_IP5) {
 		i8259_irqdispatch();
 	} else if (pending & CAUSEF_IP2) {
arch/mips/oprofile/Makefile +1 -0
index bf3be6f..9148850 100644
@@ -15,3 +15,4 @@ oprofile-$(CONFIG_CPU_MIPS64)		+= op_model_mipsxx.o
 oprofile-$(CONFIG_CPU_R10000)		+= op_model_mipsxx.o
 oprofile-$(CONFIG_CPU_SB1)		+= op_model_mipsxx.o
 oprofile-$(CONFIG_CPU_RM9000)		+= op_model_rm9000.o
+oprofile-$(CONFIG_CPU_LOONGSON2)		+= op_model_loongson2e.o
arch/mips/oprofile/common.c +6 -0
index 4e0a90b..50a0531 100644
@@ -16,6 +16,7 @@
 
 extern struct op_mips_model op_model_mipsxx_ops __attribute__((weak));
 extern struct op_mips_model op_model_rm9000_ops __attribute__((weak));
+extern struct op_mips_model op_model_loongson2e_ops __attribute__((weak));
 
 static struct op_mips_model *model;
 
@@ -92,6 +93,11 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
 	case CPU_RM9000:
 		lmodel = &op_model_rm9000_ops;
 		break;
+
+ 	case CPU_LOONGSON2:
+ 		lmodel = &op_model_loongson2e_ops;
+ 		break;
+ 
 	};
 
 	if (!lmodel)
arch/mips/oprofile/op_model_loongson2e.c new file +170 -0

170 lines not on this page · raw message

drivers/oprofile/cpu_buffer.c +4 -0
index a83c3db..fde9819 100644
@@ -148,6 +148,10 @@ add_sample(struct oprofile_cpu_buffer * cpu_buf,
            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);
include/asm-mips/mipsregs.h +60 -0

72 lines not on this page · raw message

#1 lore raw

drivers/oprofile/cpu_buffer.c add_sample(struct oprofile_cpu_buffer * cpu_buf, · line 154

Quoted 12 lines · Dajie Tan
drivers/oprofile/cpu_buffer.c +4 -0
index a83c3db..fde9819 100644
@@ -148,6 +148,10 @@ add_sample(struct oprofile_cpu_buffer * cpu_buf,
            unsigned long pc, unsigned long event)
 {
 	struct op_sample * entry = &cpu_buf->buffer[cpu_buf->head_pos];
+
+	if(!entry)
+		return;
+

Perhaps I wasn't clear. This change is unacceptable and must not be merged.

john