Skip to contentSkip to conversation

perfctr x86_64 core updates

PATCH In review Mikael Pettersson 1 participant 1 message Nov 11, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 perfctr x86_64 core updates

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'.

 arch/x86_64/kernel/process.c |    2 --
 include/asm-x86_64/system.h  |    6 ++++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86_64/kernel/process.c +0 -2
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
@@ -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);
 
 	/*
include/asm-x86_64/system.h +4 -2
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
@@ -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);