arch/tile: fix __ndelay etc to work better
The current implementations of __ndelay and __udelay call a hypervisor service to delay, but the hypervisor service isn't actually implemented very well, and the consensus is that Linux should handle figuring this out natively and not use a hypervisor service. By converting nanoseconds to cycles, and then spinning until the cycle counter reaches the desired cycle, we get several benefits: first, we are sensitive to the actual clock speed; second, we use less power by issuing a slow SPR read once every six cycles while we delay; and third, we properly handle the case of an interrupt by exiting at the target time rather than after some number of cycles. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Este commit está contenido en:
@@ -38,12 +38,6 @@ STD_ENTRY(kernel_execve)
|
||||
jrp lr
|
||||
STD_ENDPROC(kernel_execve)
|
||||
|
||||
/* Delay a fixed number of cycles. */
|
||||
STD_ENTRY(__delay)
|
||||
{ addi r0, r0, -1; bnzt r0, . }
|
||||
jrp lr
|
||||
STD_ENDPROC(__delay)
|
||||
|
||||
/*
|
||||
* We don't run this function directly, but instead copy it to a page
|
||||
* we map into every user process. See vdso_setup().
|
||||
|
@@ -224,3 +224,13 @@ int setup_profiling_timer(unsigned int multiplier)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use the tile timer to convert nsecs to core clock cycles, relying
|
||||
* on it having the same frequency as SPR_CYCLE.
|
||||
*/
|
||||
cycles_t ns2cycles(unsigned long nsecs)
|
||||
{
|
||||
struct clock_event_device *dev = &__get_cpu_var(tile_timer);
|
||||
return ((u64)nsecs * dev->mult) >> dev->shift;
|
||||
}
|
||||
|
Referencia en una nueva incidencia
Block a user