summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-06-04 20:43:53 +0200
committerRichard Braun <rbraun@sceen.net>2013-06-04 20:47:32 +0200
commit485e24a7afeebb7f0ce933fd3be8c61472902c34 (patch)
treec58d4f33c7db25026ada5e3d8a54bfbaeaa1e5e2
parent7c038b801b9007d2ae27420995b7f4fcfb8e70a1 (diff)
x86/{cpu,tcb}: move scheduling interrupts handling
Move scheduling interrupt functions from the tcb module to the cpu module. In addition, rename the related trap and functions to avoid mentioning "rescheduling", as it just makes descriptions more confusing. Instead, include the name of the module that makes use of this interrupt.
-rw-r--r--arch/x86/machine/cpu.c10
-rw-r--r--arch/x86/machine/cpu.h14
-rw-r--r--arch/x86/machine/tcb.c10
-rw-r--r--arch/x86/machine/tcb.h16
-rw-r--r--arch/x86/machine/trap.c7
-rw-r--r--arch/x86/machine/trap.h16
-rw-r--r--arch/x86/machine/trap_asm.S2
-rw-r--r--kern/thread.c7
8 files changed, 39 insertions, 43 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index 2a500cb1..f07e6d1a 100644
--- a/arch/x86/machine/cpu.c
+++ b/arch/x86/machine/cpu.c
@@ -599,6 +599,16 @@ cpu_halt_intr(struct trap_frame *frame)
}
void
+cpu_thread_schedule_intr(struct trap_frame *frame)
+{
+ (void)frame;
+
+ lapic_eoi();
+
+ /* Let the return from interrupt code invoke the scheduler */
+}
+
+void
cpu_llsync_reset_intr(struct trap_frame *frame)
{
(void)frame;
diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h
index ab087d86..9749353c 100644
--- a/arch/x86/machine/cpu.h
+++ b/arch/x86/machine/cpu.h
@@ -595,6 +595,20 @@ void cpu_ap_setup(void);
void cpu_ap_sync(void);
/*
+ * Send a scheduling interrupt to a remote processor.
+ */
+static inline void
+cpu_send_thread_schedule(unsigned int cpu)
+{
+ lapic_ipi_send(cpu, TRAP_THREAD_SCHEDULE);
+}
+
+/*
+ * Interrupt handler for scheduling requests.
+ */
+void cpu_thread_schedule_intr(struct trap_frame *frame);
+
+/*
* Request a remote processor to reset its checkpoint.
*/
static inline void
diff --git a/arch/x86/machine/tcb.c b/arch/x86/machine/tcb.c
index 14d74c67..e65eddf6 100644
--- a/arch/x86/machine/tcb.c
+++ b/arch/x86/machine/tcb.c
@@ -55,13 +55,3 @@ tcb_trace(const struct tcb *tcb)
{
strace_show(tcb->ip, tcb->bp);
}
-
-void
-tcb_reschedule_intr(struct trap_frame *frame)
-{
- (void)frame;
-
- lapic_eoi();
-
- /* Let the return from interrupt code handle rescheduling */
-}
diff --git a/arch/x86/machine/tcb.h b/arch/x86/machine/tcb.h
index bd0a793d..b3785afe 100644
--- a/arch/x86/machine/tcb.h
+++ b/arch/x86/machine/tcb.h
@@ -24,8 +24,6 @@
#include <kern/assert.h>
#include <kern/macros.h>
#include <machine/cpu.h>
-#include <machine/lapic.h>
-#include <machine/trap.h>
/*
* Architecture specific thread data.
@@ -89,18 +87,4 @@ tcb_switch(struct tcb *prev, struct tcb *next)
*/
void tcb_trace(const struct tcb *tcb);
-/*
- * Send a rescheduling interrupt to a remote processor.
- */
-static inline void
-tcb_send_reschedule(unsigned int cpu)
-{
- lapic_ipi_send(cpu, TRAP_RESCHEDULE);
-}
-
-/*
- * Interrupt handler for rescheduling requests.
- */
-void tcb_reschedule_intr(struct trap_frame *frame);
-
#endif /* _X86_TCB_H */
diff --git a/arch/x86/machine/trap.c b/arch/x86/machine/trap.c
index 42b5750d..36585c25 100644
--- a/arch/x86/machine/trap.c
+++ b/arch/x86/machine/trap.c
@@ -30,7 +30,6 @@
#include <machine/pic.h>
#include <machine/pmap.h>
#include <machine/strace.h>
-#include <machine/tcb.h>
#include <machine/trap.h>
/*
@@ -77,7 +76,7 @@ void trap_isr_simd_fp_exception(void);
void trap_isr_pic_int7(void);
void trap_isr_pic_int15(void);
void trap_isr_llsync_reset(void);
-void trap_isr_reschedule(void);
+void trap_isr_thread_schedule(void);
void trap_isr_pmap_update(void);
void trap_isr_cpu_halt(void);
void trap_isr_lapic_timer(void);
@@ -206,8 +205,8 @@ trap_setup(void)
/* System defined traps */
trap_install(TRAP_LLSYNC_RESET, TRAP_HF_NOPREEMPT,
trap_isr_llsync_reset, cpu_llsync_reset_intr);
- trap_install(TRAP_RESCHEDULE, TRAP_HF_NOPREEMPT,
- trap_isr_reschedule, tcb_reschedule_intr);
+ trap_install(TRAP_THREAD_SCHEDULE, TRAP_HF_NOPREEMPT,
+ trap_isr_thread_schedule, cpu_thread_schedule_intr);
trap_install(TRAP_PMAP_UPDATE, TRAP_HF_NOPREEMPT,
trap_isr_pmap_update, pmap_update_intr);
trap_install(TRAP_CPU_HALT, TRAP_HF_NOPREEMPT,
diff --git a/arch/x86/machine/trap.h b/arch/x86/machine/trap.h
index 0e15c452..449ee953 100644
--- a/arch/x86/machine/trap.h
+++ b/arch/x86/machine/trap.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012 Richard Braun.
+ * Copyright (c) 2011, 2012, 2013 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -53,13 +53,13 @@
*
* The local APIC assigns one priority every 16 vectors.
*/
-#define TRAP_LLSYNC_RESET 237
-#define TRAP_RESCHEDULE 238
-#define TRAP_PMAP_UPDATE 239
-#define TRAP_CPU_HALT 240
-#define TRAP_LAPIC_TIMER 253
-#define TRAP_LAPIC_ERROR 254
-#define TRAP_LAPIC_SPURIOUS 255
+#define TRAP_LLSYNC_RESET 237
+#define TRAP_THREAD_SCHEDULE 238
+#define TRAP_PMAP_UPDATE 239
+#define TRAP_CPU_HALT 240
+#define TRAP_LAPIC_TIMER 253
+#define TRAP_LAPIC_ERROR 254
+#define TRAP_LAPIC_SPURIOUS 255
/*
* Vector identifying an unhandled trap.
diff --git a/arch/x86/machine/trap_asm.S b/arch/x86/machine/trap_asm.S
index 2afd7ea4..63ffc255 100644
--- a/arch/x86/machine/trap_asm.S
+++ b/arch/x86/machine/trap_asm.S
@@ -158,7 +158,7 @@ TRAP(TRAP_PIC_BASE + 15, trap_isr_pic_int15)
/* System defined traps */
TRAP(TRAP_LLSYNC_RESET, trap_isr_llsync_reset)
-TRAP(TRAP_RESCHEDULE, trap_isr_reschedule)
+TRAP(TRAP_THREAD_SCHEDULE, trap_isr_thread_schedule)
TRAP(TRAP_PMAP_UPDATE, trap_isr_pmap_update)
TRAP(TRAP_CPU_HALT, trap_isr_cpu_halt)
TRAP(TRAP_LAPIC_TIMER, trap_isr_lapic_timer)
diff --git a/kern/thread.c b/kern/thread.c
index a54f078e..f19ec853 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -429,13 +429,12 @@ thread_runq_wakeup(struct thread_runq *runq, struct thread *thread)
if ((runq != thread_runq_local())
&& thread_test_flag(runq->current, THREAD_YIELD)) {
/*
- * Make the new flags globally visible before sending the
- * rescheduling request. This barrier pairs with the one implied
- * by the rescheduling IPI.
+ * Make the new flags globally visible before sending the scheduling
+ * request. This barrier pairs with the one implied by the received IPI.
*/
mb_store();
- tcb_send_reschedule(thread_runq_id(runq));
+ cpu_send_thread_schedule(thread_runq_id(runq));
}
}