static void tau_timeout(void * info) { int cpu; unsigned long flags; int size; int shrink; /* */ local_irq_save(flags); cpu = smp_processor_id(); #ifndef CONFIG_TAU_INT TAUupdate(cpu); #endif size = tau[cpu].high - tau[cpu].low; if (size > min_window && ! tau[cpu].grew) { /* */ shrink = (2 + size - min_window) / 4; if (shrink) { tau[cpu].low += shrink; tau[cpu].high -= shrink; } else { /* */ tau[cpu].low += 1; #if 1 /* */ if ((tau[cpu].high - tau[cpu].low) != min_window){ printk(KERN_ERR "temp.c: line %d, logic error\n", __LINE__); } #endif } } tau[cpu].grew = 0; set_thresholds(cpu); /* */ mtspr(SPRN_THRM3, THRM3_SITV(500*60) | THRM3_E); local_irq_restore(flags); }
static void tau_timeout(void * info) { int cpu; unsigned long flags; int size; int shrink; /* disabling interrupts *should* be okay */ local_irq_save(flags); cpu = smp_processor_id(); #ifndef CONFIG_TAU_INT TAUupdate(cpu); #endif size = tau[cpu].high - tau[cpu].low; if (size > min_window && ! tau[cpu].grew) { /* do an exponential shrink of half the amount currently over size */ shrink = (2 + size - min_window) / 4; if (shrink) { tau[cpu].low += shrink; tau[cpu].high -= shrink; } else { /* size must have been min_window + 1 */ tau[cpu].low += 1; #if 1 /* debug */ if ((tau[cpu].high - tau[cpu].low) != min_window){ printk(KERN_ERR "temp.c: line %d, logic error\n", __LINE__); } #endif } } tau[cpu].grew = 0; set_thresholds(cpu); /* * Do the enable every time, since otherwise a bunch of (relatively) * complex sleep code needs to be added. One mtspr every time * tau_timeout is called is probably not a big deal. * * Enable thermal sensor and set up sample interval timer * need 20 us to do the compare.. until a nice 'cpu_speed' function * call is implemented, just assume a 500 mhz clock. It doesn't really * matter if we take too long for a compare since it's all interrupt * driven anyway. * * use a extra long time.. (60 us @ 500 mhz) */ mtspr(SPRN_THRM3, THRM3_SITV(500*60) | THRM3_E); local_irq_restore(flags); }