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 +++++--------- litmus/preempt.c | 6 +++++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index f5e294040b1c..7539d84628f7 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) diff --git a/litmus/preempt.c b/litmus/preempt.c index 5704d0bf4c0b..6be2f26728b8 100644 --- a/litmus/preempt.c +++ b/litmus/preempt.c @@ -2,6 +2,7 @@ #include #include +#include /* The rescheduling state of each processor. */ @@ -47,6 +48,7 @@ void sched_state_ipi(void) set_tsk_need_resched(current); TRACE_STATE("IPI -> set_tsk_need_resched(%s/%d)\n", current->comm, current->pid); + TS_SEND_RESCHED_END; } else { /* ignore */ TRACE_STATE("ignoring IPI in state %x (%s)\n", @@ -85,8 +87,10 @@ void litmus_reschedule(int cpu) if (scheduled_transition_ok) { if (smp_processor_id() == cpu) set_tsk_need_resched(current); - else + else { + TS_SEND_RESCHED_START(cpu); smp_send_reschedule(cpu); + } } TRACE_STATE("%s picked-ok:%d sched-ok:%d\n", -- cgit v1.2.2