[PATCH][2.6.10-rc1-mm4][2/4] perfctr x86_64 core updates

From: Mikael Pettersson
Date: Thu Nov 11 2004 - 04:42:58 EST


Part 2/4 of the perfctr interrupt fixes:
- Move perfctr_suspend_thread() call from __switch_to()
to the beginning of switch_to(). Ensures that suspend
actions are done when the owner task still is 'current'.

Signed-off-by: Mikael Pettersson <mikpe@xxxxxxxxx>

arch/x86_64/kernel/process.c | 2 --
include/asm-x86_64/system.h | 6 ++++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff -rupN linux-2.6.10-rc1-mm4/arch/x86_64/kernel/process.c linux-2.6.10-rc1-mm4.perfctr-x86_64-core-update/arch/x86_64/kernel/process.c
--- linux-2.6.10-rc1-mm4/arch/x86_64/kernel/process.c 2004-11-10 18:02:55.000000000 +0100
+++ linux-2.6.10-rc1-mm4.perfctr-x86_64-core-update/arch/x86_64/kernel/process.c 2004-11-11 00:23:20.000000000 +0100
@@ -432,8 +432,6 @@ struct task_struct *__switch_to(struct t
int cpu = smp_processor_id();
struct tss_struct *tss = &per_cpu(init_tss, cpu);

- perfctr_suspend_thread(prev);
-
unlazy_fpu(prev_p);

/*
diff -rupN linux-2.6.10-rc1-mm4/include/asm-x86_64/system.h linux-2.6.10-rc1-mm4.perfctr-x86_64-core-update/include/asm-x86_64/system.h
--- linux-2.6.10-rc1-mm4/include/asm-x86_64/system.h 2004-10-28 19:28:42.000000000 +0200
+++ linux-2.6.10-rc1-mm4.perfctr-x86_64-core-update/include/asm-x86_64/system.h 2004-11-11 00:23:48.000000000 +0100
@@ -26,7 +26,8 @@
#define __EXTRA_CLOBBER \
,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15"

-#define switch_to(prev,next,last) \
+#define switch_to(prev,next,last) do { \
+ perfctr_suspend_thread(&(prev)->thread); \
asm volatile(SAVE_CONTEXT \
"movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \
"movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \
@@ -46,7 +47,8 @@
[tif_fork] "i" (TIF_FORK), \
[thread_info] "i" (offsetof(struct task_struct, thread_info)), \
[pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \
- : "memory", "cc" __EXTRA_CLOBBER)
+ : "memory", "cc" __EXTRA_CLOBBER); \
+} while (0)

extern void load_gs_index(unsigned);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/