From 50ca05ff9cc85176c3ee18bf1363d3d7c34aa355 Mon Sep 17 00:00:00 2001 From: Andrea Bastoni Date: Thu, 17 Dec 2009 21:39:14 -0500 Subject: [ported from 2008.3] Add GSN-EDF plugin - insert arm_release_timer() in add_relese() path - arm_release_timer() uses __hrtimer_start_range_ns() instead of hrtimer_start() to avoid deadlock on rq->lock. --- arch/x86/kernel/smp.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'arch/x86/kernel/smp.c') diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index ec1de97600e..337ce0c44f9 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -22,6 +22,9 @@ #include #include +#include +#include + #include #include #include @@ -117,6 +120,7 @@ static void native_smp_send_reschedule(int cpu) WARN_ON(1); return; } + TS_SEND_RESCHED_START(cpu); apic->send_IPI_mask(cpumask_of(cpu), RESCHEDULE_VECTOR); } @@ -197,7 +201,12 @@ static void native_smp_send_stop(void) void smp_reschedule_interrupt(struct pt_regs *regs) { ack_APIC_irq(); + /* LITMUS^RT needs this interrupt to proper reschedule + * on this cpu + */ + set_tsk_need_resched(current); inc_irq_stat(irq_resched_count); + TS_SEND_RESCHED_END; /* * KVM uses this interrupt to force a cpu out of guest mode */ -- cgit v1.2.2 From b085cafc43bc395e255626204169e20a587f28ba Mon Sep 17 00:00:00 2001 From: Andrea Bastoni Date: Thu, 17 Dec 2009 21:44:47 -0500 Subject: [ported from 2008.3] Add send_pull_timers() support for x86_32 arch --- arch/x86/kernel/smp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'arch/x86/kernel/smp.c') diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index 337ce0c44f9..e83f79de863 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -150,6 +150,16 @@ void native_send_call_func_ipi(const struct cpumask *mask) free_cpumask_var(allbutself); } +/* trigger timers on remote cpu */ +void smp_send_pull_timers(int cpu) +{ + if (unlikely(cpu_is_offline(cpu))) { + WARN_ON(1); + return; + } + apic->send_IPI_mask(cpumask_of(cpu), PULL_TIMERS_VECTOR); +} + /* * this function calls the 'stop' function on all other CPUs in the system. */ @@ -230,6 +240,14 @@ void smp_call_function_single_interrupt(struct pt_regs *regs) irq_exit(); } +extern void hrtimer_pull(void); + +void smp_pull_timers_interrupt(struct pt_regs *regs) +{ + ack_APIC_irq(); + TRACE("pull timer interrupt\n"); +} + struct smp_ops smp_ops = { .smp_prepare_boot_cpu = native_smp_prepare_boot_cpu, .smp_prepare_cpus = native_smp_prepare_cpus, -- cgit v1.2.2 From c15be843778236e9f2fdbc207ab36ba996b2bb1b Mon Sep 17 00:00:00 2001 From: Andrea Bastoni Date: Thu, 17 Dec 2009 21:45:38 -0500 Subject: [ported from 2008.3] Add hrtimer_start_on() API --- arch/x86/kernel/smp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/x86/kernel/smp.c') diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index e83f79de863..a93528bc16e 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -246,6 +246,7 @@ void smp_pull_timers_interrupt(struct pt_regs *regs) { ack_APIC_irq(); TRACE("pull timer interrupt\n"); + hrtimer_pull(); } struct smp_ops smp_ops = { -- cgit v1.2.2 From 2c142d1028f276c6d5e58c553768ae32ed9bda68 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Wed, 10 Nov 2010 12:25:43 -0500 Subject: Hook up LITMUS^RT remote preemption support on x86 Call into scheduler state machine in the IPI handler. --- arch/x86/kernel/smp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'arch/x86/kernel/smp.c') diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index 97af589a5c0..74cca6014c0 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include #include @@ -212,10 +213,8 @@ static void native_smp_send_stop(void) void smp_reschedule_interrupt(struct pt_regs *regs) { ack_APIC_irq(); - /* LITMUS^RT needs this interrupt to proper reschedule - * on this cpu - */ - set_tsk_need_resched(current); + /* LITMUS^RT: this IPI might need to trigger the sched state machine. */ + sched_state_ipi(); inc_irq_stat(irq_resched_count); TS_SEND_RESCHED_END; /* -- cgit v1.2.2 From a13904d4b6d04278deb6841020dd7dee9867745e Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Tue, 4 Sep 2012 12:45:54 +0200 Subject: Trace IPI-related IRQs with ft_irq_fired() IPIs have some special cases where irq_enter() is not called. This caused ft_irq_fired() to "miss" some rescheduling-related interrupts, which in turn may cause outliers. This patch makes sure ft_irq_fired() is called on scheduling-related IPIs. --- arch/x86/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/x86/kernel/smp.c') diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index ed4c4f54e2a..f5e294040b1 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -251,8 +251,10 @@ extern void hrtimer_pull(void); void smp_pull_timers_interrupt(struct pt_regs *regs) { ack_APIC_irq(); + irq_enter(); TRACE("pull timer interrupt\n"); hrtimer_pull(); + irq_exit(); } struct smp_ops smp_ops = { -- cgit v1.2.2 From d940d731de7c4c98e47d526d08064035893dbeed Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Thu, 6 Sep 2012 15:14:10 +0200 Subject: Move SEND_RESCHED tracing to preempt.c The SEND_RESCHED is really only interesting if the IPI was generated by LITMUS^RT. Therefore, we don't need to trace in Linux's architecture-specific code. Instead, we hook into the preemption state machine, which is informed about incoming IPIs anyway. --- arch/x86/kernel/smp.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'arch/x86/kernel/smp.c') diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index f5e294040b1..7539d84628f 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -25,7 +25,6 @@ #include #include -#include #include #include @@ -122,7 +121,6 @@ static void native_smp_send_reschedule(int cpu) WARN_ON(1); return; } - TS_SEND_RESCHED_START(cpu); apic->send_IPI_mask(cpumask_of(cpu), RESCHEDULE_VECTOR); } @@ -214,18 +212,16 @@ static void native_stop_other_cpus(int wait) void smp_reschedule_interrupt(struct pt_regs *regs) { ack_APIC_irq(); - /* LITMUS^RT: this IPI might need to trigger the sched state machine. */ - sched_state_ipi(); inc_irq_stat(irq_resched_count); - /* - * LITMUS^RT: starting from 3.0 schedule_ipi() actually does something. - * This may increase IPI latencies compared with previous versions. - */ scheduler_ipi(); - TS_SEND_RESCHED_END; /* * KVM uses this interrupt to force a cpu out of guest mode */ + + /* LITMUS^RT: this IPI might need to trigger the sched state machine. + * Starting from 3.0 schedule_ipi() actually does something. This may + * increase IPI latencies compared with previous versions. */ + sched_state_ipi(); } void smp_call_function_interrupt(struct pt_regs *regs) -- cgit v1.2.2