aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 07:18:46 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 06:21:17 -0400
commit5014e7011964ff46b2d73cf91a05ed9eed5a8fa2 (patch)
tree76fad060cf673112d92a4f5f2d9b9423383610f6 /arch
parentfc6ac04ddc314b9cff5bdb92c8330569658076a3 (diff)
Add hrtimer_start_on() support
This patch adds hrtimer_start_on(), which allows arming timers on remote CPUs. This is needed to avoided timer interrupts on "shielded" CPUs and is also useful for implementing semi-partitioned schedulers.
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/x86/Kconfig3
-rw-r--r--arch/x86/include/asm/entry_arch.h1
-rw-r--r--arch/x86/include/asm/hw_irq.h4
-rw-r--r--arch/x86/include/asm/irq_vectors.h6
-rw-r--r--arch/x86/kernel/entry_64.S2
-rw-r--r--arch/x86/kernel/irqinit.c3
-rw-r--r--arch/x86/kernel/smp.c38
8 files changed, 59 insertions, 1 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ce948d46a1b3..d3bfc3a4e56a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2123,5 +2123,8 @@ source "arch/arm/kvm/Kconfig"
2123config ARCH_HAS_FEATHER_TRACE 2123config ARCH_HAS_FEATHER_TRACE
2124 def_bool n 2124 def_bool n
2125 2125
2126config ARCH_HAS_SEND_PULL_TIMERS
2127 def_bool n
2128
2126source "litmus/Kconfig" 2129source "litmus/Kconfig"
2127 2130
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6331227b4686..f9c9a4d70b24 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2598,4 +2598,7 @@ source "lib/Kconfig"
2598config ARCH_HAS_FEATHER_TRACE 2598config ARCH_HAS_FEATHER_TRACE
2599 def_bool y 2599 def_bool y
2600 2600
2601config ARCH_HAS_SEND_PULL_TIMERS
2602 def_bool y
2603
2601source "litmus/Kconfig" 2604source "litmus/Kconfig"
diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
index dc5fa661465f..e657219d7964 100644
--- a/arch/x86/include/asm/entry_arch.h
+++ b/arch/x86/include/asm/entry_arch.h
@@ -13,6 +13,7 @@
13BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR) 13BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
14BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR) 14BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
15BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR) 15BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
16BUILD_INTERRUPT(pull_timers_interrupt,PULL_TIMERS_VECTOR)
16BUILD_INTERRUPT3(irq_move_cleanup_interrupt, IRQ_MOVE_CLEANUP_VECTOR, 17BUILD_INTERRUPT3(irq_move_cleanup_interrupt, IRQ_MOVE_CLEANUP_VECTOR,
17 smp_irq_move_cleanup_interrupt) 18 smp_irq_move_cleanup_interrupt)
18BUILD_INTERRUPT3(reboot_interrupt, REBOOT_VECTOR, smp_reboot_interrupt) 19BUILD_INTERRUPT3(reboot_interrupt, REBOOT_VECTOR, smp_reboot_interrupt)
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index e9571ddabc4f..3e860d1f9416 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -77,6 +77,8 @@ extern asmlinkage void threshold_interrupt(void);
77extern asmlinkage void call_function_interrupt(void); 77extern asmlinkage void call_function_interrupt(void);
78extern asmlinkage void call_function_single_interrupt(void); 78extern asmlinkage void call_function_single_interrupt(void);
79 79
80extern asmlinkage void pull_timers_interrupt(void);
81
80#ifdef CONFIG_TRACING 82#ifdef CONFIG_TRACING
81/* Interrupt handlers registered during init_IRQ */ 83/* Interrupt handlers registered during init_IRQ */
82extern void trace_apic_timer_interrupt(void); 84extern void trace_apic_timer_interrupt(void);
@@ -89,6 +91,7 @@ extern void trace_reschedule_interrupt(void);
89extern void trace_threshold_interrupt(void); 91extern void trace_threshold_interrupt(void);
90extern void trace_call_function_interrupt(void); 92extern void trace_call_function_interrupt(void);
91extern void trace_call_function_single_interrupt(void); 93extern void trace_call_function_single_interrupt(void);
94extern void trace_pull_timers_interrupt(void);
92#define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt 95#define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt
93#define trace_reboot_interrupt reboot_interrupt 96#define trace_reboot_interrupt reboot_interrupt
94#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi 97#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
@@ -179,6 +182,7 @@ extern __visible void smp_reschedule_interrupt(struct pt_regs *);
179extern __visible void smp_call_function_interrupt(struct pt_regs *); 182extern __visible void smp_call_function_interrupt(struct pt_regs *);
180extern __visible void smp_call_function_single_interrupt(struct pt_regs *); 183extern __visible void smp_call_function_single_interrupt(struct pt_regs *);
181extern __visible void smp_invalidate_interrupt(struct pt_regs *); 184extern __visible void smp_invalidate_interrupt(struct pt_regs *);
185extern __visible void smp_pull_timers_interrupt(struct pt_regs *);
182#endif 186#endif
183 187
184extern char irq_entries_start[]; 188extern char irq_entries_start[];
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 666c89ec4bd7..82545836e1a1 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -124,6 +124,12 @@
124 */ 124 */
125#define LOCAL_TIMER_VECTOR 0xef 125#define LOCAL_TIMER_VECTOR 0xef
126 126
127/*
128 * LITMUS^RT pull timers IRQ vector.
129 * Make sure it's not used by Linux.
130 */
131#define PULL_TIMERS_VECTOR 0xdf
132
127#define NR_VECTORS 256 133#define NR_VECTORS 256
128 134
129#ifdef CONFIG_X86_LOCAL_APIC 135#ifdef CONFIG_X86_LOCAL_APIC
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 02c2eff7478d..d810f5fea04f 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -947,6 +947,8 @@ apicinterrupt CALL_FUNCTION_VECTOR \
947 call_function_interrupt smp_call_function_interrupt 947 call_function_interrupt smp_call_function_interrupt
948apicinterrupt RESCHEDULE_VECTOR \ 948apicinterrupt RESCHEDULE_VECTOR \
949 reschedule_interrupt smp_reschedule_interrupt 949 reschedule_interrupt smp_reschedule_interrupt
950apicinterrupt PULL_TIMERS_VECTOR \
951 pull_timers_interrupt smp_pull_timers_interrupt
950#endif 952#endif
951 953
952apicinterrupt ERROR_APIC_VECTOR \ 954apicinterrupt ERROR_APIC_VECTOR \
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index cd10a6437264..834496ed9536 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -115,6 +115,9 @@ static void __init smp_intr_init(void)
115 alloc_intr_gate(CALL_FUNCTION_SINGLE_VECTOR, 115 alloc_intr_gate(CALL_FUNCTION_SINGLE_VECTOR,
116 call_function_single_interrupt); 116 call_function_single_interrupt);
117 117
118 /* IPI for hrtimer pulling on remote cpus */
119 alloc_intr_gate(PULL_TIMERS_VECTOR, pull_timers_interrupt);
120
118 /* Low priority IPI to cleanup after moving an irq */ 121 /* Low priority IPI to cleanup after moving an irq */
119 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt); 122 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
120 set_bit(IRQ_MOVE_CLEANUP_VECTOR, used_vectors); 123 set_bit(IRQ_MOVE_CLEANUP_VECTOR, used_vectors);
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index be8e1bde07aa..7ce9fb210d55 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -24,6 +24,8 @@
24#include <linux/cpu.h> 24#include <linux/cpu.h>
25#include <linux/gfp.h> 25#include <linux/gfp.h>
26 26
27#include <litmus/debug_trace.h>
28
27#include <asm/mtrr.h> 29#include <asm/mtrr.h>
28#include <asm/tlbflush.h> 30#include <asm/tlbflush.h>
29#include <asm/mmu_context.h> 31#include <asm/mmu_context.h>
@@ -164,6 +166,16 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)
164 return NMI_HANDLED; 166 return NMI_HANDLED;
165} 167}
166 168
169/* trigger timers on remote cpu */
170void smp_send_pull_timers(int cpu)
171{
172 if (unlikely(cpu_is_offline(cpu))) {
173 WARN_ON(1);
174 return;
175 }
176 apic->send_IPI_mask(cpumask_of(cpu), PULL_TIMERS_VECTOR);
177}
178
167/* 179/*
168 * this function calls the 'stop' function on all other CPUs in the system. 180 * this function calls the 'stop' function on all other CPUs in the system.
169 */ 181 */
@@ -216,7 +228,7 @@ static void native_stop_other_cpus(int wait)
216 while (num_online_cpus() > 1 && (wait || timeout--)) 228 while (num_online_cpus() > 1 && (wait || timeout--))
217 udelay(1); 229 udelay(1);
218 } 230 }
219 231
220 /* if the REBOOT_VECTOR didn't work, try with the NMI */ 232 /* if the REBOOT_VECTOR didn't work, try with the NMI */
221 if ((num_online_cpus() > 1) && (!smp_no_nmi_ipi)) { 233 if ((num_online_cpus() > 1) && (!smp_no_nmi_ipi)) {
222 if (register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback, 234 if (register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
@@ -341,6 +353,30 @@ static int __init nonmi_ipi_setup(char *str)
341 353
342__setup("nonmi_ipi", nonmi_ipi_setup); 354__setup("nonmi_ipi", nonmi_ipi_setup);
343 355
356extern void hrtimer_pull(void);
357
358static inline void __smp_pull_timers_interrupt(void)
359{
360 TRACE("pull timer interrupt\n");
361 hrtimer_pull();
362}
363
364__visible void smp_pull_timers_interrupt(struct pt_regs *regs)
365{
366 smp_entering_irq();
367 __smp_pull_timers_interrupt();
368 exiting_irq();
369}
370
371__visible void smp_trace_pull_timers_interrupt(struct pt_regs *regs)
372{
373 smp_entering_irq();
374 trace_call_function_single_entry(PULL_TIMERS_VECTOR);
375 __smp_pull_timers_interrupt();
376 trace_call_function_single_exit(PULL_TIMERS_VECTOR);
377 exiting_irq();
378}
379
344struct smp_ops smp_ops = { 380struct smp_ops smp_ops = {
345 .smp_prepare_boot_cpu = native_smp_prepare_boot_cpu, 381 .smp_prepare_boot_cpu = native_smp_prepare_boot_cpu,
346 .smp_prepare_cpus = native_smp_prepare_cpus, 382 .smp_prepare_cpus = native_smp_prepare_cpus,