2008-01-11 Joel Sherrill <joel.sherrill@oarcorp.com>

* configure.ac, irq/irq.c, startup/bspclean.c, startup/bspstart.c: Add
	ALLOW_IRQ_NESTING option. The MPC5200 has a settle time after
	acknowledging the IRQs and currently the BSP does not account for
	that. After acknowledging an interrupt, it currently gets a second
	spurious IRQ a significant percentage of the time. Rename to
	BENCHMARK_IRQ_PROCESSING and get it working again. Under one test
	load, not nesting interrupts resulted in a 50% reduction in the
	number of IRQs and an ~30% reduction in time spent in IRQs.
This commit is contained in:
Joel Sherrill
2008-01-11 18:25:35 +00:00
parent 49cf70f1d0
commit eabd9f06e7
5 changed files with 53 additions and 9 deletions

View File

@@ -1,3 +1,14 @@
2008-01-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* configure.ac, irq/irq.c, startup/bspclean.c, startup/bspstart.c: Add
ALLOW_IRQ_NESTING option. The MPC5200 has a settle time after
acknowledging the IRQs and currently the BSP does not account for
that. After acknowledging an interrupt, it currently gets a second
spurious IRQ a significant percentage of the time. Rename to
BENCHMARK_IRQ_PROCESSING and get it working again. Under one test
load, not nesting interrupts resulted in a 50% reduction in the
number of IRQs and an ~30% reduction in time spent in IRQs.
2007-12-18 Joel Sherrill <joel.sherrill@OARcorp.com> 2007-12-18 Joel Sherrill <joel.sherrill@OARcorp.com>
* startup/linkcmds: Spacing. * startup/linkcmds: Spacing.

View File

@@ -25,6 +25,14 @@ RTEMS_BSPOPTS_HELP([INSTRUCTION_CACHE_ENABLE],
[If defined, the instruction cache will be enabled after address translation [If defined, the instruction cache will be enabled after address translation
is turned on.]) is turned on.])
RTEMS_BSPOPTS_SET([BENCHMARK_IRQ_PROCESSING],[*],[0])
RTEMS_BSPOPTS_HELP([BENCHMARK_IRQ_PROCESSING],
[If defined, enable code to benchmark IRQ processing.])
RTEMS_BSPOPTS_SET([ALLOW_IRQ_NESTING],[*],[1])
RTEMS_BSPOPTS_HELP([ALLOW_IRQ_NESTING],
[If defined, allow nested IRQ processing.])
RTEMS_CHECK_NETWORKING RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes") AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")

View File

@@ -631,7 +631,7 @@ int BSP_rtems_irq_mngt_get(rtems_irq_global_settings** config)
return 0; return 0;
} }
#if defined(TIME_IRQs) #if (BENCHMARK_IRQ_PROCESSING == 1)
#include <stdio.h> #include <stdio.h>
uint64_t BSP_Starting_TBR; uint64_t BSP_Starting_TBR;
uint64_t BSP_Total_in_ISR; uint64_t BSP_Total_in_ISR;
@@ -688,7 +688,7 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
register unsigned int new_msr; register unsigned int new_msr;
register unsigned int pmce; register unsigned int pmce;
register unsigned int crit_pri_main_mask, per_mask; register unsigned int crit_pri_main_mask, per_mask;
#if defined(TIME_IRQs) #if (BENCHMARK_IRQ_PROCESSING == 1)
uint64_t start, stop, thisTime; uint64_t start, stop, thisTime;
start = PPC_Get_timebase_register(); start = PPC_Get_timebase_register();
@@ -759,18 +759,22 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
crit_pri_main_mask = mpc5200.crit_pri_main_mask; crit_pri_main_mask = mpc5200.crit_pri_main_mask;
mpc5200.crit_pri_main_mask |= irqMaskTable[irq]; mpc5200.crit_pri_main_mask |= irqMaskTable[irq];
#if (ALLOW_IRQ_NESTING == 1)
/* enable interrupt nesting */ /* enable interrupt nesting */
_CPU_MSR_GET(msr); _CPU_MSR_GET(msr);
new_msr = msr | MSR_EE; new_msr = msr | MSR_EE;
_CPU_MSR_SET(new_msr); _CPU_MSR_SET(new_msr);
#endif
/* call the module specific handler and pass the /* call the module specific handler and pass the
* specific handler * specific handler
*/ */
rtems_hdl_tbl[irq].hdl(0); rtems_hdl_tbl[irq].hdl(0);
#if (ALLOW_IRQ_NESTING == 1)
/* disable interrupt nesting */ /* disable interrupt nesting */
_CPU_MSR_SET(msr); _CPU_MSR_SET(msr);
#endif
/* restore original interrupt mask */ /* restore original interrupt mask */
mpc5200.crit_pri_main_mask = crit_pri_main_mask; mpc5200.crit_pri_main_mask = crit_pri_main_mask;
@@ -796,18 +800,22 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
per_mask = mpc5200.per_mask; per_mask = mpc5200.per_mask;
mpc5200.per_mask |= irqMaskTable[irq]; mpc5200.per_mask |= irqMaskTable[irq];
#if (ALLOW_IRQ_NESTING == 1)
/* enable interrupt nesting */ /* enable interrupt nesting */
_CPU_MSR_GET(msr); _CPU_MSR_GET(msr);
new_msr = msr | MSR_EE; new_msr = msr | MSR_EE;
_CPU_MSR_SET(new_msr); _CPU_MSR_SET(new_msr);
#endif
/* call the module specific handler and pass /* call the module specific handler and pass
* the specific handler * the specific handler
*/ */
rtems_hdl_tbl[irq].hdl(0); rtems_hdl_tbl[irq].hdl(0);
#if (ALLOW_IRQ_NESTING == 1)
/* disable interrupt nesting */ /* disable interrupt nesting */
_CPU_MSR_SET(msr); _CPU_MSR_SET(msr);
#endif
/* restore original interrupt mask */ /* restore original interrupt mask */
mpc5200.per_mask = per_mask; mpc5200.per_mask = per_mask;
@@ -883,16 +891,20 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
per_mask = mpc5200.per_mask; per_mask = mpc5200.per_mask;
mpc5200.per_mask |= irqMaskTable[irq]; mpc5200.per_mask |= irqMaskTable[irq];
#if (ALLOW_IRQ_NESTING == 1)
/* enable interrupt nesting */ /* enable interrupt nesting */
_CPU_MSR_GET(msr); _CPU_MSR_GET(msr);
new_msr = msr | MSR_EE; new_msr = msr | MSR_EE;
_CPU_MSR_SET(new_msr); _CPU_MSR_SET(new_msr);
#endif
/* call the module specific handler and pass the /* call the module specific handler and pass the
* specific handler */ * specific handler */
rtems_hdl_tbl[irq].hdl(rtems_hdl_tbl[irq].handle); rtems_hdl_tbl[irq].hdl(rtems_hdl_tbl[irq].handle);
#if (ALLOW_IRQ_NESTING == 1)
_CPU_MSR_SET(msr); _CPU_MSR_SET(msr);
#endif
/* restore original interrupt mask */ /* restore original interrupt mask */
mpc5200.per_mask = per_mask; mpc5200.per_mask = per_mask;
@@ -948,17 +960,21 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
crit_pri_main_mask = mpc5200.crit_pri_main_mask; crit_pri_main_mask = mpc5200.crit_pri_main_mask;
mpc5200.crit_pri_main_mask |= irqMaskTable[irq]; mpc5200.crit_pri_main_mask |= irqMaskTable[irq];
#if (ALLOW_IRQ_NESTING == 1)
/* enable interrupt nesting */ /* enable interrupt nesting */
_CPU_MSR_GET(msr); _CPU_MSR_GET(msr);
new_msr = msr | MSR_EE; new_msr = msr | MSR_EE;
_CPU_MSR_SET(new_msr); _CPU_MSR_SET(new_msr);
#endif
/* call the module specific handler and pass the specific /* call the module specific handler and pass the specific
* handler */ * handler */
rtems_hdl_tbl[irq].hdl(rtems_hdl_tbl[irq].handle); rtems_hdl_tbl[irq].hdl(rtems_hdl_tbl[irq].handle);
#if (ALLOW_IRQ_NESTING == 1)
/* disable interrupt nesting */ /* disable interrupt nesting */
_CPU_MSR_SET(msr); _CPU_MSR_SET(msr);
#endif
/* restore original interrupt mask */ /* restore original interrupt mask */
mpc5200.crit_pri_main_mask = crit_pri_main_mask; mpc5200.crit_pri_main_mask = crit_pri_main_mask;
@@ -980,17 +996,21 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
per_mask = mpc5200.per_mask; per_mask = mpc5200.per_mask;
mpc5200.per_mask |= irqMaskTable[irq]; mpc5200.per_mask |= irqMaskTable[irq];
#if (ALLOW_IRQ_NESTING == 1)
/* enable interrupt nesting */ /* enable interrupt nesting */
_CPU_MSR_GET(msr); _CPU_MSR_GET(msr);
new_msr = msr | MSR_EE; new_msr = msr | MSR_EE;
_CPU_MSR_SET(new_msr); _CPU_MSR_SET(new_msr);
#endif
/* call the module specific handler and pass the /* call the module specific handler and pass the
* specific handler */ * specific handler */
rtems_hdl_tbl[irq].hdl(rtems_hdl_tbl[irq].handle); rtems_hdl_tbl[irq].hdl(rtems_hdl_tbl[irq].handle);
#if (ALLOW_IRQ_NESTING == 1)
/* disable interrupt nesting */ /* disable interrupt nesting */
_CPU_MSR_SET(msr); _CPU_MSR_SET(msr);
#endif
/* restore original interrupt mask */ /* restore original interrupt mask */
mpc5200.per_mask = per_mask; mpc5200.per_mask = per_mask;
@@ -1022,11 +1042,12 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
break; break;
} /* end of switch(excNum) */ } /* end of switch(excNum) */
#if defined(TIME_IRQs) #if (BENCHMARK_IRQ_PROCESSING == 1)
stop = PPC_Get_timebase_register(); stop = PPC_Get_timebase_register();
thisTime = stop - start; thisTime = stop - start;
if ( thisTime > BSP_Worst_ISR ); BSP_Total_in_ISR += thisTime;
thisTime = BSP_Worst_ISR; if ( thisTime > BSP_Worst_ISR )
BSP_Worst_ISR = thisTime;
#endif #endif
return 0; return 0;
} }

View File

@@ -21,7 +21,7 @@ extern int mpc5200_uart_pollRead(int minor);
void bsp_cleanup( void ) void bsp_cleanup( void )
{ {
#if defined(TIME_IRQs) #if (BENCHMARK_IRQ_PROCESSING == 1)
{ {
extern void BSP_report_IRQ_Timing(void); extern void BSP_report_IRQ_Timing(void);
BSP_report_IRQ_Timing(); BSP_report_IRQ_Timing();

View File

@@ -65,7 +65,7 @@
/* conditions. */ /* conditions. */
/* The mmu is unused at this time. */ /* The mmu is unused at this time. */
/* */ /* */
/* COPYRIGHT (c) 1989-2007. /* COPYRIGHT (c) 1989-2007. */
/* On-Line Applications Research Corporation (OAR). */ /* On-Line Applications Research Corporation (OAR). */
/* */ /* */
/* The license and distribution terms for this file may be */ /* The license and distribution terms for this file may be */
@@ -301,13 +301,17 @@ void bsp_start(void)
* not malloc'ed. It is just "pulled from the air". * not malloc'ed. It is just "pulled from the air".
*/ */
Configuration.work_space_start = (void *)&_WorkspaceBase; Configuration.work_space_start = (void *)&_WorkspaceBase;
#ifdef SHOW_MORE_INIT_SETTINGS
printk( "workspace=%p\n", Configuration.work_space_start );
printk( "workspace size=%d\n", Configuration.work_space_size );
#endif
/* /*
* Initalize RTEMS IRQ system * Initalize RTEMS IRQ system
*/ */
BSP_rtems_irq_mng_init(0); BSP_rtems_irq_mng_init(0);
#if defined(TIME_IRQs) #if (BENCHMARK_IRQ_PROCESSING == 1)
{ {
void BSP_initialize_IRQ_Timing(void); void BSP_initialize_IRQ_Timing(void);
BSP_initialize_IRQ_Timing(); BSP_initialize_IRQ_Timing();