Skip to content

Commit 6472a2d

Browse files
committed
s390/irq,idle: simplify idle check
Use the per-cpu CIF_ENABLED_WAIT flag to decide if an interrupt occurred while a cpu was idle, instead of checking two conditions within the old psw. Also move clearing of the CIF_ENABLED_WAIT bit to the early interrupt handler, which in turn makes arch_vcpu_is_preempted() also a bit more precise, since the flag is now cleared before interrupt handlers have been called. Reviewed-by: Sven Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent f96f41a commit 6472a2d

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

arch/s390/include/asm/idle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ extern struct device_attribute dev_attr_idle_count;
2323
extern struct device_attribute dev_attr_idle_time_us;
2424

2525
void psw_idle(struct s390_idle_data *data, unsigned long psw_mask);
26-
void psw_idle_exit(void);
2726

2827
#endif /* _S390_IDLE_H */

arch/s390/kernel/idle.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ void account_idle_time_irq(void)
2828
u64 cycles_new[8];
2929
int i;
3030

31-
clear_cpu_flag(CIF_ENABLED_WAIT);
3231
if (smp_cpu_mtid) {
3332
stcctm(MT_DIAG, smp_cpu_mtid, cycles_new);
3433
for (i = 0; i < smp_cpu_mtid; i++)

arch/s390/kernel/irq.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void noinstr do_io_irq(struct pt_regs *regs)
136136
{
137137
irqentry_state_t state = irqentry_enter(regs);
138138
struct pt_regs *old_regs = set_irq_regs(regs);
139-
int from_idle;
139+
bool from_idle;
140140

141141
irq_enter_rcu();
142142

@@ -146,7 +146,7 @@ void noinstr do_io_irq(struct pt_regs *regs)
146146
current->thread.last_break = regs->last_break;
147147
}
148148

149-
from_idle = !user_mode(regs) && regs->psw.addr == (unsigned long)psw_idle_exit;
149+
from_idle = test_and_clear_cpu_flag(CIF_ENABLED_WAIT);
150150
if (from_idle)
151151
account_idle_time_irq();
152152

@@ -171,7 +171,7 @@ void noinstr do_ext_irq(struct pt_regs *regs)
171171
{
172172
irqentry_state_t state = irqentry_enter(regs);
173173
struct pt_regs *old_regs = set_irq_regs(regs);
174-
int from_idle;
174+
bool from_idle;
175175

176176
irq_enter_rcu();
177177

@@ -185,7 +185,7 @@ void noinstr do_ext_irq(struct pt_regs *regs)
185185
regs->int_parm = S390_lowcore.ext_params;
186186
regs->int_parm_long = S390_lowcore.ext_params2;
187187

188-
from_idle = !user_mode(regs) && regs->psw.addr == (unsigned long)psw_idle_exit;
188+
from_idle = test_and_clear_cpu_flag(CIF_ENABLED_WAIT);
189189
if (from_idle)
190190
account_idle_time_irq();
191191

0 commit comments

Comments
 (0)