History

powerpc: Save the TAR register earlier

This moves us to save the Target Address Register (TAR) a earlier in __switch_to. It introduces a new function save_tar() to do this. We need to save the TAR earlier as we will overwrite it in the transactional memory reclaim/recheckpoint path. We are going to do this in a subsequent patch which will fix saving the TAR register when it's modified inside a transaction.

Michael Neuling committed 13 years ago

Commit c2d52641 parent 25176173 files · +19 −9Browse files

Unified · Split

3 files
  1. arch/powerpc/include/asm/switch_to.h +9 −0
  2. arch/powerpc/kernel/entry_64.S +0 −9
  3. arch/powerpc/kernel/process.c +10 −0
arch/powerpc/include/asm/switch_to.h+9−0
@@ -15,6 +15,15 @@ extern struct task_struct *__switch_to(struct task_struct *, · 14 unmodified lines
15struct thread_struct;15struct thread_struct;
16extern struct task_struct *_switch(struct thread_struct *prev,16extern struct task_struct *_switch(struct thread_struct *prev,
17 struct thread_struct *next);17 struct thread_struct *next);
18#ifdef CONFIG_PPC_BOOK3S_64
19static inline void save_tar(struct thread_struct *prev)
20{
21 if (cpu_has_feature(CPU_FTR_ARCH_207S))
22 prev->tar = mfspr(SPRN_TAR);
23}
24#else
25static inline void save_tar(struct thread_struct *prev) {}
26#endif
18 27
19extern void giveup_fpu(struct task_struct *);28extern void giveup_fpu(struct task_struct *);
20extern void load_up_fpu(void);29extern void load_up_fpu(void);
arch/powerpc/kernel/entry_64.S+0−9
@@ -449,15 +449,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_DSCR) · 448 unmodified lines
449 449
450#ifdef CONFIG_PPC_BOOK3S_64450#ifdef CONFIG_PPC_BOOK3S_64
451BEGIN_FTR_SECTION451BEGIN_FTR_SECTION
452 /*
453 * Back up the TAR across context switches. Note that the TAR is not
454 * available for use in the kernel. (To provide this, the TAR should
455 * be backed up/restored on exception entry/exit instead, and be in
456 * pt_regs. FIXME, this should be in pt_regs anyway (for debug).)
457 */
458 mfspr r0,SPRN_TAR
459 std r0,THREAD_TAR(r3)
460
461 /* Event based branch registers */452 /* Event based branch registers */
462 mfspr r0, SPRN_BESCR453 mfspr r0, SPRN_BESCR
463 std r0, THREAD_BESCR(r3)454 std r0, THREAD_BESCR(r3)
arch/powerpc/kernel/process.c+10−0
@@ -600,6 +600,16 @@ struct task_struct *__switch_to(struct task_struct *prev, · 599 unmodified lines
600 struct ppc64_tlb_batch *batch;600 struct ppc64_tlb_batch *batch;
601#endif601#endif
602 602
603 /* Back up the TAR across context switches.
604 * Note that the TAR is not available for use in the kernel. (To
605 * provide this, the TAR should be backed up/restored on exception
606 * entry/exit instead, and be in pt_regs. FIXME, this should be in
607 * pt_regs anyway (for debug).)
608 * Save the TAR here before we do treclaim/trecheckpoint as these
609 * will change the TAR.
610 */
611 save_tar(&prev->thread);
612
603 __switch_to_tm(prev);613 __switch_to_tm(prev);
604 614
605#ifdef CONFIG_SMP615#ifdef CONFIG_SMP

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t