]> git.baikalelectronics.ru Git - kernel.git/commitdiff
x86/entry: Convert reschedule interrupt to IDTENTRY_SYSVEC_SIMPLE
authorThomas Gleixner <tglx@linutronix.de>
Thu, 21 May 2020 20:05:45 +0000 (22:05 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 11 Jun 2020 13:15:16 +0000 (15:15 +0200)
The scheduler IPI does not need the full interrupt entry handling logic
when the entry is from kernel mode. Use IDTENTRY_SYSVEC_SIMPLE and spare
all the overhead.

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/20200521202119.835425642@linutronix.de
arch/x86/entry/entry_64.S
arch/x86/include/asm/entry_arch.h
arch/x86/include/asm/hw_irq.h
arch/x86/include/asm/idtentry.h
arch/x86/include/asm/trace/common.h
arch/x86/include/asm/trace/irq_vectors.h
arch/x86/kernel/idt.c
arch/x86/kernel/smp.c
arch/x86/kernel/tracepoint.c

index fd7efb8dededb3d5a9dcd64841781adf45dc1cf8..9c0722e725ef5abdc5b4c3813826a1a3c7820c65 100644 (file)
@@ -956,10 +956,6 @@ apicinterrupt3 \num \sym \do_sym
 POP_SECTION_IRQENTRY
 .endm
 
-#ifdef CONFIG_SMP
-apicinterrupt RESCHEDULE_VECTOR                        reschedule_interrupt            smp_reschedule_interrupt
-#endif
-
 /*
  * Reload gs selector with exception handling
  * edi:  new selector
index a01bb74244ac17ae7ba1421c65249ea3ce5c262d..3e841ed5c17a40865e05c0590e8b5c939d2935a4 100644 (file)
@@ -10,6 +10,3 @@
  * is no hardware IRQ pin equivalent for them, they are triggered
  * through the ICC by us (IPIs)
  */
-#ifdef CONFIG_SMP
-BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
-#endif
index fd5e7c8825e18e2967229f593e892aa705fe364d..74c12437401eb270a735b20251e12543c08e1182 100644 (file)
@@ -28,9 +28,6 @@
 #include <asm/irq.h>
 #include <asm/sections.h>
 
-/* Interrupt handlers registered during init_IRQ */
-extern asmlinkage void reschedule_interrupt(void);
-
 #ifdef CONFIG_X86_LOCAL_APIC
 struct irq_data;
 struct pci_dev;
index 71cf82bf24ba01858168f1b492ad8ae65b2ca87d..38b672ded40bd1a4c3f29982a6b1a2958a71228e 100644 (file)
@@ -600,6 +600,7 @@ DECLARE_IDTENTRY_SYSVEC(X86_PLATFORM_IPI_VECTOR,    sysvec_x86_platform_ipi);
 #endif
 
 #ifdef CONFIG_SMP
+DECLARE_IDTENTRY(RESCHEDULE_VECTOR,                    sysvec_reschedule_ipi);
 DECLARE_IDTENTRY_SYSVEC(IRQ_MOVE_CLEANUP_VECTOR,       sysvec_irq_move_cleanup);
 DECLARE_IDTENTRY_SYSVEC(REBOOT_VECTOR,                 sysvec_reboot);
 DECLARE_IDTENTRY_SYSVEC(CALL_FUNCTION_SINGLE_VECTOR,   sysvec_call_function_single);
index 57c8da027d99238f03591a0ab4cfab53da9a03a7..f0f9bcdb74d9caa43d040db226d4438b9b4afdf4 100644 (file)
@@ -5,12 +5,8 @@
 DECLARE_STATIC_KEY_FALSE(trace_pagefault_key);
 #define trace_pagefault_enabled()                      \
        static_branch_unlikely(&trace_pagefault_key)
-DECLARE_STATIC_KEY_FALSE(trace_resched_ipi_key);
-#define trace_resched_ipi_enabled()                    \
-       static_branch_unlikely(&trace_resched_ipi_key)
 #else
 static inline bool trace_pagefault_enabled(void) { return false; }
-static inline bool trace_resched_ipi_enabled(void) { return false; }
 #endif
 
 #endif
index 33b9d0f0aafe59e5f5dc2f663ea082e5914073d7..88e7f0f3bf6275cb611e631f41fc8a2e79729497 100644 (file)
@@ -10,9 +10,6 @@
 
 #ifdef CONFIG_X86_LOCAL_APIC
 
-extern int trace_resched_ipi_reg(void);
-extern void trace_resched_ipi_unreg(void);
-
 DECLARE_EVENT_CLASS(x86_irq_vector,
 
        TP_PROTO(int vector),
@@ -37,18 +34,6 @@ DEFINE_EVENT_FN(x86_irq_vector, name##_exit, \
        TP_PROTO(int vector),                   \
        TP_ARGS(vector), NULL, NULL);
 
-#define DEFINE_RESCHED_IPI_EVENT(name)         \
-DEFINE_EVENT_FN(x86_irq_vector, name##_entry,  \
-       TP_PROTO(int vector),                   \
-       TP_ARGS(vector),                        \
-       trace_resched_ipi_reg,                  \
-       trace_resched_ipi_unreg);               \
-DEFINE_EVENT_FN(x86_irq_vector, name##_exit,   \
-       TP_PROTO(int vector),                   \
-       TP_ARGS(vector),                        \
-       trace_resched_ipi_reg,                  \
-       trace_resched_ipi_unreg);
-
 /*
  * local_timer - called when entering/exiting a local timer interrupt
  * vector handler
@@ -99,7 +84,7 @@ TRACE_EVENT_PERF_PERM(irq_work_exit, is_sampling_event(p_event) ? -EPERM : 0);
 /*
  * reschedule - called when entering/exiting a reschedule vector handler
  */
-DEFINE_RESCHED_IPI_EVENT(reschedule);
+DEFINE_IRQ_VECTOR_EVENT(reschedule);
 
 /*
  * call_function - called when entering/exiting a call function interrupt
index faaadd430882d7bc37c69fcc60b3b7b4c6ddd727..bc9b0d1d7bb8ace1c397c3e1981ec6e4207cea03 100644 (file)
@@ -112,7 +112,7 @@ static const __initconst struct idt_data def_idts[] = {
  */
 static const __initconst struct idt_data apic_idts[] = {
 #ifdef CONFIG_SMP
-       INTG(RESCHEDULE_VECTOR,                 reschedule_interrupt),
+       INTG(RESCHEDULE_VECTOR,                 asm_sysvec_reschedule_ipi),
        INTG(CALL_FUNCTION_VECTOR,              asm_sysvec_call_function),
        INTG(CALL_FUNCTION_SINGLE_VECTOR,       asm_sysvec_call_function_single),
        INTG(IRQ_MOVE_CLEANUP_VECTOR,           asm_sysvec_irq_move_cleanup),
index e5647daa7e9687e08c192b5a2998332de03d041f..eff4ce3b10da7185cb770e35b6006516e72830db 100644 (file)
@@ -220,26 +220,15 @@ static void native_stop_other_cpus(int wait)
 
 /*
  * Reschedule call back. KVM uses this interrupt to force a cpu out of
- * guest mode
+ * guest mode.
  */
-__visible void __irq_entry smp_reschedule_interrupt(struct pt_regs *regs)
+DEFINE_IDTENTRY_SYSVEC_SIMPLE(sysvec_reschedule_ipi)
 {
        ack_APIC_irq();
+       trace_reschedule_entry(RESCHEDULE_VECTOR);
        inc_irq_stat(irq_resched_count);
-
-       if (trace_resched_ipi_enabled()) {
-               /*
-                * scheduler_ipi() might call irq_enter() as well, but
-                * nested calls are fine.
-                */
-               irq_enter();
-               trace_reschedule_entry(RESCHEDULE_VECTOR);
-               scheduler_ipi();
-               trace_reschedule_exit(RESCHEDULE_VECTOR);
-               irq_exit();
-               return;
-       }
        scheduler_ipi();
+       trace_reschedule_exit(RESCHEDULE_VECTOR);
 }
 
 DEFINE_IDTENTRY_SYSVEC(sysvec_call_function)
index 496748ed266a97311d8125785c780a3a387b0306..fcfc077afe2dcf86915a1e493bf8ff9048cb5235 100644 (file)
@@ -25,20 +25,3 @@ void trace_pagefault_unreg(void)
 {
        static_branch_dec(&trace_pagefault_key);
 }
-
-#ifdef CONFIG_SMP
-
-DEFINE_STATIC_KEY_FALSE(trace_resched_ipi_key);
-
-int trace_resched_ipi_reg(void)
-{
-       static_branch_inc(&trace_resched_ipi_key);
-       return 0;
-}
-
-void trace_resched_ipi_unreg(void)
-{
-       static_branch_dec(&trace_resched_ipi_key);
-}
-
-#endif