diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2009-10-06 04:34:04 -0400 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2009-10-06 04:35:08 -0400 |
commit | 78d81f2f844b739b377817cfd279fb6067e191a7 (patch) | |
tree | f252e003e3ead8079a35167eea19f54bc4047964 /arch/s390 | |
parent | 102e835d5152e4299c1d150d6481b9bd47095998 (diff) |
[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: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/lib/delay.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c index 97c1eca83cc2..2c3094342789 100644 --- a/arch/s390/lib/delay.c +++ b/arch/s390/lib/delay.c | |||
@@ -49,17 +49,22 @@ static void __udelay_disabled(unsigned long usecs) | |||
49 | static void __udelay_enabled(unsigned long usecs) | 49 | static void __udelay_enabled(unsigned long usecs) |
50 | { | 50 | { |
51 | unsigned long mask; | 51 | unsigned long mask; |
52 | u64 end, time; | 52 | u64 clock_saved; |
53 | u64 end; | ||
53 | 54 | ||
54 | mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO; | 55 | mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO; |
55 | end = get_clock() + ((u64) usecs << 12); | 56 | end = get_clock() + ((u64) usecs << 12); |
56 | do { | 57 | do { |
57 | time = end < S390_lowcore.clock_comparator ? | 58 | clock_saved = 0; |
58 | end : S390_lowcore.clock_comparator; | 59 | if (end < S390_lowcore.clock_comparator) { |
59 | set_clock_comparator(time); | 60 | clock_saved = local_tick_disable(); |
61 | set_clock_comparator(end); | ||
62 | } | ||
60 | trace_hardirqs_on(); | 63 | trace_hardirqs_on(); |
61 | __load_psw_mask(mask); | 64 | __load_psw_mask(mask); |
62 | local_irq_disable(); | 65 | local_irq_disable(); |
66 | if (clock_saved) | ||
67 | local_tick_enable(clock_saved); | ||
63 | } while (get_clock() < end); | 68 | } while (get_clock() < end); |
64 | set_clock_comparator(S390_lowcore.clock_comparator); | 69 | set_clock_comparator(S390_lowcore.clock_comparator); |
65 | } | 70 | } |