perfctr x86_64 core updates
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'.
Signed-off-by Mikael Pettersson <[email protected]>
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
@@ -432,8 +432,6 @@ struct task_struct *__switch_to(struct tint 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
@@ -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);