aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process_64.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2008-01-30 07:31:09 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:31:09 -0500
commiteee3af4a2c83a97fff107ddc445d9df6fded9ce4 (patch)
treea7e9179b82b4df9e4cf6e810c54309324589395b /arch/x86/kernel/process_64.c
parent7796931f542518092d1fd2fb7cf1f1d96e0cd4b5 (diff)
x86, ptrace: support for branch trace store(BTS)
Resend using different mail client Changes to the last version: - split implementation into two layers: ds/bts and ptrace - renamed TIF's - save/restore ds save area msr in __switch_to_xtra() - make block-stepping only look at BTF bit Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/process_64.c')
-rw-r--r--arch/x86/kernel/process_64.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 057b5442ffda..843bf0c978a4 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -568,11 +568,21 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
568 struct tss_struct *tss) 568 struct tss_struct *tss)
569{ 569{
570 struct thread_struct *prev, *next; 570 struct thread_struct *prev, *next;
571 unsigned long debugctl;
571 572
572 prev = &prev_p->thread, 573 prev = &prev_p->thread,
573 next = &next_p->thread; 574 next = &next_p->thread;
574 575
575 if (next->debugctlmsr != prev->debugctlmsr) 576 debugctl = prev->debugctlmsr;
577 if (next->ds_area_msr != prev->ds_area_msr) {
578 /* we clear debugctl to make sure DS
579 * is not in use when we change it */
580 debugctl = 0;
581 wrmsrl(MSR_IA32_DEBUGCTLMSR, 0);
582 wrmsrl(MSR_IA32_DS_AREA, next->ds_area_msr);
583 }
584
585 if (next->debugctlmsr != debugctl)
576 wrmsrl(MSR_IA32_DEBUGCTLMSR, next->debugctlmsr); 586 wrmsrl(MSR_IA32_DEBUGCTLMSR, next->debugctlmsr);
577 587
578 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) { 588 if (test_tsk_thread_flag(next_p, TIF_DEBUG)) {
@@ -598,6 +608,16 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
598 */ 608 */
599 memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); 609 memset(tss->io_bitmap, 0xff, prev->io_bitmap_max);
600 } 610 }
611
612 /*
613 * Last branch recording recofiguration of trace hardware and
614 * disentangling of trace data per task.
615 */
616 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS))
617 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS);
618
619 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS))
620 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES);
601} 621}
602 622
603/* 623/*
@@ -701,8 +721,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
701 /* 721 /*
702 * Now maybe reload the debug registers and handle I/O bitmaps 722 * Now maybe reload the debug registers and handle I/O bitmaps
703 */ 723 */
704 if (unlikely((task_thread_info(next_p)->flags & _TIF_WORK_CTXSW)) 724 if (unlikely(task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT ||
705 || test_tsk_thread_flag(prev_p, TIF_IO_BITMAP)) 725 task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV))
706 __switch_to_xtra(prev_p, next_p, tss); 726 __switch_to_xtra(prev_p, next_p, tss);
707 727
708 /* If the task has used fpu the last 5 timeslices, just do a full 728 /* If the task has used fpu the last 5 timeslices, just do a full