irq_pipeline: Account for stage migration across faults
PATCH v2 2/2 irq_pipeline: Account for stage migration across faults
From: Jan Kiszka <[email protected]>
We need to unstall the inband stage when we entered for a fault over OOB and then migrated to inband. So far we kept the inband stage stalled, causing a state corruption this way.
Introduce an additional state to irqentry_info, tracking the stalling state on OOB entry. It should always be unstalled when doing a migration, but it's better to validate this assumption.
Signed-off-by Jan Kiszka <[email protected]>
--- include/linux/entry-common.h | 3 ++- kernel/entry/common.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-)
include/linux/entry-common.h +2 -1
@@ -402,7 +402,8 @@ void irqentry_exit_to_user_mode(struct pt_regs *regs);enum irqentry_info {IRQENTRY_INBAND_UNSTALLED =0 ,IRQENTRY_INBAND_STALLED , -IRQENTRY_OOB , +IRQENTRY_OOB_UNSTALLED , +IRQENTRY_OOB_STALLED , };#ifndef irqentry_state
kernel/entry/common.c +10 -3
@@ -410,7 +410,8 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs)#ifdef CONFIG_IRQ_PIPELINE if (running_oob ()) { - ret.stage_info =IRQENTRY_OOB ; + ret.stage_info =test_oob_stall () ?IRQENTRY_OOB_STALLED : +IRQENTRY_OOB_UNSTALLED ;return ret; }#endif
@@ -577,9 +578,15 @@ noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)/* * If pipelining interrupts, clear the in-band stall bit if * irqentry_enter() raised it in order to mirror the hardware -* state. +* state. Also clear it when we where coming from oob, thus went +* through a migration that was caused by taking, e.g., a fault. +* +* In all sane cases, a stalled oob entry can be excluded. +* Warn if this is violated. */ -if (state.stage_info ==IRQENTRY_INBAND_UNSTALLED ) +if (state.stage_info ==IRQENTRY_INBAND_UNSTALLED || + state.stage_info ==IRQENTRY_OOB_UNSTALLED || +WARN_ON_ONCE (state.stage_info ==IRQENTRY_OOB_STALLED ))unstall_inband ();#endif return ;
--
2.26.2