--- zzzz-none-000/linux-2.6.28.10/include/linux/irq_cpustat.h 2009-05-02 18:54:43.000000000 +0000 +++ fusiv-7390-686/linux-2.6.28.10/include/linux/irq_cpustat.h 2012-02-14 14:37:49.000000000 +0000 @@ -28,4 +28,69 @@ /* arch dependent irq_stat fields */ #define nmi_count(cpu) __IRQ_STAT((cpu), __nmi_count) /* i386 */ +typedef struct __fusiv_irq_softirq_stats { + unsigned long softirq_cycles; + unsigned long hardirq_cycles; + unsigned long softirq_ticks; + unsigned long nested_interrupts; +} fusiv_irq_softirq_stats_t; + +extern fusiv_irq_softirq_stats_t fusiv_irq_softirq_stats[]; + +#ifdef CONFIG_FUSIV_SOFTIRQ_CPU_UTILIZATION_FIX +#define GET_CYCLE_COUNTER() ({unsigned long ticks; __asm__ volatile ("mfc0 %0,$9\nnop" : "=d"(ticks)); (ticks);}) +#define __GET_SOFTIRQ_STATS(cpu,member) (fusiv_irq_softirq_stats[cpu].member) +#define __INCR_SOFTIRQ_STATS(cpu,member,val) (fusiv_irq_softirq_stats[cpu].member += (val)) +#define __DECR_SOFTIRQ_STATS(cpu,member,val) (fusiv_irq_softirq_stats[cpu].member -= (val)) +#define __RESET_SOFTIRQ_STATS(cpu,member) (fusiv_irq_softirq_stats[cpu].member = 0) + +#define local_softirq_cycles() \ + __GET_SOFTIRQ_STATS(smp_processor_id(), softirq_cycles) + +#define local_softirq_ticks() \ + __GET_SOFTIRQ_STATS(smp_processor_id(), softirq_ticks) + +#define local_hardirq_cycles() \ + __GET_SOFTIRQ_STATS(smp_processor_id(), hardirq_cycles) + +#define local_nested_interrupts() \ + __GET_SOFTIRQ_STATS(smp_processor_id(), nested_interrupts) + +#define local_incr_softirq_cycles(val) \ + __INCR_SOFTIRQ_STATS (smp_processor_id(), softirq_cycles, val) + +#define local_decr_softirq_cycles(val) \ + __DECR_SOFTIRQ_STATS (smp_processor_id(), softirq_cycles, val) + +#define local_reset_softirq_cycles() \ + __RESET_SOFTIRQ_STATS (smp_processor_id(), softirq_cycles) + +#define local_incr_softirq_ticks(val) \ + __INCR_SOFTIRQ_STATS (smp_processor_id(), softirq_ticks, val) + +#define local_decr_softirq_ticks(val) \ + __DECR_SOFTIRQ_STATS (smp_processor_id(), softirq_ticks, val) + +#define local_reset_softirq_ticks() \ + __RESET_SOFTIRQ_STATS (smp_processor_id(), softirq_ticks) + +#define local_incr_hardirq_cycles(val) \ + __INCR_SOFTIRQ_STATS (smp_processor_id(), hardirq_cycles, val) + +#define local_decr_hardirq_cycles(val) \ + __DECR_SOFTIRQ_STATS (smp_processor_id(), hardirq_cycles, val) + +#define local_reset_hardirq_cycles() \ + __RESET_SOFTIRQ_STATS (smp_processor_id(), hardirq_cycles) + +#define local_incr_nested_interrupts(val) \ + __INCR_SOFTIRQ_STATS (smp_processor_id(), nested_interrupts, val) + +#define local_decr_nested_interrupts(val) \ + __DECR_SOFTIRQ_STATS (smp_processor_id(), nested_interrupts, val) + +#define local_reset_nested_interrupts() \ + __RESET_SOFTIRQ_STATS (smp_processor_id(), nested_interrupts) +#endif + #endif /* __irq_cpustat_h */