summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-05-21 23:05:25 +0300
committerThomas Gleixner <tglx@linutronix.de>2020-06-11 16:15:08 +0300
commit1de16e0c17155d138282f3a9f65914a9a5da757e (patch)
tree4e65db0bc6169ec46f79546f9b0e8756166fb54a
parenteb6555c83933ce8e094d5429d57970aaa9f0591e (diff)
downloadlinux-1de16e0c17155d138282f3a9f65914a9a5da757e.tar.xz
x86/entry: Split out idtentry_exit_cond_resched()
The XEN PV hypercall requires the ability of conditional rescheduling when preemption is disabled because some hypercalls take ages. Split out the rescheduling code from idtentry_exit_cond_rcu() so it can be reused for that. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Andy Lutomirski <luto@kernel.org> Link: https://lore.kernel.org/r/20200521202117.962199649@linutronix.de
-rw-r--r--arch/x86/entry/common.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 2a80e4e1b4c1..066215a243b4 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -583,6 +583,20 @@ bool noinstr idtentry_enter_cond_rcu(struct pt_regs *regs)
return false;
}
+static void idtentry_exit_cond_resched(struct pt_regs *regs, bool may_sched)
+{
+ if (may_sched && !preempt_count()) {
+ /* Sanity check RCU and thread stack */
+ rcu_irq_exit_check_preempt();
+ if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
+ WARN_ON_ONCE(!on_thread_stack());
+ if (need_resched())
+ preempt_schedule_irq();
+ }
+ /* Covers both tracing and lockdep */
+ trace_hardirqs_on();
+}
+
/**
* idtentry_exit_cond_rcu - Handle return from exception with conditional RCU
* handling
@@ -624,21 +638,7 @@ void noinstr idtentry_exit_cond_rcu(struct pt_regs *regs, bool rcu_exit)
}
instrumentation_begin();
-
- /* Check kernel preemption, if enabled */
- if (IS_ENABLED(CONFIG_PREEMPTION)) {
- if (!preempt_count()) {
- /* Sanity check RCU and thread stack */
- rcu_irq_exit_check_preempt();
- if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
- WARN_ON_ONCE(!on_thread_stack());
- if (need_resched())
- preempt_schedule_irq();
- }
- }
- /* Covers both tracing and lockdep */
- trace_hardirqs_on();
-
+ idtentry_exit_cond_resched(regs, IS_ENABLED(CONFIG_PREEMPTION));
instrumentation_end();
} else {
/*