How to enable tracing of task switches with PowerPC 4xx The PowerPC 4xx series only have program flow trace capability. In order to trace task switches, you need to record a data access. Lauterbach provides a special patch to enable a limited support of data trace. See demo/powerpc/etc/trace4xx. To do performance measurements that are task sensitive (e.g. Trace.CHART.TASK), you need to record the write accesses to the variable holding the current running task. Follow the steps below. 1) Enable data trace in TRACE32 SYStem.Option DataTrace ON 2) Enable trace port of the CPU Either modify your startup code to do so, or use TRACE32 to do the necessary settings: Data.Set DCR:0xB1 data.long(dcr:0xB1)|0x08000000 3) Add the data trace to the scheduling routine Modify kernel/sched.c: schedule(): Linux 2.6: rq->curr = next; #ifdef CONFIG_4xx T32_DataTrace_Write32(&rq->curr,rq->curr); #endif Linux 2.4: sched_data->curr = next; #ifdef CONFIG_4xx T32_DataTrace_Write32(&sched_data->curr,sched_data->curr); #endif 4) Add the TRACE32 data trace routines Add the following lines to arch/ppc/kernel/entry.S: #ifdef CONFIG_4xx .globl T32_DataTrace_Write32 T32_DataTrace_Write32: mflr r0 # get return address mtctr r0 # save in CTR register clrlwi. r0,r4,30 beq T32_DataTrace_Write32_D0 cmpwi r0,2 beq T32_DataTrace_Write32_D2 cmpwi r0,1 beq T32_DataTrace_Write32_D1 T32_DataTrace_Write32_D3: mtlr r4 # show data to trace b T32_DataTrace_Address T32_DataTrace_Write32_D2: mtlr r4 # show data to trace b T32_DataTrace_Address T32_DataTrace_Write32_D1: mtlr r4 # show data to trace b T32_DataTrace_Address T32_DataTrace_Write32_D0: mtlr r4 # show data to trace T32_DataTrace_Address: clrlwi. r0,r3,30 bne T32_DataTrace_Address1 T32_DataTrace_Address_A0: mtlr r3 # show address to trace bctr T32_DataTrace_Address1: cmpwi r0,2 bne T32_DataTrace_Address2 T32_DataTrace_Address_A2: mtlr r3 # show address to trace bctr T32_DataTrace_Address2: cmpwi r0,1 bne T32_DataTrace_Address_A3 T32_DataTrace_Address_A1: mtlr r3 # show address to trace bctr T32_DataTrace_Address_A3: mtlr r3 # show address to trace bctr #endif 5) Recompile the kernel with debug info