提交 78d81f2f 编写于 作者: C Christian Borntraeger 提交者: Martin Schwidefsky

[S390] Fix enabled udelay for short delays.

When udelay() gets called with a delay that would expire before the
next clock event it reprograms the clock comparator.
When the interrupt happens the clock comparator won't be resetted
therefore the interrupt condition doesn't get cleared.
The result is an endless timer interrupt loop until the next clock
event would expire (stored in lowcore).
So udelay() usually would wait much longer for small delays than it
should.

Fix this by disabling the local tick which makes sure that the clock
comparator will be resetted when a timer interrupt happens.
Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 102e835d
...@@ -49,17 +49,22 @@ static void __udelay_disabled(unsigned long usecs) ...@@ -49,17 +49,22 @@ static void __udelay_disabled(unsigned long usecs)
static void __udelay_enabled(unsigned long usecs) static void __udelay_enabled(unsigned long usecs)
{ {
unsigned long mask; unsigned long mask;
u64 end, time; u64 clock_saved;
u64 end;
mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO; mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO;
end = get_clock() + ((u64) usecs << 12); end = get_clock() + ((u64) usecs << 12);
do { do {
time = end < S390_lowcore.clock_comparator ? clock_saved = 0;
end : S390_lowcore.clock_comparator; if (end < S390_lowcore.clock_comparator) {
set_clock_comparator(time); clock_saved = local_tick_disable();
set_clock_comparator(end);
}
trace_hardirqs_on(); trace_hardirqs_on();
__load_psw_mask(mask); __load_psw_mask(mask);
local_irq_disable(); local_irq_disable();
if (clock_saved)
local_tick_enable(clock_saved);
} while (get_clock() < end); } while (get_clock() < end);
set_clock_comparator(S390_lowcore.clock_comparator); set_clock_comparator(S390_lowcore.clock_comparator);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册