Skip to content

Commit 0587d40

Browse files
author
Martin Schwidefsky
committed
s390/time: return with irqs disabled from psw_idle
Modify the psw_idle waiting logic in entry[64].S to return with interrupts disabled. This avoids potential issues with udelay and interrupt loops as interrupts are not reenabled after clock comparator interrupts. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 6b169ac commit 0587d40

5 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎arch/s390/kernel/entry.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,13 +886,13 @@ cleanup_idle:
886886
stm %r9,%r10,__LC_SYSTEM_TIMER
887887
mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2)
888888
# prepare return psw
889-
n %r8,BASED(cleanup_idle_wait) # clear wait state bit
889+
n %r8,BASED(cleanup_idle_wait) # clear irq & wait state bits
890890
l %r9,24(%r11) # return from psw_idle
891891
br %r14
892892
cleanup_idle_insn:
893893
.long psw_idle_lpsw + 0x80000000
894894
cleanup_idle_wait:
895-
.long 0xfffdffff
895+
.long 0xfcfdffff
896896

897897
/*
898898
* Integer constants

‎arch/s390/kernel/entry64.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ cleanup_idle:
929929
stg %r9,__LC_SYSTEM_TIMER
930930
mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2)
931931
# prepare return psw
932-
nihh %r8,0xfffd # clear wait state bit
932+
nihh %r8,0xfcfd # clear irq & wait state bits
933933
lg %r9,48(%r11) # return from psw_idle
934934
br %r14
935935
cleanup_idle_insn:

‎arch/s390/kernel/process.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ void arch_cpu_idle(void)
7171
}
7272
/* Halt the cpu and keep track of cpu time accounting. */
7373
vtime_stop_cpu();
74+
local_irq_enable();
7475
}
7576

7677
void arch_cpu_idle_exit(void)

‎arch/s390/kernel/time.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ void clock_comparator_work(void)
9292
struct clock_event_device *cd;
9393

9494
S390_lowcore.clock_comparator = -1ULL;
95-
set_clock_comparator(S390_lowcore.clock_comparator);
9695
cd = &__get_cpu_var(comparators);
9796
cd->event_handler(cd);
9897
}

‎arch/s390/lib/delay.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ static void __udelay_disabled(unsigned long long usecs)
4444
do {
4545
set_clock_comparator(end);
4646
vtime_stop_cpu();
47-
local_irq_disable();
4847
} while (get_tod_clock() < end);
4948
lockdep_on();
5049
__ctl_load(cr0, 0, 0);
@@ -64,7 +63,6 @@ static void __udelay_enabled(unsigned long long usecs)
6463
set_clock_comparator(end);
6564
}
6665
vtime_stop_cpu();
67-
local_irq_disable();
6866
if (clock_saved)
6967
local_tick_enable(clock_saved);
7068
} while (get_tod_clock() < end);

0 commit comments

Comments
 (0)